I noticed that the Color property of CADEntity is incorrect on certain CAD files. The code is like below,
Code: Select all
static void Main(string[] args)
{
// Load any DWG or DXF file.
string fName = @"..\..\..\nusajaya.dwg";
CADImage cadImageSource = CADImage.CreateImageByExtension(fName);
cadImageSource.LoadFromFile(fName);
cadImageSource.SetCurrentLayout(0);
for (int i = 0; i < cadImageSource.Converter.Entities.Count; i++)
{
CADEntity entSource = cadImageSource.Converter.Entities[ i ];
if (entSource.Handle == 1210)
{
// Retrieve a CADEntity based on its Handle
// that is pre-obtained from the Viewer program.
Console.WriteLine("Type: " + entSource.GetType());
Console.WriteLine("Color: " + entSource.Color);
Console.WriteLine("Name: " + entSource.EntName);
Console.WriteLine("Layer: " + entSource.Layer.Name);
break;
}
}
}
Question #2 is, it seems that each CADEntity has a Handle property, which I assume it is its unique id. I was wondering whether there is anyway to retrieve a specific CADEntity from CADEntityCollection via its Handle?
Thanks!
<b>Objective World Pvt. Ltd.</b>
"<i>Turning Knowledge Into Wisdom.</i>"
http://www.objectiveworld.com