V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course...

70
OpenPlant Component Scripting V8i (SELECTseries 3) Bentley Institute Course Guide TRN00NNNN-L/000X

Transcript of V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course...

Page 1: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

TRN00NNNN-L/000X

OpenPlant Component ScriptingV8i (SELECTseries 3)

Bentley Institute Course Guide

Page 2: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Trademarks

AccuDraw, Bentley, the “B” Bentley logo, MDL, MicroStation and SmartLine are registered trademarks; PopSet and Raster Manager are trademarks; Bentley SELECT is a service mark of Bentley Systems, Incorporated or Bentley Software, Inc.

AutoCAD is a registered trademark of Autodesk, Inc.

All other brands and product names are the trademarks of their respective owners.

Patents

United States Patent Nos. 5,8.15,415 and 5,784,068 and 6,199,125.

Copyrights

©2000-2011 Bentley Systems, Incorporated. MicroStation ©1998 Bentley Systems, Incorporated. All rights reserved.

Course Name Here 2 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 3: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Sep-11

Table of Contents

Course Overview ____________________________________ 5Course Description ____________________________________5Target Audience_______________________________________5Prerequisites _________________________________________5Course Objectives _____________________________________6Modules Included _____________________________________6System Requirements __________________________________7Software Requirements_________________________________7Important Notes: ______________________________________9

Component Scripting ________________________________ 11Module Overview _____________________________________11Module Prerequisites __________________________________11Module Objectives_____________________________________11Best practice to developing scripts ________________________12Local Workspace ______________________________________12Base workflow ________________________________________13Launching Modeler ____________________________________14Place standard component ______________________________16Key-in _______________________________________________18Place Non-existent Component___________________________19Add EC Class__________________________________________19Add CREATION_ATTRIBUTE to Link EC Class to .NET Class ______21Create New .NET Assembly from Scratch ___________________24Publishing .NET Assembly to Local Workspace _______________29Parameterize Geometry ________________________________32Debugging ___________________________________________39Preview Diagram ______________________________________40Toolbar Icon __________________________________________43Placement Points ______________________________________46Datum ______________________________________________47Mapping EC Class to Spec/Catalogue table__________________49Value Mapping________________________________________50Differencing Schemas __________________________________50Publishing to Managed Workspace________________________53Examples – a .NET solution folder_________________________59

3 Course Name HereCopyright © 2011 Bentley Systems, Incorporated

Page 4: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Name Here

Table of Contents

References _________________________________________ 61Module Overview _____________________________________61Module Prerequisites __________________________________61Module Objectives_____________________________________61Joint Implementation __________________________________62Controlling EC Property view behavior _____________________64Component Creation Setup______________________________65

Course Summary ____________________________________ 67Course Summary ______________________________________67Course Review ________________________________________68

Questions ________________________________________68Answers__________________________________________69

4 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 5: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Overview

Course Description

This course contains step by step exercises to create custom parametric 3D components using the OpenPlant software.

This course is designed to instruct the project administrator how to create and customize a project to meet corporate standards. You will use several tools in the OpenPlant family of products built to support these functions. It is rare when a company can use a software application without making modifications to the symbology or menus or component definitions.

You will be instructed on how to create a new project and add classes and properties to components. You will also learn how to modify tags and how to create and maintain specifications. You will create and modify reports for placement in a drawing or for export to other applications.

Target Audience

This course is recommended for the following audience(s):

• Engineers, Designers and Drafters responsible for customizing the OpenPlant Modeler software to fit their corporate needs.

Prerequisites• Students taking this course should have a working knowledge of CAD systems

and 3D modeling concepts

Sep-11 5 Course Overview

Copyright © 2011 Bentley Systems, Incorporated

Page 6: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Objectives

• Students should have completed the OpenPlant Modeler User Fundamentals course and the OpenPlant Modeler Administrator course.

Course Objectives

After completing this course, you will be able to:

• Create custom parametric 3D components

Modules Included

The following modules are included in this course:

• Creating Custom Components

Course Overview 6 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 7: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

System Requirements

System Requirements

You must have a CD drive or Internet access for product installation. The following prerequisites are required to run the OpenPlant Modeler (SELECTseries3):

Processor: Intel Pentium 4 processor or AMD Athlon, 3.0 GHz or greater, or Intel or AMD Dual Core Processor, 2.0 GHZ or greater

Operating System: Windows 7, Windows 7 x64, Windows Vista, Windows Vista x64, Windows XP Professional (SP2 or later) Windows XP Professional x64, Windows XP Home Edition (SP2 or later), Windows XP Tablet PC Edition, Windows 2000 Professional (SP3 or later), Windows 2000 Server, Windows Server 2003 (SP1 or later), Windows Server 2003 x64, Windows Server 2008, Windows Server 2008 x64.

Microsoft Office: Professional Edition 2000 (SR1a), XP, 2003 or 2007.

Memory: 2GB minimum recommended (More memory almost always improves performance, particularly when working with larger models.).

Hard Disk: Requires 30 MB minimum free hard disk space in addition to the OpenPlant Modeler V8i requirement of 400 MB minimum free hard disk space.

Input Device: Any industry-standard input device supported by Windows.

Output Device: Any industry-standard output device supported by Windows.

Software Requirements

Install following software prior to joining OpenPlant component scripting training

Note: It can take several hours before you install everything

• Bentley Prerequisites pack

• Bentley ProjectWise Explorer & Administrator (optional)

• Bentley Class Editor (08.11.08.04)

• Bentley OpenPlant Modeler (08.11.08.29 or 38)

