[DXF][.Net] CAD sdk return wrong color

Dear Aspose support team,

We have faced quite a lot of issue since today related to DXF->PDF import and we went to implement direct reading of the DXF entity to be converted to our internal data types.
During the implementation we faced one problem where the original color is given back wrong.

In attached file, the surrounding rectangle is a LwPolyline. It should have the green color, but values in the returned CAD entity and in the corresponding layer say it’s black. Is there some other values than ColorId on the enitity and ColorId and ColorValue on the layer that should be checked for the right value?

Drawing3.zip (22.8 KB)

Current version we use:

@VartanSaakian,
Hello.

Here is short example:

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
{
	foreach (CadEntityBase entityBase in cadImage.Entities)
	{
		if (entityBase.TypeName == CadEntityTypeName.LWPOLYLINE)
		{
			CadLwPolyline pline = (CadLwPolyline)entityBase;
			CadLayerTable layer = cadImage.Layers.GetLayer(pline.LayerName);

			System.Console.WriteLine("Polyline color ID is {0}, layer's name is {1}, layer's color ID is {2}", pline.ColorId, pline.LayerName, layer.ColorId);
		}
	}
}

For the first green polyline it prints:
Polyline color ID is 256, layer’s name is Leader 1, layer’s color ID is 3

that means that 256 value in color ID of the lwpolyline points to “ByLayer” option, and the color ID in layer is 3, referring to green color.

Please share the details of your environment, version if it works in different way so we can reproduce.

1 Like

Hi @oleksii.gorokhovatskyi looks like it solved our problem :slight_smile: huge thanks for your help.
We will test it a bit more further and i will post last update message.

1 Like

@VartanSaakian,
we are happy to help :slight_smile: