.NET

Reply
Contributor
annse
Posts: 15
Registered: ‎04-04-2012
Message 1 of 1 (151 Views)

P&ID custom data.

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

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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.