Hi,
The DBObject class (from which Entity is derived) has an XData property.
Thank you _gile,
Actually I am looking for .NET snippet like the one in autolisp (setq oXDlst (cdr (assoc -3 (entget (car (entsel)) '("*")))))
You should post what you've written so far so that we can adapt a snippet.
The C# "equivalent" to the (setq oXDlst (cdr (assoc -3 (entget (car (entsel)) '("*"))))) AutoLISP snippet, could be:
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
var promptEntityResult = ed.GetEntity("\nSelect object: ");
ResultBuffer oXDlst = default;
if (promptEntityResult.Status == PromptStatus.OK)
{
using (var tr = db.TransactionManager.StartTransaction())
{
var entity = tr.GetObject(promptEntityResult.ObjectId, OpenMode.ForRead);
oXDlst = entity.XData;
tr.Commit();
}
}
Thank you _gile,
I was trying (Googling and using ChatGPT) to get or develop a solution to retrieve all XData of a selected entity, but my code turned out to be quite long and convoluted. I didn't manage to find a direct and efficient way to do it, which is why I didn't post it here. I was sure that there was a more direct and straightforward solution.