• .NET Framework 4.0 (if necessary)

Sep-11 7 Course OverviewCopyright © 2011 Bentley Systems, Incorporated

Page 8: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Software Requirements

• LINQPad: Excellent learning tool and scripting environment for .NET

http://www.linqpad.net/

Download and install the free version. Autocompletion is not necessary but if you want to invest into learning C#, it is a great helper, works just like the intellisense in Visual Studio.

• IlSpy or Reflector: Browser, navigator, decompiler of .NET assemblies

Choose Ilspy if the free version of Reflector is no longer available

http://wiki.sharpdevelop.net/ilspy.ashx (requires .NET Framework 4.0)

http://www.red-gate.com/products/reflector/

• One of the following development environments for .NET - required to build and debug component scripts:

• SharpDevelop 4

Open source development environment for .NET trying to look and feel same as Visual Studio. Supports attaching debugger. MSDN library is not integrated directly into product as is in Visual Studio but the .NET documentation is available from Microsoft website freely, so it's not a problem. I’d recommend to take a look at SharpDevelop even if you have access to Visual Studio.

http://www.icsharpcode.net/OpenSource/SD/

-or-

Visual Studio 2010, 2008 or 2005 Professional – not a free product

90-day trial version can be downloaded:

http://msdn.microsoft.com/cs-cz/evalcenter/bb655861(en-us).aspx

The express version of visual studio can’t be used for script debugging as it lacks the attach debugger to running process feature.

Course Overview 8 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 9: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Important Notes:

Important Notes:

For OpenPlant (SELECTseries 3) there are differences in the installation directories for Windows XP, Windows 7 or Windows Server 2008. The following tables provide the paths to the software files.

Windows XP:

Note: Whenever Network_Root/Local_Root/Project_Root are mentioned in the document, it refers to the above paths.

Windows 7 (32 bit) or Windows Server 2008:

Note: Whenever Network_Root/Local_Root/Project_Root are mentioned in the document, it refers to the above paths.

Windows 7 (64 bit) or Windows Server 2008:

Network_Root: Program:C:\Program Files\Bentley\OpenPlantModeler (SELECTseries 3)\

Local_Root: C:\Documents and Settings\All Users\Application Data\Bentley\OpenPlantModeler (SELECTseries 3)\WorkSpace\Projects

Default Projects Root: C:\Bentley Plant V8i Projects\

Network_Root: C:\Program Files\Bentley\OpenPlantModeler (SELECTseries 3)\

Local_Root: C:\ProgramData\Bentley\OpenPlantModeler (SELECTseries 3)\WorkSpace\Projects

Default Projects Root: C:\Program Data\Bentley\OpenPlantModeler (SELECTseries 3)\WorkSpace\Projects\

Network_Root: C:\Program Files (x86)\Bentley\OpenPlantModeler (SELECTseries 3)\

Sep-11 9 Course OverviewCopyright © 2011 Bentley Systems, Incorporated

Page 10: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Important Notes:

The training manual is written using Windows XP (32-bit), so all snapshots and steps used in exercises will have locations according to Windows XP (32-bit). If you are using a different OS, please refer to the table above.

Local_Root: C:\ProgramData\Bentley\OpenPlantModeler (SELECTseries 3)\WorkSpace\Projects

Default Projects Root: C:\Program Data\Bentley\OpenPlantModeler (SELECTseries 3)\WorkSpace\Projects

Course Overview 10 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 11: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Component Scripting

Module Overview

This module provides the steps to create custom parametric 3D components

Module Prerequisites• Familiarity with CAD systems and OpenPlant Modeler software.

Module Objectives

After completing this module, you will be able to:

• Create a custom parametric 3D component

Sep-11 11 Component Scripting

Copyright © 2011 Bentley Systems, Incorporated

Page 12: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Best practice to developing scripts

Best practice to developing scripts1 Develop and test scripts in local workspace modifying local schemas.

2 Publish to PW Managed Workspace.

3 Test from a different machine.

Local Workspace

The Local Workspace is installed with OpenPlant Modeler by default into following locations:

Windows XP

C:\Documents and Settings\All Users\Application Data\Bentley\OpenPlantModeler V8i\WorkSpace

Windows 7, Windows Vista

C:\Users\All Users\Bentley\OpenPlantModeler V8i\WorkSpace

Windows 7, Windows Vista -64bit

C:\ProgramData\Bentley\OpenPlantModeler (SELECTseries 3)\WorkSpace\Projects

Note: All exercises in this book assume using OPModeler_Imperial project and PlantInstances.dgn.

Component Scripting 12 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 13: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Base workflow

Base workflow

Sep-11 13 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
This image is illegible, can we get an updated image?
Page 14: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Launching Modeler

Launching Modeler

This section contains hands on exercises to build a custom component “My Box” from scratch and serves as accompanying material to Advanced Training.

Exercise:

1 Launch OpenPlant Modeler by clicking on a desktop icon or from the Start menu.

2 Click Cancel in ProjectWise Login dialog. We will be developing a new datasource using a local dgn file.

3 Open PlantInstances.dgn file from OPModeler_Imperial project.

Hint: Use bottom right section to quickly navigate to the desired location by selecting

User: OPModeler

Component Scripting 14 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 15: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Launching Modeler

Project: OPModeler_ImperialMetric

4 Click Cancel in Open a Repository dialog. Connection is not necessary when developing locally.

Sep-11 15 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 16: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Place standard component

5 Modeler opens up ready for your input.

Place standard component

Exercise:

1 Launch OpenPlant Modeler.

