TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Hrishikesh on July 10, 2017, 03:37:01 AM
-
Hi All,
I need a Lisp routine to on/off particular layer list.
e.g. layers "0" "Defpoints" "Dim" "Text" "Embeds" should turn off/on in single command.
Thanks,
Hrishikesh
-
Something like that:
(defun c:laysoff
( / LayLst
) (setq LayLst
(list "0" "Defpoints" "Dim" "Text" "Embeds")) )
)
)
(defun c:layson
( / LayLst
) (setq LayLst
(list "0" "Defpoints" "Dim" "Text" "Embeds")) )
)
)
*cd-ActiveDocument*
(setq *cd
-ActiveDocument
* )
)
*cd-ActiveDocument*
)
*cd-Layers*
)
*cd-Layers*
)
-
Thanks, I will try this...
-
Layer states will do this.
-
Can you make it work with wildcards?
Tried this but did not work
(setq LayLst (list "*Dim*" "*Text" ))
Something like that:
(defun c:laysoff
( / LayLst
) (setq LayLst
(list "0" "Defpoints" "Dim" "Text" "Embeds")) )
)
)
(defun c:layson
( / LayLst
) (setq LayLst
(list "0" "Defpoints" "Dim" "Text" "Embeds")) )
)
)
*cd-ActiveDocument*
(setq *cd
-ActiveDocument
* )
)
*cd-ActiveDocument*
)
*cd-Layers*
)
*cd-Layers*
)
-
Replace: (member (vla-get-name %) LayLst) with (wcmatch (strcase (vla-get-name %)) "*DIM*,*TEXT")
-
Wow! This works great!!!
Thanks guys,
Both of you are made my work so easy & fast.
Thanks,
-Hrishikesh
-
Can you make it work with wildcards?
Tried this but did not work
Try with this:
(defun c:laysoff
( / LayLst
) )
)
)
(defun c:layson
( / LayLst
) )
)
)
*cd-ActiveDocument*
(setq *cd
-ActiveDocument
* )
)
*cd-ActiveDocument*
)
*cd-Layers*
)
*cd-Layers*
)
(defun cd:STR_ReParse
(Lst Sep
/ res
) )
res
)
-
Thanks. Both method works.