.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change active color in C#

3 REPLIES 3
Reply
Message 1 of 4
stardust1611
851 Views, 3 Replies

Change active color in C#

I wanted to change active color in the color control, with the COM interface, but I simply couldn't figure it out. To change active layer or active lineype is so easy:

app.ActiveDocument.ActiveLinetype = app.ActiveDocument.Linetypes.Item("ByLayer");
app.ActiveDocument.ActiveLayer = app.ActiveDocument.Layers.Item("Window");

But command to set active color is not there, and also to set the active lineweight. So, how do I set active color and active lineweight with COM classes, and how do I do it with managed classes? Thanks.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: stardust1611

Set the CECOLOR system variable.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6138029@discussion.autodesk.com...
I wanted to change active color in the color control, with the COM
interface, but I simply couldn't figure it out. To change active layer or
active lineype is so easy: app.ActiveDocument.ActiveLinetype =
app.ActiveDocument.Linetypes.Item("ByLayer"); app.ActiveDocument.ActiveLayer
= app.ActiveDocument.Layers.Item("Window"); But command to set active color
is not there, and also to set the active lineweight. So, how do I set active
color and active lineweight with COM classes, and how do I do it with
managed classes? Thanks.
Message 3 of 4
stardust1611
in reply to: stardust1611

Thanks Tony very much. This works:
app.ActiveDocument.SetVariable("CECOLOR","BYLAYER");

and I found the system varible to set the active lineweight:
app.ActiveDocument.SetVariable("CELWEIGHT",-1);

Is this the only way to set it, or is there an alternative?
Message 4 of 4
Anonymous
in reply to: stardust1611

In C#, the Database object has a corresponding property
for most system variables that are saved in the drawing.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6138036@discussion.autodesk.com...
Thanks Tony very much. This works:
app.ActiveDocument.SetVariable("CECOLOR","BYLAYER"); and I found the system
varible to set the active lineweight:
app.ActiveDocument.SetVariable("CELWEIGHT",-1); Is this the only way to set
it, or is there an alternative?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost