Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Is there a way to find the extents of an object with one command?
bruce_williams
Member, Developers Posts: 842 EDU
My ideal would be a way to 'automatically' find the smallest volume rectangular box containing the object(s) and then spit out the height, width, length, area, & volume of said box. The target objects being individual or combination of surfaces, parts, or assemblies (whatever is selected).
www.accuratepattern.com
Tagged:
1
Best Answers
-
@bruce_williams
The bounding box size appears as a printout in the FeatureScript console of your part studio. To access this press the button at the top of your page that looks like a set of braces surrounding a checkmark:
Then, when you use the feature, the printout will appear in the panel at the bottom of your screen.Jake Rosenfeld - Modeling Team1 -
@bruce_williams
Figured I'd just jump the gun and do it. See new "keep bounds as new part" option in V2.
Note: There's not anything special about "Part 3" here, I just set its appearance to white and transparent in the right click > "Edit Appearance for Part 3..." menu after committing the feature.Jake Rosenfeld - Modeling Team1 -
It would be hard to display anywhere besides the console reliably from inside FeatureScript. You can get the l/w/h easily through the UI though:

Just click the edge in question and it will display the length in the bottom right corner of the screen.Jake Rosenfeld - Modeling Team1 -
As of right now part colors cannot be changed through FeatureScript, but stay tuned.
FYI, (noticed something in another comment) you don't actually have to copy the document to get the custom feature in your toolbar. If you just click the "+" button while looking at my document, you can add the feature from the "current document" section of the dialog that pops up. That way, if there are ever updates to the feature you will automatically be prompted about them and be given the option to update to the new version, rather than having to discover them yourself organically, and copy the document again.
So, click the +, then "current document", then the feature in question:
Then when there's an update available, you'll see a little blue notification and can right click and press "Update":
Jake Rosenfeld - Modeling Team1 -
Ask and you shall receive! See new V3

Jake Rosenfeld - Modeling Team0 -
The units pulldown determines the units of the printout in the FeatureScript console. I'm not sure how useful the printout is though, I may just simplify the script by getting rid of the printout and always keeping the see-through box as a new part.Jake Rosenfeld - Modeling Team1
-
@Jake_Rosenfeld
@bruce_williams
Look at what the SolidWorks article says.
They can't do bounding boxes for separate bodies.It should be noted that for multibody parts, creating a bounding box using this method will include all bodies (unless hidden). As such, it’s not currently possible to create separate bounding boxes for each body individually using the new Bounding Box command
2 -
@Jake_Rosenfeld
@bruce_williams
I have added support for faces to use as a coordinate system
Link: https://cad.onshape.com/documents/e03ea510c6145f7c79b64acb5
Answers
-
@bruce_williams
This could probably be done in FeatureScript, although the smallest volume part may get a little tricky. Additionally, if it was done in FeatureScript it could only be done for a part studio (of course you could always go the in context -> copy in place route to get an assembly into a part studio).
I'll do some googling about bounding volume algorithms
Jake Rosenfeld - Modeling Team0 -
@bruce_williams
Just to clarify, would you be happy with the smallest axis-aligned bounding box around the selected items? The coordinate system could be defined as either the default or by a mate connector. Or does the tool you have in mind also find the orientation of the box that makes it the smallest?Jake Rosenfeld - Modeling Team0 -
Part studio only will be fine. I was shooting for the moon... I use this for evaluating imported models for quoting and also developing material sizes. Just a little tedious to measure or make sketch to bound.
On smallest volume - I would be happy with manually setting up a parallel plane. This does not need to be precise.www.accuratepattern.com0 -
@Jake_Rosenfeld
our messages crossed. Yes, the shortest axis (or close to it) would be good. And OK to set mate connector or plane before fs
www.accuratepattern.com0 -
@bruce_williams
I hope you find this to your liking!
https://cad.onshape.com/documents/2ce3e64026df1ac7e63b98bd/w/7a2029e15b241c80c591a492/e/ee8919ad0a28cec3b0740617
Jake Rosenfeld - Modeling Team2 -
-
@Jake_Rosenfeld
I think you need to make the document public so we can access it and get the custom feature.0 -
Jake Rosenfeld - Modeling Team0
-
@Jake_Rosenfeld
got it copied and it looks very promising. Maybe I do not know how to use. How do I get the bounding box sizes? I see the box while in dialog and then green check the box disappears.
www.accuratepattern.com0 -
@bruce_williams
The bounding box size appears as a printout in the FeatureScript console of your part studio. To access this press the button at the top of your page that looks like a set of braces surrounding a checkmark:
Then, when you use the feature, the printout will appear in the panel at the bottom of your screen.Jake Rosenfeld - Modeling Team1 -
@Jake_Rosenfeld
Kudos Mr. Rosenfeld! That is exactly what I need; going to be used every day. Thank you!www.accuratepattern.com1 -
You're absolutely welcome! Please let me know if you think of any tweaks or improvements for the tool, or any other useful geometry tools.Jake Rosenfeld - Modeling Team0
-
Well, since you asked. An option to save the box would help for stock & tool design.
just for reference - sw bounding box
and I do have other ideas. I will work on defining; pretty exciting to see and the team so responsive. Thankswww.accuratepattern.com0 -
I could add a checkbox to keep the bounding box as a new Part in the Part Studio if you'd like. Would that help?Jake Rosenfeld - Modeling Team0
-
@bruce_williams
Figured I'd just jump the gun and do it. See new "keep bounds as new part" option in V2.
Note: There's not anything special about "Part 3" here, I just set its appearance to white and transparent in the right click > "Edit Appearance for Part 3..." menu after committing the feature.Jake Rosenfeld - Modeling Team1 -
Yes, A checkbox would be perfect.
And for extra credit - is there a fairly easy way to show the size/volume values without using the FS console? Once the box is a part, mass properties show area & volume but not x, y, z linear size.www.accuratepattern.com0 -
It would be hard to display anywhere besides the console reliably from inside FeatureScript. You can get the l/w/h easily through the UI though:

