Active Contributor
Posts: 27
Registered: ‎09-25-2008
Message 1 of 3 (293 Views)
Accepted Solution

Accessing database tables with AutoCAD PNID 2011

293 Views, 2 Replies
09-21-2011 11:35 AM


I'm having a problem accessing data manager tables in the 2011 version.  My C# .NET code worked fine with 2010.  Here is a sample of the 2010 code that works, but returns zero length tables in 2011.



ProjectPartCollection oPP = PlantApplication.CurrentProject.ProjectParts;

PlantProject oPProj = PlantApplication.CurrentProject;
Project oProj = oPP["PnId"];


                //get ACAD data table
                System.Collections.Specialized.StringCollection strColl =                      Autodesk.ProcessPower.DataLinks.DataLinksManager.GetLinkManagerNames();
                if (strColl.Count > 0)
                    String dlName = strColl[0];
                    if (dlName != String.Empty)
                        dlObj = oProj.DataLinksManager;
                        PnPDatabase pnpDB = dlObj.GetPnPDatabase();
                        // get a reference to all the tables in the P&ID project
                        // database
                        PnPTable drawings= null;
                        drawings = pnpDB.Tables["PnPDrawings"];
                        PnPRows drawingRows = drawings.Rows;
                        PnPRowIdArray DwgRowIndexes = drawings.SelectCachedIds();



end of try loop;


The last two lines fail to object any meaningful data in 2011.  In 2010, I would have all the table rows and could access tags and asset information. 


Any help would be appreciated.



Active Contributor
Posts: 38
Registered: ‎10-04-2009
Message 2 of 3 (257 Views)

Re: Accessing database tables with AutoCAD PNID 2011

10-06-2011 05:30 PM in reply to: PATRICKCAREY9382

I do this and it works in 2010+


PnPTable drawings= pnpDB.Tables["PnPDrawings"];
PnPRow[] rows = drawings.Select();


I have had fairly unpredictable results using PnPTable.Rows, perhaps because of caching, but Im not sure at this point. The code above always seems to work.


Hope that helps



Active Contributor
Posts: 27
Registered: ‎09-25-2008
Message 3 of 3 (237 Views)

Re: Accessing database tables with AutoCAD PNID 2011

10-07-2011 01:06 PM in reply to: jessaskey


I believe your solution is the only way to do it now.  I've run into some other issues such that accessing some of the table parameters is not as easy as it was before and it probably is related to caching. 


I've coded up this solution and it works for me for now.  I have other scripts that may still be broken, but I'll deal with them later.


You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community