Warning: I am a newbie to this forum and working with Autodesk .Net API....
Senario, I am registering the application name in th RegAppTable. It seems to have worked becuase when I save the drawing as a DXF file and I open it in a text editor I can find the application name is in the DXF. However if I reopen the drawing and run that code it ALWAYS returns false!?!
I am not understanding the RegAppTable or is this a bug?
using (Transaction tr = db.TransactionManager.StartTransaction()) {
// Open the Registered Applications table for read
RegAppTable rat = tr.GetObject(db.RegAppTableId, OpenMode.ForRead) as RegAppTable;
// Check to see if the Registered Applications table record for the custom app exists
if (rat.Has(APPNAME) == false) {
using (RegAppTableRecord ratRec = new RegAppTableRecord()) {
ratRec.Name = APPNAME;
rat.UpgradeOpen();
rat.Add(ratRec);
tr.AddNewlyCreatedDBObject(ratRec, true);
}
}
}
Windows 8.1 w/ Visual Studio 2013 & AutoCAD 2015
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
Although you said you can see the XData application name after saving the drawing as DXF file, I suspect the application being existing may not be the result of your code execution, because in yor code the Transaction is NOT COMMITED, thus, you code shown here that adds a RegAppTableRecord into Database's RegAppTable eventaully will be be aborted at the end of the Transaction.
Norman Yuan