Sei sulla pagina 1di 56

Smart 3D

Structure Symbols using .NET – Course Guide

Version 2014 October 2013


Copyright
Copyright © 1999-2013 Intergraph Corporation. All Rights Reserved.
Including software, file formats, and audiovisual displays; may be used pursuant to applicable software license agreement; contains confidential
and proprietary information of Intergraph and/or third parties which is protected by copyright law, trade secret law, and international treaty, and
may not be provided or otherwise made available without proper authorization from Intergraph Corporation.
Portions of this software are owned by Spatial Corp. © 1986-2013. All Rights Reserved.

U.S. Government Restricted Rights Legend


Use, duplication, or disclosure by the government is subject to restrictions as set forth below. For civilian agencies: This was developed at private
expense and is "restricted computer software" submitted with restricted rights in accordance with subparagraphs (a) through (d) of the
Commercial Computer Software - Restricted Rights clause at 52.227-19 of the Federal Acquisition Regulations ("FAR") and its successors, and is
unpublished and all rights are reserved under the copyright laws of the United States. For units of the Department of Defense ("DoD"): This is
"commercial computer software" as defined at DFARS 252.227-7014 and the rights of the Government are as specified at DFARS 227.7202-3.
Unpublished - rights reserved under the copyright laws of the United States.
Intergraph Corporation
P.O. Box 240000
Huntsville, AL 35813
Street address: 170 Graphics Drive, Madison, AL 35758

Terms of Use
Use of this software product is subject to the End User License Agreement and Limited Product Warranty ("EULA") delivered with this software
product unless the licensee has a valid signed license for this software product with Intergraph Corporation. If the licensee has a valid signed
license for this software product with Intergraph Corporation, the valid signed license shall take precedence and govern the use of this software
product. Subject to the terms contained within the applicable license agreement, Intergraph Corporation gives licensee permission to print a
reasonable number of copies of the documentation as defined in the applicable license agreement and delivered with the software product for
licensee's internal, non-commercial use. The documentation may not be printed for resale or redistribution.

Warranties and Liabilities


All warranties given by Intergraph Corporation about equipment or software are set forth in the EULA provided with the software or applicable
license for the software product signed by Intergraph Corporation, and nothing stated in, or implied by, this document or its contents shall be
considered or deemed a modification or amendment of such warranties. Intergraph believes the information in this publication is accurate as of its
publication date.
The information and the software discussed in this document are subject to change without notice and are subject to applicable technical product
descriptions. Intergraph Corporation is not responsible for any error that may appear in this document.
The software discussed in this document is furnished under a license and may be used or copied only in accordance with the terms of this license.
No responsibility is assumed by Intergraph for the use or reliability of software on equipment that is not supplied by Intergraph or its affiliated
companies. THE USER OF THE SOFTWARE IS EXPECTED TO MAKE THE FINAL EVALUATION AS TO THE USEFULNESS OF THE
SOFTWARE IN HIS OWN ENVIRONMENT.
Intergraph is not responsible for the accuracy of delivered data including, but not limited to, catalog, reference and symbol data. Users should
verify for themselves that the data is accurate and suitable for their project work.

Trademarks
Intergraph, the Intergraph logo, PDS, SmartPlant, FrameWorks, I-Convert, I-Export, I-Sketch, SmartMarine, IntelliShip, INtools, ISOGEN,
MARIAN, SmartSketch, SPOOLGEN, SupportManager, and SupportModeler are trademarks or registered trademarks of Intergraph Corporation
or its subsidiaries in the United States and other countries. Microsoft and Windows are registered trademarks of Microsoft Corporation. ACIS is a
registered trademark of SPATIAL TECHNOLOGY, INC. Infragistics, Presentation Layer Framework, ActiveTreeView Ctrl, ProtoViewCtl,
ActiveThreed Ctrl, ActiveListBar Ctrl, ActiveSplitter, ActiveToolbars Ctrl, ActiveToolbars Plus Ctrl, and ProtoView are trademarks of
Infragistics, Inc. Incorporates portions of 2D DCM, 3D DCM, and HLM by Siemens Product Lifecycle Management Software III (GB) Ltd. All
rights reserved. Gigasoft is a registered trademark, and ProEssentials a trademark of Gigasoft, Inc. VideoSoft and VXFlexGrid are either
registered trademarks or trademarks of ComponentOne LLC 1991-2012, All rights reserved. Oracle, JD Edwards, PeopleSoft, and Retek are
registered trademarks of Oracle Corporation and/or its affiliates. Tribon is a trademark of AVEVA Group plc. Other brands and product names
are trademarks of their respective owners.
Smart 3D .net Content

Quick Overview of Smart 3D .net API


From the perspective of writing
Content

Smart 3D .net Symbols Training – © 2008. Intergraph Corporation. All Rights Reserved.
Overview Of Smart 3D .net API - 1

Topics of Interest from Content perspective

• Smart 3D .net API Architecture.


– Leverages .net methodologies, and provides .net based Automation
capability.
– Useful components delivered to you as .net Assemblies.
– Use Visual Studio v2010 - VB.net or C# or any .net language.

• API available for your use in your Content


• Middle Tier Services/Components
• Metadata – Classes, BOCs, Interfaces, Properties, Codelists …
• Get/Set Properties, Access Relationships
• Access Discipline specific objects and properties.
• Fully documented with API Help integrated into Visual Studio
Environment. F1 help works and shows context sensitive help.

Smart 3D .net Symbols Training – © 2008. Intergraph Corporation. All Rights Reserved.
Overview Of Smart 3D .net API - 2
Smart3D .net API Architecture

Client Tier (Within Smart 3D Environment)

Smart 3D native .net based Automation


Smart 3D .net API
(COM) Custom Commands
Client Tier Infrastructure
Client Tier (Interactive –
(Services/Components)
Services/Components Within TaskHost)

.net based Customization


User Defined Forms

Middle Tier
.net based Automation
Smart 3D .net API
Standalone Applications
Middle Tier Infrastructure
(Non-Interactive –
(Services/Components)
Outside Taskhost)

.net based Customization

Symbols NameRules
Smart 3D native
(COM) IFC Rules
Middle Tier
Services/Components

Legend Intergraph Delivered .net API Assemblies User Customized .net Assemblies

Smart 3D .net Symbols Training – © 2008. Intergraph Corporation. All Rights Reserved.
Overview Of Smart 3D .net API - 3

Smart3D .net API delivered Assemblies

All of the Smart 3D .net API is delivered in assemblies in


$Smart3D\Core\Container\Bin\Assemblies\Release\

Client Tier (Within Smart3D


Environment)
CommonClient.DLL
Smart 3D .net API
SP3DFrmDefHelper.dll
Client Tier Infrastructure
CustomFormDefinitionControls.dll
(Services/Components)

Middle Tier
CommonMiddle.DLL
SystemsMiddle.DLL
RefDataMiddle.DLL
CommonRouteMiddle.DLL
Smart 3D .net API GridsMiddle.DLL
Middle Tier Infrastructure SpaceMiddle.DLL
(Services/Components) SupportMiddle.DLL
SmartPlantStructureMiddle.DLL


NameRuleWrapperForNet.DLL

Smart 3D .net Symbols Training – © 2008. Intergraph Corporation. All Rights Reserved.
Overview Of Smart 3D .net API - 4
Smart 3D .net Structure Symbols

Lecture

Writing Traffic Entities Symbols
(Stairs, Ladders and Handrails)
Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 1

Lecture - Overview
• In this lecture we will learn
– Writing Traffic Entities symbols in VB.net

• Basics of Symbol
• Creating new Symbol Definition
• Base Classes
• StructureSymbolDefinition
• Learning other Base Classes and Helper Classes of Traffic entities
• Symbol Helper and Validation Helper
• SmartPlantStructureMiddle Class
• Create Custom Symbol - Definition of Inputs, Aspects and their
outputs and providing override implementation – symbol
functionality

– Deploying Symbols

– Debugging Symbols

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 2
Basics of Symbol Machinery
• Symbol is a collection of graphical outputs
– Always used in the context of an application business object.

• Symbol Definition describes and implements the behavior shared


by all the symbol occurrences referencing it.
– Defines Inputs/Aspects/Outputs and methods.
• graphic Outputs aspects can be driven by a set of inputs.
• Executing a Symbol generates Outputs in the Aspects
defined by the Symbol.

• The symbol occurrence is placed by applying the methods


associated to the graphics.

• Flavor holds the actual symbol geometry.


– Flavor Manager knows all the different flavors associated to the
same definition and serves the correct flavor to the symbol.
Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 3

Base Classes
Custom (Stair, Ladder, Handrail) Symbols
- inherit from their respective base
classes and override the functionality.
- can implement ICustomWeightCG interface
to calculate the weight and CG.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 4
Creating a New Symbol Definition
• Create a new class which is derived from CustomSymbolDefinition or any App specific BaseClass
– application specific base classes provide more functionality out of the box to reduce user effort.

• Define Inputs
– Identify objects and properties which control symbol graphics.
– symbol architecture allows objects as input in general; but app functionality only allow a specific pattern for input objects.

• Define Aspects
– Identify which aspects the symbol is going to have.
– Users can add more aspects. Default aspects available in the system:
• Simple Physical – Geometry of the symbol
• Detailed Physical - Detailed geometry of the symbol.
• Centerline – Wire or stick representation of the geometry of the symbol.
• Operation – geometry defining operational aspect of the item.
• Insulation – Geometry of the insulation on the object.
• ReferenceGeometry – is used to add DatumShapes / ControlPoints which can be referenced by other objects.
• Maintenance - Space for maintenance access cleaning/ servicing/replacing parts etc, or for drop zones to reserve areas
to use where heavy valves etc are dropped down as part of maintenance.
– Typically SimplePhysical and Centerline aspects are supported by Structure symbols.

• Construct Outputs
• Implement Custom Behavior – Foul Check, Weight COG calculation, Property Management etc.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 5

Structure Symbol Definition


• Every structure symbol class needs to inherit from
StructureSymbolDefinition which implements some
basic symbol functionality like
ICustomPropertyManagement and ICustomFoulCheck.
• Product provides implementation of BO specific symbol
definition classes.
• All the common functionality of Stairs, Ladders and
Handrails are provided on these base classes and can
be overridden from its child classes.

• StructureSymbolDefinition.DLL provides few other


SymbolDefinition classes and many helper classes.
– StairLadderHelper
– HandrailHelper
– FootingHelper
– EquipmentFoundationHelper
– SymbolHelper
– ValidationHelper
– And more….

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 6
Symbol Helper
SymbolHelper class provides methods useful for while writing structure symbols.
• To create geometric shapes
• To calculate VolumeCOG for some shapes.
• To validate, do calculations and many more helper methods.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 7

Validation Helper
• ValidationHelper class helps in validating the Angle/Length properties.

IsGreaterThanZero: To validates property values which must be greater than 0


IsLowerThan100: To validate property values which must be lower than 100
IsBetween0And360: To validate property values need to be in between 0-360
degrees

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 8
SmartPlant Structure Middle
• SmartPlantStructureMiddle Library provides many classes, helper classes
and services. All the structure related classes are defined in this library.
• A few of those Services & Helper classes help write custom symbols.
• Few helper classes.
– StructHelper
– StructConnectableHelper
– And more..

• Few Services:
– CrossSectionServices
– GeometryServices
– MemberServices
– WeightCOGServices
– And more..

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 9

Create Custom Symbol


Namespace Ingr.SP3D.Content.Structure
Custom Symbol Class is created by
Inheriting its related SymbolDefinition base
Public Class CustomStair : Inherits StairSymbolDefinition class
Implements ICustomWeightCG

Public Overloads Overrides Sub SetStepProperties(ByVal stair As Stair, ByVal numberOfSteps As


Integer)
End Sub

Public Overloads Overrides Sub SetStepProperties(ByVal stair As Stair, ByVal numberOfSteps As


Integer, ByVal actualPitch As Double)
End Sub

Public Sub EvaluateWeightCG(ByVal oBusinessObject As BusinessObject) Implements


ICustomWeightCG.EvaluateWeightCG
End Sub
End Class
Custom Symbol Class can Implement the
ICustomWeightCG Interface to evaluate Wt & COG
• More details are provided in labs.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 10
Define Inputs

• Input Custom attributes for symbols class should be defined at the beginning of
the class definition.

• Must provide basic inputs used by base classes. (Ex: IJSPSCommonStairLadderProps)


Class InputCatalogPartAttribute
• Always first input is CatalogPart. Defines the global member attribute that is
CatalogPart type.
#Region "Definition of Inputs“ This is always the 1st attribute defined.

<InputCatalogPart(1)> Public m_oPartInput As InputCatalogPart


<InputDouble(2, "Width", "Width", 0.6)> Public m_dWidth As InputDouble
<InputDouble(3, "Angle", "Angle", 55)> Public m_dAngle As InputDouble
<InputDouble(4, "StepPitch", "Step Pitch", 0.25)> Public m_dStepPitch As InputDouble

Class InputDoubleAttribute
Defines a global member attribute that is a Double type.
6 is the index in the inputs list.
“StepPitch” is the name of the attribute.
“Step Pitch” is the description of the attribute.
• More details are provided in labs. 0.25 is the default value.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 11

Define Aspects and Construct outputs


Define Aspects: Define the aspects using Aspect attribute: A symbol defines its outputs in aspects.
Aspects help to group outputs meaningfully which can be turned on or off in display
Aspects supported : Simple Physical, Centerline, Operational, Insulation, Maintenance, Reference Geometry
Define each Aspect the symbol will
'SimplePhysical Aspect
support. “SimplePhysical” is the Aspect
<Aspect("SimplePhysical", "Simple Physical Aspect", AspectID.SimplePhysical)> _ name; “Simple Physical Aspect” is the
Public m_oSimplePhysicalAspect As AspectDefinition description, AspectID.SimplePhysical is
the AspectId
'Operation Aspect
<Aspect("Operation", "Operation Aspect", AspectID.Operation)> _
<SymbolOutput("OperationalEnvelope1", "Operational envelope of the stair")> _
Public m_oOperationAspect As AspectDefinition
Declare SymbolOutputs if any for
'Centerline Aspect Operational aspect.
<Aspect("Centerline", "Centerline Aspect", AspectID.Centerline)> _ This attribute is required for bulkload to
Public m_oCenterlineAspect As AspectDefinition recognize an AspectDefinition field has
symbol outputs. “OperationalEnvelope1”
is the SymbolOutput Name
Construct Outputs:
– Symbol definition must override the ConstructOutputs method.
– This method has code to construct the geometry of outputs.

• More details are provided in labs.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 12
Implement custom behavior
• Implement ICustomWeightCG interface and Calculate Weight COG

• Override the base class methods according to the needs.

• Implement ICustomEvaluate, ICustomPropertyManagement,


ICustomFoulCheck as needed.

• Build and deploy the dll (Details in next slides)

• Prepare bulkload data and load data to catalog (Details in next slides)

• More details are provided in labs.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 13

Deploying & Testing the Symbol


• Save the Symbol Assembly DLL to the [Product Reference Data Directory]\ custom symbols
folder of the Symbols share.
• In Project Management, select the catalog you want to update then invoke menu item
– Tools > Update Custom Symbol Configuration
• The command creates or updates the file called CustomSymbolConfig.xml in the
[Product Reference Data Directory]\Xml folder of the Symbols share.
CustomSymbolConfig.xml contains entries of ProgID, CLSID, and DLL name for
each class in the custom DLLs. After CustomSymbolConfig.xml is created, the
software uses the custom DLLs from the [Product Reference Data
Directory]\Custom Symbols folder.
• Bulkload Data (Next Slide)
• To test:
– Start Smart 3D
– Switch to the Structure Task
– Place some members which can be used as inputs to place Stair/Ladder/Handrail.
– Select “Place Stair” command
– Select the “CustomStair” symbol from drop down list on ribbon bar.
– Place the Stair by selecting proper inputs and Finish.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 14
Sample Bulkload data
PartClass Name: CustomStair

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 15

Moving/Copying/Opening Projects across machines


• .NET is not like COM in many respects.
• When you open a Project in a new machine, if the 3D installation folder in the
new machine is not the same as that of the machine where the project was
originally saved, you will encounter broken references.
• This is due to the fact that the references added to the project from the
original machine are not found at those folder locations in the new machine.
• Whereas, in COM, the system goes by the registry to auto correct the DLL file
references.
• To solve this situation, You will have to open and fix the project files in the
new machine to use the corrected paths.
• Using Standard installation paths for the developers in your automation team
is a good idea to avoid this problem.
• Installation : Your Setup Installer must only include your custom DLLs. Do not
include (i.e. re-deliver) ANY of the Smart 3D delivered API DLLs because the
Smart 3D Product delivery (ServicePack/HotFixes) is responsible for those.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 16
Debugging the Symbols
Approach #1: Attach to an already running Smart 3D process.
Approach #2: Specify Executable to start which invokes the Symbol class.
(details next)

Note : Developer Studio Express Edition limits its UI from doing both of
these approaches. However, Approach #2 can be setup by specifying the
details of the Executable in the <project>.vbproj.user file. Optionally you
can also specify the Session File name in StartArguments section.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>C:\SP3D\WS\Core\Container\Bin\TaskHost.exe</StartProgram>
<StartArguments>FullPathToSessionFile</StartArguments>
</PropertyGroup>
</Project>
Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 17

Debugging the Symbols


Approach #1: Attach to
an already running
Smart 3D process.

Inside Visual Studio


2008, choose Tools >
Attach To Process,
Select the
TaskHost.exe process
and press Attach.

Inside TaskHost, invoke


the Symbols as
described earlier to
test.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 18
Debugging the Command…
Approach #2: Start a new Smart
3D process from within the
debugger. (Note: you need to
add the full Core\Runtime and
GeometryTopology\Runtime
paths to your Path
Environment Variable first. (see
HKLM\Software\[Wow6432Node\]Micros
oft\Windows\CurrentVersion\App
Paths\S3DHost.exe)

Inside Visual Studio 2010, Project


> Project Properties

Choose the following settings and


save.

Now select Debug>Run menu


item in Visual Studio.
TIP : You can also specify the session file name in the
Inside TaskHost, invoke the Command line arguments field, with which the
commands as described earlier application will start in that session file directly
to test. instead of the normal open session file dialog.

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 19

Labs

• Custom Inclined Ladder


• Custom Stair
• Custom Handrail

Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 20
Smart 3D .net Structure Symbols

Lab-1

Inclined Ladder Symbol

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 1

Lab – Overview – Custom Inclined Ladder


In this lab we will learn how to create Inclined Ladder
symbol in VB.net

• Creating Project, manage its settings, adding


required references, and Importing required
namespaces
• Inheriting from LadderSymbolDefinition
• Define Inputs
• Define Aspects and their Outputs
• Construction of Outputs of all Aspects
• Providing override implementation – symbol
functionality
• Evaluate Origin and orientation – ICustomEvaluate
• Evaluate Weight-COG - ICustomWeightCG
• Evaluate Custom Property Management –
ICustomPropertyManagement
• Deploying Symbols
• Debugging Symbols

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 2
Creating Project, Manage its settings, Adding required
references, and Importing required namespaces

Refer basic .Net API labs to know how to create VS2010 Project
(If Project already exists, then add a new class “CustomInclinedLadder.vb” to it)

• Project Information:
Project Name – TrafficSymbols
ClassName – CustomInclinedLadder.vb

• References to be added:
– CommonMiddle.dll
– ReferenceDataMiddle.dll
– StructureSymbolDefinition.dll
– SmartPlantStructureMiddle.dll

• NameSpace:
– INGR.SP3D.Content.Structure

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 3

Ladder Symbol Definition

Imports System Add required Imports Statements


Imports System.Math
Imports System.Collections.ObjectModel You can add the Imports Statements as you encounter the need.
Imports Ingr.SP3D.Common.Middle Intellisense / Code-refactoring features of Visual Studio can help
Imports Ingr.SP3D.Common.Middle.Services here to detect and add automatically with little user intervention
Imports Ingr.SP3D.Content.Structure
Imports Ingr.SP3D.ReferenceData.Middle
Imports Ingr.SP3D.ReferenceData.Middle.Services
Imports Ingr.SP3D.Common.Exceptions
Imports Ingr.SP3D.Structure.Middle.Services
Imports Ingr.SP3D.Structure.Middle
Imports Ingr.SP3D.ReferenceData.Exceptions
Imports Ingr.SP3D.Content.Structure.Services

Namespace Ingr.SP3D.Content.Structure
Public Class CustomInclinedLadder : Inherits LadderSymbolDefinition
Implements ICustomWeightCG
Subclass from LadderSymbolDefinition,
'We write our code here Implement ICustomWeightCG

End Class
End NameSpace
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 4
Define Symbol Inputs
Specify Inputs for Inclined Ladder.
#Region "Definition Of Inputs" Catalog Part
'Catalog Part input Geometry properties: Length,
<InputCatalogPart(1)> Public m_oPartInput As InputCatalogPart Height, Span, Width, Angle
'Properties on IJSPSCommonStairLadderProps are used by base class. Positional properties: Justification,
Top Support Side, Offset.
'Geometry inputs
<InputDouble(2, "Span", "Span", 1.0)> Public m_dSpan As InputDouble
<InputDouble(3, "Height", "Height", 1.0)> Public m_dHeight As InputDouble
<InputDouble(4, "Length", "Length", 1.0)> Public m_dLength As InputDouble
<InputDouble(5, "Width", "Width", 0.35)> Public m_dWidth As InputDouble
<InputDouble(6, "Angle", "Angle", 1.3089969)> Public m_dAngle As InputDouble 'default = 75deg; 75 to 90 deg
'Position inputs
<InputDouble(7, "TopSupportSide", "TopSupportSide", 1.0)> Public m_dTopSupportSide As InputDouble
<InputDouble(8, "Justification", "Justification", 1.0)> Public m_dJustification As InputDouble
<InputDouble(9, "WallOffset", "Wall Offset", 0.135)> Public m_dWallOffset As InputDouble

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 5

Define Symbol Inputs Contd.


Steps Geometry and Cross Section properties: Step Pitch, Number of Steps, Step Section Name,
StepSectionReferenceStandard
Side Frame Cross Section properties: SideFrame Section Name, SideFrame, SectionReferenceStandard.
Material properties: Material, Material Grade
'Step Geometry and Section inputs
<InputDouble(10, "StepPitch", "Step Pitch", 0.25)> Public m_dStepPitch As InputDouble
<InputDouble(11, "NumSteps", "Number of Steps", 1.0)> Public m_dNumSteps As InputDouble
<InputDouble(12, "StepProtrusion", "Step Protrusion", 0.005)> Public m_dStepProtrusion As InputDouble
<InputString(13, "Step_SPSSectionRefStandard", "Step SectionReferenceStandard", "")> Public m_sStep_SPSRefStd As
InputString
<InputString(14, "Step_SPSSectionName", "Step SectionName", "")> Public m_sStep_SPSSection As InputString

'Side Rail Geometry and Section inputs


<InputString(15, "SideRail_SPSSectionRefStandard", "SideRail SectionReferenceStandard", "")> Public
m_sSideRail_SPSRefStd As InputString
<InputString(16, "SideRail_SPSSectionName", "SideRail SectionName", "")> Public m_sSideRail_SPSSection As
InputString

'Material data
<InputString(17, "Primary_SPSMaterial", "Primary Material", "Steel - Carbon")> Public m_sPrimaryMaterial As
InputString
<InputString(18, "Primary_SPSGrade", "Primary Material Grade", "A")> Public m_sPrimaryMatGrade As InputString
#End Region
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 6
Define Output Aspects

Define output aspects of the symbol: In this symbol we create only Simple Physical aspect.
#Region "Definitions of Aspects and their outputs“
'SimplePhysical Aspect
<Aspect("SimplePhysical", "SimplePhysical Aspect", AspectID.SimplePhysical)> Public m_oSimplePhysical As AspectDefinition
#End Region

Symbol constructs its outputs for all #Region "Construct Outputs" 1


aspects in ConstructOutputs Protected Overrides Sub ConstructOutputs()
method we override here. Dim dSpan, dHeight, dLength, dWidth, dAngle, dWallOffset As Double
Dim sStepRefStd, sStepSection, sSideRailRefStd, sSideRailSection As String
Dim justify As Integer
Get Input Values Dim oWarnings As New Collection(Of SymbolWarningException)
Try 2
'Get Input values
dSpan = m_dSpan.Value
Get Input Values Continued…
dHeight = m_dHeight.Value dWallOffset = m_dWallOffset.Value
3
dLength = m_dLength.Value justify = m_dJustification.Value
dWidth = m_dWidth.Value sStepRefStd = m_sStep_SPSRefStd.Value
dAngle = m_dAngle.Value sStepSection = m_sStep_SPSSection.Value
dWallOffset = m_dWallOffset.Value sSideRailRefStd = m_sSideRail_SPSRefStd.Value
sSideRailSection = m_sSideRail_SPSSection.Value

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 7

Construct Outputs Contd…


• Initialize variables needed for symbol 'Get Connection where Symbol (occurrence) outputs will be created 4
computation Dim oConn As SP3DConnection = Me.OccurrenceConnection
• Symbol input value can be obtained
'Get Step and SideRail dimensions
directly from the symbol input class
Dim oCatConn =
variable. Get the values for length,
MiddleServiceProvider.SiteMgr.ActiveSite.ActivePlant.PlantCatalog
span, height, stepPitch, width,
angle,WallOffset, justify, StepRefStd, Dim oCatStructHlpr As New CatalogStructHelper(oCatConn)
StepSection, sideRailRefStd, Dim oStepCS = oCatStructHlpr.GetCrossSection(sStepRefStd, "", sStepSection)
sideRailSection. Dim oSideRailCS = oCatStructHlpr.GetCrossSection(sSideRailRefStd, "",
• Define other variables needed during sSideRailSection)
output computation like
databaseConnection where the Dim dStepWidth, dStepDepth, dSideRailWidth, dSideRailDepth As Double
outputs will be created. SymbolHelper.GetCrossSectionDimensions(oStepCS, dStepDepth, dStepWidth)
• Get cross-section from catalog and the SymbolHelper.GetCrossSectionDimensions(oSideRailCS, dSideRailDepth,
width and depth dimensions for dSideRailWidth)
sideRail and step sections. 'Set ladder position based on justification
• Set the Ladder position based on left Dim dLadderOriginOffsetX as Double
or right or center justification. If (justify = SPSSymbolConstants.ALIGNMENT_LEFT) Then
dLadderOriginOffsetX = ((dWidth / 2) + dSideRailWidth)
ElseIf (justify = SPSSymbolConstants.ALIGNMENT_RIGHT) Then
dLadderOriginOffsetX = -((dWidth / 2) + dSideRailWidth)
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 8
Construct Outputs Contd...
Establish Local Coordinate System. 'setting corner positions 5
Dim oTopLeft As New Position, oBottomLeft As New Position
All outputs will be based on the local
coordinate system which needs to be oTopLeft.X = -(dWidth / 2 + dLadderOriginOffsetX)
adjusted based on user given position oTopLeft.Y = dWallOffset
along top support and justification of oTopLeft.Z = 0
ladder. oBottomLeft.X = oTopLeft.X
oBottomLeft.Y = oTopLeft.Y + dHeight / Math.Tan(dAngle)
oBottomLeft.Z = -dHeight
Calculate Ladder Corner Positions.
Left Upper, Left Lower, Right Upper, Right
Dim oTopRight As New Position(oTopLeft), oBottomRight As New
Lower Positions.
Position(oBottomLeft)
oTopRight.X += dWidth
oBottomRight.X += dWidth

'Calculate Vertical offset from the difference of Height and Span


Dim dVertOffset, dTopSupportLoc As Double
dVertOffset = (dHeight - dSpan)
dTopSupportLoc = -dVertOffset

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 9

Construct Outputs Contd...


Call private routines for creating PlaceRailing(oConn, oTopLeft, oBottomLeft, oSideRailCS, 6
"Left")'Leftside Rail
various outputs.
Place Left Railing, Place Right Railing, Place PlaceRailing(oConn, oTopRight, oBottomRight, oSideRailCS,
Rungs, Add Volume COG output. "Right")'Right side Rail

PlaceRungs(oConn, oTopLeft, oTopRight, oStepCS, dSideRailWidth,


dAngle, dStepWidth) 'Steps

AddVolumeCOGOutput(oConn)

Catch oEx As Exception


If (TypeOf oEx Is SymbolWarningException) Then
oWarnings.Add(CType(oEx, SymbolWarningException))
Else
Throw
End If 'can customize code so that errors/warnings can be added to
ToDolist entries.
End Try
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 10
PlaceRailings Method
#Region "Side Railing Creation"
Side Railing Implementation: Private Sub PlaceRailing(ByVal oConnection As SP3DConnection,
ByVal oStartPos As Position, ByVal oEndPos As Position, ByVal
Same method for both Left and Right oCSPart As CrossSection, ByVal sRailSide As String)
Railing will be used.
GetProjectionSurfaces sweeps the Dim oCSServices As New CrossSectionServices
cross-section along the given Line3d Dim oStartNormal As New Vector(0.0, 0.0, 1.0)
trace curve. Dim oEndNormal As New Vector(0.0, 0.0, 1.0)
Start Normal and End Normal are Dim swpOpts = SweepOptions.CreateCaps
provided in Z- direction Dim lCP = 5 : Dim dRotAngle = 0.0# : Dim bMirrorFlag = False
Each projection surface is added as an
'Create line and trace the crosssection along this
output to the SimplePhysicalAspect.
Dim oLine3D = New Line3d(oStartPos, oEndPos)
Dim oSurfaces =
oCSServices.GetProjectionSurfacesFromCrossSection (
oConnection, oCSPart, oLine3D, lCP, bMirrorFlag, dRotAngle,
oStartPos, oStartNormal, oEndPos, oEndNormal, swpOpts)
For i = 0 To oSurfaces.Count - 1
m_oSimplePhysical.Outputs.Add(sRailSide & "SideRailing" &
CStr(i), oSurfaces(i))
Next
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 11

PlaceRungs Method
#Region "Rungs Creation"
Rungs Implementation: 1
• Get Step related values from Private Sub PlaceRungs(ByVal oConnection As SP3DConnection, ByVal
oStartPos As Position, ByVal oEndPos As Position, ByVal oCSPart As
symbol inputs. CrossSection, ByVal dSideRailThk As Double, ByVal dAngle As Double,
• Adjust the x-position of the ByVal dStepWidth As Double)
rungs to account for side rail
thickness and step. Dim oWarnings As New Collection(Of SymbolWarningException)
Dim dStepProtrusion, dStepPitch As Double, nSteps As Integer
Try
nSteps = m_dNumSteps.Value
dStepPitch = m_dStepPitch.Value
dStepProtrusion = m_dStepProtrusion.Value
Catch oEx As Exception
If (TypeOf oEx Is SymbolWarningException) Then
oWarnings.Add(CType(oEx, SymbolWarningException)) 'Can add
these warnings to TODO list.
Else
Throw
End If
End Try

'Step positions
oStartPos.X -= dSideRailThk / 2.0 - dStepProtrusion
oEndPos.X += dSideRailThk / 2.0 + dStepProtrusion

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 12
PlaceRungs – Contd…

Dim oCSServices As New CrossSectionServices


Rungs Implementation: 'Normal direction is X-Direction
2
• We will project along the local Dim oStartNormal As New Vector(1, 0, 0)
x-axis which is along the width Dim oEndNormal As New Vector(1, 0, 0)
of the ladder. Dim swpOpts = SweepOptions.CreateCaps
• Adjust the y-position/z- Dim lCP = 5: Dim dRotAngle = 0.0# : Dim bMirrorFlag = False
position for top step to
For i = 1 To nSteps
accommodate for ladder
'Create line and trace the crosssection along this
inclination and pitch. Dim oLine3D = New Line3d(oStartPos, oEndPos)
• Create the given number of Dim oSurfaces =
steps by extruding the given oCSServices.GetProjectionSurfacesFromCrossSection(oConnec
tion, oCSPart, oLine3D, lCP, bMirrorFlag, dRotAngle, oStartPos,
cross-section. oStartNormal, oEndPos, oEndNormal, swpOpts)
• Each projection surface is
added as an output to the For j = 0 To oSurfaces.Count - 1
SimplePhysicalAspect. m_oSimplePhysical.Outputs.Add("Step" & CStr(i) & CStr(j),
oSurfaces(j))
Next

oStartPos.Y += dStepPitch * Math.Cos(dAngle)


oStartPos.Z -= dStepPitch * Sin(dAngle)
oEndPos.Y = oStartPos.Y
oEndPos.Z = oStartPos.Z
Next
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 13

Volume and COG calculation


Construct Volume COG. Private Sub AddVolumeCOGOutput(ByVal oConn As SP3DConnection) 1
Dim oLadderVolCOG As VolumeCG = Nothing
We have to create an object of Dim dCOGX, dCOGY, dCOGZ, dProjX, dProjY, dProjZ As Double
VolumeCOG and add it as an output to Dim dCurveArea, dProjVecLength, dAccmVol, dProjVol As Double
the SimplePhysicalAspect. Dim oProjVec As New Vector(dProjX, dProjY, dProjZ)
Dim oCurve As ICurve = Nothing
For this lab, we can hard code the Dim oCentroid As New Position, oProjCG As New Position
volume and COG to known values. Dim oAccumCG As New Position
Completion of code for volume and
COG calculation is left as an exercise for
Dim oOutputDictionary = m_oSimplePhysical.Outputs
the students.
For Each oDictEntry As DictionaryEntry In oOutputDictionary
(Actually, to calculate volume and COG, If (TypeOf oDictEntry.Value Is Projection3d) Then
we get each output from simple
physical aspect and calculate. Dim oProjection3D = DirectCast(oDictEntry.Value, Projection3d)
As we only created Projection3D oProjVec = oProjection3D.ProjVec
surfaces for all outputs, we only need to oCurve = oProjection3D.GenCurve
handle Projection3D outputs.) dCurveArea = oCurve.Area
oCentroid = oCurve.Centroid

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 14
Volume and COG calculation Contd…
COG calculation oProjCG.X = oCentroid.X + (0.5 * oProjVec.X) 2
oProjCG.Y = oCentroid.Y + (0.5 * oProjVec.Y)
Contd…
oProjCG.Z = oCentroid.Z + (0.5 * oProjVec.Z)

dProjVecLength = oProjection3D.ProjLength
dProjVol = dProjVecLength * dCurveArea
dAccmVol += dProjVol

If (dAccmVol > 0) Then


oAccumCG.X += (oProjCG.X - oAccumCG.X) * dProjVol / dAccmVol
oAccumCG.Y += (oProjCG.Y - oAccumCG.Y) * dProjVol / dAccmVol
oAccumCG.Z += (oProjCG.Z - oAccumCG.Z) * dProjVol / dAccmVol
End If
End If
Next
dCOGX = oAccumCG.X : dCOGY = oAccumCG.Y : dCOGZ = oAccumCG.Z
oLadderVolCOG = New VolumeCG(oConn, dAccmVol, dCOGX, dCOGY, dCOGZ)
m_oSimplePhysical.Outputs.Add("VolumeCOG", oLadderVolCOG)
End Sub
---- Outputs Creation done----
Note: The geometry we have created so far is in LCS of the ladder which we established earlier. On
compute, it will be transformed by the ladder BO to its global position based on the orientation matrix
which we will calculate next.

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 15

ICustomEvaluate
Evaluate Origin and Orientation: Public Overrides Function ComputeLadderLength(ByVal
ladder As Ladder, ByVal ladderPart As Part, ByVal height As
Ladder needs to be positioned/oriented based on the Double, ByVal ladderWidth As Double, ByRef stepDiameter
TopSupport, SideReference and BottomSupport inputs. As Double) As Double
Evaluating origin and orientation involves
• Construct transformation matrix for the given inputs. Dim dAngle = StructHelper.GetDoubleProperty(ladder,
• Set transformation matrix on the Business Object. SPSSymbolConstants.IJSPSCommonStairLadderProps,
SPSSymbolConstants.Angle)
ICustomEvaluate interface is implemented on the base
class LadderSymbolDefinition. It needs us to override If (StructHelper.AreEqual(dAngle, 0.0)) Then
few methods which return custom data for its Throw New CmnException("Incorrect Angle. Ladder
implementation – i.e. angle cannot be zero.")
• override ComputeLadderLength. Else
• override SetStepProperties. Return height / Math.Sin(dAngle)
In SetProperties, we set “Num of steps” value on the End If
property of IJUALadderTypeA interface.
End Function

Public Overrides Sub SetStepProperties(ByVal ladder As


Ladder, ByVal numberOfSteps As Integer, ByVal
firstStepPitch As Double)
ladder.SetPropertyValue(numberOfSteps,
SPSSymbolConstants.IJUALadderTypeA,
SPSSymbolConstants.NumSteps)
End Sub

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 16
Property Management – IsProperty - ReadOnly, Valid
The ICustomPropertyManagement interface helps validate PropertyValues (updated from
PropertyPages) for some Business Objects. This can be implemented by the Symbol Code of such
Objects.
For example, a stair can only support angle values within a certain range. Ladder symbol which
only supports a vertical ladder must make the angle field read-only only on PropertyPages.
This interface provides two overloadable methods - OnPreLoad is called before the properties are
loaded in the property page control. Properties can be hidden, grayed out etc using logic.
OnPropertyChange is called when a property is modified. Any custom validation can be done
here.
The StructureSymbolDefinition baseclass already implements this and you need to override
below methods which are used by BaseClass’s ICustomPropertyManagement implementation.
IsPropertyReadOnly and IsPropertyValid

Public Overrides Function IsPropertyReadOnly (ByVal interfaceName As String, ByVal propertyName As String) As
Boolean
Select Case propertyName
Case "FirstStepPitch", "NumSteps", "Span", "Height", "Length" : Return True
End Select
End Function

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 17

Property Management – IsProperty - ReadOnly, Valid


Public Overrides Function IsPropertyValid (ByVal interfaceName As String, ByVal propertyName As String, ByVal
propertyValue As Object, ByRef errorMessage As String) As Boolean
'set the default value as valid. Override the value later for known checks
Dim isValid As Boolean = True
If (propertyValue Is Nothing) Then Return True

Select Case propertyName


Case "Angle"
isValid = ValidationHelper.IsBetween90And75(DirectCast(propertyValue, Double), errorMessage)
Case "Span"
isValid = ValidationHelper.IsLowerThan100(DirectCast(propertyValue, Double), errorMessage)
Case "Width", "StepPitch"
isValid = ValidationHelper.IsGreaterThanZero(DirectCast(propertyValue, Double), errorMessage)
End Select
Return isValid
End Function

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 18
ICustomWeightCG
Implement ICustomWeightCG : This interface is used to handle custom weight COG evaluation in symbol definition.
Get the VolumeCOG symbol output . This output was created/updated during symbol computation earlier.
Get the material object and it’s density. Get weight using total volume and density.
To calculate Weight, we use helper methods of SymbolHelper class and supply the Volume and Material Properties Interface.
COG is directly obtained from the output object.
Note: As our ladder part is composed of single material, weight COG computation here only gets one volume output object.
For ladder composed of multiple materials, this computation can be modified to get individual VolumeCOG output for each material.

Public Sub EvaluateWeightCG(ByVal oBusinessObject As BusinessObject) Implements ICustomWeightCG.EvaluateWeightCG


Dim oObject As Object = SymbolHelper.GetSymbolOutput(oBusinessObject, "SimplePhysical", "VolumeCOG")
If (oObject IsNot Nothing) Then
Dim oLadderVolCOG = DirectCast(oObject, VolumeCG)
Dim dVolume = oLadderVolCOG.Volume
Dim dCOGX = oLadderVolCOG.COGX, dCOGY = oLadderVolCOG.COGY, dCOGZ = oLadderVolCOG.COGZ

'get the weight using volume and material density


Dim dWeight = SymbolHelper.EvaluateWeightFromVolume(oBusinessObject, dVolume, SPSSymbolConstants.IJUALadderTypeA)

'Set the net Wt and COG on business object


Dim oWeightCOGServices As New WeightCOGServices()
oWeightCOGServices.SetWeightAndCOG(oBusinessObject, dWeight, dCOGX, dCOGY, dCOGZ)
End If
End Sub

We can also Implement ICustomMirror/ICustomFoulCheck and customize as needed. (Not included in this lab)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 19

Bulkload data for InclinedLadder


PartClass Name: CustomInclinedLadder
– Before bulkloading, deploy DLL in “<SYMBOL_SHARE_PATH>\Custom Symbols\” directory and Run
“Update Custom Symbol Configuration” command from project management.
– IUALadderSections is a custom interface added for Ladder sections.
– Bulkload datasheets will be provided by instructor. Load it in Append mode.
– Create a .gif file for new custom symbol and give that gif file path. (we used delivered SPSLadder.gif)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 20
Smart 3D .net Structure Symbols

Lab-2

StairSymbol

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 1

Lab Overview
SideFrames
In this lab we will learn Steps
– How to create Stair symbol in VB.net Posts
• Creating Project, manage its settings, LeftHandrail
adding required references, and
Importing required namespaces RightHandrail
• Inheriting from StairSymbolDefinition
• Define Inputs, Aspects and outputs
• Construction of Outputs of all aspects
• Providing override implementation –
symbol functionality Height
• Evaluate Origin and orientation –
ICustomEvaluate
• Evaluate Weight-COG - ICustomWeightCG
• Custom Property Mgmt –
ICustomPropertyManagement
– Deploying Symbols
– Debugging Symbols

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 2
Creating Project, Manage its settings, Adding required
references and Importing required namespaces

Refer basic .net API labs to know how to create VS2010 Project
(If Project already exists, then add a new class “CustomStair.vb” to it)

• Project Information:
Project Name – TrafficSymbols
ClassName – CustomStair.vb

• References to be added:
– CommonMiddle.dll
– ReferenceDataMiddle.dll
– StructureSymbolDefinition.dll
– SmartPlantStructureMiddle.dll

• NameSpace:
– INGR.SP3D.Content.Structure

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 3

Stair Symbol Definition

Subclass from LadderSymbolDefinition,


Implement ICustomWeightCG
Add required Imports Statements
2
Imports System 1 Namespace Ingr.SP3D.Content.Structure
Imports System.Math
Imports System.Collections.ObjectModel
Public Class CustomStair : Inherits StairSymbolDefinition
Imports Ingr.SP3D.Common.Middle
Imports Ingr.SP3D.Common.Middle.Services Implements ICustomWeightCG
Imports Ingr.SP3D.Content.Structure
Imports Ingr.SP3D.ReferenceData.Middle End Class
Imports Ingr.SP3D.ReferenceData.Middle.Services
Imports Ingr.SP3D.Common.Exceptions End NameSpace
Imports Ingr.SP3D.Structure.Middle.Services
Imports Ingr.SP3D.Structure.Middle
Imports Ingr.SP3D.ReferenceData.Exceptions
Imports Ingr.SP3D.Content.Structure.Services

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 4
Define Symbol Inputs
#Region "Definition of Inputs" Catalog Part, Positional properties,
'Catalog Part input Geometry properties, Steps Geometry
and Cross Section properties
<InputCatalogPart(1)> Public m_oPartInput As InputCatalogPart
'Properties on IJSPSCommonStairLadderProps are Used by base class. So, we must provide them. 1
'Geometry inputs
<InputDouble(2, "Width", "Width", 0.6)> Public m_dWidth As InputDouble
<InputDouble(3, "Angle", "Angle", 55)> Public m_dAngle As InputDouble
<InputDouble(4, "Span", "Span", 1)> Public m_dSpan As InputDouble
<InputDouble(5, "Length", "Length", 1)> Public m_dLength As InputDouble
<InputDouble(6, "Height", "Height", 1.0)> Public m_dHeight As InputDouble
'Position inputs
<InputDouble(7, "Justification", "Justification", 1)> Public m_dJustification As InputDouble
<InputDouble(8, "TopSupportSide", "Top Support Side", 1)> Public m_dTopSupportSide As InputDouble
'Step Geometry and Section inputs
<InputDouble(9, "NumSteps", "Number of Steps", 0.0)> Public m_dNumSteps As InputDouble
<InputDouble(10, "StepPitch", "Step Pitch", 0.25)> Public m_dStepPitch As InputDouble
<InputDouble(11, "StepSectionCP", "Step Section Cardinal Point", 5)> Public m_dStepSectionCP As InputDouble
<InputDouble(12, "StepSectionAngle", "Step Section Angle", 0)> Public m_dStepSectionAngle As InputDouble
<InputString(13, "Step_SPSSectionName", "Step Section Name", "C12x25")> Public m_sStepSection As InputString
<InputString(14, "Step_SPSSectionRefStandard", "Step Section Reference Standard", "AISC-LRFD-3.1")> Public
m_sStepRefStd As InputString

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 5

Define Symbol Inputs Contd.


SideFrame/Handrail Geometry & Cross Section properties, Custom Properties

'SideFrame Geometry and Section inputs


2
<InputDouble(15, "SideFrameSectionCP", "Side Frame Section Cardinal Point", 4)> Public m_dSideFrameSectionCP As
InputDouble
<InputDouble(16, "SideFrameSectionAngle", "Side Frame Section Angle", 0)> Public m_dSideFrameSectionAngle As
InputDouble
<InputString(17, "SideFrame_SPSSectionName", "Side Frame Section Name", "C12x25")> Public m_sSideFrameSection
As InputString
<InputString(18, "SideFrame_SPSSectionRefStandard", "Side Frame Section Reference Standard", "AISC-LRFD-3.1")>
Public m_sSideFrameRefStd As InputString
'HandRail Geometry and Section inputs
<InputDouble(19, "HandRailSectionCP", "HandRail Section Cardinal Point", 0)> Public m_dHRSectionCP As InputDouble
<InputDouble(20, "HandRailSectionAngle", "HandRail Section Angle", 0)> Public m_dHRSectionAngle As InputDouble
<InputDouble(21, "HandRailPostPitch", "HandRail Post Pitch", 1)> Public m_dHRPostPitch As InputDouble
<InputString(22, "HandRail_SPSSectionName", "HandRail Section Name", "PIPE2sch40")> Public m_sHandRailSection
As InputString
<InputString(23, "HandRail_SPSSectionRefStandard", "HandRail Section Reference Standard", "AISC-LRFD-3.1")> Public
m_sHandRailRefStd As InputString
<InputDouble(24, "PostHeight", "Post Height", 1.2)> Public m_dPostHeight As InputDouble
<InputDouble(25, "NumMidRails", "Number of MidRails", 3)> Public m_dNumMidRails As InputDouble

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 6
Define Symbol Inputs Contd... Define Aspects/Outputs
Operational Aspect Properties, Material Properties 3
'Step ActualPitch (set on Custom property) computed
<InputDouble(26, "ActualPitch", "Actual Pitch", 3)> Public m_dActualPitch As InputDouble
'Operational Aspect input
<InputDouble(27, "EnvelopeHeight", "Envelope Height", 0)> Public m_dEnvelopeHeight As InputDouble
'Material
<InputString(28, "Primary_SPSMaterial", "Primary Material", "Steel - Carbon")> Public m_sPrimaryMaterial As
InputString
<InputString(29, "Primary_SPSGrade", "Primary Material Grade", "A")> Public m_sPrimaryMatGrade As InputString
#End Region

• Define the aspects using #Region "Definitions of Aspects and their outputs"
Aspect attribute. 'SimplePhysical Aspect
• Define symbol output(s) if <Aspect("SimplePhysical", "SimplePhysical Aspect", AspectID.SimplePhysical)> _
any, using SymbolOutput
Public m_oSimplePhysical As AspectDefinition
Attribute
'Operation Aspect
• Define output aspects
required for the symbol : We <Aspect("Operation", "Operation Aspect", AspectID.Operation)> _
create “Simple Physical” & <SymbolOutput("OperationalEnvelope1", "Operational envelope of the stair")> _
“Operational” Aspects for Public m_oOperation As AspectDefinition
our custom Stair Symbol.
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 7

Override Construct Outputs


Symbol constructs its outputs in ConstructOutputs method, which we Override. We get Symbol Inputs.
#Region "Construct outputs of all aspects" 1
Protected Overrides Sub ConstructOutputs()
Dim oWarnings As New Collection(Of SymbolWarningException)
Try
' Construction of Simple Physical Aspect
Dim dSecWidth, dTmpDepth, dTotalWidth, dDepth, dStepDepth, _
dStepSpan, dHRDepth, dHRWidth, dStairOriginOffsetX As Double
Dim swOpts = SweepOptions.CreateCaps
Dim currentAspectID As AspectID

'Get the connection where outputs will be created.


Dim oConnection As SP3DConnection = OccurrenceConnection

'Get Input values


Dim dLength = m_dLength.Value
Dim dWidth = m_dWidth.Value
Dim dAngle = m_dAngle.Value
Dim dHeight = m_dHeight.Value
Dim dSideSectionAngle = m_dSideFrameSectionAngle.Value

Dim dHRSectionAngle = m_dHRSectionAngle.Value


Dim dHRPostPitch = m_dHRPostPitch.Value

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 8
Override Construct Outputs … Contd…
Dim dPostHeight = m_dPostHeight.Value 2
Dim sStepRefStd = CStr(m_sStepRefStd.Value)
Dim sStepSection = CStr(m_sStepSection.Value)
Dim sHRRefStd = CStr(m_sHandRailRefStd.Value)
Dim sHRSection = CStr(m_sHandRailSection.Value)
Dim sSideFrameSection = CStr(m_sSideFrameSection.Value)
Dim sSideFrameRefStd = CStr(m_sSideFrameRefStd.Value)

Dim nJustification As Integer = CInt(m_dJustification.Value)


Dim nNumMidRails As Integer = CInt(m_dNumMidRails.Value)
Dim nNumSteps As Integer = CInt(m_dNumSteps.Value)
Dim nSideFrameSectionCP As Integer = CInt(m_dSideFrameSectionCP.Value)
Dim nHandRailSectionCP As Integer = CInt(m_dHRSectionCP.Value)

If (String.IsNullOrEmpty(sStepRefStd) Or String.IsNullOrEmpty(sStepSection) Or _
String.IsNullOrEmpty(sHRRefStd) Or String.IsNullOrEmpty(sHRSection) Or
String.IsNullOrEmpty(sSideFrameSection) Or String.IsNullOrEmpty(sSideFrameRefStd)) Then
'With empty or null section properties, symbol cannot be created.
Throw New SymbolErrorException ("Step/HandRail/SideFrame Section properties are missing, please check catalog.“,
New InvalidArgumentException ("Step / HandRail / SideFrame : ~Section or ~RefStd Argument(s) is/are invalid"))
'Or can create ToDoList messages.
Return
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 9

Construct Outputs Contd.


'dAngle is the angle between Stair span and bottom horizontal support plane. 3
Dim dTheta = (Math.PI / 2 - dAngle) 'dTheta is the angle between Stair span and Vertical supporting Wall.

'Set Stair position based on justification


If nJustification = SPSSymbolConstants.ALIGNMENT_LEFT Then
dStairOriginOffsetX = -(dWidth / 2)
ElseIf nJustification = SPSSymbolConstants.ALIGNMENT_RIGHT Then
dStairOriginOffsetX = (dWidth / 2)
End If Set the Stair position based
on Justification (Left / Right /
'Calculate corner positions Center).
Dim oTopLeft As New Position(-(dWidth / 2 + dStairOriginOffsetX), 0, 0) Establish Local Coordinate
Dim oBottomLeft As New Position System.
oBottomLeft.X = -dWidth / 2 - dStairOriginOffsetX All outputs will be w.r.t. Local
Coordinate System which will be
oBottomLeft.Y = oTopLeft.Y - (Math.Tan(dTheta) * dHeight) adjusted based on user specified
oBottomLeft.Z = -dHeight position along TopSupport and
Justification.

Dim oTopRight As New Position(oTopLeft) Calculate Stair Corner


Dim oBottomRight As New Position(oBottomLeft) Positions.
TopLeft, BottomLeft, TopRight,
oTopRight.X += dWidth : oBottomRight.X += dWidth BottomRight Positions.

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 10
Construct Outputs Contd.
Dim oCSSideFrame As CrossSection = GetCrossSection( sSideFrameRefStd, sSideFrameSection) 4
Dim oCSStep As CrossSection = GetCrossSection(sStepRefStd, sStepSection)
Dim oCSHandRail As CrossSection = GetCrossSection(sHRRefStd, sHRSection)
Get the C/S dimensions (width and
currentAspectID = AspectID.SimplePhysical depth) for SideFrame

'Code for geometry should be written for all aspects according to the graphics requirement in particular aspect
Consider Cardinal Point and section
SymbolHelper.GetCrossSectionDimensions(oCSSideFrame, dDepth, dSecWidth) angle data while calculating positions.
Call Methods to Place Side Frames
'Place left side frame
PlaceSideFrame(oConnection, oTopLeft, oBottomLeft, oCSSideFrame, nSideFrameSectionCP, dSideSectionAngle, "Left")
Place Side Frames (Left & Right)
'Place right side frame
PlaceSideFrame(oConnection, oTopRight, oBottomRight, oCSSideFrame, nSideFrameSectionCP, dSideSectionAngle, "Right")
Get the C/S dimensions (width and
'Place steps depth) for Steps.
dTmpDepth = (dDepth / 2) / Math.Sin(dTheta) ' to get to the center axis of the member and place steps on that axis
'here the StepDepth is really the width of the step section
SymbolHelper.GetCrossSectionDimensions(oCSStep, dStepSpan, dStepDepth)
'only support step section CP5 as default CP Calculate Span/Depth
dStepDepth = dStepDepth / 2
dStepSpan = dStepSpan / 2

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 11

Construct Outputs Contd.


5
Dim dActualPitch As Double = dHeight / (nNumSteps + 1)
PlaceSteps(oConnection, oTopLeft, oTopRight, nNumSteps, dTheta, dActualPitch, dTmpDepth, dStepDepth, dStepSpan,
oCSStep)
Calculate Pitch and Place Steps
'Place handrails and posts
oTopLeft.X = oTopLeft.X - (dSecWidth / 2)
oTopRight.X = oTopRight.X + (dSecWidth / 2)
oBottomLeft.X = oBottomLeft.X - (dSecWidth / 2)
oBottomRight.X = oBottomRight.X + (dSecWidth / 2)

'using same section for posts and handrails Get Handrail Dimensions

SymbolHelper.GetCrossSectionDimensions(oCSHandRail, dHRDepth, dHRWidth)

'Place posts Place Posts and Place Handrails


PlacePosts(oConnection, oCSHandRail, dTheta, oTopLeft, oBottomLeft, oTopRight, oBottomRight, dLength,
nHandRailSectionCP, dHRSectionAngle, dPostHeight, dHRDepth, dHRPostPitch)

'Place handrail
PlaceHandrails(oConnection, oCSHandRail, oTopLeft, oBottomLeft, oTopRight, oBottomRight, nHandRailSectionCP,
dHRSectionAngle, dPostHeight, nNumMidRails, dHRDepth)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 12
Construct Outputs … Contd…
'Construction of Operational Aspect
'we will create the side of the stair and then project it along the width to create the envelope
6
'all the points for the side will be in local xy, assuming width to be along the z-axis.
'Total width is 2 times the handrail section width plus the stair width.
dTotalWidth = dWidth + 2 * dSecWidth
Place Operational Envelope
'Place operational envelope
PlaceEnvelope(oConnection, dTotalWidth, dStairOriginOffsetX)
Create & Add VolumeCOG output.
Dim volumeCG As New VolumeCG(oConnection, 0, 0, 0, 0) We are not calculating here, but
m_oSimplePhysical.Outputs.Add("VolumeCOG", volumeCG) using 0,0,0 of Local Coordinate
System as the COG.
Catch oEx As Exception ' General Unhandled exception
If (TypeOf oEx Is SymbolWarningException) Then
Handle Exceptions
'Customize code so that errors/warnings can be added to ToDolist entries.
'(See product delivered example stairs for more info)
oWarnings.Add(CType(oEx, SymbolWarningException))
Else
Throw
End If
End Try
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 13

PlaceSideFrame Subroutine
#Region "Side Frames Creation"

Private Sub PlaceSideFrame(ByVal oConnection As SP3DConnection, ByVal oStartPos As Position, ByVal oEndPos As
Position, ByVal oCSPart As CrossSection, ByVal nSideFrameSectionCP As Integer, ByVal dSideSectionAngle As Double,
ByVal sFrameSide As String)

Method to Create Side Frames


Dim oCSServices As New CrossSectionServices • GetProjectionSurfaces sweeps the
Dim oStartNormal As New Vector(0.0, 1.0, 0.0) cross-section along the given Line3d
Dim oEndNormal As New Vector(0.0, 0.0, 1.0) trace curve.
Dim swOpts = SweepOptions.CreateCaps • Start Normal is provided in Y-direction
and End Normal is provided in Z-
Dim bMirrorFlag = False direction
• Each projection surface is added as an
'Create line and trace the crosssection along this output to the SimplePhysicalAspect.
Dim oLine3D = New Line3d(oStartPos, oEndPos)
Dim oSurfaces = oCSServices.GetProjectionSurfacesFromCrossSection(oConnection, oCSPart, oLine3D,
nSideFrameSectionCP, bMirrorFlag, dSideSectionAngle, oStartPos, oStartNormal, oEndPos, oEndNormal, swOpts)
For i = 0 To oSurfaces.Count - 1
m_oSimplePhysical.Outputs.Add(sFrameSide & "SideFrame" & CStr(i), oSurfaces(i))
Next
End Sub

#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 14
PlaceSteps Subroutine
Private Sub PlaceSteps(ByVal oConnection As SP3DConnection, ByVal oTopLeft As Position, ByVal oTopRight As Position,
ByVal nNumSteps As Integer, ByVal dAngle As Double, ByVal dPitch As Double, ByVal dTmpDepth As Double, ByVal
dStepDepth As Double, ByVal dStepSpan As Double, ByVal oCrossSection As CrossSection)

Get Step related values from symbol inputs.


Dim nStepSectionCP = CInt(m_dStepSectionCP.Value)
We will project along the local x-axis which is
Dim dStepSectionAngle = m_dStepSectionAngle.Value along the width of the Stair.
Dim oStartPt = New Position(oTopLeft.X, oTopLeft.Y, oTopLeft.Z) Adjust the x-position of the rungs to account
Dim oEndPt = New Position(oTopRight.X, oTopRight.Y, oTopRight.Z) for side rail thickness and step.
For i = 1 To nNumSteps
oStartPt.Y = -Math.Tan(dAngle) * ((dPitch * i) - dTmpDepth + dStepDepth)
oStartPt.Z = -(i * dPitch + dStepDepth) Adjust the y-position/z-position for top step to
oEndPt.Y = oStartPt.Y : oEndPt.Z = oStartPt.Z accommodate for Stair inclination and pitch.
Dim oCrossSectionServices As New CrossSectionServices, oLine = New Line3d(oStartPt, oEndPt)
Dim swOpts = SweepOptions.BreakCrossSection Or SweepOptions.BreakPath
Dim oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection, oCrossSection,
oLine, nStepSectionCP, False, dStepSectionAngle, swOpts)
If Not oSurfaceColl Is Nothing Then For each Step, arrive at Line to project the
For j = 0 To oSurfaceColl.Count - 1 Step’s C/S
m_oSimplePhysical.Outputs.Add("Step" & i & j, oSurfaceColl(j)) Create the given number of steps by
Next j extruding the given cross-section.
End If Each projection surface is added as an
output to the SimplePhysicalAspect.
Next i
End Sub
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 15

PlacePosts Subroutine
#Region "Posts Creation“ 1
Private Sub PlacePosts(ByVal oConnection As SP3DConnection, ByVal oCrossSection As CrossSection, ByVal dAngle As
Double, ByVal oTopLeft As Position, ByVal oBottomLeft As Position, ByVal oTopRight As Position, ByVal oBottomRight
As Position, ByVal dLength As Double, ByVal nHandRailSectionCP As Integer, ByVal dHRSectionAngle As Double, ByVal
dPostHeight As Double, ByVal dHRDepth As Double, ByVal dHRPostPitch As Double)

Dim nNumPosts As Integer = CInt(Math.Floor(((dLength - 0.6) / dHRPostPitch) + 1))


Dim dNewSpacing As Double = dLength / nNumPosts
Dim oStartPt As New Position, oEndPt As New Position

'0.3m we leave at the top and bottom - Calculate Number of Posts using
oStartPt.Set(oTopLeft.X, oTopLeft.Y, oTopLeft.Z) length of Stair & Handrail PostPitch.
oStartPt.Y = oStartPt.Y - Math.Sin(dAngle) * 0.3 - We leave 0.3m at both ends of
oStartPt.Z = oStartPt.Z - Math.Cos(dAngle) * 0.3 stair and consider the remaining
length for Posts creation.
oEndPt.Set(oStartPt.X, oStartPt.Y, oStartPt.Z + dPostHeight)
- Calculate positions of each post.

Dim oCrossSectionServices As New CrossSectionServices


Dim oStartNormal As New Vector(0.0, (-1 / Math.Sin(dAngle)), (1 / Math.Cos(dAngle)))
Dim swOpts = SweepOptions.BreakCrossSection Or SweepOptions.BreakPath

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 16
PlacePosts Subroutine Contd…
'Intermediate Posts 2
For i = 1 To nNumPosts
If i <> 1 Then
oStartPt.Y = oStartPt.Y - (Math.Sin(dAngle) * dNewSpacing)
oStartPt.Z = oStartPt.Z - (Math.Cos(dAngle) * dNewSpacing)
oEndPt.Set(oStartPt.X, oStartPt.Y, oStartPt.Z)
oEndPt.Z = oEndPt.Z + dPostHeight
End If

Dim oLine = New Line3d(oStartPt, oEndPt)


Dim oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection, oCrossSection,
oLine, nHandRailSectionCP, False,dHRSectionAngle, oStartPt, oStartNormal, Nothing, Nothing, swOpts)
If Not oSurfaceColl Is Nothing Then
For j = 0 To oSurfaceColl.Count - 1
m_oSimplePhysical.Outputs.Add("LPost" & i & j, oSurfaceColl(j))
Next j
End If
Next i

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 17

PlacePosts Subroutine Contd…


oStartPt.Set(oTopRight.X, oTopRight.Y, oTopRight.Z) 3
oStartPt.Z = oStartPt.Z - Math.Cos(dAngle) * 0.3
oStartPt.Y = oStartPt.Y - Math.Sin(dAngle) * 0.3
'now get depth correction
Select Case nHandRailSectionCP
Case 7, 8, 9, 14 : oStartPt.X = oStartPt.X + dHRDepth 'top edge
Case 4, 5, 6 'along half depth
Case 1, 2, 3, 11 : oStartPt.X = oStartPt.X - dHRDepth 'bottom edge
Case 10, 12, 13 'along centroid in depth direction
Case 15 'shear center
End Select
oEndPt.Set(oStartPt.X, oStartPt.Y, oStartPt.Z + dPostHeight)

For i = 1 To nNumPosts
If i <> 1 Then
oStartPt.Y = oStartPt.Y - (Math.Sin(dAngle) * dNewSpacing)
oStartPt.Z = oStartPt.Z - (Math.Cos(dAngle) * dNewSpacing)
oEndPt.Set(oStartPt.X, oStartPt.Y, oStartPt.Z)
oEndPt.Z = oEndPt.Z + dPostHeight
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 18
PlacePosts Subroutine Contd…
4
Dim oLine = New Line3d(oStartPt, oEndPt)
Dim oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection,
oCrossSection, oLine, nHandRailSectionCP, False, dHRSectionAngle, oStartPt, oStartNormal,
Nothing, Nothing, swOpts)
If Not oSurfaceColl Is Nothing Then
For j = 0 To oSurfaceColl.Count - 1
m_oSimplePhysical.Outputs.Add("RPost" & i & j, oSurfaceColl(j))
Next j
End If
Next i
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 19

PlaceHandrails Subroutine
#Region "Handrails Creation" 1
Private Sub PlaceHandrails(ByVal oConnection As SP3DConnection, ByVal oCrossSection As CrossSection, ByVal oTopLeft
As Position, ByVal oBottomLeft As Position, ByVal oTopRight As Position, ByVal oBottomRight As Position, ByVal
nHandRailSectionCP As Integer, ByVal dHRSectionAngle As Double, ByVal dPostHeight As Double, ByVal nNumMidRails
As Integer, ByVal dHRDepth As Double)

'creation of left handrails


Dim oStartPt As New Position, oEndPt As New Position, dDepthCorrection As Double = 0
oStartPt.Set(oTopLeft.X, oTopLeft.Y, oTopLeft.Z)
oEndPt.Set(oBottomLeft.X, oBottomLeft.Y, oBottomLeft.Z)
Select Case nHandRailSectionCP
Case 6, 8, 13, 14: dDepthCorrection = -dHRDepth / 2
Case 1: dDepthCorrection = dHRDepth • This methods creates the Handrail on top of the
Stair
Case 2, 4, 11, 12: dDepthCorrection = dHRDepth / 2
• Calculate Left hand Rails positions and create.
Case 3, 5, 7, 10, 15:
• Calculate Left Mid Rails positions and create.
Case 9: dDepthCorrection = -dHRDepth
• Calculate Right hand Rails positions and create.
End Select • Calculate Right Mid Rails positions and create.

Dim oPosStart As New Position, oPosEnd As New Position


oPosStart.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight)
oPosEnd.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight)
Dim dHRSpacing As Double = dPostHeight / (nNumMidRails + 1)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 20
PlaceHandrails Subroutine
Dim oLine = New Line3d(oPosStart, oPosEnd) 2
Dim oCurveColl As New Collection(Of ICurve)
oCurveColl.Add(oLine)
Dim oComplex = New ComplexString3d(oCurveColl)
oCurveColl = Nothing

If nNumMidRails >= 1 Then


oPosStart.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight)
oPosEnd.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))
oLine.DefineBy2Points(oPosStart, oPosEnd)
oComplex.AddCurve(oLine, True)

oPosStart.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))


oPosEnd.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight - (dHRSpacing * (nNumMidRails)))
oLine.DefineBy2Points(oPosStart, oPosEnd)
oComplex.AddCurve(oLine, True)

oPosStart.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))


oPosEnd.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight)
oLine.DefineBy2Points(oPosStart, oPosEnd)
oComplex.AddCurve(oLine, True)
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 21

PlaceHandrails Subroutine contd…


Dim oCrossSectionServices = New CrossSectionServices() 3
Dim swOpts = SweepOptions.BreakCrossSection Or SweepOptions.BreakPath
Dim oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection, oCrossSection, oComplex,
nHandRailSectionCP, False, dHRSectionAngle, swOpts)
If Not oSurfaceColl Is Nothing Then
For i = 0 To oSurfaceColl.Count - 1
m_oSimplePhysical.Outputs.Add(“LHandRail1" & i, oSurfaceColl(i))
Next i
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 22
PlaceHandrails Subroutine contd…
'creation of left midrails 4
oStartPt.Set(oTopLeft.X, oTopLeft.Y, oTopLeft.Z)
oEndPt.Set(oBottomLeft.X, oBottomLeft.Y, oBottomLeft.Z)

If nNumMidRails >= 2 Then


For i = 2 To nNumMidRails
oPosStart.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight - (dHRSpacing * (i - 1)))
oPosEnd.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight - (dHRSpacing * (i - 1)))
oLine.DefineBy2Points(oPosStart, oPosEnd)
oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection, oCrossSection,
oLine, nHandRailSectionCP, False, dHRSectionAngle, swOpts)
If Not oSurfaceColl Is Nothing Then
For j = 0 To oSurfaceColl.Count - 1
m_oSimplePhysical.Outputs.Add("LHandRail1" & i & j, oSurfaceColl(j))
Next j
End If
Next i
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 23

PlaceHandrails Subroutine contd…


'creation of right handrails 5
dDepthCorrection = 0
oStartPt.Set(oTopRight.X, oTopRight.Y, oTopRight.Z)
oEndPt.Set(oBottomRight.X, oBottomRight.Y, oBottomRight.Z)
Select Case nHandRailSectionCP
Case 4, 8, 12, 14 : dDepthCorrection = dHRDepth / 2
Case 1, 5, 9, 10, 15
Case 2, 6, 11, 13 : dDepthCorrection = -dHRDepth / 2
Case 3 : dDepthCorrection = -dHRDepth
Case 7 : dDepthCorrection = dHRDepth
End Select

oPosStart.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight)


oPosEnd.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight)
oLine = New Line3d(oPosStart, oPosEnd)
oCurveColl = New Collection(Of ICurve)
oCurveColl.Add(oLine)
oComplex = New ComplexString3d(oCurveColl)
oCurveColl = Nothing

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 24
PlaceHandrails Subroutine contd…
If nNumMidRails >= 1 Then 6
oPosStart.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight)
oPosEnd.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))
oLine.DefineBy2Points(oPosStart, oPosEnd)
oComplex.AddCurve(oLine, True)

oPosStart.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))


oPosEnd.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))
oLine.DefineBy2Points(oPosStart, oPosEnd)
oComplex.AddCurve(oLine, True)

oPosStart.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight - (dHRSpacing * nNumMidRails))


oPosEnd.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight)
oLine.DefineBy2Points(oPosStart, oPosEnd)
oComplex.AddCurve(oLine, True)
End If
oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection, oCrossSection, oComplex,
nHandRailSectionCP, False, dHRSectionAngle, swOpts)
If Not oSurfaceColl Is Nothing Then
For i = 0 To oSurfaceColl.Count - 1
m_oSimplePhysical.Outputs.Add("RHandRail1" & i, oSurfaceColl(i))
Next i
End If

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 25

PlaceHandrails Subroutine contd…


'creation of right midrails 7
If nNumMidRails >= 2 Then
For i = 2 To nNumMidRails
oPosStart.Set(oStartPt.X + dDepthCorrection, oStartPt.Y, oStartPt.Z + dPostHeight - (dHRSpacing * (i - 1)))
oPosEnd.Set(oEndPt.X + dDepthCorrection, oEndPt.Y, oEndPt.Z + dPostHeight - (dHRSpacing * (i - 1)))
oLine.DefineBy2Points(oPosStart, oPosEnd)
oSurfaceColl = oCrossSectionServices.GetProjectionSurfacesFromCrossSection(oConnection, oCrossSection,
oLine, nHandRailSectionCP, False, dHRSectionAngle, swOpts)
If Not oSurfaceColl Is Nothing Then
For j = 0 To oSurfaceColl.Count - 1
m_oSimplePhysical.Outputs.Add("RHandRail1" & i & j, oSurfaceColl(j))
Next j
End If
Next i
End If
End Sub

#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 26
GetCrossSection Function
#Region "GetCrossSection" This method Gets the crosssection.

Private Function GetCrossSection(ByVal referenceStandard As String, ByVal sectionName As String) As CrossSection


Dim catalogStructHelper As New CatalogStructHelper()
Dim crossSection As CrossSection = Nothing
Try
crossSection = catalogStructHelper.GetCrossSection(referenceStandard, sectionName)
Catch ex As RefdataCrossSectionNotFoundException
LogError(SPSSymbolConstants.S_FALSE, "Section name " + sectionName + " of reference standard " +
referenceStandard + " is not available in catalog.", SPSSymbolConstants.SectionDefinitionMissing)
End Try

If Not crossSection Is Nothing Then


Dim crossSectionServices As New CrossSectionServices
Dim symFile As String = String.Empty
If Not crossSectionServices.DoesSymFileExist(crossSection, symFile) Then
LogError(SPSSymbolConstants.S_FALSE, symFile + " is not accessible.", SPSSymbolConstants.SymFileNotAccessible)
End If
End If
Return crossSection
End Function

#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 27

PlaceEnvelope Subroutine
#Region "Operational Envelope Creation" 1
Private Sub PlaceEnvelope(ByVal oConnection As SP3DConnection, ByVal dTotalWidth As Double, ByVal dPosition As
Double)

Dim dEnvelopeHeight As Double = m_dEnvelopeHeight.Value


Dim dAngle As Double = m_dAngle.Value
Dim dLength As Double = m_dLength.Value

'We start at the top of the stair and go down along the stair. Origin at the top right.
Dim oPos1 As New Position, oPos2 As New Position, oPosColl As New Collection(Of Position)
oPos1.Set(0.0, 0.0, 0.0)
oPos2.Set(-dLength * Math.Cos(dAngle), -dLength * Math.Sin(dAngle), 0.0)
oPosColl.Add(oPos1)
oPosColl.Add(oPos2)

Dim oLineString As New LineString3d(oPosColl)


oPos1.Set(-dLength * Math.Cos(dAngle), -dLength * Math.Sin(dAngle) + dEnvelopeHeight, 0.0)
oLineString.AddPoint(oPos1)
oPos1.Set(0.0, dEnvelopeHeight, 0.0)
oLineString.AddPoint(oPos1) • This method Creates the Output object
oPos1.Set(0.0, 0.0, 0.0) 'Close out the line string of Operation aspect.
oLineString.AddPoint(oPos1) • Around the stair we create a envelope
projection and it as output.

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 28
PlaceEnvelope Subroutine contd…
'Now project it along z 2
Dim oVecProjDir As New Vector(0.0, 0.0, 1.0)
Dim oProjection As New Projection3d(oConnection, oLineString, oVecProjDir, dTotalWidth, True)

Dim oXVector As New Vector, oYVector As New Vector, oZVector As New Vector, aMatrix(15) As Double
oXVector.Set(0, 1, 0) 'x-axis is the y-axis on the projection
oYVector.Set(0, 0, 1) 'Global Y axis is the z axis on the projection
oZVector.Set(1, 0, 0) 'Global z axis is the x axis on the projection

'Now apply the xform to correctly orient the envelope


aMatrix(0) = oXVector.X : aMatrix(1) = oXVector.Y : aMatrix(2) = oXVector.Z
aMatrix(4) = oYVector.X : aMatrix(5) = oYVector.Y : aMatrix(6) = oYVector.Z
aMatrix(8) = oZVector.X : aMatrix(9) = oZVector.Y : aMatrix(10) = oZVector.Z
aMatrix(12) = -dTotalWidth / 2.0 - dPosition
aMatrix(13) = 0.0 : aMatrix(14) = 0.0 : aMatrix(15) = 1.0

Dim oMatrix As New Matrix4X4(aMatrix, False)


oProjection.Transform(oMatrix)

m_oOperation.Outputs.Add("OperationalEnvelope1", oProjection)
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 29

Implement ICustomWeightCG
Public Sub EvaluateWeightCG(ByVal oBusinessObject As Implement ICustomWeightCG :
BusinessObject) Implements
Implement this Interface to handle custom weight
ICustomWeightCG.EvaluateWeightCG
COG evaluation in symbol definition.
• Get the VolumeCOG symbol output, which was
Dim oObject As Object = SymbolHelper.GetSymbolOutput(
created/updated during symbol compute earlier.
oBusinessObject, "SimplePhysical", "VolumeCOG")
• Get the material object and it's density.
If (oObject IsNot Nothing) Then • Get weight using total volume and density.
Dim oStairVolCOG = DirectCast(oObject, VolumeCG) • To calculate Weight, we use helper methods
Dim dVolume = oStairVolCOG.Volume of SymbolHelper class and supply the Volume
Dim dCOGX = oStairVolCOG.COGX and Material Properties Interface.
Dim dCOGY = oStairVolCOG.COGY • COG is directly obtained from the output object.
Dim dCOGZ = oStairVolCOG.COGZ Note: As our Stair part is composed of single material,
'get the weight using volume and material density weight COG computation here only gets one volume
Dim dWeight = output object.
SymbolHelper.EvaluateWeightFromVolume ( For Stair part composed of multiple materials, this
oBusinessObject, dVolume, computation can be easily modified to get individual
SPSSymbolConstants.IJUAStairTypeA) VolumeCOG output for each material.
'Set the net Wt and COG on business object
Dim oWeightCOGServices = New WeightCOGServices() Can also Implement ICustomMirror /
oWeightCOGServices.SetWeightAndCOG(
oBusinessObject, dWeight, dCOGX, dCOGY, dCOGZ)
ICustomFoulCheck and customize as
End If needed. (Not included in this lab)
End Sub
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 30
Evaluate Origin & Orientation
Stair needs to be positioned & oriented based on inputs selected by the user. Evaluating origin and orientation
involves,
• Finalize transformation matrix based on given inputs.
• Set the transformation matrix on the Business Object.

ICustomEvaluate Interface is implemented by the baseclass StairSymbolDefinition to support evaluation of origin


and orientation for parts. We only need to override few methods which return custom data for the given
symbol's schema.
• Override SetStepProperties (Set “IJUALadderTypeA.NumSteps”, Set “IUAStairPitchParams.ActualPitch”) -
(We added a custom interface with this property)
• Override WithTopLanding and return False, Override IsPropertyReadOnly as per need to set properties as
readonly.

Public Overrides Sub SetStepProperties(ByVal stair As Stair, ByVal numberOfSteps As Integer, ByVal actualPitch As Double)
stair.SetPropertyValue(numberOfSteps, SPSSymbolConstants.IJUAStairTypeA, SPSSymbolConstants.NumSteps)
stair.SetPropertyValue(actualPitch, SPSSymbolConstants.IUAStairPitchParams, SPSSymbolConstants.ActualPitch)
End Sub

Public Overrides Function WithTopLanding(ByVal stair As Stair) As Boolean


Return False'StructHelper.GetBoolProperty(stair, SPSSymbolConstants.IJUAStairTypeA,
SPSSymbolConstants.WithTopLanding)
End Function

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 31

Property Management – IsProperty - ReadOnly, Valid


The ICustomPropertyManagement interface helps validate PropertyValues (updated from
PropertyPages) for some Business Objects. This can be implemented by the Symbol Code of such
Objects.
For example, a stair can only support angle values within a certain range. Ladder symbol which only
supports a vertical ladder must make the angle field read-only only on PropertyPages.
This interface provides two overloadable methods - OnPreLoad is called before the properties are
loaded in the property page control. Properties can be hidden, grayed out etc using logic.
OnPropertyChange is called when a property is modified. Any custom validation can be done here.
The StructureSymbolDefinition baseclass already implements this and you need to override below
methods which are used by BaseClass’s ICustomPropertyManagement implementation.
IsPropertyReadOnly and IsPropertyValid
Public Overrides Function IsPropertyReadOnly(ByVal interfaceName As String, ByVal propertyName$)As Boolean
Select Case propertyName
'making following property values as read-only.
Case SPSSymbolConstants.SideFrameSectionRefStandard,SPSSymbolConstants.HandRailSectionRefStandard,
SPSSymbolConstants.StepSectionRefStandard, SPSSymbolConstants.NumSteps, SPSSymbolConstants.Span,
SPSSymbolConstants.Height, SPSSymbolConstants.Length, SPSSymbolConstants.WithTopLanding
Return True
End Select
End Function
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 32
Property Management – IsProperty - ReadOnly, Valid
Public Overrides Function IsPropertyValid(ByVal interfaceName As String, ByVal propertyName As String, ByVal
propertyValue As Object, ByRef errorMessage$) As Boolean

'by default set the property value as valid. Override the value later for known checks
Dim isValidPropertyValue As Boolean = True
If propertyValue IsNot Nothing Then
Select Case propertyName
'following property values need to be in between 25-65 degrees
Case SPSSymbolConstants.Angle
isValidPropertyValue = ValidationHelper.IsBetween65And25(CDbl(propertyValue), errorMessage)

'following property value has combo-box to select the proper option, so set the property value as valid.
Case SPSSymbolConstants.SideFrameSectionName, SPSSymbolConstants.HandRailSectionName, _
SPSSymbolConstants.StepSectionName, SPSSymbolConstants.PrimaryMaterial
isValidPropertyValue = True

'following property values need to be in between 0-360 degrees


Case SPSSymbolConstants.SideFrameSectionAngle, SPSSymbolConstants.HandrailSectionAngle,
SPSSymbolConstants.StepSectionAngle
isValidPropertyValue = ValidationHelper.IsBetween0And360(CDbl(propertyValue), errorMessage)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 33

Property Management – IsProperty - ReadOnly, Valid


'following property values must be greater than 0 and lower than 100
Case SPSSymbolConstants.Width, SPSSymbolConstants.StepPitch
isValidPropertyValue = ValidationHelper.IsGreaterThanZero(CDbl(propertyValue), errorMessage) AndAlso _
ValidationHelper.IsLowerThan100(CDbl(propertyValue), errorMessage)

'following property values must be lower than 100


Case SPSSymbolConstants.Span
isValidPropertyValue = ValidationHelper.IsLowerThan100(CDbl(propertyValue), errorMessage)

'following property values must be greater than 0


Case SPSSymbolConstants.NumberOfMidRails
isValidPropertyValue = ValidationHelper.IsGreaterThanZero( CInt(propertyValue), errorMessage)

'following property values must be greater than 0


Case SPSSymbolConstants.PlatformThickness, SPSSymbolConstants.EnvelopeHeight,
SPSSymbolConstants.Height, SPSSymbolConstants.Length, SPSSymbolConstants.TopLandingLength,
SPSSymbolConstants.PostHeight, SPSSymbolConstants.HandRailPostPitch
isValidPropertyValue = ValidationHelper.IsGreaterThanZero(CDbl(propertyValue), errorMessage)
End Select
End If
Return isValidPropertyValue
End Function

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 34
Validate Codelist value data
Public Overrides Sub ValidateUndefinedCodelistValue(ByVal stair As Stair)

'validate justification
ValidateUndefinedCodelistValue(stair, SPSSymbolConstants.Justification, SPSSymbolConstants.StructAlignment,
SPSSymbolConstants.REFDAT, SPSSymbolConstants.TDL_INVALID_JUSTIFICATION)

'validate side frame cross-section cardinal point


ValidateUndefinedCodelistValue(stair, SPSSymbolConstants.SideFrameSectionCP,
SPSSymbolConstants.CrossSectionCardinalPoints, SPSSymbolConstants.CMNSCH,
SPSSymbolConstants.TDL_INVALID_SIDEFRAME_SECTIONCP)

'validate handrail cross-section cardinal point


ValidateUndefinedCodelistValue(stair, SPSSymbolConstants.HandRailSectionCP,
SPSSymbolConstants.CrossSectionCardinalPoints, SPSSymbolConstants.CMNSCH,
SPSSymbolConstants.TDL_INVALID_HANDRAIL_SECTIONCP)

'validate step cross-section cardinal point


ValidateUndefinedCodelistValue(stair, SPSSymbolConstants.StepSectionCP,
SPSSymbolConstants.CrossSectionCardinalPoints, SPSSymbolConstants.CMNSCH,
SPSSymbolConstants.TDL_INVALID_STEP_SECTIONCP)
End Sub

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 35

Validate Codelist value data


Private Overloads Sub ValidateUndefinedCodelistValue(ByVal stair As Stair, ByVal propertyName As String, _
ByVal codelistTableName As String, ByVal codelistTableNamespace As String, ByVal errNumber As Integer)
Dim propertyValue As Integer
Try
propertyValue = StructHelper.GetIntProperty(stair, SPSSymbolConstants.IJUAStairTypeA, propertyName)
Catch ex As Exception
'unable to get the property value, create a warning todo record and exit
MyBase.ToDoListMessage = New ToDoListMessage(ToDoMessageTypes.ToDoMessageWarning, propertyName +
+ “ property does not exist on the stair. Check the error log and catalog data.")
Return
End Try

'now, check the value is valid or not


If Not StructHelper.IsValidCodeListValue(codelistTableName, codelistTableNamespace, propertyValue) Then
'create a todo record with appropriate message
MyBase.ToDoListMessage = New ToDoListMessage(ToDoMessageTypes.ToDoMessageError,
SPSSymbolConstants.StructureToDoMessageCodelist, errNumber, String.Empty, stair)
End If
End Sub
#End Region
End Class
End Namespace

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 36
Bulkload data for Stair
PartClass Name: CustomStair
– Before bulkloading, deploy Dll in “<SYMBOL_SHARE_PATH>\Bin\SmartPlantStructure\Symbols\Release” directory and
Update CustomSymbolConfiguration from project management.
– IUAStairPitchParams is a custom interface added on Stair to set “ActualPitch” property.
– Bulkload datasheets will be provided by instructor. Load it in Append mode.
– Create a .gif file for new custom symbol and give that gif file path. (Currently delivered SPSStair.gif is used)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 37
Smart 3D .net Structure Symbols

Lab-3

Handrail Symbol

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 1

Lab – Overview – Custom Handrail


In this lab we will learn how to create Handrail
symbol in VB.net

– Creating Project, manage its settings, adding


required references, and Importing required
namespaces
– Inheriting from HandrailSymbolDefinition
– Define Inputs
– Define Aspects and their Outputs
– Construction of Outputs of all Aspects
– Providing override implementation – symbol
functionality
– Evaluate Origin and orientation – ICustomEvaluate
– Evaluate Weight-COG - ICustomWeightCG
– Evaluate Custom Property Management –
ICustomPropertyManagement

• Deploying Symbols
• Debugging Symbols

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 2
Creating Project, Manage its settings, Adding required
references and Importing required namespaces

Refer basic .net API labs to know how to create VS2010 Project
(If Project already exists, then add a new class “CustomHandrail.vb” to it)

• Project Information:
Project Name – TrafficSymbols
ClassName – CustomHandrail.vb

• References to be added:
– CommonMiddle.dll
– ReferenceDataMiddle.dll
– StructureSymbolDefinition.dll
– SmartPlantStructureMiddle.dll

• NameSpace:
– Ingr.SP3D.Content.Structure

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 3

Handrail Symbol Definition

Imports System.Collections.ObjectModel
Imports Ingr.SP3D.Common.Middle Add Required NameSpaces
Imports Ingr.SP3D.Common.Middle.Services
Imports Ingr.SP3D.ReferenceData.Middle
Imports Ingr.SP3D.ReferenceData.Middle.Services
Imports Ingr.SP3D.Structure.Middle.Services
Imports Ingr.SP3D.Structure.Middle
Imports Ingr.SP3D.Content.Structure

Namespace Ingr.SP3D.Content.Structure

Public Class CustomHandrail : Inherits HandrailSymbolDefinition


Implements ICustomWeightCG

Subclass from HandrailSymbolDefinition,


'We write our code here
Implement ICustomWeightCG
End Class
End NameSpace
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 4
Define Symbol Inputs
Specify Inputs for Handrail.
#Region "Definition of Inputs" Catalog Part, Sketch3D, Geometry
'Catalog Part input properties (WithToePlate,
<InputCatalogPart(1)> Public m_oPartInput As InputCatalogPart Height, NoOfMidRails)
'Sketch3D input for handrail comes from input sketch3D while placing.
<InputObject(2, "Sketch3d", "Sketch3d output complex curve")> Public m_oSketch3d As InputObject

'Other Bulkloaded Properties


<InputDouble(3, "Height", "Height of the Handrail from path to top of Top Rail", 1.067)> Public m_dHeight As
InputDouble
<InputDouble(4, "WithToePlate", "With or Without Toe/Kick plate", 1.0)> Public m_dWithToePlate As InputDouble
<InputDouble(5, "NoOfMidRails", "With One/Many/None mid rails", 1.0)> Public m_dNoOfMidRails As InputDouble

'Post space Properties


<InputDouble(6, "SegmentMaxSpacing", "Maximum spacing between posts on straight/arc line", 1.524)> Public
m_dSegmentMaxSpacing As InputDouble
<InputDouble(7, "SlopedSegmentMaxSpacing", "Maximum spacing between posts on slope", 1.829)> Public
m_dSlopedSegmentMaxSpacing As InputDouble

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 5

Define Symbol Inputs Contd.


'MidRail and ToePlate position properties
<InputDouble(8, "TopOfToePlateDim", "Dimension to the top of the toe plate from Path", 0.102)> Public
m_dTopOfToePlateDim As InputDouble
<InputDouble(9, "TopOfMidRailDim", "Dimension to the top of the Mid rail from top of toe plate", 0.5334)>
Public m_dTopOfMidRailDim As InputDouble
<InputDouble(10, "MidRailSpacing", "Spacing between mid rails", 0.2)> Public m_dMidRailSpacing As InputDouble

'EndTreatmentType Properties
<InputDouble(11, "BeginTreatmentType", "Begin treatment type 0 for rectangular, 1 for rounded", 2.0)> Public
m_dBeginTreatmentType As InputDouble
<InputDouble(12, "EndTreatmentType", "End treatment type 0 for rectangular, 1 for rounded", 2.0)> Public
m_dEndTreatmentType As InputDouble
<InputDouble(13, "PostConnectionType", "Connection required to assemble the entire handrail", 1.0)> Public
m_dPostConnectionType As InputDouble
<InputDouble(14, "WithPostAtTurn", "With or Without Post at the turn", 1.0)> Public m_dWithPostAtTurn As
InputDouble

'Section Names
<InputString(15, "TopRail_SPSSectionName", "TopRail Section from structural cross sections", "HSS1-7/8x.145")>
Public m_sTopRailSection As InputString
<InputString(16, "TopRail_SPSSectionRefStandard", "TopRail Section Reference Standard", "AISC-LRFD-3.1")> Public
m_sTopRailRefStd As InputString
<InputString(17, "MidRail_SPSSectionName", "MidRail Section from structural cross sections", "HSS1-7/8x.145")>
Public m_sMidRailSection As InputString
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 6
Define Symbol Inputs Contd.
Cross Section properties: MidRail_SPSSectionRefStandard, ToePlate_SPSSectionName,
ToePlate_SPSSectionRefStandard, Post_SPSSectionName, Post_SPSSectionRefStandard

Material properties: Material, Material Grade

<InputString(18, "MidRail_SPSSectionRefStandard", "MidRail Section Reference Standard", "AISC-LRFD-3.1")> Public


m_sMidRailRefStd As InputString
<InputString(19, "ToePlate_SPSSectionName", "ToePlate Section from structural cross sections", "RS0.125x4")>
Public m_sToePlateSection As InputString
<InputString(20, "ToePlate_SPSSectionRefStandard", "ToePlate Section Reference Standard", "Misc")> Public
m_sToePlateRefStd As InputString
<InputString(21, "Post_SPSSectionName", "Post Section from structural cross sections", "HSS1-7/8x.145")> Public
m_sPostSection As InputString
<InputString(22, "Post_SPSSectionRefStandard", "Post Section Reference Standard", "AISC-LRFD-3.1")> Public
m_sPostRefStd As InputString

'Material
<InputString(23, "Primary_SPSMaterial", "Primary Material", "Steel - Carbon")> Public m_sPrimaryMaterial As
InputString
<InputString(24, "Primary_SPSGrade", "Primary Material Grade", "A")> Public m_sPrimaryMatGrade As InputString

#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 7

Define Output Aspects


Define output aspects of the symbol: In this symbol we create only Simple Physical aspect.
#Region "Definitions of Aspects and their outputs“
'SimplePhysical Aspect
<Aspect("SimplePhysical", "SimplePhysical Aspect", AspectID.SimplePhysical)> Public m_oSimplePhysical As
AspectDefinition
#End Region
Symbol constructs its outputs for Dim topOfToePlateDim = m_dTopOfToePlateDim.Value 2
all aspects in ConstructOutputs Dim segmentMaximumSpacing = m_dSegmentMaxSpacing.Value
method we override here. Dim slopedSegmentMaxSpacing =
m_dSlopedSegmentMaxSpacing.Value
Get Input Values Dim numberOfMidrails = CInt(m_dNoOfMidRails.Value)

#Region "Construct Outputs" 1 'TopRail, MidRail, ToePlate and Post Crosssection Properties
Protected Overrides Sub ConstructOutputs()
Dim midRailSection = CStr(m_sMidRailSection.Value)
Dim sketchPath As Sketch3D =
Dim midRailRefStd = CStr(m_sMidRailRefStd.Value)
DirectCast(m_oSketch3d.Value,Sketch3D)
Dim toePlateSection = CStr(m_sToePlateSection.Value)
Dim height = m_dHeight.Value
Dim toePlateRefStd = CStr(m_sToePlateRefStd.Value)
Dim topOfMidrailDim =
m_dTopOfMidRailDim.Value Dim topRailSection = CStr(m_sTopRailSection.Value)
Dim midRailSpacing = Dim topRailRefStd = CStr(m_sTopRailRefStd.Value)
m_dMidRailSpacing.Value Dim postSection = CStr(m_sPostSection.Value)
Dim postRefStd = CStr(m_sPostRefStd.Value)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 8
Construct Outputs Contd…
Initialize variables needed for symbol Dim isWithToePlate = CBool(m_dWithToePlate.Value) 3
computation Dim isPostAtEveryTurn = CBool(m_dWithPostAtTurn.Value)
Symbol input value can be obtained
directly from the symbol input class 'Get Connection where Symbol (occurrence) outputs will be created
variable. Dim connection As SP3DConnection = OccurrenceConnection

Get the values for midRailSection,


midRailRefStd, toePlateSection 'Get CrossSection
toePlateRefStd, topRailSection Dim topRailCS = GetCrossSection(topRailRefStd, topRailSection)
topRailRefStd, postSection, postRefStd. Dim midRailCS = GetCrossSection(midRailRefStd, midRailSection)
• Define other variables needed during Dim toePlateCS = GetCrossSection(toePlateRefStd, toePlateSection)
output computation like Dim postCS = GetCrossSection(postRefStd, postSection)
databaseConnection where the
outputs will be created. 'Assumptions:
• Get cross-section from catalog and the ‘No Left or Right Offset for this handrail
width and depth dimensions for ‘Begin and Treatment type are NO_END_TREATMENT
TopRail, MidRail, ToePlate and Post ‘Use posts orientation as vertical irrespective of handrail orientation.
sections. Dim beginTreatmentType As Integer = 2, endTreatmentType As Integer = 2
• Give Begin and End treatments & Dim orientation = SPSSymbolConstants.VERTICAL_ORIENTATION
Orientation (For post direction) 'Get the handrail complex string from the sketch object
• Get the Path of the HandRail Curve Dim handrailComplexPath As ComplexString3d =
DirectCast(sketchPath.ComplexString, ComplexString3d)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 9

Construct Outputs Contd...


Dim curves As Collection(Of ICurve) = Nothing 4
handrailComplexPath.GetCurves(curves)

'add handrail curves as one of the outputs


AddPathAsOutputOfHandrail(connection, curves, m_oSimplePhysical)

'get topRail section depth and width


Dim topRailSectionHeight, topRailSectionWidth As Double
SymbolHelper.GetCrossSectionDimensions(topRailCS, topRailSectionHeight, topRailSectionWidth)

'Get the max possible distance covered by the cross-section based on the selected CP and the angle rotated for topRail
Dim deltaHeight, topRailCenterX, topRailCenterY As Double
Dim handrailHelper As New HandrailHelper()
handrailHelper.GetDeltaHeightAndCenterForHandrail(topRailCS, 5, 0.0, topRailSectionWidth, topRailSectionHeight,
deltaHeight, topRailCenterX, topRailCenterY)

'Get the circular treatment offset


Dim circularTreatmentOffset, lastMidrailHeight As Double
Dim topRailPath As ComplexString3d = Nothing
Dim currentAspectID = AspectID.SimplePhysical

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 10
Construct Outputs Contd...
5
'Create Toprail
CreateToprail(connection, currentAspectID, handrailComplexPath, height - deltaHeight, orientation, circularTreatmentOffset,
beginTreatmentType, endTreatmentType, topRailCS)

'Create Midrail(s)
CreateMidrails(connection, currentAspectID, handrailComplexPath, orientation, numberOfMidrails, midRailSpacing,
topOfMidrailDim, topOfToePlateDim, lastMidrailHeight, circularTreatmentOffset, beginTreatmentType, endTreatmentType,
midRailCS, topRailSectionHeight / 2)

'Create ToePlate
If isWithToePlate Then
CreateToePlate(connection, currentAspectID, handrailComplexPath, topOfToePlateDim, orientation, toePlateCS)
End If

'Create Post(s)
CreatePosts(connection, curves, (height - topRailSectionHeight / 2), orientation, segmentMaximumSpacing,
slopedSegmentMaxSpacing, isPostAtEveryTurn, beginTreatmentType, endTreatmentType, postCS)

End Sub Call private routines for creating


#End Region various outputs.
TopRail, MidRails, ToePlate, Posts

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 11

CreateTopRail Subroutine
#Region "Private Functions and Methods"
#Region “Create TopRail"

Private Sub CreateToprail(ByVal connection As SP3DConnection, ByVal currentAspectID As AspectID, ByVal traceCurve As
ComplexString3d, ByVal height As Double, ByVal orientation As Integer, ByVal circularTreatmentOffset As Double, ByVal
beginTreatmentType As Integer, ByVal endTreatmentType As Integer, ByVal toprailCS As CrossSection)

If traceCurve Is Nothing Then Exit Sub Get curves from traceCurve


Dim curves As Collection(Of ICurve) = Nothing Make a complexString3D with that curves.
traceCurve.GetCurves(curves)
Dim tempComplexString = New ComplexString3d(curves)
'Transform only if orientation is VerticalOrientation.
If orientation = SPSSymbolConstants.VERTICAL_ORIENTATION Then
Dim transformMatrix As New Matrix4X4, translation As New Vector(0, 0, height)
transformMatrix.Translate(translation)
transform that complexString by height.
tempComplexString.Transform(transformMatrix)
Call a helper routine which takes the CrossSection,
End If path to create the geometry, and adds it as an output
Dim handrailHelper As New HandrailHelper(), outputName = "TopRail"
BuildHandrailOutput(connection, tempComplexString, toprailCS, False, outputName,
handrailHelper.HandrailMemberType.Toprail)
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 12
CreateMidRail Subroutine
#Region "Create midrails" 1
Private Sub CreateMidrails(ByVal connection As SP3DConnection, ByVal currentAspectID As AspectID, ByVal traceCurve As
ComplexString3d, ByVal orientation As Integer, ByVal numberOfMidrails As Integer, ByVal midrailSpacing As Double,
ByVal topOfMidrailDimension As Double, ByVal topOfToePlateDimension As Double, ByVal lastMidrailHeight As Double,
ByVal circularTreatmentOffset As Double, ByVal beginTreatmentType As Integer, ByVal endTreatmentType As Integer,
ByVal midrailCS As CrossSection, ByVal circularTreatmentOffsetDelta As Double)

If (midrailSpacing = 0 OrElse (traceCurve Is Nothing) OrElse (orientation <> SPSSymbolConstants.VERTICAL_ORIENTATION))


Then Exit Sub
Get curves from traceCurve
Dim curves As Collection(Of ICurve) = Nothing Make a complexString3D with that curves.
traceCurve.GetCurves(curves)
For each MidRail we need, make a Transformation
If curves Is Nothing Then Exit Sub
Matrix for the Height of the MidRail.

Dim nMidrailsPlaced As Integer = 0, nMultiOutputIndex As Integer = 0, outputName = "MidRail"


For i = 1 To numberOfMidrails
If (topOfMidrailDimension > topOfToePlateDimension And topOfMidrailDimension > 0) Then
Dim transformMatrix As New Matrix4X4, translation As New Vector(0, 0, topOfMidrailDimension)
transformMatrix.Translate(translation) Transform complexString.
Dim tempComplexString = New ComplexString3d(curves)
Call a helper routine which
tempComplexString.Transform(transformMatrix)
takes the CrossSection,
BuildHandrailOutput(connection, tempComplexString, midrailCS, False, outputName, path to create geometry,
HandrailHelper.HandrailMemberType.Midrail, nMultiOutputIndex) and adds it as an output

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 13

Subroutines - CreateMidRail Contd…, CreateToePlate


nMidrailsPlaced = nMidrailsPlaced + 1 2
End If
topOfMidrailDimension -= midrailSpacing
Arrive at the next topOfMidRailDimension
Next i
End Sub
#End Region

#Region "Create toe plate"


Private Sub CreateToePlate(ByVal connection As SP3DConnection, ByVal currentAspectID As AspectID, ByVal traceCurve
As ComplexString3d, ByVal topOfToePlateDimension As Double, ByVal orientation As Integer, ByVal toePlateCS As
CrossSection)

If topOfToePlateDimension <= 0.0 Then Exit Sub


Dim outputName = "ToePlate"
Dim transformMatrix As New Matrix4X4, translation As New Vector(0.0, 0.0, topOfToePlateDimension)
If (currentAspectID = AspectID.Centerline) Then translation.Set(0.0, 0.0, topOfToePlateDimension - 0.1)
transformMatrix.Translate(translation)
traceCurve.Transform(transformMatrix)
BuildHandrailOutput(connection, traceCurve, toePlateCS, False, outputName, HandrailHelper.HandrailMemberType.ToePlate)
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 14
CreatePosts Subroutine
#Region "Create Posts"
Private Sub CreatePosts(ByVal connection As SP3DConnection, ByVal curves As Collection(Of ICurve), ByVal postHeight
As Double, ByVal orientation As Integer, ByVal segmentMaxSpacing As Double, ByVal slopedSegmentMaxSpacing
As Double, ByVal isPostAtEveryTurn As Boolean, ByVal beginTreatmentType As Integer, ByVal endTreatmentType
As Integer, ByVal postCS As CrossSection)

'currently set this value to be 2Feet for maximum and 9inches for minimum clearance at post turn
Dim maximumClearanceAtPostTurn = 0.6096, minimumClearanceAtPostTurn = 0.2286, deltaAngle = Math.PI

'Call the Helper Routine to Calculate data for all Posts


Dim handrailHelper As New HandrailHelper(), outputCreatedCount As Integer = 1
Dim posts = handrailHelper.GetHandrailPosts(curves, 0.0, 0.0, segmentMaxSpacing, slopedSegmentMaxSpacing,
minimumClearanceAtPostTurn, maximumClearanceAtPostTurn, 0.0, 0.0, deltaAngle, beginTreatmentType,
endTreatmentType, orientation, isPostAtEveryTurn, False)

Dim nMultiOutputIndex As Integer = 0, outputName = "HRPost"


For Each post In posts
Dim oLine As New Line3d(post.BasePosition, post.PostDirection, postHeight)
BuildHandrailOutput(connection, oLine, postCS, False, outputName, HandrailHelper.HandrailMemberType.Post,
nMultiOutputIndex)
Next
End Sub
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 15

BuildHandrailOutput Subroutine
#Region "Build HandRail Outputs"
Public Sub BuildHandrailOutput(ByVal connection As SP3DConnection, ByVal traceCurve As BusinessObject, ByVal
section As CrossSection, ByVal isMirror As Boolean, ByVal outputPrefix$, ByVal handrailMemberType As Integer,
Optional ByRef nMultiOutputIndex As Integer = 1)

Dim crossSectionServices As New CrossSectionServices(), surfaces As Collection(Of ISurface)


If handrailMemberType = HandrailHelper.HandrailMemberType.ToePlate Then
surfaces = crossSectionServices.GetProjectionSurfacesFromCrossSection(connection, section, CType(traceCurve,
ICurve), 2, isMirror, 0.0, SweepOptions.CreateCaps, SweepOrientation.NormalAlongZ)
Else
surfaces = crossSectionServices.GetProjectionSurfacesFromCrossSection(connection, section, CType(traceCurve,
ICurve), 5, isMirror, 0.0, SweepOptions.CreateCaps)
End If

nMultiOutputIndex += 1
If Not surfaces Is Nothing Then
For index = 0 To surfaces.Count - 1
m_oSimplePhysical.Outputs.Add(outputPrefix & nMultiOutputIndex, surfaces(index))
nMultiOutputIndex += 1
Next index
End If
End Sub
#End Region
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 16
AreHandrailPropertiesValid Function
#Region "AreHandrailPropertiesValid"
Private Function AreHandrailPropertiesValid(ByVal handrail As HandRail, ByRef errorMessage$) As Boolean
Try
errorMessage = String.Empty
Dim dHRHeight = StructHelper.GetDoubleProperty(handrail, SPSSymbolConstants.IJUAHRTypeAProps,
SPSSymbolConstants.Height)
Dim dMRDist = StructHelper.GetDoubleProperty(handrail, SPSSymbolConstants.IJUAHRTypeAProps,
SPSSymbolConstants.TopOfMidrailDimension)
Dim dMRSpacing = StructHelper.GetDoubleProperty(handrail, SPSSymbolConstants.IJUAHRTypeAProps,
SPSSymbolConstants.MidRailSpacing)
Dim nMidRails = StructHelper.GetLongProperty(handrail, SPSSymbolConstants.IJUAHRTypeAProps,
SPSSymbolConstants.NoOfMidRails)
If (dHRHeight <= dMRDist) OrElse (((nMidRails - 1) * dMRSpacing) >= dMRDist) Then
errorMessage = "Invalid property value(s) - check user inputs"
Return False
End If
Return True
Catch ex As Exception
errorMessage = "Some required user properties not found on HandRail. Check the ErrorLog and CatalogData."
Return False
End Try
End Function
#End Region
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 17

GetCrossSection Function
#Region "GetCrossSection"
Private Function GetCrossSection(ByVal referenceStandard As String, ByVal sectionName As String) As CrossSection

Dim catalogStructHelper As New CatalogStructHelper()


Dim crossSection = catalogStructHelper.GetCrossSection(referenceStandard, sectionName)
Dim crossSectionServices As New CrossSectionServices
Dim symFile As String = String.Empty
If Not crossSectionServices.DoesSymFileExist(crossSection, symFile) Then
MyBase.ToDoListMessage = New ToDoListMessage(ToDoMessageTypes.ToDoMessageError, symFile + " " + "section
.sym file is not accessible.")
LogError(SPSSymbolConstants.S_FALSE, symFile + " is not accessible.", SPSSymbolConstants.SymFileNotAccessible)
End If
Return crossSection

End Function

#End Region
#End Region ' Private methods

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 18
Implement ICustomWeightCG
Implement ICustomWeightCG : This interface is used to handle custom weight COG evaluation in symbol definition.
Get the VolumeCOG symbol output . This output was created/updated during symbol computation earlier.
Get the material object and it’s density. Get weight using total volume and density.
To calculate Weight, we use helper methods of SymbolHelper class and supply the Volume and Material Properties
Interface. COG is directly obtained from the output object.

#Region "ICustomWeightCG Members"


Public Sub EvaluateWeightCG(ByVal businessObject As BusinessObject) Implements ICustomWeightCG.EvaluateWeightCG
'Getting Weight and COG origin
Dim weightCOGOrigin = StructHelper.GetIntProperty(businessObject, SPSSymbolConstants.IJWCGValueOrigin,
SPSSymbolConstants.DryWCGOrigin)
If weightCOGOrigin = SPSSymbolConstants.DRY_WCOG_ORIGIN_COMPUTED Then
Dim volume = 0.0, cogX = 0.0, cogY = 0.0, cogZ = 0.0
'CalculateVolumeCOG(DirectCast(businessObject, HandRail), volume, cogX, cogY, cogZ)
'Getting weight from volume
Dim weight = SymbolHelper.EvaluateWeightFromVolume(businessObject, volume,
SPSSymbolConstants.IJUAHRTypeAProps)
'Set the net weight and COG on the handrail business object using helper method provided in WeightCOGServices
Dim weightCOGServices As New WeightCOGServices()
weightCOGServices.SetWeightAndCOG(businessObject, weight, cogX, cogY, cogZ)
End If
End Sub We can also Implement ICustomMirror/ICustomFoulCheck and customize as needed.
#End Region (Not included in this lab)
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 19

Property Management – IsProperty - ReadOnly, Valid


#Region "Overrides Functions And Methods"
Public Overrides Function IsPropertyReadOnly(ByVal interfaceName As String, ByVal propertyName As String) As
Boolean
Select Case propertyName
'making following property values as read-only.
Case SPSSymbolConstants.ToprailSectionRefStandard, SPSSymbolConstants.MidrailSectionRefStandard,
SPSSymbolConstants.ToePlateSectionRefStandard, SPSSymbolConstants.PostSectionRefStandard,
SPSSymbolConstants.BeginTreatmentType, SPSSymbolConstants.EndTreatmentType
Return True
End Select
End Function

Public Overrides Function IsPropertyValid(ByVal handrail As HandRail, ByVal interfaceName As String, ByVal propertyName
As String, ByVal propertyValue As Object, ByRef errorMessage As String) As Boolean

If propertyValue Is Nothing Then Return True


Select Case propertyName
'following property value has combo-box to select the proper option, so set the property value as valid.
Case SPSSymbolConstants.ToprailSectionName, SPSSymbolConstants.MidrailSectionName,
SPSSymbolConstants.ToePlateSectionName, SPSSymbolConstants.PostSectionName,
SPSSymbolConstants.PrimaryMaterial
Return True
1
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 20
Property Management – IsProperty - ReadOnly, Valid
'following property values need to be in between 0-360 degrees 2
Case SPSSymbolConstants.TopRailSectionAngle, SPSSymbolConstants.MidRailSectionAngle,
SPSSymbolConstants.ToePlateSectionAngle, SPSSymbolConstants.PostSectionAngle
Return ValidationHelper.IsBetween0And360(CDbl(propertyValue), errorMessage)

'following property values must be greater than 0, And AllOther HandRailProperties must be valid
Case SPSSymbolConstants.Height, SPSSymbolConstants.TopOfMidrailDimension,
SPSSymbolConstants.MidRailSpacing
Return ValidationHelper.IsGreaterThanZero(CDbl(propertyValue), errorMessage) AndAlso
AreHandrailPropertiesValid(handrail, errorMessage)

'following property values must be greater than 0, And AllOther HandRailProperties must be valid
Case SPSSymbolConstants.NoOfMidRails
Return ValidationHelper.IsGreaterThanZero(CInt(propertyValue), errorMessage) AndAlso
AreHandrailPropertiesValid(handrail, errorMessage)

'following property values must be greater than 0


Case SPSSymbolConstants.HorizontalOffsetDimension, SPSSymbolConstants.SegmentMaxSpacing,
SPSSymbolConstants.SlopedSegmentMaxSpacing, SPSSymbolConstants.TopOfToePlateDimension
Return ValidationHelper.IsGreaterThanZero(CDbl(propertyValue), errorMessage)
End Select
Return True
End Function
#End Region

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 21

Bulkload data for Handrail


PartClass Name: CustomHandrail
– Before bulkloading, deploy Dll in “<SYMBOL_SHARE_PATH>\Bin\SmartPlantStructure\Symbols\Release” directory and
Update CustomSymbolConfiguration from project management.
– Bulkload datasheets will be provided by instructor. Load it in Append mode.
– Create a .gif file for new custom symbol and give that gif file path. (Currently delivered SPSHandrail.gif is used)

Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 22

Potrebbero piacerti anche