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

C# Publish_BeginSheet and PnP Database Access

0 REPLIES 0
Reply
Message 1 of 1
jessaskey
509 Views, 0 Replies

C# Publish_BeginSheet and PnP Database Access

I need to access the PnP Database (P&ID and Plant3D) of the open drawing during the publish process in order to apply a Drawable overrule. It is pretty straightforward, as I want to run the following code within the Publisher BeginSheet event....

 

private void publisher_BeginSheet(object sender, PublishSheetEventArgs e)
{
     //get the current document, this is opened by the publish process and is not null during BeginSheet
     Document doc = AcadApp.DocumentManager.MdiActiveDocument;

     Database oDB = AcadApp.DocumentManager.MdiActiveDocument.Database;
     //work to getting the drawing ID so we can query with it later, we are going to query the PnPDatabase directly
     PnPTable pnpDrawingTable = oDB.Tables["PnPDrawings"];
     PnPRow pnpDrawingRow = pnpDrawingTable.Select("PnPDrawingGuid='" + doc.Database.FingerprintGuid + "'").FirstOrDefault();

     //standard stuff
     Editor oEditor = AcadApp.DocumentManager.MdiActiveDocument.Editor;
     Autodesk.AutoCAD.DatabaseServices.TransactionManager oTxMgr = oDB.TransactionManager;

     using (Transaction oTx = oTxMgr.StartTransaction())
     {
         //finally get our drawing id here
         int dwgid= int.Parse(pnpDrawingRow["PnPId"].ToString());
         //call SelectAcPpRowIds to get all ids of items on the current drawing
         PnPRowIdArray items = PlantApplication.CurrentProject.ProjectParts["PnId"].DataLinksManager.SelectAcPpRowIds(dwgid);
         //items is always empty, like the DataLinksManager is not applicable within the Publisher event


     }
}

 

As you can see in the comments, Im not able to sucessfully use the .SelectAcPpRowIds method to get all the RowID's of items within the drawing.

 

I certainly see where I may be confusing the drawing database with the project database and could be getting things mixed up. so if anyone can help me understand the best way to get all RowIds off the currently open project, then that woudl work just fine too.

 

thank you...

 

jess

 

0 REPLIES 0

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