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 it possible to use feature script to quickly export mass property values for assemblies?

Hi all,

Still learning about feature script but I wanted to know if anyone has had any experience using Feature Script to export/output data (specifically mass property values like mass, center of mass, and moment of inertias) into either the command line or ideally into a txt file for an entire assembly. This action would be the same as manually clicking the mass property feature onto the entire assembly but I'm wondering if there is a method to automate this process and have these values easily exported as matrices/vectors. This would be especially beneficial if it can be done for multiple configurations of an assembly.

Best Answer

  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Answer ✓
    There are 3 major hurdles:
    1. Custom Features only work in a part studio, not an assembly. You might workaround by making a part studio in context of the assembly, and using the transform tool to copy all parts in place. I don't know of a way to get the materials to go with them though, so they'd have to be assigned all over again in the studio. This would also have to be updated for each config, which isn't desirable. I think this is the biggest challenge
    2. Features can't access certain metadata as inputs, like part name, or material, because it would be crazy to have a feature change behavior just because you renamed something. You can get those things in custom tables though, so that might be the way to go. Otherwise, you'd need a way to manually assign material densities to each part within the custom feature.
    3. FS is pretty sandboxed and can't export things. I can think of 3 ways of varying difficulty. (1) printLn() to print it to the notices panel, then copy/paste, (2) create a custom table and export that (this sounds best to be so far), or (3) do it via the API, which is over my head, however, you could probably bypass issues 1 and 2 doing it this way too. If this is going to be a common thing you need, it could be worth learning how!
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io

Answers

  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Answer ✓
    There are 3 major hurdles:
    1. Custom Features only work in a part studio, not an assembly. You might workaround by making a part studio in context of the assembly, and using the transform tool to copy all parts in place. I don't know of a way to get the materials to go with them though, so they'd have to be assigned all over again in the studio. This would also have to be updated for each config, which isn't desirable. I think this is the biggest challenge
    2. Features can't access certain metadata as inputs, like part name, or material, because it would be crazy to have a feature change behavior just because you renamed something. You can get those things in custom tables though, so that might be the way to go. Otherwise, you'd need a way to manually assign material densities to each part within the custom feature.
    3. FS is pretty sandboxed and can't export things. I can think of 3 ways of varying difficulty. (1) printLn() to print it to the notices panel, then copy/paste, (2) create a custom table and export that (this sounds best to be so far), or (3) do it via the API, which is over my head, however, you could probably bypass issues 1 and 2 doing it this way too. If this is going to be a common thing you need, it could be worth learning how!
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
Sign In or Register to comment.