Author Topic: Layer States  (Read 3779 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Layer States
« 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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Layer States
« Reply #1 on: September 09, 2005, 03:07:33 PM »
;;  simple example, freeze all layers ...

Code: [Select]
(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
                    )
                )
            )
        )
    )
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Layer States
« Reply #2 on: September 09, 2005, 03:11:48 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.
This thread should get you what you need: Click Here

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Layer States
« Reply #3 on: September 09, 2005, 03:14:26 PM »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Layer States
« Reply #4 on: September 09, 2005, 03:14:58 PM »
Note to self: Read original question better.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Layer States
« Reply #5 on: September 09, 2005, 03:15:11 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.
This thread should get you what you need: Click Here

Thanks Jeff...that's looks like it

sourdough

  • Bull Frog
  • Posts: 367
Re: Layer States
« Reply #6 on: September 10, 2005, 01:25:32 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.

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
LDC 2009/C3D 2010/C3D 2011/C3D 2016

Win 10 64bit

Peter Jamtgaard

  • Guest
Re: Layer States
« Reply #7 on: September 12, 2005, 05:49:30 PM »
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

Code: [Select]
(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)



Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Layer States
« Reply #8 on: November 01, 2005, 12:49:00 PM »
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.