Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to calculate pipes' start and end structure invert elevations

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
1397 Views, 5 Replies

How to calculate pipes' start and end structure invert elevations

How to calculate the pipe's start invert elevation and end invert elevations using Civil 3D COM API?.
These properties are displayed in the Pipe properties dialog but there is no direct API available to retrieve it. So I want to calculate these properties using available API functions in Civil 3D 2008.
5 REPLIES 5
Message 2 of 6
Civil3DReminders_com
in reply to: Anonymous

You have to subtract 1/2 the height of the pipe. There is some code sample in this AU paper:
http://au.autodesk.com/sessions/detail/830/

Christopher
http://civil-3d.blogspot.com/
Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 3 of 6
rherx
in reply to: Anonymous

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
Message 4 of 6
Anonymous
in reply to: Anonymous

Thank you very much Christopher and Randy for your prompt reply.
The code provided by Randy works perfectly fine. Actually Earlier I didn't notice the Z coordinate of the Pipe Start and End point.

Thanks,
Ankit
Message 5 of 6
rherx
in reply to: Anonymous

You're welcome, I'm glad to have helped!

Regards,
Randy Herx
Resource International, LTD.
---------------------------------
Message 6 of 6
prabhakar.sa
in reply to: rherx

How to run this code. I copy pasted the code in VBA editor by it was showing some error.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report