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
-
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646@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 Moderator, Onshape Employees, Developers Posts: 1,646@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 -
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646It 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 -
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646As 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 -
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646Ask and you shall receive! See new V3Jake Rosenfeld - Modeling Team0
-
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646The 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
-
MBartlett21 Member, OS Professional, Developers Posts: 2,047 ✭✭✭✭✭@Jake_Rosenfeld
@bruce_williams
Look at what the SolidWorks article says.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 command2 -
MBartlett21 Member, OS Professional, Developers Posts: 2,047 ✭✭✭✭✭@Jake_Rosenfeld
@bruce_williams
I have added support for faces to use as a coordinate system
Link: https://cad.onshape.com/documents/e03ea510c6145f7c79b64acb5
Answers
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
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?
On smallest volume - I would be happy with manually setting up a parallel plane. This does not need to be precise.
our messages crossed. Yes, the shortest axis (or close to it) would be good. And OK to set mate connector or plane before fs
I hope you find this to your liking!
https://cad.onshape.com/documents/2ce3e64026df1ac7e63b98bd/w/7a2029e15b241c80c591a492/e/ee8919ad0a28cec3b0740617
I think you need to make the document public so we can access it and get the custom feature.
IR for AS/NZS 1100
Sorry! Made it public, should be working now!
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.
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.
Kudos Mr. Rosenfeld! That is exactly what I need; going to be used every day. Thank you!
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. Thanks
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.
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.
Just click the edge in question and it will display the length in the bottom right corner of the screen.
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.
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":
That is beautiful. Thanks!
Question - what does the units pull down do?
Again Nice work and this is useful.
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.
@bruce_williams
Look at what the SolidWorks article says.
They can't do bounding boxes for separate bodies.
IR for AS/NZS 1100
@bruce_williams
I have added support for faces to use as a coordinate system
Link: https://cad.onshape.com/documents/e03ea510c6145f7c79b64acb
IR for AS/NZS 1100
@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!