Configuring cable weight via FeatureScript: override mass directly, or override material density?

Domechanic
Domechanic Member, pcbaevp Posts: 17 PRO
edited September 28 in FeatureScript

I'm building a FeatureScript feature to configure cables & tubes (many different types). For each cable type we know the weight per unit length (kg/m), the cross-sectional area, and the length — from which the total weight follows directly.

My question: what's the better approach for getting the correct weight on the part —

  1. Override the mass directly (compute mass = kg/m × length in FeatureScript and write it as a mass property override), or
  2. Override the material/density instead (set density = (kg/m) / cross-sectional area via a custom material() and assign it to the part, letting Onshape compute mass = volume × density automatically)?

Best Answer

  • Ace_Caoile
    Ace_Caoile Member Posts: 18 PRO
    Answer ✓

    I'd just change the material density and let onshape compute the mass… it keeps the script shorter and easier to mod later

Answers

  • Ace_Caoile
    Ace_Caoile Member Posts: 18 PRO
    Answer ✓

    I'd just change the material density and let onshape compute the mass… it keeps the script shorter and easier to mod later

  • EvanReese
    EvanReese Member, Mentor Posts: 3,095 PRO

    I've done some custom features for hoses etc and I ended up overriding the mass because I had to also add in some non-geometric stuff. Some of the end fitting models had errors or were surfaces, which won't give a mass, so it estimated those. It also calculated the weight of hoses full of oil without having to model the oil. It might not matter for you, but I also expect the math-to-override method to perform slightly faster, which really only matters if you're putting a lot of these in one place or making a lot of tubes in one go. I's probably lean toward an override, but I don't think either way is wrong and you can always change from one to the other without a big overhaul.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com