Posts: 18
Registered: ‎04-04-2012
Message 1 of 1 (153 Views)

P&ID custom data.

153 Views, 0 Replies
04-21-2013 12:08 AM



What would be the best way to transfer custom data from a P&ID object to the corresponding Plant 3D object?


My scenario is:
I've added custom data to P&ID objects.

When the user uses the P&ID Line List to place a part from P&ID schematic I want to add my custom data from the P&ID object to the placed part.


So far I've been playing with something like this...


//Get the line number from the selected Plant 3D object.
PlantProject project = PlantApplication.CurrentProject;
PipingProject pipeProj = (PipingProject)project.ProjectParts["Piping"];
DataLinksManager dlm = pipeProj.DataLinksManager;

int rowId = dlm.FindAcPpRowId(objId);
PnPRowIdArray relatedIds = dlm.GetRelatedRowIds("P3dLineGroupPartRelationship", "Part", rowId, "LineGroup");
int lgRowId = relatedIds.First.Value;
PnPRow lgRow = dlm.GetPnPDatabase().GetRow(lgRowId);
string ln = lgRow["Number"].ToString();


//Get the components in the LineGroup from the PnIdProject
PnIdProject pnIdProj = (PnIdProject)project.ProjectParts["PnId"];
DataLinksManager dlmPnId = pnIdProj.DataLinksManager;
PnPDatabase pnpDb = dlmPnId.GetPnPDatabase();
PnPTable table = pnpDb.Tables["PipeLineGroup"];
PnPRow[] rows = table.Select(String.Format("LineNumber={0}", ln));
PnPRowIdArray components = dlmPnId.GetRelatedRowIds("PipeLineGroupRelationship", "PipeLineGroup", rows[0].RowId, "PipeLine");


//Get custom data from components...




Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!