Hello,
I wrote some code in C# to get some data from the PID database and to update the P3D database then the Tag fields match.
I tested it and it works locally, but the changes don't propagate to the Construction Cloud.
The code:
var projPid = currentProj.ProjectParts["PnID"];
var dlmPid = projPid.DataLinksManager;
var dbPid = dlmPid.GetPnPDatabase();
var drawingsTable = dbPid.Tables["PipeLineGroup"];
var allPidPipes = drawingsTable.Select("Description='PIPE LINE GROUP'");
var projP3d = currentProj.ProjectParts["Piping"];
var dlmP3d = projP3d.DataLinksManager;
var dbP3d = dlmP3d.GetPnPDatabase();
drawingsTable = dbP3d.Tables["P3dLineGroup"];
var allP3dPipes = drawingsTable.Select("Tag like '%'");
foreach ( var p in allPidPipes )
{
PnPRow partRowPID = dbPid.GetRow(Convert.ToInt32(p["PnPID"]));
var linePID = $"{p["Service"]}{p["Secteur"]}{p["Page"]}{p["LineNumber"]}";
var partRowP3D = allP3dPipes.FirstOrDefault(e => e["Tag"].ToString() == linePID);
if ( partRowP3D != null )
{
ed.WriteMessage($"linePID={linePID}, partRowP3D={partRowP3D["Tag"]}");
partRowP3D.SetPropertyValue("test", "TESTAAA");
}
}
Solved! Go to Solution.
Solved by Sonny_Dethier. Go to Solution.
Have you tried checking out all affected drawings prior to running your code?
You mean I have to go drawing by drawing if I want to change properties?
I can't just make changes in the P3dLineGroup table and somehow save the changes?
Typically, what I want to do is take the line designation table information taken from the PIDs and sync it with the lines in the P3DLineGroup table where tags match so I can map the P3DLineGroup fields in my isometrics.
@Sonny_Dethier wrote:
You mean I have to go drawing by drawing if I want to change properties?
I can't just make changes in the P3dLineGroup table and somehow save the changes?
I'm not certain. I'd guess you'll either need to checkout the project settings or the drawings while running your code then check back in for the ACC data to update.
In order for Autodesk Construction Cloud to know a change was made in the drawing, you have to update the PnPBase table. Find the PnPID and update the PnPTimestamp to the current time in Ticks.
Once you check in the drawing, the changes will be propagated to ACC.
Can't find what you're looking for? Ask the community or share your knowledge.