Jump to content

Recommended Posts

Posted

I have a doubt and I ask for help from the masters.

There is another way to change the color of a layer via LISP?

I tried this method:

 

(defun make_layer ()

(command "_.layer" "t" "LAYER_01" "c" "50" "" "")

(command "_.layer" "t" "LAYER_02" "c" "191" "" "")

(command "_.layer" "t" "LAYER_03" "c" "70" "" "")

)

 

...but does not change the color of existing layers with same name.

Posted

You have to specify the layer name...

 

(defun make_layer ()
 (command "_.layer" "t" "LAYER_01" "c" "50" "LAYER_01" "")
 (command "_.layer" "t" "LAYER_02" "c" "191" "LAYER_02" "")
 (command "_.layer" "t" "LAYER_03" "c" "70" "LAYER_03" "")
)

Posted

There is another way to change the color of a layer via LISP?

 

 

Yes. Try this:

 

[color=#000]vla-put-color [i]<vla-object> [/i]<color>[/color]

 

 

Or this:

 

[color=#000]vlax-put-property [i]<vla-object>[/i] 'color[/color]

 

 

...but does not change the color of existing layers with same name.

 

 

This requires additional steps.

Posted
You have to specify the layer name...

 

(defun make_layer ()
 (command "_.layer" "t" "LAYER_01" "c" "50" "LAYER_01" "")
 (command "_.layer" "t" "LAYER_02" "c" "191" "LAYER_02" "")
 (command "_.layer" "t" "LAYER_03" "c" "70" "LAYER_03" "")
)

 

 

Alan, thanks for reply.

I've tried this and also not work if I already have layers with the same names.

I use CAD2002. :(

Posted

...but does not change the color of existing layers with same name.

 

You have to specify the layer name...

 

(defun make_layer ()
(command "_.layer" "t" "LAYER_01[color=red]*[/color]" "c" "50" "LAYER_01[color=#ff0000]*[/color]" "")
(command "_.layer" "t" "LAYER_02[color=#ff0000]*[/color]" "c" "191" "LAYER_02[color=#ff0000]*[/color]" "")
(command "_.layer" "t" "LAYER_03[color=#ff0000]*[/color]" "c" "70" "LAYER_03[color=#ff0000]*[/color]" "")
)

 

Slight revision to accomplish this with existing layers as well, perhaps?

 

Note- the asterisk will effect all layer with this prefix.

Posted
Alan, thanks for reply.

I've tried this and also not work if I already have layers with the same names.

I use CAD2002. :(

Well, all you are doing is thawing and setting the color.

Are you trying to use this to create the layer?

Posted
Well, all you are doing is thawing and setting the color.

Are you trying to use this to create the layer?

 

I want to change the color properties of existing layers.

Posted
I want to change the color properties of existing layers.

 

And what you have will. Perhaps you need to account for language.

(defun make_layer ()
 (command "_.layer" "_t" "LAYER_01" "_c" "50" "LAYER_01" "")
 (command "_.layer" "_t" "LAYER_02" "_c" "191" "LAYER_02" "")
 (command "_.layer" "_t" "LAYER_03" "_c" "70" "LAYER_03" "")
)

Posted
Else look at entmod'ing the tblobjname...

baby steps :wink:

Posted
Slight revision to accomplish this with existing layers as well, perhaps?

 

Note- the asterisk will effect all layer with this prefix.

 

RenderMan,

 

Now it worked perfectly.

 

Thank you for your help.

Posted

Aww, shucks... I just added [a tiny bit] to what Alanjt already provided you. :wink:

Posted

Perhaps his layers are still locked.

 

 (command "_.layer" "t" "LAYER_01" "u" "LAYER_01" "c" "50" "LAYER_01" "")

SteveJ

 

EDIT: Oops. Nevermind

Posted
Perhaps his layers are still locked.

 

 (command "_.layer" "t" "LAYER_01" "u" "LAYER_01" "c" "50" "LAYER_01" "")

SteveJ

Locking a layer only limits the user from editing objects on the layer; the layer itself can still be altered.

Posted

Yeah. I was thinking from the Layer Properties Manager it would be easy, but using LISP might require that extra little step. Turns out that wasn't the problem, anyway.

 

SteveJ

Posted

Still abusing the patience of colleagues, does anybody know how to write a subroutine to change the color of multiple layers?

I would like to activate this subroutine as follows:

 

(Subroutine "NewColor" "layername1, layername2, layername3,...")

 

Thanks in advance.

Posted

Separate layer names with commas (no spaces before or after the comma)

 

"layername1,layername2,layername3"

Also, wildcard character (*) is permitted

 

"layername*"

would modify all the above

 

SteveJ

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