0

I'm trying to get project details information of an Autocad project by means of C# in my plug-in. I can access a few properties in the following class.

Autodesk.ProcessPower.PlantInstance.PlantApplication.CurrentProject

However this class does not provide all project details such as project number etc. How can I access to project details via C#?

Demir
  • 1,787
  • 1
  • 29
  • 42

2 Answers2

0

You have to cast the CurrentProject to an appropriate project part, as in shown here: http://adndevblog.typepad.com/autocad/2012/05/getting-all-the-properties-of-a-selected-pipe-in-plant3d-using-cnet.html

They used a reference to P3dProjectParts.dll to get the PipingProject class. There is a base ProjectPartsMgd.dll that contains the generic project part implementation.

dwolfe
  • 71
  • 2
0

Took be a bit to figure out to get project number from project details, so thought I would post my solution here:

PnIdProject oPnIdProject =
    (PnIdProject)PlantApplication.CurrentProject.ProjectParts["PnID"];

//Assuming you want Project Number from the "General" category.  If you have
//a custom category property you want, just replace "General" with the name
//of the custom category
List<ProjectProperty> metaData = 
    oPnIdProject.GetProjectPropertyMetadata("General");

string projectNumberString = "";

foreach (ProjectProperty prop in metaData)
{
    if (prop.Name == "Project_Number")
    {
        projectNumberString = oPnIdProject.GetProjectPropertyValue(prop);
    }
}

I'm assuming the same could be done for any project part...

Wralf
  • 16
  • 1