Cable Volume Rule - Intergraph Smart 3D - Reference Data - Hexagon PPM

Intergraph Smart 3D Electrical Reference Data

Language
English
Product
Intergraph Smart 3D
Subproduct
Electrical
Search by Category
Reference Data
Smart 3D Version
13

The Cable Volume Rule filters the cableway network and routes the cable based on the avoidance volumes and the avoidance planes. You can customize the rule CableVolumeRule.vb. The .Net Visual Basic Project (vbproj) is available in the following folder:

[Reference Data folder]\Programming\ExampleCode\CommonRoute\Rules\CableVolumeRule\CableVolumeRule

CableVolumeRule.vb

Defines the CableVolumeRule which inherits the CARVolumeRule. The BaseClass contains CARVolumeRuleMethod method which is overwritten in this file. The method definition is as follows:

  • Public MustOverride Sub CARVolumeRuleMethod(cableRun As Ingr.SP3D.Route.Middle.CableRun, redundantCableColl As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject), avoidancePlnColl As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject), avoidanceVolColl As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject))

    cableRun - Specifies the cable run for which the rule is applied

    avoidancePlnColl - Specifies the planes that the rule must avoid for all the allowed volumes

    avoidanceVolColl - Specifies the volumes that are avoided

The rule also defines the public property CARVolZoneHelper and has methods exposed to assist with the Volumes or the Zones. The method definitions is as follows:

  • Public Sub GetCommonPlaneGivenTwoVolumes(volume1 As Ingr.SP3D.Common.Middle.BusinessObject, volume2 As Ingr.SP3D.Common.Middle.BusinessObject, ByRef commonPlane As Ingr.SP3D.Common.Middle.BusinessObject)

  • Public Function GetPlaneCollFromVolume(volume As Ingr.SP3D.Common.Middle.BusinessObject, planeType As Ingr.SP3D.Route.Middle.RteVolumePlanes) As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject)

  • Public Function GetS3DObjCollWithinRangeOfInputObj(inputObject As Ingr.SP3D.Common.Middle.BusinessObject, outputObjectType As Ingr.SP3D.Route.Middle.RteObjectTypeForVolRule) As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject)

  • Public Function GetVolumesGivenAnEquipment(equipment As Ingr.SP3D.Common.Middle.BusinessObject, spaceVolumeType As Ingr.SP3D.Route.Middle.RteSpaceVolumeType) As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject)

Sample code for Cable Volume Rule

Public Overrides Sub CARVolumeRuleMethod(ByVal cableRun As Ingr.SP3D.Route.Middle.CableRun, ByVal redundantCableColl As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject), ByVal avoidancePlnColl As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject), ByVal avoidanceVolColl As System.Collections.ObjectModel.Collection(Of Ingr.SP3D.Common.Middle.BusinessObject))

Try

Dim StrQuery As String

Dim oCableRunBussinessObj As Ingr.SP3D.Common.Middle.BusinessObject = cableRun

Dim oSp3dConn As Ingr.SP3D.Common.Middle.Services.SP3DConnection = cableRun.DBConnection

Dim eDBProvider As Ingr.SP3D.Common.Middle.Services.SiteManager.eDBProviderTypes

If (cableRun.DBConnection.DBProvider = "MSSQL") Then

eDBProvider = Ingr.SP3D.Common.Middle.Services.SiteManager.eDBProviderTypes.MSSQL

Else

eDBProvider = Ingr.SP3D.Common.Middle.Services.SiteManager.eDBProviderTypes.Oracle

End If

'The below code is done to add the zones in the Avoidance Zones.

StrQuery = "select oid from JCUSPAHazardousAtmospheresO"

Dim oDT As DataTable = RunSelectQuery(cableRun.DBConnection.Server, cableRun.DBConnection.Name, StrQuery, eDBProvider)

Dim currentRows As DataRow() = oDT.Select()

For OIDindex As Integer = currentRows.GetLowerBound(0) To currentRows.GetUpperBound(0)