Just click the edge in question and it will display the length in the bottom right corner of the screen.Jake Rosenfeld - Modeling Team1 -
Nicely done with the checkbox.
I agree on easy to get anything needed with UI now that you have the create part option. I really like the white transparent idea - how about having the FS set that appearance. Bounding box will almost never be used for anything but reference.www.accuratepattern.com0 -
As of right now part colors cannot be changed through FeatureScript, but stay tuned.
FYI, (noticed something in another comment) you don't actually have to copy the document to get the custom feature in your toolbar. If you just click the "+" button while looking at my document, you can add the feature from the "current document" section of the dialog that pops up. That way, if there are ever updates to the feature you will automatically be prompted about them and be given the option to update to the new version, rather than having to discover them yourself organically, and copy the document again.
So, click the +, then "current document", then the feature in question:
Then when there's an update available, you'll see a little blue notification and can right click and press "Update":
Jake Rosenfeld - Modeling Team1 -
Thanks for the info on adding FS.www.accuratepattern.com1
-
Jake_Rosenfeld said:As of right now part colors cannot be changed through FeatureScript, but stay tuned
@Jake_Rosenfeld, With OS update release today for FS property programming - the white semi-transparent would be a nice touch imho
www.accuratepattern.com0 -
Ask and you shall receive! See new V3

Jake Rosenfeld - Modeling Team0 -
@Jake_Rosenfeld Mathew 7:7 words to live by
That is beautiful. Thanks!
Question - what does the units pull down do?www.accuratepattern.com1 -
The units pulldown determines the units of the printout in the FeatureScript console. I'm not sure how useful the printout is though, I may just simplify the script by getting rid of the printout and always keeping the see-through box as a new part.Jake Rosenfeld - Modeling Team1
-
Oh yeah! Although I would love to be FS literate it is not happening yet. IMHO I like your simpler route. Doubt if many would pick up on looking at the console. And the box can always be hidden or deleted.
Again Nice work and this is useful.
www.accuratepattern.com0 -
Really appreciate all the feedback,
I just made an update to V4.1, the feature now operates on an option of whether to create a new part or print out the results. If the print option is selected, a banner at the top of the screen explains how to open the console.
Jake Rosenfeld - Modeling Team1 -
Elegant! I just showed this latest version to my assistant and it is easily understood.www.accuratepattern.com0
-
@Jake_Rosenfeld
@bruce_williams
Look at what the SolidWorks article says.
They can't do bounding boxes for separate bodies.It should be noted that for multibody parts, creating a bounding box using this method will include all bodies (unless hidden). As such, it’s not currently possible to create separate bounding boxes for each body individually using the new Bounding Box command
2 -
@Jake_Rosenfeld
@bruce_williams
I have added support for faces to use as a coordinate system
Link: https://cad.onshape.com/documents/e03ea510c6145f7c79b64acb5 -
@Jake_Rosenfeld
@mbartlett21 Nice work! Choosing face is a good improvement and time saver. - I continue to use this nearly daily and often multiple times/day. And thanks for sharing about SW. I knew they had added capability but did not realize the limitation.
Onshape is making my work easier and fun!www.accuratepattern.com0


