To modify cableway fill, modify the method IJDFillCalculations_GetCwayFillParams.
Sample Rule
For all cableways having a nominal width of less than 18 inches, calculate the fill with respect to the cross-sectional width.
Data Needed
To solve such calculations, you need the following information:
-
Nominal width from the cableway feature.
-
Cross-sectional width from the cableway feature.
-
Collection of cables passing through the feature.
-
Diameter of the cables passing through the feature.
-
Sum of the diameters of all the cables passing through the feature.
-
Fill calculation = sum of diameters of cables / cross-sectional width.
-
Returns the fill calculated.
Modify IJDFillCalculations_GetCwayFillParams
The code is written as follows:
Private Sub IJDFillCalculations_GetCwayFillParams(ByVal pDispCableWayFeatObject As
Object,
ByVal pDispCableWayGenPart As Object, lNoCables As Long, dWireArea As Double, bTradeSize
As String,
dTotalTraverseArea As Double, dAllowableTraverseArea As Double, dPercentFull As Double,
dAvailableTraverseArea As Double, bStatus As String)
Const METHOD = "IJDFillCalculations_GetCwayFillParams"
On Error GoTo ErrorHandler
Dim oCableWayFeat As IJRteCablewayPathFeat
Dim oParent As IJDesignParent
Dim oChild As IJDesignChild
Dim oCableWayPart As IJCableTrayPart
Dim oCableTrayPartObj As IJPartOcc
Dim oIJDAssocRelation As IJDAssocRelation
Dim oTargetObjCol As IJDTargetObjectCol
Dim nLoop As Integer
Dim oSegmentPathFeat As IJRtePathFeat
Dim oCableRun As IJRteCableRun
Dim OCablePart As IJCablePart
Dim oCableway As IJRteCableway
Dim oCbleTrayFeat As IJRtePathFeat
Dim oCblwyPartCol As IJDObjectCollection
Dim oCblwyRun As IJRtePathRun
Dim oTempPart As IJDPart
Dim oCblPartObj As Object
Dim dTempWidth As Double
Dim dTempDepth As Double
Dim dblAvailArea As Double
Dim strFillStatus As String
'Get the input cableway feature variable pDispCableWayFeatObject.
'Get IJRtePathFeat interface from the object.
Set oCbleTrayFeat = pDispCableWayFeatObject
'Get the cableway run from the IJRtePathFeat.
Set oCblwyRun = oCbleTrayFeat.GetPathRun
'Pass the run to the method to get the fillefficiency defined for the run.
m_dblCableTrayFillEff = GetFillEfficiencyFromFeature(oCblwyRun)
'Get collection of cables inside the feature.
Set oIJDAssocRelation = pDispCableWayFeatObject
'Get the collection of segments in relation with the Cabletray.
Set oTargetObjCol = oIJDAssocRelation.CollectionRelations(IID_IJRtePathFeat, "Segment")
'Get count of cables.
lNoCables = oTargetObjCol.Count
Dim dSumofCableDia As Double
dSumofCableDia = 0#
For nLoop = 1 To lNoCables
Set oSegmentPathFeat = Nothing
Set oCableRun = Nothing Set OCablePart = Nothing
Set oSegmentPathFeat = oTargetObjCol.Item(nLoop)
Set oCableRun = oSegmentPathFeat.GetPathRun
m_intSignalType = oCableRun.SignalType
Set OCablePart = oCableRun.GetSpecificCablePart
If Not OCablePart Is Nothing Then
dSumofCableDia = OCablePart.CableDiameter
End If
Next nLoop
Set oCableWayPart = GetCablewayPartFromFeature(pDispCableWayFeatObject)
'The method GetCablewayPartFromFeature is declared below.
'Check if we found a part; if not, this must be a cableway with no part.
If Not oCableWayPart Is Nothing Then
Dim dNominalWidth As Double
'Get the nominalWidth.
dNominalWidth = oCableWayPart.NominalDepth
'The default units will be meters, so need to convert the meters to inches as we need to compare the distance in inches
dNominalWidth = m_UOM.ConvertDbuToUnit(UNIT_DISTANCE, dNominalWidth, DISTANCE_INCH)
If dNominalWidth < 18 Then
'Need to get the crossectional width from the cableway feature
Dim oRteCrossSectOcc As IJRteCrossSectOccur
Dim dCWWidth As Double
Dim dCWDepth As Double
Dim dCWRad As Double
Dim eShape As CrossSectionShapeTypes
'Get the cross section occurrence
Set oRteCrossSectOcc = pDispCableWayFeatObject
'Get the cross section parameters of the current run
oRteCrossSectOcc.GetParameters eShape, dCWWidth, dCWDepth, dCWRad
'The most important thing to remember is to set the fill value to dPercentFull because this is the variable where the data will be persisted.
dPercentFull = dSumofCableDia / (dCWWidth * m_dblCableTrayFillEff)
End If
End If
Exit Sub
ErrorHandler:
Set m_oServerError = m_oServerErrors.AddFromErr(Err, "Error processing ", METHOD, MODULE)
m_oServerError.Raise
End Sub
Private method to get the cableway part from the cableway feature:
Private Function GetCablewayPartFromFeature(oCablewayfeature As Object) As IJCableTrayPart
Const METHODNAME = "GetCablewayPartFromFeature"
On Error GoTo ErrHandler
Dim oCableWayFeat As IJRtePathFeat
Dim oParent As IJDesignParent
Dim oChild As IJDesignChild
Dim oCableWayPart As IJCableTrayPart
Dim oCableTrayPartObj As IJPartOcc
Dim oCableway As IJRteCableway
Dim oCbleTrayFeat As IJRtePathFeat
Dim oCblwyPartCol As IJDObjectCollection
Dim oCblwyRun As IJRtePathRun
Dim oTempPart As IJDPart
Dim oCblPartObj As Object
Set oCableWayFeat = oCablewayfeature
Set oCblwyRun = oCableWayFeat.GetPathRun
Set oCblwyPartCol = oCblwyRun.GetParts
For Each oCblPartObj In oCblwyPartCol
If TypeOf oCblPartObj Is IJPartOcc Then
Set oCableTrayPartObj = oCblPartObj
oCableTrayPartObj.GetPart oTempPart
Set GetCablewayPartFromFeature = oTempPart
Exit For
End If
Next oCblPartObj
Exit Function
ErrHandler:
Set m_oServerError = m_oServerErrors.AddFromErr(Err, "Failed GetCablewayPartFromFeature ", METHODNAME, MODULE)
m_oServerError.Raise
End Function
-
Do not to modify or remove any of the variable declarations in the project. Additional data types can be added as per your requirement.
-
If you are looking for any specific property, try searching for it in the Object Browser (F12) to find out on which interface it is available. Try searching for that interface in the existing implementation to see how it can be obtained.
-
Always remember to set the calculated Fill value to the variable dPercentFill.
-
If you are generating a report for the Fill Calculations, then remember to return the values for dTotalTraverseArea, dAllowableTraverseArea, dAvailableTraverseArea, and bStatus. Go through the existing implementation on how we can calculate them.