Starting from Eyeshot 2020, we introduced a new property of type AutodeskMiscProperties of the Entity class called AutdoeskProperties. This class gathers inside it some miscellaneous Autodesk properties such as curve thickness, the thickness extrusion direction, and the entity XData.
Now to read and write the entity XData you need to proceed as follows:
Line line = new Line(0, 0, 0, 100, 100, 100);
List<KeyValuePair<short, object>> myList = new List<KeyValuePair<short, object>>();
myList.Add(new KeyValuePair<short, object>(1001, "MyAPP"));
myList.Add(new KeyValuePair<short, object>(1000, "BlaBlaBla"));
line.AutodeskProperties = new AutodeskMiscProperties(myList);
line.AutodeskProperties.Thickness = 3; // here we set also the line thickness
design1.Entities.Add(line);
WriteAutodeskParams wrp = new WriteAutodeskParams(design1.Document)
{
Version = autodeskVersionType.Acad2007
};
WriteAutodesk wra = new WriteAutodesk(wrp, "test.dwg");
wra.DoWork();
// delete the line and load it from file
design1.Entities.Clear();
ReadAutodesk ra = new ReadAutodesk("test.dwg");
ra.DoWork();
ra.AddTo(design1);
Entity first = design1.Entities.First();
Console.WriteLine("XData values:");
foreach (var pair in first.AutodeskProperties.XData)
{
Console.WriteLine(pair.Value);
}
More details on AutoCAD extended entity data can be found here.
Comments
Please sign in to leave a comment.