Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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_williamsbruce_williams Member, Developers Posts: 842 PRO
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

Best Answers

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    @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 Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    @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 Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    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 Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    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 Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    Ask and you shall receive! See new V3 :):)
    Jake Rosenfeld - Modeling Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    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 Team
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    Answer ✓
    @Jake_Rosenfeld
    @bruce_williams
    Look at what the SolidWorks article says. :smile:
    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
    They can't do bounding boxes for separate bodies. :smiley:
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
«1

Answers

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @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 Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    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.com
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    @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.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    wow that was fast @Jake_Rosenfeld !  The link is not working for me though.   :(
    www.accuratepattern.com
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @Jake_Rosenfeld

    I think you need to make the document public so we can access it and get the custom feature.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @bruce_williams @mbartlett21

    Sorry! Made it public, should be working now!
    Jake Rosenfeld - Modeling Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    @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.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    @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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    @Jake_Rosenfeld

    Kudos Mr. Rosenfeld!   That is exactly what I need; going to be used every day.  Thank you!
    www.accuratepattern.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    edited January 2018
    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.  Thanks
    www.accuratepattern.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    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 Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    @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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    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.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    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.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    Thanks for the info on adding FS.  
    www.accuratepattern.com
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    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.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    Ask and you shall receive! See new V3 :):)
    Jake Rosenfeld - Modeling Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    @Jake_Rosenfeld  Mathew 7:7 words to live by

    That is beautiful.  Thanks!

    Question - what does the units pull down do?
    www.accuratepattern.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Answer ✓
    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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    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.com
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    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 Team
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    Elegant!  I just showed this latest version to my assistant and it is easily understood.
    www.accuratepattern.com
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    Answer ✓
    @Jake_Rosenfeld
    @bruce_williams
    Look at what the SolidWorks article says. :smile:
    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
    They can't do bounding boxes for separate bodies. :smiley:
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    @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.com
Sign In or Register to comment.