Message 1 of 7
Bounding Box
Not applicable
10-17-2005
07:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm sure that this is a redundant subject but I really need help. By using the bounding box, I would like to determine the length, width, and height of a part. I found this code::: But I'm having a difficult time to set this code in place. Can anyone help me with this? Is there an easier alternative?
Thanks,
Hiram
Public Sub ShowRange()
' Get the active document. This assumes it is a part document.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
Dim oBox As Box
Set oBox = oPartDoc.ComponentDefinition.SurfaceBodies.Item(1).RangeBox
Dim strResult As String
strResult = "Part Range Size:" & vbCrLf
strResult = strResult & " X Size: " & Format(oBox.MaxPoint.X -
oBox.MinPoint.X, "0.000000") & " cm" & vbCrLf
strResult = strResult & " Y Size: " & Format(oBox.MaxPoint.Y -
oBox.MinPoint.Y, "0.000000") & " cm" & vbCrLf
strResult = strResult & " Z Size: " & Format(oBox.MaxPoint.Z -
oBox.MinPoint.Z, "0.000000") & " cm"
MsgBox strResult
End Sub
Thanks,
Hiram
Public Sub ShowRange()
' Get the active document. This assumes it is a part document.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
Dim oBox As Box
Set oBox = oPartDoc.ComponentDefinition.SurfaceBodies.Item(1).RangeBox
Dim strResult As String
strResult = "Part Range Size:" & vbCrLf
strResult = strResult & " X Size: " & Format(oBox.MaxPoint.X -
oBox.MinPoint.X, "0.000000") & " cm" & vbCrLf
strResult = strResult & " Y Size: " & Format(oBox.MaxPoint.Y -
oBox.MinPoint.Y, "0.000000") & " cm" & vbCrLf
strResult = strResult & " Z Size: " & Format(oBox.MaxPoint.Z -
oBox.MinPoint.Z, "0.000000") & " cm"
MsgBox strResult
End Sub