fathihvac 发表于 2022-7-6 09:46:06

实际上我用这个。
 
(defun _makelayer ( name color ltype lnwt )
   (
       (lambda ( _function )
         (_function
               (list
                   (cons 0 "LAYER")
                   (cons 100 "AcDbSymbolTableRecord")
                   (cons 100 "AcDbLayerTableRecord")
                   (cons 2 name)
                   (cons 70 0)
                   (cons 62 color)
                   (cons 6 ltype)
                   (cons 370 lnwt)
               )
         )
       )
       (if (tblsearch "LAYER" name)
         (lambda ( data ) (entmod (cons (cons -1 (tblobjname "LAYER" name)) data)))
         entmakex
       )
   )
)
 
然后只需使用LL,您就拥有了所有图层选项。

Lee Mac 发表于 2022-7-6 09:54:30

我使用这些:
 
 
通用宏:
(_makelayer "YourLayer" 3 "Continuous" 40)
 
快速虚拟层,并将预选对象放置在层上:
(defun C:LL ()
   (menucmd "s=layer")(command "layer")(princ))

pman860507 发表于 2022-7-6 09:57:03

alanjt 发表于 2022-7-6 09:59:17

I use these:
 
 
Generic macro:
;MAKE A LAYER(defun c:LM () (command "-layer" "make" ) (princ))
 
Quick dummy layers and will put preselected objects on layer:

(defun AT:DummyLayer (name color plot / ss) (setq ss (ssget "_I")) (cond   ((eq (strcase name) (strcat (getvar 'clayer)))    (princ (strcat "\nLayer: \"" name "\" is the current layer."))   )   ((tblsearch "layer" name)    (vl-cmdf "_.layer" "_t" name "_s" name "_p" plot name "")    (princ (strcat "\nLayer: \"" name "\" is the current layer."))   )   ((vl-cmdf "_.layer" "_m" name "_c" color name "_p" plot name "")    (princ (strcat "\nLayer: \"" name "\" has been created."))   ) ) (if ss   ((lambda (i / e)      (while (setq e (ssname ss (setq i (1+ i))))      (vla-put-layer (vlax-ename->vla-object e) name)      )      (princ (strcat "\n" (itoa (sslength ss)) " object(s) moved to layer: \"" name "\""))    )   -1   ) ));"ALAN" LAYER(defun c:ALAN (/) (AT:DummyLayer "ALAN" 2 "P") (princ));"TEMP" LAYER(defun c:TEMP (/) (AT:DummyLayer "TEMP" 7 "P") (princ));"DEFPOINTS" LAYER(defun c:DEF (/) (AT:DummyLayer "Defpoints" 7 "N") (princ));"VP" LAYER(defun c:VP (/) (AT:DummyLayer "VP" 4 "N")(princ));"HIDE" LAYER(defun c:HI (/) (AT:DummyLayer "HIDE" 210 "N")(princ));"0" LAYER(defun c:L0 (/) (AT:DummyLayer "0" 7 "P")(princ))
页: 1 [2]
查看完整版本: 在autolisp和n中创建层