Entity.XData

Here is a small example on how to add XData to Eyeshot entities. More details on AutoCAD extended entity data can be found here

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.XData = myList;
viewportLayout1.Entities.Add(line);
viewportLayout1.WriteAutodesk("test.dwg", autocadVersionType.Acad2007, false);
viewportLayout1.Clear();
ReadAutodesk ra = new ReadAutodesk("test.dwg");
ra.DoWork();
ra.AddToScene(viewportLayout1);
Entity first = viewportLayout1.Entities.First();
Console.WriteLine("XData values:");
foreach (var pair in first.XData)
{
    Console.WriteLine(pair.Value);
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.