TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Dommy2Hotty on September 09, 2005, 02:34:38 PM
-
1) Anyone have any insight as how to set a certain layer state with LISP?
2) Anyone have a multiple layer state delete utility? Delteting them one by one sux.
-
;; simple example, freeze all layers ...
(setq pattern "*")
(vlax-map-collection
(vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
'(lambda ( layer )
(if (wcmatch (vla-get-name layer) pattern)
(vl-catch-all-apply
'(lambda ()
(vla-put-freeze
layer
:vlax-true
)
)
)
)
)
)
-
1) Anyone have any insight as how to set a certain layer state with LISP?
2) Anyone have a multiple layer state delete utility? Delteting them one by one sux.
This thread should get you what you need: Click Here (http://www.theswamp.org/forum/index.php?topic=763.msg12179#msg12179)
-
I'm sorry...should have been more specific...
Express->Layers->Layer Manager...
Those layer states. I want to make a plotting routine that will set the LTSCALE, and the set the Express Layer State (derived from the filename and CTAB variable). I've got it all worked out, but I can't figure out how to set the Express Layer State.
-
Note to self: Read original question better.
-
1) Anyone have any insight as how to set a certain layer state with LISP?
2) Anyone have a multiple layer state delete utility? Delteting them one by one sux.
This thread should get you what you need: Click Here (http://www.theswamp.org/forum/index.php?topic=763.msg12179#msg12179)
Thanks Jeff...that's looks like it
-
1) Anyone have any insight as how to set a certain layer state with LISP?
2) Anyone have a multiple layer state delete utility? Delteting them one by one sux.
Go to my post here it has alot of good info about layerstates I wrote and worked with others on. This should give you alot more to work with
to get what you want out of layerstates.
http://www.theswamp.org/forum/index.php?topic=5516.0
http://www.theswamp.org/forum/index.php?topic=5516.0
Mike
-
This should help.
I cooked it for one of my AU lectures a couple of years ago.
You might have to modify the version of autocad.
Peter Jamtgaard
(defun LSTATE (STATNAM / STATEOBJ)
(vl-load-com)
(if (= (substr (getvar "acadver") 1 2) "16")
(setq STATEOBJ (vla-getinterfaceobject
(vlax-get-acad-object)
"autocad.acadlayerstatemanager.16"
)
)
(setq STATEOBJ (vla-getinterfaceobject
(vlax-get-acad-object)
"autocad.acadlayerstatemanager"
)
)
)
(vla-SetDataBase STATEOBJ
(vla-get-database
(setq CDWGOBJ (vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
)
)
(if (vl-catch-all-error-p
(vl-catch-all-apply
'(lambda (X)(vla-restore STATEOBJ X))
(list STATNAM)
)
)
(princ "\nLayer state doesn't exist! :")
; (vla-regen CDWGOBJ)
)
(princ)
)
-
Peter...that works fantastically! Except, I'm looking for the EXPRESS Layer states...as defined thru the LMAN command. I tested with the LAYER command layer states, and it works great...however, all the drawings I want to use this on have the Express Layer States defined.