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

How to get the value of default color in AutoCAD?

9 REPLIES 9
Reply
Message 1 of 10
$o-olitarY
3376 Views, 9 Replies

How to get the value of default color in AutoCAD?

Hello

 

I want to iterate the entities in the drawing and find all intities, whose colour equals to default. How can I get value of default color?

I learned how to iterate the autocad data base.

Moreover I see, that class Entity has a ColorIndex field, but class Autodesk.AutoCAD.Colors.Color do not have a field like 'DefaultColor'.

I need a field or method, because user can set the color he wants. Default color - I mean exactly, the color will be printed like black on a paper.

(If it is possible to give answer with C#-code sample)

 

Thank you.

9 REPLIES 9
Message 2 of 10
hgasty1001
in reply to: $o-olitarY

Hi,

 

 Autocad use the CECOLOR system variable that is usually set to the default "BYLAYER" (with color index:=256), meaning that the actual color of the entity is defined by the color of the layer in which lay on. Another special color is "BYBLOCK" (with color index:=0) meaning that the object inherits its color from the block that contain it. So, to filter by color it's a bit tricky as you can't say the exact color a entity has if the color is "BYLAYER", in that case you will need to check the color of the layer.

 

Gaston Nunez

 

 

 

 

Message 3 of 10
$o-olitarY
in reply to: hgasty1001

Ok.

 

Am I underastand you right?

The CECOLOR system variable keeps the value of default color in AutoCAD, that will be printed as black.

 

I think next way:

  Entity has a ColorIndex field, that keep

     eather a color of object [1, 2, ..., 255],

     or     0=ByBlock, I need to see block's color, 

     or 256=ByLayer, so I need to see the color of its layer.

It is possible to program, I think.

Message 4 of 10
hgasty1001
in reply to: $o-olitarY

Hi,

 

Not sure to understand "print to black",in AutoCAD the color mapping to a plot it's controled by the plot configuration, so it's up to you the plotted color of any color index an entity has.

CECOLOR it's the default color at user level, so if you create a line (or any other entity), that line will have the CECOLOR color, including the BYLAYER color.

 

Gaston Nunez

Message 5 of 10
dgorsman
in reply to: $o-olitarY

You might want to elaborate on what you are calling the "default color".  You might also want to consider how to handle entities with TrueColor settings.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 6 of 10
$o-olitarY
in reply to: dgorsman

I'm confuesd by next fact:

 

Different versions of AutoCAD has different background colors. Thus the contrast "base color" (that using for drawing) also different.

For example, AutoCAD 2013 has black background on default and white "base color".

(Besides user can change colors manually in options).

In addition the "base color" and white color are different, despite the fact they are looked the same on a screen.

Because there are two white colors in the color dialogbox. And only one of them is converts to real black color on a paper.

Thats why I need exactly correct "base color" (In Layers Manager this color has name "default" in AutoCAD 2013).

 

In agreement with the post above I come to conclusion, that 

  contrast "base color" = "default" in Layers Manager = "ByLayer" in value of CECOLOR = Entity.ColorIndex[256] in C#.

whatever his real color is.

 

Am I say clear?

Message 7 of 10
hgasty1001
in reply to: $o-olitarY

Hi,

 

Background color has nothing to do with entity color or plot color, plot colors are controled by plot configuration, screen displayed color depends on background color ( a property of AutoCAD's editor window), entity color (a property of the entity itself)  and maybe other things (transparency settings, masking behind other entity or such), and finally, plot colors depends on the plot configuration and the plot style tables.

Please make clear what it's exactly what you want: plot colors, display colors, filter entities by intrinsic color...etc.

 

Gaston Nunez

Message 8 of 10
$o-olitarY
in reply to: hgasty1001

I thought there are one set of colors in AutoCAD. I do not know what colors I want.

 

My task is to get all colored entities from the drawing.

How can I distinguish colored object and object is drawn by black lines?

Now I do not know what I should do.

Message 9 of 10
hgasty1001
in reply to: $o-olitarY

Hi,

 

This link should help you to understand the basic on filter objects by properties: Filters

 

Gaston Nunez

Message 10 of 10
jeff
in reply to: $o-olitarY

I think that would be the first step.

 

Is to read and play with AutoCAD a little more until you figure out what it is you need.

You can also find your answers @ TheSwamp

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