The Buzzard 发表于 2022-7-6 15:13:45

 
没问题,罗布,总是很乐意帮忙。
不要让可能的客户从裂缝中溜走。
优先事项优先。

The Buzzard 发表于 2022-7-6 15:16:24

 
 
抢劫
 
我意识到你可能认为每次你想设置一个层时都需要做一个函数。但事实并非如此。我只是想澄清一下。
在本例中,使用两种不同的线型和两种不同的颜色创建了两个不同的图层。
只需在要更改的行之前调用layer函数。
 
这里有一个更好的例子。
函数语法:LINLAY
 
(defun C:LINLAY ()                                                ;Define function
(setq OLDLAY (getvar "CLAYER"))                                 ;Save current layer to old layer
(command "_.ltscale" 20)                                          ;Set line scale
(setq PT01 (list0.0   0.00.0))                              ;PT01 Coord
(setq PT02 (list 25.025.00.0))                              ;PT02 Coord
(setq PT03 (list 25.25 25.50 0.0))                              ;PT03 Coord
(setq PT04 (list 50.25 60.00.0))                              ;PT04 Coord
(SLL "HIDDEN" "1" "HIDDEN")                                       ;Go to SLL Layer Function
(command "_.line" PT01 PT02 "")                                 ;Line command
(SLL "CONTINUOUS" "5" "CONTINUOUS")                               ;Go to SLL Layer Function
(command "_.line" PT03 PT04 "")                                 ;Line command
(setvar "CLAYER" OLDLAY)                                          ;Restore old layer                                       
(princ)                                                         ;Exit quietly
)                                                                   ;End define function

;;; Layer Function - Set Layer & Linetype.                        ;Function Description
(defun SLL (NLAY CLR LT / LAY FRZ)                                  ;Define function, Declare local variables and arguments
(setq LAY(tblsearch "layer" NLAY))                              ;Search drawing to find layer, Note: (NOT USED)
(if                                                               ;If the following returns true
   (not LAY)                                                       ;Layer not in drawing
   (command "_.layer" "m" NLAY "c" CLR "" "lt" LT "" "")         ;Layer command ~ make new layer with color and linetype
   (progn                                                          ;Then do the following
   (setq FRZ (cdr (assoc 70 LAY)))                               ;Variable FRZ is frozen layer
   (if (= FRZ 65)                                                ;Layer frozen from last edit
       (progn                                                      ;Then do the following
         (command "_.layer" "t" NLAY "")                           ;Thaw new layer if frozen
         (command "_.layer" "s" NLAY ""))                        ;Set new layer
       (command "_.layer" "s" NLAY ""))))                        ;Set new layer
)                                                                   ;End define function
页: 1 [2]
查看完整版本: Lisp使用不同的线型