2 Click Place Horizontal Vessel.

3 The Place Equipment window with Design Geometry properties group opens.

Component Scripting 16 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 17: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Place standard component

4 Finish placing the component by clicking twice into Isometrics view.

5 Right-click on the vessel and select Modify Component from the context menu.

6 In the Design Geometry property group modify the field B: Length tan tan to 250inXXmm.

7 Click Save.

Lessons learned

• Components are placed by clicking on an icon.

• Place Equipment and Modify Equipment dialogs show component diagram and also lists some properties.

• 3D geometry of a parametric component is controlled by property values.

Sep-11 17 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 18: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Key-in

Key-in

Exercise:

1 Select Utilities > Key-in.

2 Type mechaddin place HORIZONTAL_VESSEL_PAR DISC=EQUIP into the Key-in dialog and click Enter.

Note: From now on, we will refer to typing a key-in expression and clicking enter by simply saying: Key-in <an expression>.

3 Finish placing the component.

Lessons learned

• Every component can be placed using a key-in expression by specifying appropriate class name.

Component Scripting 18 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 19: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Place Non-existent Component

Place Non-existent Component

Exercise:

1 Key-in: mechaddin place MY_BOX DSC=EQUIP.

2 Observe message center.

Lessons learned

• Every custom component requires an EC Class defined in the OpenPlant_3D schema.

Add EC Class

Exercise:

1 Launch Bentley Class Editor V8i.

2 Open OpenPlant_3D.01.02.ecschema.xml file located in:

...(Operating System)\Bentley\OpenPlantModeler V8i\WorkSpace\Projects\OPModeler_Imperial\DataSet\Schemas\

3 Supplement OpenPlant_3D with OpenPlant_3D_Supplemental_Modelling.

Hint: To supplement the schema right-click OpenPlant_3D schema in the tree and select Supplement Schema. Navigate to the same location as above to select the supplemental schema.

Sep-11 19 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 20: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Add EC Class

4 Add a derived class from Equipment.

5 Change attributes of the new class as follows:

Name = MY_BOX (use capital letters separated by underscores for Name)

DisplayLabel = My Box (use proper case separated by spaces for DisplayLabel)

Hint: Class Names are used as XML tag name, so special characters or spaces are not possible. As you can see, Class definition will be stored into OpenPlant_3D schema.

Component Scripting 20 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
Can we put this in project properties schema? Would be better for the user if possible.
Page 21: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Add CREATION_ATTRIBUTE to Link EC Class to .NET Class

6 Click Save in the bottom-right of the screen to apply your changes.

Note: Depending on your version of Class Editor – if the Save button is not present, all in-memory changes are applied automatically as you type. Note that you will still need to save the schema file to disk after you make all your desired changes to make it available.

7 Select File > Save to save your schema changes

8 Restart Modeler to reload your schema changes.

9 Key-in: mechaddin MY_BOX DSC=EQUIP.

Observe message center.

Lessons learned:

• EC Class definition alone is not enough - we will need a draw script (to be implemented in .NET class) and then link the draw script to My Box EC class using Custom attribute named CREATION_ATTRIBUTE.

Add CREATION_ATTRIBUTE to Link EC Class to .NET Class

Exercise:

We will proceed to add CREATION_ATTRIBUTE first and then define .NET class in the next exercise.

1 Back in Cass Editor with OpenPlant_3D schema opened and supplemented by OpenPlant_3D_Supplemental_Modelling.

Sep-11 21 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 22: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Add CREATION_ATTRIBUTE to Link EC Class to .NET Class

2 Open OpenPlant_CustomAttributes.08.11.ecschema.xml from: C:\Documents and Settings\All Users\Application Data\Bentley\OpenPlantModeler V8i\WorkSpace\OPModeler\schemas\.

3 Right-click on My Box class in the tree and select Custom Attributes > Add/Remove...

4 Find CREATION_ATTRIBUTE in the list, push it to the bottom list, change its location to OpenPlant_3D_Supplemental_Modelling.

Component Scripting 22 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Cross-Out
Shaun.Severin
Replacement Text
..
Page 23: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Add CREATION_ATTRIBUTE to Link EC Class to .NET Class

5 Click OK.

6 Fill in following values of the Creation Attribute properties:

Assembly Name = MyComponents

Class Name = MyBox

Namespace = MyComponents

Placement tool = EquipmentPlacementTool

Handler Type = Equipment

Hint: Assembly Name, Class Name and Namespace are used to lookup draw script located in a .NET assembly. Placement tool determines placement behaviour. Handler type determines how your component will be handled by Modeler. Diagram Cell Name and Cell Library will be discussed later.

Note: Placement tool and Handler Type are described in the appendix.

7 Click Save to apply changes.

8 Click File > Save to save all your schemas to disk.

Lessons learned

• Supplemental schemas are used for storing custom attributes.

Sep-11 23 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 24: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Create New .NET Assembly from Scratch

Create New .NET Assembly from Scratch

Draw script is a piece of code which instructs Modeler to draw 3D geometry.

The draw script is implemented as a method named Create3DElements() of a .NET class, located in a namespace inside of a .NET assembly.

The .NET assembly resides in a DLL (dynamically linked library) file, typically located in the workspace folder.

The .NET assembly references other OpenPlant assemblies that provide building blocks for the draw script and enable it to communicate with OpenPlant Modeler.

Modeler looks for the DLL file via $OPM_DIR_COMPONENT_ASSEMBLIES and $OPM_DIR_ASSEMBLIES variables and also within its installation location \Program Files\OpenPlant Modeler V8i\.

