Hi @SharkDesign
Are you looking for something like this? 🙂
Sub Main
Dim oOccName As String = InputBox("Occurrence name:", "Get range box data", "Part1:1")
Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oOcc As ComponentOccurrence = Nothing
For Each oDoc As Document In oAsm.AllReferencedDocuments
For Each sOcc As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc)
If sOcc.Name = oOccName
oOcc = sOcc
Exit For
End If
Next
If oOcc IsNot Nothing Then Exit For
Next
If oOcc IsNot Nothing Then
Dim oRB As Double() = GetRangeBoxData(oOcc, oAsm)
MsgBox(oOccName & " rangebox:" & vbCrLf & _
"X: " & oRB(0) & vbCrLf & _
"Y: " & oRB(1) & vbCrLf & _
"Z: " & oRB(2))
Else
MsgBox("No occurrence with name: " & oOccName & " in this assembly.")
End If
End Sub
Function GetRangeBoxData(ByVal oOcc As ComponentOccurrence, oAsm As AssemblyDocument) As Double()
Dim UoM As UnitsOfMeasure = oAsm.UnitsOfMeasure
Dim returnVal(2) As Double
Dim oBox As Box = oOcc.RangeBox
returnval(0) = UoM.ConvertUnits(Math.Abs(oBox.MaxPoint.X - oBox.MinPoint.X), UnitsTypeEnum.kDatabaseLengthUnits, UoM.LengthUnits)
returnval(1) = UoM.ConvertUnits(Math.Abs(oBox.MaxPoint.Y - oBox.MinPoint.Y), UnitsTypeEnum.kDatabaseLengthUnits, UoM.LengthUnits)
returnval(2) = UoM.ConvertUnits(Math.Abs(oBox.MaxPoint.Z - oBox.MinPoint.Z), UnitsTypeEnum.kDatabaseLengthUnits, UoM.LengthUnits)
Return returnVal
End Function