Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp to Auto rename layers

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
6895 Views, 3 Replies

Lisp to Auto rename layers

Hey guys,

I've been looking for an AutoLISP that renames layers, but does more than one layer at once (e.g. I don't need to run 20 lisps to rename 20 layers).

Currently I have a list of "Features" and every time i digitise one of these I add a suffix (e.g. FENCE02 or FENCE_02 the software unfortunately only exports Polylines with names as layers) and then later export them all into a .DXF file.  When i get them into AutoCAD I select them, explode them, flatten them, join them (fun 3D PL to PL workflows are fun) and then go about changing all the duplicate layer names to a reference name.

Is there any way I can automate this?  My reference layers are:

ROAD 
DRIVEWAY 
TOP_OF_BANK 
TOE_OF_BANK
EARTH_DRAIN_
RETAINING_WALL
ELEC_POLE
BUSH_EXTENTS
TREE_EXTENTS
TRUNKS_
FENCE_
GATE_
SIGN_
BUILDING
STORMWATER_
ABOVE_GROUND_HYDRANT_
ROAD_FURNITURE_
PIT_TELSTRA_
PIT_GAS_
PIT_SEWER_
PIT_WATER_
PIT_IRRIGATION_
PIT_UNCLASSIFIED_
PIT_IRRIGATION
PIT_UNCLASSIFIED


Any help muchly appreciated, i've had a decent look online and most of the LISPS only change one predefine layer, and my complete lack of LISPING skills means I cannot just copy paste the code with the new refs.   

Thanks guys,

K

3 REPLIES 3
Message 2 of 4
ВeekeeCZ
in reply to: Anonymous

Have you tried _LAYTRANS command?

 

Or you can find the lisp HERE or HERE

Message 3 of 4
pbejse
in reply to: Anonymous


@Anonymous wrote:

Hey guys,

I've been looking for an AutoLISP that renames layers, but does more than one layer at once ......

..... Any help muchly appreciated, i've had a decent look online and most of the LISPS only change one predefine layer, and my complete lack of LISPING skills means I cannot just copy paste the code with the new refs.   

Thanks guys,

K


Request such as this requires complete understanding of WHAT IS and WHAT WILL for layer names, what you need is a bare RENAME lisp function that accepts a list of LAYER NAMES as arguments supplied by the user, perhaps from a list on a TEXT (txt) file so users can easily add more names without modifying the lisp program.

 

It pretty easy K

 

p

 

Message 4 of 4
Anonymous
in reply to: pbejse

I was initially thinking tha a rename function of some sort would work but wasn't sure what wildcards to use or how to structure it...  That said now that I have that structure in the LISP BeekeeCZ has provided I can probably figure it out.  I hadn't seen a LISP so basic, some of the other one i was looking at used VLISP and LISP and had quite complex bodies so I shied away from them.

I'll give this a stab, thanks.

Also the LayerTrans table will work for me until I have some time to make this puppy up, so thanks BeeKeeCZ. Amazing that I've never come across LayerTrans, that's ridiculously helpful.

Thanks a whole heap guys.

Kudos to this forum and the people in it for making my life a little less monotonous!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report