Modeler first loads the .NET assembly when user executes corresponding key-in expression for the first time. The dll file is then locked and the draw script can't be changed until the Modeler is closed or until the assembly domain is forced to unload.

Exercise:

Note: A pre-created example .NET assembly will be described later.

1 Open Microsoft Visual Studio.

2 Select File > New > Project…

3 Select Visual C# and Class Library from the Visual Studio installed templates.

Component Scripting 24 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 25: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Create New .NET Assembly from Scratch

4 Type MyComponents in the Name field.

5 Type C:\Development in the Location field.

Hint: Make sure to spell the name exactly as is shown below. This is going to be your assembly name as well as the initial namespace. Both can be change later in the development environment. Version .NET Framework 3.5 is recommended although you can use any version installed.

6 Define new class MyBox in the namespace MyComponents with the end result as follows:

7 Add references to following assemblies:

Sep-11 25 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 26: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Create New .NET Assembly from Scratch

• 32-bit Windows C:\Program Files\Bentley\OpenPlantModeler V8i\OpenPlantModeler\assemblies\

• 64-bit Windows C:\Program Files (x86)\Bentley\OpenPlantModeler V8i\OpenPlantModeler\assemblies\

• Bentley.Building.Mechanical.Api.dll

• Bentley.Building.Mechanical.ComponentLibrary.dll

• Bentley.Building.Mechanical.Components.dll

• OPMCommon.dll

• C:\Program Files\Bentley\OpenPlantModeler V8i\OpenPlantModeler\assemblies\ECFramework

• Bentley.ECObjects.2.0.dll

• Bentley.Geometry.2.0.dll

• Bentley.Platform.dll

8 Paste following code into MyBox.cs:

Component Scripting 26 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 27: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Create New .NET Assembly from Scratch

9 Your window should look like this:

Note: Namespace = MyComponents and Class name = MyBox

10 Double-click Properties in the Solution Explorer to review your assembly name.

Review that Assembly name = MyComponents.

Sep-11 27 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 28: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Create New .NET Assembly from Scratch

11 Press F6 to build your solution.

If necessary, fix any build errors.

Your solution is ready for the first run.

Lessons learned:

We know where to look for Assembly name, Namespace and Class Name - the parameters referred from CREATION_ATTRIBUTE.

• MyBox .NET class inherits from BaseEquipment .NET class

• MyBox has a constructor with some mandatory initialization

• MyBox has a blank Setup() method

• MyBox defines very simple draw script in its Create3DElements() method

• The draw script uses helper Plate object (a building block) which knows how to draw a box

Next we need to tell Modeler where to look for our new assembly

Component Scripting 28 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 29: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing .NET Assembly to Local Workspace

Publishing .NET Assembly to Local Workspace

Exercise:

Two options exist to make our new assembly visible to OpenPlant Modeler:

1 Copy MyComponents.dll to one of the default locations where Modeler looks by default (defined by following variables):

2 Change or append to the above variables the path where the MyComponents.dll file is located.

Note: Same principle applies when publishing to a ProjectWise Managed Workspace. There are some issues with loading .NET libraries from UNC path - so avoid placing it in a shared drive.

We will choose option 2 in our examples and ask Modeler to look into our visual studio project build ouptut folder.

1 Open Modeler.

2 Select Workspace > Configuration….

3 Highlight OPM_DIR_COMPONENT_ASSEMBLIES variable.

$OPM_DIR_ASSEMBLIES C:\Program Files\Bentley\OpenPlantModeler V8i\OpenPlantModeler\assemblies

$OPM_DIR_COMPONENT_ASSEMBLIES C:\Documents and Settings\All Users\Application Data\Bentley\OpenPlantModeler V8i\WorkSpace\OPModeler\Assemblies

Sep-11 29 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 30: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing .NET Assembly to Local Workspace

4 Click Edit….

5 Change Edit Mode to Append and paste in your visual studio project output folder where the MyComponents.dll is located. e.g. "C:\Development\MyComponents\bin\Debug\". Make sure to include trailing back slash.

6 Click OK.

7 Click OK to close Configuration dialog.

8 Click Yes, to confirm changes in OPmodeler.ucf configuration file - this is the place where the variable re-definition is stored.

Component Scripting 30 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 31: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing .NET Assembly to Local Workspace

9 To verify if our script works and if it can be found by the Modeler, key-in: mechaddin place MY_BOX DSC=EQUIP.

You should be able to place MyBox now.

Note: The Preview diagram is blank and there are no Design Geometry properties available to parameterize our drawing.

Note: If there is a problem with configuration of assembly path - Modeler can crash:

Sep-11 31 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 32: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

Lessons learned

• Modeler looks for component assemblies into several locations driven by configuration variables

• We learned how to re-define such locations

• Modeler will now look into our bin/Debug folder so we don't need to worry about publishing the changes whenever we modify and recompile our draw script during development.

• Preview diagram and parametric properties are missing - this we will take care of in the next excercises

Parameterize Geometry

Examining our draw script reveals that the values of length; width and height are hard coded.

To parameterize them, we need to define corresponding EC properties in My Box class and then modify our script to use those properties.

Additionally, we will define initial values via Default Value custom attribute. And to make life easier to the users, we will put the three parameters into its own DESIGN GEOMETRY group. Also by means of custom attributes assigned to EC properties.

Exercise:

1 Open OpenPlant_3D schema in Class Editor and supplement it with two supplemental schemas:

• OpenPlant_3D_Supplemental_Modelling

• OpenPlant_3D_Supplemental_ModellingViews

