Jump to content

Recommended Posts

Posted

Good morning

 

I need some help with a script..

I need a script that pass many objects from one layer to an other layer, automatic....can anyone help me?

exemple: object with layer x pass to layer y

 

thanks

:)

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • nmareis

    18

  • MSasu

    16

  • SLW210

    2

  • Tuns

    2

Popular Days

Top Posters In This Topic

Posted

May do that by an AutoLISP statement:

(command "_CHPROP" (ssget "_X" '((8 . "[color=blue]LayerFrom[/color]"))) "" "_LA" "[color=blue]LayerTo[/color]" "")

But please note that this doesn't account for the case that source layer is locked.

Posted

i tryed to copy this and past in notepad but dont work..can you help me?? i want to pass this layers:001_14_C_AUX_ALTERADO_NOVO to 006_12_C_AUX_ALTERADO_NOVO; 002_14_C_AUX_ALTERADO_NOVO to 006_12_C_AUX_ALTERADO_NOVO...etc.....thanks

Posted

The above line adjusted for you first case:

(command "_CHPROP" (ssget "_X" '((8 . "001_14_C_AUX_ALTERADO_NOVO"))) "" "_LA" "006_12_C_AUX_ALTERADO_NOVO" "")

How you tested that? What message error you got?

If the source layer un-locked?

If the target layer available? It no,t should add a line to create it before atempting to move the items.

Posted

this works but ineed something that i write in comand line a command and execut this comand...do you know how?

 

some thing linke....writ lra and executes the aplication...

 

thanks

Posted

For that case should define a new command and include those statements in it.

(defun c:LRA()
(command "_CHPROP"
         (ssget "_X" '((8 . "001_14_C_AUX_ALTERADO_NOVO")))
         "" "_LA" "006_12_C_AUX_ALTERADO_NOVO" "")
(command "_CHPROP"
         (ssget "_X" '((8 . "002_14_C_AUX_ALTERADO_NOVO")))
         "" "_LA" "006_12_C_AUX_ALTERADO_NOVO" "")
(princ)
)

Load it into AutoCAD and call LRA on command prompt.

Posted

Just noticed that from above example you seems to want to merge some layers? For this case may want to check built-in LAYMRG command.

Posted

thaks MSasu,

 

realy works...thanks

 

sorry for my english but i am portuguese and my write english is not so good..lol

 

thanks

Posted

Glad to hear it worked for you, Nmareis; you're entirely welcome!

 

As for your English writing skills, I think that your messages were comprehensible. Don't forget that here are many non-native English speakers (me included) along you.

Posted

ok...thants...

one other question and is the last one...lol:)

if i want change colors of any layers to other color, existe any autolisp to do this?..

i have a scrip but if i can use this sistem i think that is beter...

Thanks

Posted

May try this - just replace the part in blue with your layer name, respectively the red one with desired color index:

(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "[color=blue]Layer1[/color]")) [color=red]75[/color])

Posted

works...but how do i put the comand to call this autolisp to the colors....the autolisp of layer in one of the files ask me what the new name for the layer when i tried to run...thanks

Posted
but how do i put the comand to call this autolisp to the colors

Just surround that statement with a command definition:

(defun c:FIXLAYERCOLOR()
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "Layer1")) 75)
(princ)
)

 

 

the autolisp of layer in one of the files ask me what the new name for the layer when i tried to run

Seems that the target layer isn't available in that drawing - press to see the entire error message.

Posted

this is the error...

 

Command: chl

_CHPROP

Select objects: 2 found

 

Select objects:

Enter property to change

[Color/LAyer/LType/ltScale/LWeight/Thickness/Material]: _LA

Enter new layer name : 006_12_C_AUX_ALTERADO_NOVO

Cannot find layer "006_12_C_AUX_ALTERADO_NOVO".

; error: Function cancelled

 

Enter new layer name : *Cancel*

Posted
Enter new layer name : 006_12_C_AUX_ALTERADO_NOVO

Cannot find layer "006_12_C_AUX_ALTERADO_NOVO".

; error: Function cancelled

As you can see, the 006_12_C_AUX_ALTERADO_NOVO is not available in that drawing.

Posted
and to change more than one???

Just multiply and adjust the statement to suit your needs:

(defun c:FIXLAYERCOLOR()
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "Layer1")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "Layer2")) 76)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "Layer3")) 77)
(princ)
)

Posted

only change the first one the others stay equal..

 

 

Command: clc

; error: bad argument type: lentityp nil

Posted (edited)

there is the code:

 

(defun c:clc()
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "RAMAISmdm")) 75) 
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "G_EM_CONSTRUCAO")) 75) 
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_ARRUAMENTOS")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "001_14_C_AUX_ALTERADO_NOVO")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_AUX_ALTERADO_NOVO")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_EDIFICACOES")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_EDIFICACOES_PUBLICAS")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_N_POLICIA")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_TERRENOS")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "C_TOPONIMIA")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "CROQUIS_MOLD500")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "MARGEM")) 75)
(vla-put-color (vlax-ename->vla-object (tblobjname "LAYER" "MOLD500")) 75)
(princ)
)

Edited by SLW210

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...