.NET

Reply
Member
martin.wright
Posts: 4
Registered: ‎11-02-2011
Message 1 of 7 (398 Views)
Accepted Solution

Plant 3D - Creating Project Folders

398 Views, 6 Replies
08-08-2012 09:10 PM

I am currently looking at writing a function to create our folder structure within the Plant 3D project.

 

I have looked at the PnPProjectFolder object but am unable to determine how to create a new project folder.

I do not understand how I obtain a folderGUID or the best way to discover if the folder exists. (I can loop through the ProjectItems collection).

 

We need to add 30 folders, including sub-folders, setting their paths as we are not using virtual folders.

 

I am not at a stage where I have any code worth publishing here.

 

I would appreciate and guidance on this.

 

Regards

Martin

Active Member
dave.evans
Posts: 8
Registered: ‎05-11-2012
Message 2 of 7 (371 Views)

Re: Plant 3D - Creating Project Folders

08-10-2012 03:23 AM in reply to: martin.wright

Hi Martin,

Let me possibly save you some work. 

If you make a template project, build your folder structure under the template.  Then, when you create a new project in Project Manager, use the "Copy settings form existing proect" radio button.

This will buid the project strucure under the new project.

This is how we deploy all our customisation / configuration changes in a consisytent manner for all clients.

I hope this helps.

Regards

Dave

Technical Specialist - Plant

Nothern Europe

Member
martin.wright
Posts: 4
Registered: ‎11-02-2011
Message 3 of 7 (354 Views)

Re: Plant 3D - Creating Project Folders

08-12-2012 10:26 PM in reply to: dave.evans

Hi Dave

I have looked at this method and found that I can achieve what I require.

 

The trick for me was to specify the same folder for the P&ID drawings and the Plant 3D model drawings, then the project folders were built on top of that, as I required them.

 

I would still like to know how to achieve this programatically as the API does imply it can be done.

 

Thanks

Martin

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 4 of 7 (322 Views)

Re: Plant 3D - Creating Project Folders

08-21-2012 12:27 PM in reply to: martin.wright

The PnpProjectFolder class only creates the Virtual entries in the project database, not the physical entries on disk - to do that you need to use the normal Microsoft APIs. 

 

The Autodesk.ProcessPower.ProjectManager.Project.CreateFolder(string, Autodesk.ProcessPower.ProjectManager.PnPProjectFolder) actually returns the GUID based on a new row in the DCF file. 

 

I hope this explains. 
 





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Member
martin.wright
Posts: 4
Registered: ‎11-02-2011
Message 5 of 7 (302 Views)

Re: Plant 3D - Creating Project Folders

08-23-2012 04:24 PM in reply to: fenton.webb

Hi Fenton

Unfortunately I need more information

 

    <CommandMethod("AddMyFolder")> _

    Public Sub AddMyFolder()

        Dim oPrjPiping As Project = DirectCast(PlantApplication.CurrentProject.ProjectParts("Piping"),  _

                                                Project)

        Dim MyFolder As New PnPProjectFolder

        Dim FldrName As String = "C:\CAD_Dwg"

        System.IO.Directory.CreateDirectory(FldrName)

        MyFolder.Name = "CAD_DWG"

        MyFolder.AbsoluteFolderPath = FldrName

 

        Dim FldrGuid As String = oPrjPiping.CreateFolder("Plant 3D Drawings", MyFolder)

        oPrjPiping.Save()

 

    End Sub

 

Can you advise where I am going wrong?

In this FldrGuid  = “”

 

 

Regards

Martin

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 6 of 7 (262 Views)

Re: Plant 3D - Creating Project Folders

08-29-2012 02:46 PM in reply to: martin.wright

I think if you pass null to CreateFolder it will do the magic for you...

 

e.g.

 

string FldrGuid = oPrjPiping.CreateFolder(null, MyFolder);

 





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Member
martin.wright
Posts: 4
Registered: ‎11-02-2011
Message 7 of 7 (256 Views)

Re: Plant 3D - Creating Project Folders

08-29-2012 03:17 PM in reply to: fenton.webb

Hi Fenton

Excellent.

I’m using VB and used Nothing in place of null but that did the job.

 

Regards

Martin

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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