(see previous steps on how to do this)

2 Open OpenPlant_CustomAttributes schema as well.

Component Scripting 32 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 33: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

3 Add three new properties to My Box class, MY_HEIGHT, MY_LENGTH and MY_WIDTH respectively, all with the same TypeName: double.

4 Select My Height in the Properties list and click Custom Attributes… > Add/Remove…

Sep-11 33 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 34: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

5 Add two custom attributes: Category and DEFAULT_VALUE.

6 Place Category into OpenPlant_3D_Supplemental_ModellingViews.

7 Place DEFAULT_VALUE into OpenPlant_3D_Supplemental_Modelling.

8 Repeat last step with My Length and My Width.

Note: You can also right-click on My Height and use copy feature to save some typing.

9 Fill in property values of the newly added custom attributes:

• Defaul Value

• Value = 50

• Category

• Standard = 0 (always 0)

• Name = DESIGN_GEOMETRY

• DisplayLabel = Design Geometry

• Priority = 400

Component Scripting 34 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 35: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

• Expand = True

10 Click Save.

11 Repeate for My Width and My Length parameters as well except to use different default value for each.

12 Leave the Category priority for all three parameters same = 400.

Note: It is handy to use Custom Attributes… > Copy feature to save you some typing.

13 Save all your schemas.

Sep-11 35 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 36: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

14 Modify your draw script by replacing your code with following:

15 Build your solution (press F6).

Hint: Watch status bar - you want to see Build Succeeded.

If you see following error message during compilation, it means the Modeler is still running and has your dll file locked, hence can't be overwritten by a new build. To ensure successful build, always exit Modeler before compiling your solution.

Let's test our new component in Modeler.

16 Key-in: mechaddin place MY_BOX DSC=EQUIP.

17 Complete placing of the equipment.

Component Scripting 36 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 37: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

Notice our dimensional parameters are now visible in the Design Geometry group.

18 Modify component by setting My Height = 150 and click Apply changes.

Sep-11 37 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 38: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Parameterize Geometry

Has your drawing changed?

Lessons learned

• We have removed hard coded values from our draw script and added instance variables to hold parameter values.

• We initialized our instance variables from property bag.

• Initialization was moved to Setup method for performance reasons. This is because the Setup is called once but the Create3DElements is re-called each time the geometry has to be re-drawn.

• My Height parameter received a Default Value when My Box was first placed, then it stored a new value after we changed it.

• My Box dynamically changed shape when we changed My Height dimensional parameter.

Component Scripting 38 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 39: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Debugging

Debugging

Exercise:

1 Put a breakpoint in a place where you want to stop.

2 Make sure Modeler is running.

3 Select Debug > Attach to Process….

4 Select OpenPlantModeler.exe process and click Attach.

Sep-11 39 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 40: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Preview Diagram

5 Switch to Modeler and invoke the functionality which will lead to execute your code. The debugger will stop when the execution hits the breakpoint, letting you step through the code and inspecting variables.

Preview Diagram1 Launch Modeler with Empty.dgn file located in workspace folder (same

place as PlantInstances.dgn).

2 Add a new 2D model using File > Models and Create a new Model.

Component Scripting 40 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 41: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Preview Diagram

3 Type Drawing in the Type field. Type My Box in the Name field and click OK.

4 Sketch a box and name its three dimensions.

Note: Use Top view because it is the one that will be displayed by the Placement dialog.

5 Save the drawing as MyComponents.cel into folder Workspace\OPModeler\cells.

6 Launch Class Editor.

Sep-11 41 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
Select
Page 42: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Preview Diagram

7 Open OpenPlant3D schema and supplement it with OpenPlant_3D_Supplemental_Modeling schema.

8 Navigate to My Box and edit CREATION_ATTRIBUTE and set two missing properties:

Diagram Cell Name = My Box

Cell Library= MyComponents.cel

9 Save all schemas.

10 Restart Modeler so that the schema changes take effect and key-in: mechaddin place MY_BOX DSC=EQUIP.

Diagram is now displayed in the Place Equipment dialog.

Component Scripting 42 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 43: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Toolbar Icon

Lessons learned

• Preview diagram is a named model in a cell library file.

• Modeler finds the cell using creation attribute's two properties - Diagram Cell Name and Cell Library.

• Cell Library path is controlled by OPM_DIR_WORKSPACE_CELLS.

Toolbar Icon

Exercise: Prepare icon

1 Make an icon graphics of 24x24 pt resolution and save it preferably with .png file type.

2 Launch Modeler and open file PM_Tools.dgnlib from default location: C:\Program Files\Bentley\OpenPlantModelerV8i\OpenPlantModeler\interfaces.

Note: Even if OpenPlant Modeler appears to be fully loaded and seems to be ready for your input, it is recommended that you wait for a couple of minutes after opening the file. That is to avoid any possible crash due to overloading or clashing with any in process or file loading procedure.

Exercise: Load icon file into DGNLib

1 Select Work Space > Customize.

2 Select the Icons tab.

3 From the Current File icon, select Import Icons > From Bitmap….

This will open the Import BMP dialog.

4 Type My Icon.bmp of 24x24 resolutions in the Icon Name: field.

5 Select All Icon Sizes from the Generate: list.

6 Click the Magnifying glass icon, next to the Generate: list to browse to the 24x24 .bmp file and click OK. This will add the selected .bmp in the icon library with the given name

Sep-11 43 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 44: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Toolbar Icon

Exercise: Add button to palette

1 Select Work Space > Customize.

2 In the Tools tab, expand the User Tools > Piping Node and navigate to the desired tool palette.

