Hi!
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...
Thanks!
//Annse