Následující iLogic makro posčítá délky všech potrubních segmentů v prostředí "Trubky a potrubí" v sestavě Autodesk Inventoru.
Makro spusťte v prostředí sestavy, nikoliv v otevřeném Vedení potrubí, v jednotlivém Vedení nebo v Trase.
'Add lengths of all pipes (CADforum.cz)
Dim docFile As Document
Dim customPropSet As PropertySet
Dim oDocInts As DocumentInterests
Dim bHas_TP_Interest As Boolean
Dim TotalL As Double
Dim uom = ThisDoc.Document.UnitsOfMeasure
TotalL = 0
For Each docFile In ThisApplication.ActiveEditDocument.AllReferencedDocuments
customPropSet = docFile.PropertySets.Item("Inventor User Defined Properties")
oDocInts = docFile.DocumentInterests
bHas_TP_Interest = oDocInts.HasInterest("{4D39D5F1-0985-4783-AA5A-FC16C288418C}") 'T&P
If bHas_TP_Interest Then
Try
PL = customPropSet.Item("PL").Value 'string
PL = uom.GetValueFromExpression(PL, _
uom.GetStringFromType(UnitsTypeEnum.kDefaultDisplayLengthUnits))
TotalL = TotalL + PL
Catch
End Try
End If
Next
MsgBox("Total length:" & vbCrLf & vbCrLf & _
uom.GetStringFromValue(TotalL, UnitsTypeEnum.kDefaultDisplayLengthUnits), _
MsgBoxStyle.Information, "Pipe lengths")
Další možností získání délek trubek, hadic a potrubí je kusovník potrubní sestavy - součet sloupce KS obsahujícího délky segmentů.
Informaci o délkách tvořících segmentů potrubní sestavy získáte rovněž poklepáním myší na konkrétní trasu ve stromu prohlížeče: