DISCLAIMER: I may have mentioned already, but this is something I was
playing around with. It is not fully tested and does not include the depth
stuff, though I wasn't concerned with that part. My idea was to collect the
pipe sizes on the first iteration through, then for each pipe size, collect
the depth info. As you can see, I stopped after collecting total length of
each size.
This is for 2009........you'd have to change the 6.0 part near the bottom
for others.
Option Explicit
Dim oAlignment As AeccAlignment
Dim oPartDataField As AeccPartDataField
Dim oPartDataRecord As AeccPartDataRecord
Dim oAcadObject As Object
Dim entbasepnt As Variant
Dim oPipeID As AeccPipe
Dim found As Boolean
Dim oNetworks As AeccPipeNetworks
Dim oNetwork As AeccPipeNetwork
Dim workingNetwork As AeccPipeNetwork
Dim oApp As AcadApplication
Dim sAppName As String
'Next TWO lines were not in pilfered code
Dim g_oPipeApplication As AeccXUiPipeLib.AeccPipeApplication
Dim g_oPipeDocument As AeccXUiPipeLib.AeccPipeDocument
Dim yeahright As Variant
Dim oColPipes As Collection
Dim oColPipeSizes As Collection
Private Sub cbtGetQuantities_Click()
Dim oNetwork As AeccPipeNetwork
Set oNetwork = g_oPipeDocument.PipeNetworks(Me.cbxPipeNetworks.Text)
Dim oPipe As AeccPipe
Set oColPipes = New Collection
Set oColPipeSizes = New Collection
For Each oPipe In oNetwork.Pipes
'Me.tbxOutput.Text = Me.tbxOutput.Text & vbCrLf & oPipe.Name
oColPipes.Add oPipe
On Error Resume Next
oColPipeSizes.Add oPipe.InnerDiameterOrWidth,
Format(oPipe.InnerDiameterOrWidth, "0.00000000")
On Error GoTo 0
Next oPipe
Dim icnt As Integer
Me.tbxOutput.Text = "Quantities for network: " & oNetwork.Name & vbCrLf &
vbCrLf & _
"Pipes"
For icnt = 1 To oColPipeSizes.Count
Dim sSize As String
'sSize = Format(oColPipeSizes(iCnt) * 12#, "0") & "\"""
sSize = Format(oColPipeSizes(icnt) * 12#, "0") & "\"""
Dim dTotalLength As Double
dTotalLength = 0#
For Each oPipe In oColPipes
If oPipe.InnerDiameterOrWidth = oColPipeSizes(icnt) Then
dTotalLength = dTotalLength + oPipe.Length2D
End If
Next oPipe
Me.tbxOutput.Text = Me.tbxOutput.Text & vbCrLf & sSize & " <> " &
Format(dTotalLength, "0.00")
Next icnt
Me.tbxOutput.Text = Me.tbxOutput & vbCrLf & vbCrLf & "Structures" & vbCrLf
Dim oStruct As AeccStructure
For Each oStruct In oNetwork.Structures
Dim sOut As String
sOut = oStruct.Name & " <> " & oStruct.Description & " <> " & _
oStruct.RimElevation & " <> " & oStruct.SumpElevation & vbCrLf
Me.tbxOutput.Text = Me.tbxOutput & sOut
Next oStruct
End Sub
Private Sub UserForm_Initialize()
Set oApp = ThisDrawing.Application
' NOTE - Always specify the version number.
sAppName = "AeccXUiPipe.AeccPipeApplication.6.0"
Set g_oPipeApplication = oApp.GetInterfaceObject(sAppName)
Set g_oPipeDocument = g_oPipeApplication.ActiveDocument
Set oNetworks = g_oPipeDocument.PipeNetworks
Set oNetwork = Nothing
Me.cbxPipeNetworks.Clear
For Each oNetwork In oNetworks
Me.cbxPipeNetworks.AddItem oNetwork.Name
Next oNetwork
Me.cbxPipeNetworks.ListIndex = 0
End Sub
wrote in message news:6012340@discussion.autodesk.com...
That would be very helpful. My biggest problem is usually the syntax. I
can do the math and the loop and all that I just have a tough time working
with the actually access the objects and getting user input for objects.
Really it's more working with the Civil 3D object model. But if you have
something for me to work with that would be great.