.NET

Reply
Valued Mentor
dennis
Posts: 709
Registered: ‎07-29-2005
Message 1 of 3 (128 Views)
Accepted Solution

Plant 3D 2015: VB.NET code direction

128 Views, 2 Replies
08-07-2014 07:44 AM

I am trying to figure out how to access via VB.NET the "Selection List" setup for both the PnID and P3D, buried in the Project Properties / Setup.  The only reference I can find is in the chm Plant SDK 2015: Developer Help, under Plant Project / Se Up Selection Lists and reads:

 

quote

As part of project setup tasks, developers can set up new selection lists or change the values of existing lists.

The new or modified selection lists populate the Class Property Settings data, where the properties of each class (specific component or line) are defined.

Those properties are included in the component behavior when it is placed from the tool palette onto a drawing.

end quote

 

However, no examples are given.  Any one have a bit of code that will point me in the right direction?

Here's a short sample that shows how to access (C#). 

if
(PlantApplication.CurrentProject == null) return; (PipingProject)PlantApplication.CurrentProject.ProjectParts["Piping"]; Project pnid = PlantApplication.CurrentProject.ProjectParts["PnID"]; PnPDatabaseMode current = pnid.Mode; try { pnid.Mode = PnPDatabaseMode.Exclusive; } catch { throw new System.Exception("Unable to modify project setup while other users are in the project."); } string picklistname = "Pipe_Specs"; PnPPicklist specList = pnid.Picklists.Add(picklistname, picklistname); foreach (var s in specs) { specList.Add(s, string.Empty); } pnid.Save();
*Expert Elite*
dave.wolfe
Posts: 695
Registered: ‎12-04-2009
Message 2 of 3 (110 Views)

Re: Plant 3D 2015: VB.NET code direction

08-07-2014 11:46 AM in reply to: dennis
Here's a short sample that shows how to access (C#). 

if
(PlantApplication.CurrentProject == null) return; (PipingProject)PlantApplication.CurrentProject.ProjectParts["Piping"]; Project pnid = PlantApplication.CurrentProject.ProjectParts["PnID"]; PnPDatabaseMode current = pnid.Mode; try { pnid.Mode = PnPDatabaseMode.Exclusive; } catch { throw new System.Exception("Unable to modify project setup while other users are in the project."); } string picklistname = "Pipe_Specs"; PnPPicklist specList = pnid.Picklists.Add(picklistname, picklistname); foreach (var s in specs) { specList.Add(s, string.Empty); } pnid.Save();
Dave Wolfe
Isaiah 57:15

ECAD, Inc.
Tips and Tricks on our blog: Process Design, from the Outside

A P3D Authorized Reseller
Plant 3d Wish list: https://plant3d.uservoice.com/
Valued Mentor
dennis
Posts: 709
Registered: ‎07-29-2005
Message 3 of 3 (94 Views)

Re: Plant 3D 2015: VB.NET code direction

08-08-2014 04:15 AM in reply to: dave.wolfe

Thanks Dave.  I was thinking I needed to check into PickList since my searching through the Object Browser for SelectionList was going nowhere.  I will run your example through a C#2VB Converter and head in that direction.  Thanks again.

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.