Hello,
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.
C#
ProjectPartCollection oPP = PlantApplication.CurrentProject.ProjectParts;
PlantProject oPProj = PlantApplication.CurrentProject;
Project oProj = oPP["PnId"];
try
{
//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"];
drawings.Select();
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.
Thanks,
Patrick
Solved! Go to Solution.
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
jess
Thanks.
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.
--Patrick