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.

Mass Properties

JWPJWP Member Posts: 11 PRO

I know i can select a part and click the scales to get the mass, however, is there a way to have a variable that displays the mass of a part?

I found the featurescript Mv Measure Value, which is very handy, but it doesn't do mass.

I also found evApproximateMassProperties in the featurescript manual, but i cant work out if it gives me a way to display the mass of a particular part.

Comments

  • Alex_KempenAlex_Kempen Member Posts: 258 EDU
    You probably want to use the getProperties method with PropertyType.MATERIAL to get the material of selected parts, which can then be used to get the density. Unfortunately, however, this is not usable inside of the feature body since parts regenerate (and FeatureScripts run) before user-defined properties are applied to parts, so calling getProperties inside the feature body doesn't actually work. Thus, if your FeatureScript doesn't set the density of the parts inside of it, you have to jump through some hoops to get the user defined density, usually by setting an always hidden parameter to be equal to the density via editing logic and then using that parameter's value inside your feature body. If you really want to get the user defined density, I can go into more detail about how to do it.

    evApproximateMassProperties can estimate the mass of parts, but it takes a density as an input, so it probably isn't the most useful to you unless you can get the density first. 
    Software Developer at Epic Systems
    FRC Design Mentor - Team 1306 BadgerBots


  • daniele_grandidaniele_grandi Member Posts: 2
    @JWP
    did you figure out how to do this? I'm also interested 
  • ansgar_dierkesansgar_dierkes Member Posts: 2

    Is there even a way to get the density? I have only found the material(…) function which 'constructs a material with a name and a density' but no way to get the density.

    Also, calling the getProperty(…) function for a body throws the Runtime Warning '@getProperty: Cannot get properties during feature regeneration in current context'

    For my context: I want to write a feature that creates a point at the center of mass of a selection of bodies and I'm currently not seeing any way this could work.

    Maybe someone from Onshape could explain what's happening and if there is a solution? Thanks in advance!

  • _anton_anton Member, Onshape Employees Posts: 514 image

    If the bodies are all known to have the same material, the solution is obvious - you just need the centroid.

    Else, no, there's no built-in way to get properties during regeneration because what you specify in the UI gets applied "after" regeneration. You could sort of hack around Onshape's UI - write a feature that sets the material, plus also something like density as an attribute on the body. Note that you'll first need to clear the material you've set in the UI.

    Do you intend to model using the centroid? If you just want to know where it is, the mass properties dialog should suffice.

  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 709 PRO

    I actually have a relevant example here. At Boss Display we produce a lot of tipping water buckets that need to fill up to a level that overbalances and dumps out the contents, then returns to neutral for the next filling cycle.

    image.png

    Feathering the center of mass of all of the HDPE and Acrylic and Stainless Steel components that go into the bucket constructions in relation to the center of mass of the water that fills the assembly is critical to proper operation of these things and I've seen us do it without driving the geometry via mass properties and the result was always guess and checking with prototype parts. Sometimes you'd get a bucket that doesn't tip at all, sometimes you get a bucket that tips after a single pump of the bilge and the mechanism stays upside down instead of returning to neutral.

    So we're one of those cases where an anisotropic mass properties solver would come in handy for these builds, but I have yet to write the bucket solver script in featurescript.

Sign In or Register to comment.