Here is some code I wrote (while half asleep), but it should work! If you have any questions, please let me know.
Regards,
Randy Herx
Resource International, LTD.
---------------------------------
Sub GetPipeInverts()
Dim oPipeApplication As AeccPipeApplication
Dim oPipeDocument As AeccPipeDocument
Dim oPipe As AeccPipe
Dim oApp As AcadApplication
Dim vPipeStart(2) As Double
Dim vPipeEnd(2) As Double
Dim oEnt As AcadEntity
Dim vPicked As Variant
Set oApp = ThisDrawing.Application
Dim sAppName As String
sAppName = "AeccXUiPipe.AeccPipeApplication.5.0"
Set oPipeApplication = oApp.GetInterfaceObject(sAppName)
Set oPipeDocument = oPipeApplication.ActiveDocument
On Error GoTo done
With ThisDrawing.Utility
While Err.Number = 0
.GetEntity oEnt, vPicked, vbCr & "Select Pipe: "
If oEnt Is Nothing Then
.Prompt vbCrLf & "No pipe selected"
Exit Sub
End If
If oEnt.ObjectName = "AeccDbPipe" Then
Set oPipe = oEnt
oPipe.StartPoint.GetPoint vPipeStart(0), vPipeStart(1), vPipeStart(2)
oPipe.Endpoint.GetPoint vPipeEnd(0), vPipeEnd(1), vPipeEnd(2)
MsgBox "Start Invert =" & (vPipeStart(2) - (oPipe.InnerHeight / 2))
MsgBox "End Invert =" & (vPipeEnd(2) - (oPipe.InnerHeight / 2))
Else
.Prompt vbCrLf & "The object you selected was not a pipe."
End If
Wend
End With
done:
Set oPipe = Nothing
Set oEnt = Nothing
Set oApp = Nothing
Set oPipeApplication = Nothing
Set oPipeDocument = Nothing
Exit Sub
End Sub