3 Right-click on the desired Tool Palette and click New Tool from the right-click menu.

4 This will add new icon with Spanner graphics set as its icon. Modeler will prompt you to add an appropriate name for the tool button, give any suitable string.

5 Enter following information in fields of Command Data.

Key-in: MECHADDIN PLACE <EC Class Name> DSC=Piping.

Ballon Text: Add text that you want to appear when user hovers over that icon.

6 In General Settings click … in Icon field. This will open the icon library; select the desired icon from the list.

7 In the Task pane navigate to the tool bar for which you just created the tool button.

8 Drag the newly created tool button in the tool bar and drop it onto Task pane from the Tools tab.

9 The newly added icon shows up in the tool bar.

10 Save the file and exit Modeler.

Component Scripting 44 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
Why not put this into the equipment tools and use MyBox?
Page 45: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Toolbar Icon

Example - adding a sample My Box component into My Components.dgnlib.

Sep-11 45 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
When do we create this dgnlib? Need to do this first and should use eqp_tools as the starting point Maybe should just edit eqp_tools.dgnlib and add it there, less files to manage
Page 46: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Placement Points

Placement Points

Exercise: To add placement points:

1 Initialize _placementPoints (member of BaseEquipment) to a new instance of List<PlacementPoint>().

2 Add relevant instances of PlacementPoint into the above list

Changes highlighted in red.

Component Scripting 46 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
Need to show remaining 2 points
Page 47: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Datum

Datum

Equipment datum defines reference coordinates system for placing nozzles.

Nozzles are used to connect pipes to equipment.

Datum can also be added manually using Nozzle Manager > Datum Manager.

Convention is to be to define and show only the Z and Y axes. It depends on which nozzle type you use on how it is positioned relative to the coordinate system (datum). For example, the Axial and Block-top types have the length of the nozzle parallel to the Z-axis, while the Radial and Tangential have the length perpendicular to the Z-axis.

The constructor arguments are in-order location, Z-axis, Y-axis, name; the DatumStructure contains these values plus some flags. The two axes are not just directions, but the lengths may be used, for example, the Radial nozzle uses the length of the Y-axis to know the O.D. of the shell it is on, and the Block-top nozzle uses the length of the Z-axis to know where the face is for the non-port end of the nozzle.

For your block with

bottom face at 0,0,0 length,0,0 length,width,0 0,width,0

and top face at 0,0,height length,0,height length,width,height 0,width,height

Sep-11 47 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 48: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Datum

To make a datum to easily place Block-top nozzles on the top face:

Datum to place Axial nozzles on the top face:

To make a datum to easily place Block-top nozzles on the top face:

Datum to place Block-top nozzles on the front face (y==0) ; nozzles in –y direction:

Datum to place Block-top nozzles on the back face (y==width) ; nozzles in +y direction:

To help with the turn-around time on testing, I recommend creating several variations using different names each time; it would be easy enough to remove any you did not want after you have the combination you want.

Location Z-axis Y-axis

0,0,0 0,0,height 0,width,0 or length,0,0

Location Z-axis Y-axis

0,0,height 0,0,height+height/4 //arbitrary

0,width,height or length,0,height

Location Z-axis Y-axis

0,0,0 0,0,height 0,width,0 or length,0,0

Location Z-axis Y-axis

0,width,0 0,0,0 0,width,height or length,width,0

Location Z-axis Y-axis

0,0,0 0,0,0 0,width,height or length,width,0

Component Scripting 48 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 49: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Mapping EC Class to Spec/Catalogue table

Mapping EC Class to Spec/Catalogue table

Exercise: To map EC Class to spec/catalog table:

1 Open OpenPlant_3D.08.11.ecschema.xml schema in Class Editor.

2 Supplement it with OpenPlant_3D_Supplemental_Modeling.08.11.ecschema.xml.

3 Open OpenPlant_CustomAttributes.08.11.ecschema.xml.

4 From the class navigation tree, navigate to desired EC Class in Supplemented OpenPlant_3D.08.11.ecschema.xml.

5 Right-click on that class node and from the Context menu select Custom Attributes….

6 That will launch the Custom Attribute Addition dialog. From the Available Custom Attribute list select OpenPlant_3D_Catalogue_ClassProperties, and add it the Existing Custom Attribute list by then clicking the Down Arrow button.

7 The selected Custom Attribute will appear in the Existing Custom Attributes list, Set its location to OpenPlant_3D_Supplemental_Modeling.08.11 and click OK.

OpenPlant_3D_Catalogue_ClassProperties

Following fields are currently in use for OPM component mapping:

Table: Contains the name of the database table which holds the records of that component

Use EC Class: For rare scenario when certain EC Class uses another EC Class’s component records for component placement, the name of that EC Class needs to be defined here. The example given here is the Class Map custom attribute for PIPE_BEND EC Class. The OPM Specs doesn’t contain the PIPE_BEND records; in fact it uses the PIPE records for generated PIPE_BEND components. So here PIPE EC Class is defined under this field which will direct the OPM Query to PIPE EC Class.

Sep-11 49 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 50: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Value Mapping

Value Mapping

Value Mapping is same as most of the other application. The following custom attribute is used for OPM value Mapping.

OpenPlant_3D_Catalogue_ValueProperties

Differencing Schemas

Exercise:

1 Isolate all schemas containing your modifications.

2 For each schema separately open the source schema (containing your modifications) and the target schema (e.g. new version of the same schema delivered OPModeler) in Class Editor.

