.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RegAppTable.Has(appname) always return false?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
527 Views, 1 Reply

RegAppTable.Has(appname) always return false?

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

1 REPLY 1
Message 2 of 2
norman.yuan
in reply to: Anonymous

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

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost