Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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.
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
Smart 3D .net Symbols Training – © 2008. Intergraph Corporation. All Rights Reserved.
Overview Of Smart 3D .net API - 1
Smart 3D .net Symbols Training – © 2008. Intergraph Corporation. All Rights Reserved.
Overview Of Smart 3D .net API - 2
Smart3D .net API Architecture
Middle Tier
.net based Automation
Smart 3D .net API
Standalone Applications
Middle Tier Infrastructure
(Non-Interactive –
(Services/Components)
Outside Taskhost)
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
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.
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
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.
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
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.
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
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
• Prepare bulkload data and load data to catalog (Details in next slides)
Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 13
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
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
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)
Smart 3D .NET Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
LECTURE – Writing Structure Symbols - 19
Labs
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
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
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
'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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 7
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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 9
AddVolumeCOGOutput(oConn)
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…
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-1 – Writing Inclined Ladder Symbol - 13
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
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
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
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.
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
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
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
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
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)
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
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
'using same section for posts and handrails Get Handrail Dimensions
'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)
#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)
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)
'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.
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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 17
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)
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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 21
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)
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 23
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)
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 25
#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.
#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)
'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)
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
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.
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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 31
'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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 33
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)
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-2 – Writing Stair Symbol - 35
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
• 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
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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 5
'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
<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
#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
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 9
'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)
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)
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)
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)
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 13
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
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)
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
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.
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
'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)
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 21
Smart 3D .net Structure Symbols Training – © 2012. Intergraph Corporation. All Rights Reserved.
Lab-3 – Writing Handrail Symbol - 22