Example - merging changes to OpenPlant_3D_Supplemental_Modelling schema.

3 Select Tools > Schema Differencing….

4 In the Schema Differencing dialog select Source schema (the one which contains your changes) and Target schema and click Compare.

5 Select changes you want to merge into the new schema.

Component Scripting 50 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 51: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Differencing Schemas

6 Right-click on Multi Diameter Vessel class and select Check Sub Tree from the context menu to select all changes for this class.

7 Click Commit to confirm your changes.

Note: The changes have been committed on the in-memory representation of the schema only. To save changes permanently you must close the Schema Differencing dialog and File > Save the Target schema.

8 If desired, review all your changes were successfully committed to the Target schema by invoking Compare again.

Sep-11 51 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
We do not have any exercises to change or create this vessel. Would not hurt to add them to extend the class
Page 52: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Differencing Schemas

The status of the Multi Diameter Vessel class is now Equal and the target values in the right pane are same:

9 Close Schema Differencing Dialog.

10 Save the Target schema.

Component Scripting 52 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 53: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing to Managed Workspace

Publishing to Managed Workspace

Prerequisites

• ProjectWise Administrator

• OpenPlant Administrator

Exercise:

1 Create a PW Workspace/OPModeler/Assemblies folder in ProjectWise.

2 Set variable OPM_DIR_COMPONENT_ASSEMBLIES = to the PW folder created in step 1.

3 Save Examples.dll file into Assemblies folder

Note: It is recommended to recompile component assembly with updated references to the currently installed Modeler version. Using components compiled for different version of Modeler is not recommended.

Sep-11 53 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
All we have is MyComponents.dll
Page 54: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing to Managed Workspace

4 Assign Managed Workspace to PW working folder (where dgn files are located).

5 Check-in modified Schemas into PW.

Note: It is recommended to create new versions of existing documents.

6 Using OpenPlant Administrator > Manage Schemas commit schema differences. This operation will migrate OpenPlant Model Server database to match class and property definitions in the new schemas.

Note: This step ensures ability to check-in new component into OpenPlant Model Server database.

7 Go to ProjectWise Administrator > OpenPlant Administrator > Schema Management (you might be prompted to select working directory just like in PW Explorer)

Component Scripting 54 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 55: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing to Managed Workspace

8 Switch to tab Update Server Schema.

9 Click Select Schema and select the modified OpenPlant_3D schema, the one with your new component definitions.

Note: Make sure to have all schemas available including BentleyBase etc.

Note: You may be prompted to browse for Bentley_Standard_Custom_Attributes.01.02. One is also in C:\Program Files\Bentley\Class Editor V8i and actually version 01.01, but the compare function accepts it.

10 Once compare has completed, select all differences you wish to commit.

Hint: Expand sub-tree to review if all desired properties are checked as well.

Hint: It is recommended to keep a separate log of all changes performed for future reference.

Sep-11 55 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 56: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing to Managed Workspace

11 Click Commit.

12 Wait until schema commit has completed (the user interface may appear frozen for an extended period of time).

Note that after successful commit, there will be two new processed files created in the folder where the modified OpenPlant_3D schema was located.

Component Scripting 56 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 57: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing to Managed Workspace

My Box has been committed into database.

13 Restart OpenPlant ModelServer - Server windows service to reload schemas into OPMS cache.

14 Check-in custom cell file with diagrams into PW Workspace\OPModeler\cells folder. Ensure OPM_DIR_WORKSPACE_CELLS variable points to the above folder.

Sep-11 57 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Page 58: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Publishing to Managed Workspace

15 Check in custom dgnlib file with toolbar icons into PW Workspace\Projects\OPModeler_Imperial\DataSet\Dgnlibs. Ensure MS_DGNLIBLIST variable points to the above folder.

16 Open a DGN file from ProjectWise working directory and test placing new component.

Note: Managed workspace export appears when checking out dgn file.

Component Scripting 58 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 59: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Examples – a .NET solution folder

Examples – a .NET solution folder

Describes layout of .NET project and how to setup

Example scripts

• My Box

• Multi Diameter Vessel

• Double Block & Bleed Gate Valve

Support folder

• schemas to support examples

• cell library with preview diagram

• icon

Multi Diameter Vessel

Double Block and Bleed Valve

Sep-11 59 Component ScriptingCopyright © 2011 Bentley Systems, Incorporated

Shaun.Severin
Sticky Note
This does not make any sense? What are we supposed to do here?
Page 60: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Examples – a .NET solution folder

Component Scripting 60 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 61: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

References

Module Overview

This section contains reference material for selected functionality.

Module Prerequisites• {What fundamental knowledge or previous module is required prior to

learning this module?}

Module Objectives

After completing this module, you will be able to:

• {Bullet list of the main topics in the module.}

Sep-11 61 References

Copyright © 2011 Bentley Systems, Incorporated

Page 62: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Joint Implementation

Joint Implementation

Users can define different end conditions compatibility with each other and required conditions and fastener for the resulting joint in the Joint EC Class for OpenPlant3D schema.

1 Open OpenPlant_3D.08.11.ecschema.xml schema in Class Editor and supplement it with OpenPlant_3D_Supplemental_Modeling.08.11.ecschema.xml.

2 Navigate to the JOINT EC Class from navigation tree of supplemented OpenPlant3D schema.

OpenPlant_3D_JointTypeProperties_Map is defined which contains a Joint Type array. Each Joint Type element further contains the JOINT_NAME information, list of compatible end preparations, required fasteners and other properties which should be checked for the joint compatibility. It also contains IS_SPEC_DRIVEN Boolean value to determine whether the required fasteners should be queried form the spec or not.

