INVENTOR API - GET THE SOLID RANGEBOX IN PART ENVIRONMENT

INVENTOR API - GET THE SOLID RANGEBOX IN PART ENVIRONMENT

Khoa_NguyenDang
Advocate Advocate
1,418 Views
3 Replies
Message 1 of 4

INVENTOR API - GET THE SOLID RANGEBOX IN PART ENVIRONMENT

Khoa_NguyenDang
Advocate
Advocate

HI all guy 

Does anybody know how to get the rangbox size of solid with API 

I want to get the rangebox size for Solid in Part Environment, but I have no idea

If anyone knows it, hope you can help me.

Thank you so much 

0 Likes
Accepted solutions (2)
1,419 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor
Accepted solution

Try this code for begining

 

Dim part As PartDocument = ThisDoc.Document
Dim partDef As PartComponentDefinition = part.ComponentDefinition

Dim rangeBox As Box = Nothing

For Each sBody As SurfaceBody In partDef.SurfaceBodies
	If rangeBox Is Nothing Then
		rangeBox = sBody.RangeBox
	Else
		Dim bodyRangeBox = sBody.RangeBox
		rangeBox.Extend(bodyRangeBox.MinPoint)
		rangeBox.Extend(bodyRangeBox.MaxPoint)
	End If
Next

Dim x = rangeBox.MaxPoint.X - rangeBox.MinPoint.X
Dim y = rangeBox.MaxPoint.Y - rangeBox.MinPoint.Y
Dim z = rangeBox.MaxPoint.Z - rangeBox.MinPoint.Z

MsgBox(String.Format("{0:N2} x {1:N2} x {2:N2} [cm]", x, y, z))
0 Likes
Message 3 of 4

bradeneuropeArthur
Mentor
Mentor
Accepted solution

I can send you the code later. Hang on.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 4 of 4

Khoa_NguyenDang
Advocate
Advocate

HI @Michael.Navara 

Thank you so much, now i can do it 

0 Likes