Dim CurrentRow As DataRow

Dim tempVolumeZoneOID As String

Dim oZone As BusinessObject = Nothing

CurrentRow = currentRows(OIDindex)

If eDBProvider = Ingr.SP3D.Common.Middle.Services.SiteManager.eDBProviderTypes.MSSQL

Then

tempVolumeZoneOID = (CType(CurrentRow("oid"), Guid)).ToString("B").ToUpper()

Else

Dim oGuidTemp As Guid

Dim TempByteArr As Byte()

TempByteArr = CType(CurrentRow("oid"), Byte())

oGuidTemp = New Guid(BitConverter.ToInt32(New Byte() {TempByteArr(3), TempByteArr(2), TempByteArr(1), TempByteArr(0)}, 0),

BitConverter.ToInt16(TempByteArr, 4), BitConverter.ToInt16(TempByteArr, 6), TempByteArr(8),TempByteArr(9), TempByteArr(10), TempByteArr(11),

TempByteArr(12), TempByteArr(13), TempByteArr(14), TempByteArr(15))

tempVolumeZoneOID = oGuidTemp.ToString("N").ToUpper()

End If

Dim oBOMon As Ingr.SP3D.Common.Middle.Services.BOMoniker

oBOMon = oSp3dConn.GetBOMonikerFromDbIdentifier(CType(tempVolumeZoneOID, String))

oZone = oSp3dConn.WrapSP3DBO(oBOMon)

avoidanceVolColl.Add(oZone)

Next

'The below code is done to add the Z-planes of the zones in the Avoidance Planes

StrQuery = "select oid from JCUSPASecurityZonesO"

oDT = RunSelectQuery(cableRun.DBConnection.Server, cableRun.DBConnection.Name, StrQuery, eDBProvider)

currentRows = oDT.Select()

For OIDindex As Integer = currentRows.GetLowerBound(0) To currentRows.GetUpperBound(0)

Dim CurrentRow As DataRow

Dim tempVolumeZoneOID As String

Dim oZone As BusinessObject = Nothing

CurrentRow = currentRows(OIDindex)

If eDBProvider = Ingr.SP3D.Common.Middle.Services.SiteManager.eDBProviderTypes.MSSQL

Then

tempVolumeZoneOID = (CType(CurrentRow("oid"), Guid)).ToString("B").ToUpper()

Else

Dim oGuidTemp As Guid

Dim TempByteArr As Byte()

TempByteArr = CType(CurrentRow("oid"), Byte())

oGuidTemp = New Guid(BitConverter.ToInt32(New Byte() {TempByteArr(3),

TempByteArr(2), TempByteArr(1), TempByteArr(0)}, 0),

BitConverter.ToInt16(TempByteArr, 4), BitConverter.ToInt16(TempByteArr, 6), TempByteArr(8),TempByteArr(9), TempByteArr(10), TempByteArr(11),

TempByteArr(12), TempByteArr(13), TempByteArr(14), TempByteArr(15))

tempVolumeZoneOID = oGuidTemp.ToString("N").ToUpper()

End If

Dim oBOMon As Ingr.SP3D.Common.Middle.Services.BOMoniker

oBOMon = oSp3dConn.GetBOMonikerFromDbIdentifier(CType(tempVolumeZoneOID, String))

oZone = oSp3dConn.WrapSP3DBO(oBOMon)

Dim oTempColl As System.Collections.ObjectModel.Collection

Of Ingr.SP3D.Common.Middle.BusinessObject)

oTempColl = CARVolZoneHelper.GetPlaneCollFromVolume(oZone, RteVolumePlanes.ZNegative_Pln Or RteVolumePlanes.ZPositive_Pln)

For Each oBo As Ingr.SP3D.Common.Middle.BusinessObject In oTempColl

avoidancePlnColl.Add(oBo)

Next

Next

Catch oEx As Exception

Dim sException As String = oEx.Message

'If (Not oLogError Is Nothing) Then

' oLogError.Log(sException)

'End If

Throw oEx

End Try

End Sub