The user can expand and collapse the array list by clicking the + or – sign at the start of the list’s name. By right-clicking on any array element the user can get the

References 62 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 63: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Joint Implementation

option of deleting that particular entry from the list. The Add Element option for any array list is given on the right-click menu of Main Array field.

Every Joint Type element contains following fields.

JOINT_NAME: Name of the Joint, it should unique among the whole Joint Type array.

END_PREPARATION_1: Contains the list of end preparations that are compatible with each other.

MATCH_PROPERTY: Properties other than Nominal Diameter and End Preparation, whose values of both connecting components and fasteners should be checked for joint compatibility. Given is one such example of FLANGE_JOINT, Where FACING and RATING are defined as additional properties which should be same for the matching components and fastener inserted for this joint.

IS_SPEC_DRIVEN: Contains Boolean values. Leaving it blank or setting to TRUE will force OPM to query the required fastener records from the specs. Setting FALSE, like in the above example for WELDS, its record won’t be queried from the spec at the time of placement.

Sep-11 63 ReferencesCopyright © 2011 Bentley Systems, Incorporated

Page 64: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Controlling EC Property view behavior

Controlling EC Property view behavior

EC Property viewing status in the EC Instance dialog, Element Info and spec grid is controlled by custom attributes defined for those properties modeling views supplemental schema.

To view or edit such viewing constraints for EC Properties:

1 Open OpenPlant3D schema in Class Editor and supplement it with OpenPlant_3D_Supplemental_ModelingViews.08.11.ecschema.xml.

Here the example of EC Property Order Number of Piping Component EC Class is shown. It contains two Custom Attributes – Property Display Status and Category.

Property Display Status: Used to control visibility and position, has following three fields:

Element Info Status

Controls the property view for Element Info dialog

General Status

Defines the property view behavior for EC Instance dialog in OPM

Spec Grid Position

Defines the EC Property Column position for Spec Grid

Category: The category is used to categorize the properties in different group panes which are shown in EC Instance dialog. It contains following fields

Standard

Contains ‘0’ for all the properties

References 64 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 65: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Component Creation Setup

Name

Contains the Group Pane of EC Instance dialog

Display label

Display string for the above defined group pane

Description

Description of the above defined group pane

Priority

Property position in the group pane

Expand

Contains Boolean value to allow user to expand the property in EC Instance dialog if it is of any array type

Component Creation Setup

Other than class mapping, information like assigning placement behavior and linking the EC Class to the script class is also defined at this level.

1 Right-click on the Component class and launch the Custom Attribution dialog.

2 Add CREATION_ATTRIBUTE and set its location to OpenPlant_3D_Supplemental_Modeling.08.11.

Here is the example of CREATION_ATTRIBUTE defined for PIPE_BEND EC Class

Following fields are required:

Assembly Name: This is a .NET Assembly which contains the script class for the desired EC Class. For shipped components it is always “Bentley.Building.Mechanical.ComponentLibrary”

Class Name: Name of the Script Class which handles the drawing of component geometry of the EC Class

Sep-11 65 ReferencesCopyright © 2011 Bentley Systems, Incorporated

Page 66: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Component Creation Setup

Namespace: Namespace to which that Script class belongs too

Placement tool: Placement tool class name which defines the required placement behavior for EC Class. (NOT required for fasteners and Seal type components)

Handler Type: Handler class name which represents the required after placement component manipulation behavior for the EC Class . (NOT required for Fasteners and Seal type components)

References 66 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 67: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Summary

Course Summary

{Do you want to use ModuleReviewAnswers or the Course Summary? Use one or the other, not both.}

{If you use ModuleReviewAnswers, put both Q & A there and leave only the Q in each individual module. If you use the Course Summary, leave both Q & A in each individual module.}

{Throughout this template, instructions to the writer are enclosed in brackets. Delete the instructions after reading them.}

Now you will be able to {restate the course objectives}:

Sep-11 67 Course Summary

Copyright © 2011 Bentley Systems, Incorporated

Page 68: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Review

Course Review

Now that you have completed this course, let’s measure what you have learned.

Questions1 {Include problem solving, application, or comprehension-based

questions.}

2 {Questions can be multiple choice, or true/false, or fill in the blank.}

3 {Sequence the questions in the same order as the module content.}

4 {Copy this question to use multiple choice or fill in the blank format. For consistency, use the same number of choices in each question.}

• {First multiple choice/fill in the blank answer.}

• {Second multiple choice/fill in the blank answer.}

• {Third multiple choice/fill in the blank answer.}

5 {Copy this question to use true/false format.}

• True

• False

6 {Put the answers on the following page under “Answers.”}

Course Summary 68 Sep-11Copyright © 2011 Bentley Systems, Incorporated

Page 69: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Review

Answers1 {Copy and paste the first question here.}

{Type the answer here.}

{Provide supporting information as to why the answer is correct.}

2 {Copy and paste the first question here.}

{Type the answer here.}

{Provide supporting information as to why the answer is correct.}

3 {Copy and paste the first question here.}

{Type the answer here.}

{Provide supporting information as to why the answer is correct.}

Sep-11 69 Course SummaryCopyright © 2011 Bentley Systems, Incorporated

Page 70: V8i (SELECTseries 3) - Bentley Communities · PDF fileAutoCAD is a registered ... This course contains step by step exercises to create custom parametric 3D ... Designers and Drafters

Course Review

Course Summary 70 Sep-11Copyright © 2011 Bentley Systems, Incorporated