Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
brandnewrock8
Posts: 4
Registered: ‎08-19-2009
Message 1 of 3 (549 Views)

LISP routine to change Layer State names

549 Views, 2 Replies
11-02-2011 07:38 AM

Hello,

 

I have 2000+ drawings that have either the layer state "LMAN_DWF" or "DWF".  I want all of them to read "DWF" for scripting purposes.  Does anyone know of a LSIP routine that will go into a drawing and change rename a layerstate if it is named incorreclty, but do nothing if it is named correctly?  

 

Does Layer State "DWF" exist?

If Yes, skip file and move on to next file

If No, does Layer State "LMAN_DWF" exist?

if Yes Rename Layer State to "DWF"

If No, skip file and move to next file.

 

Or a LSIP routine that can simply dump a list of all drawings in a directory that contain "LMAN_DWF" as a layer state.  I could then use that list to do a simple script to change the layer state names on those specific files.

 

Thanks!!

Distinguished Mentor
_Tharwat
Posts: 612
Registered: ‎07-02-2010
Message 2 of 3 (511 Views)

Re: LISP routine to change Layer State names

11-04-2011 10:44 AM in reply to: brandnewrock8

Check this out , ...

 

(defun c:Test nil
  (if (layerstate-has "LMAN_DWF")
    (layerstate-rename "LMAN_DWF" "DWF")
  )
  (princ)
)

 Tharwat

____________________________________________________
Get learn and learn and practice , to become experienced guy .
Mentor
devitg
Posts: 1,704
Registered: ‎03-14-2004
Message 3 of 3 (499 Views)

Re: LISP routine to change Layer State names

11-05-2011 06:37 AM in reply to: brandnewrock8

Please send me a few of such DWG , you can do it to 

 

see attached file 

 

 

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.