nmareis Posted January 17, 2014 Posted January 17, 2014 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 Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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. Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 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 Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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. Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 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 Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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. Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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. Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 thaks MSasu, realy works...thanks sorry for my english but i am portuguese and my write english is not so good..lol thanks Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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. Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 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 Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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]) Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 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 Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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. Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 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* Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 Enter new layer name : 006_12_C_AUX_ALTERADO_NOVOCannot 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. Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 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) ) Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 only change the first one the others stay equal.. Command: clc ; error: bad argument type: lentityp nil Quote
nmareis Posted January 17, 2014 Author Posted January 17, 2014 (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 January 20, 2014 by SLW210 Quote
Recommended Posts
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.