Hi,
I'm trying to extend the pipe class with the extension method, by creating a function. This function is to:
- Determine which pipes in the network have the same EndStructureId as the startStructureId of the pipe in question
- For those pipes, calculate the minimum value of the endPoint.Z property.
Since there's no collection of the 'pipe' object per se, I have to work with the ObjectIdCollection available through GetPipeIds(), right? This means I have to make a new transaction for every pipe in the network? I can't get my mind around this.
Code:
Imports System.Runtime.CompilerServices
Imports Autodesk.Civil.DatabaseServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.ApplicationServices
Public Function LowestElev(ByVal oPipe As Pipe) As Double
Dim trans As Transaction = m_tm.StartTransaction()
Dim oNetworkId As ObjectId = oPipe.NetworkId()
Dim oNetwork As Network = trans.GetObject(oNetworkId, OpenMode.ForRead)
Dim oPipeIds As ObjectIdCollection = oNetwork.GetPipeIds()
For Each oPipeId As ObjectId In oPipeIds
Dim iPipe As Pipe = trans.GetObject(oPipeId, OpenMode.ForRead)
If iPipe.EndStructureId = oPipe.StartStructureId Then
????
End If
Next
trans.commit()
End Function
I appreciate any help!