Jump to content

lisp for layertrans


Paulvth

Recommended Posts

Hey guys,

 

I'm all new to lisp commands but really need a favor

 

I'm using layer translator to convert all layers conaining

"*DIM" to layer 0"

"*BAS" to layer "basewall"

"*EQP" to layer "equipment"

etc. etc. etc.

 

is it possible to create a lisp, because i have over 100 drawings to do....

i don't won't to open laytr every time and type all the "*xxx" and select the new layer from my .dws file...

every drawing has different layer names but the layers contain the letters "*DIM" /*BAS" "*XXX" etc.

 

 

 

thanks for help in advance!!!

Link to comment
Share on other sites

doesn't do the job yet...

i tried the following;

 

 

(defun c:layname ( )

(vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))

(if (wcmatch (strcase (vla-get-name layer)) "*BAS*")

(vl-catch-all-apply 'vla-put-name (list layer "I-BASEWALL"))

(vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))

(if (wcmatch (strcase (vla-get-name layer)) "*SUR*")

(vl-catch-all-apply 'vla-put-name (list layer "I-SURROUNDING"))

)

)

(princ)

)

(vl-load-com) (princ)

 

in layertranlator i use *BAS and press select to locate all the layers with BAS in them... then press on the new layer and then the translate button...

i want to get the same stuff in a lisp because its a lot of layers to translate and a lot of files... plz help!

Link to comment
Share on other sites

You can do the 100 in one go using a script

Open dwg1 (load "myfixup") close Y

Open dwg2 (load "myfixup") close Y

 

The myfixup lisp would have a list of pairs ((oldname newname)(oldname newname)) then just use a ssget "X" to get all objects and you can simply do a chprop LA ss newname.

 

Do you know anything about lisp and scripts ?

Link to comment
Share on other sites

doesn't do the job yet...

i tried the following;

 

 

(defun c:layname ( )

(vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))

(if (wcmatch (strcase (vla-get-name layer)) "*BAS*")

(vl-catch-all-apply 'vla-put-name (list layer "I-BASEWALL"))

(vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))

(if (wcmatch (strcase (vla-get-name layer)) "*SUR*")

(vl-catch-all-apply 'vla-put-name (list layer "I-SURROUNDING"))

)

)

(princ)

)

(vl-load-com) (princ)

 

in layertranlator i use *BAS and press select to locate all the layers with BAS in them... then press on the new layer and then the translate button...

i want to get the same stuff in a lisp because its a lot of layers to translate and a lot of files... plz help!

 

If I am not mistaken, you can save your LAYTRANS mapping, so it is available each time you use the command.

You would still need to open the dwgs in order to apply it, and yes, a lisp or a script would do it more quickly and easily.

Link to comment
Share on other sites

That's right Dadgad, i can save the mapping information.

But in the next dwg the layernames are slightly differtent, but still include the *BAS or *EQP etc.

the mapping info only remembers the old layername... and isn't searching for the layers that include these credentials...

 

Sorry BIGAL, i know how to create a lisp copy past the information and use appload... nothing more... (YET) ;P

 

thnx.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...