change active color

change active color

Anonymous
Not applicable
1,073 Views
5 Replies
Message 1 of 6

change active color

Anonymous
Not applicable

How can i change the active color in autocad?

Usually is use something like Thisdrawing.activelayer = Thisdrawing.Layers.Item("layername")

Thisdrawing includes activelayer, activedimstyle, activetextstyle etc. but no activecolor.

Does anyone knows a way around it?

 

 

0 Likes
Accepted solutions (1)
1,074 Views
5 Replies
Replies (5)
Message 2 of 6

norman.yuan
Mentor
Mentor
Accepted solution

The system variable "CECOLOR" might be what you want?

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 6

augusto.goncalves
Alumni
Alumni

Sorry but it's not clear which color you want to change.

 

If you change layer, for instance, will change the entities on the screen. But that may affect all entities on that layer... is that it?

 

Or do you want to change AutoCAD background color (usually black)?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 4 of 6

Anonymous
Not applicable

Thank you, CECOLOR worked 🙂

0 Likes
Message 5 of 6

sunchuanpu
Enthusiast
Enthusiast

I apologize if I am bothering you. I met the same question and found this post. However, being a self-studied newbie, I found what are the valid values, but I don't know how to call or set this system variable. Is it possible for you to show me an example of how to use this? One line of code should be enough. Thank you very much.

0 Likes
Message 6 of 6

_gile
Consultant
Consultant

You can either use the Application.SetSystemVariable method or the Database.Cecolor property.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub