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 (519 Views)

LISP routine to change Layer State names

519 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: 580
Registered: ‎07-02-2010
Message 2 of 3 (481 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,694
Registered: ‎03-14-2004
Message 3 of 3 (469 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 

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community