How to override the layer color
![]() 3/9/2023 3:37 PM
|
---|
I am trying to set the color of the entity (WW.Cad.Model.Entities.EntityColor DxfEntity.Color). But when I open the DXF file I see that the objects use the color of the layer (WW.Cad.Model.Color DxfLayer.Color) instead. C# Code: var layer = new DxfLayer( |
![]() 3/9/2023 9:18 PM
|
---|
Can you post a complete program with input data if present? I can't do anything with this. - Wout |
![]() 3/10/2023 4:19 PM
|
---|
I've changed the code. The method Draw() produces a DXF file with a poly face mesh. The mesh object consists of a rectangle face and a triangle face. I open the file using the "DWG TrueView 2023" program. I need this poly face mesh to use the color that I am setting directly to the mesh object (red): C# Code: mesh. C# Code: public static void Draw( |
![]() 3/10/2023 4:41 PM
|
---|
Hi, This is how AutoDesk designed the polyface mesh entity. The polyface mesh has a Color property, but it doesn't seem to be used. This is because each mesh face is by itself an entity (it inherits from DxfEntity), with its own Color property, and this is the property that is used. This property has the bylayer color by default. So if you change each face color to red, it should work as you want it to. Edit 1: I may have spoken too soon, if I change the polyface mesh color in AutoCAD, it does change the whole mesh color, so maybe CadLib does something wrong with writing the face colors. Edit 2: Yes, it does seem my initial analysis is correct. When I change color of the mesh in AutoCAD, it will internally actually change the color of the mesh, and also of all its faces and all its vertices (each vertex is also an entity). - Wout |
![]() 3/13/2023 10:41 AM
|
---|
It helped! Thank you very much! |