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.

Options

FeatureScript that generates a cube by specifying desired mass (carbon steel)

STEGSTEG Member, User Group Leader Posts: 76 PRO
Hi everyone,

This is my first FS ever and I developped it just for the fun of learning FS.
The feature builds a cube by specifying the desired mass (in kg). The density used is for carbon steel.
There is an option to center the cube on the center point in the PS.

I already have improvements ideas such as:
  • Units selection (kg or pounds)
  • Set the name of the part to something like: [mass] ~ [units] ~ [Material] ~ "Cube"
  • Selection of regular shapes (cube, sphere, half sphere, regular cylinder, tetrahedron)
  • Improve icon
  • Materials selection (steel, aluminum, brass, etc)
https://cad.onshape.com/documents/83c9763bb79238dbc9aa8331/w/9e6d28a752d1b8ebaaca9510/e/80ee92d8ee464bb4db6bb7da

Any improvement idea?
Anyone find this cube useful?


Comments

  • Options
    glen_dewsburyglen_dewsbury Member Posts: 578 ✭✭✭
    Cool. Counter weights and the like.
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,713 PRO
    edited November 2022
    Welcome to the FS club! This is cool.

    Oo your first feature has an icon  B)

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    STEGSTEG Member, User Group Leader Posts: 76 PRO
    Welcome to the FS club! This is cool.

    Oo your first feature has an icon  B)
    Yes an icon on my 1st FS, I'm so fancy!  ;)
  • Options
    Evan_ReeseEvan_Reese Member Posts: 2,064 PRO
    cool! I like it.

    It seems like an easy next-step is to add a place to type in your material density. It's maybe a little more cumbersome to use than a whole material library, but it would make it unlimitedly flexible.

    Eventually, you could add a dropdown with all the materials you want and when you pick one, it could change the density value, or if you change the density value it would set the material dropdown to say "custom" kind of like the hole feature. This would use the Editing Logic Function which you can read about here.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • Options
    STEGSTEG Member, User Group Leader Posts: 76 PRO
    edited November 2022
    cool! I like it.

    It seems like an easy next-step is to add a place to type in your material density. It's maybe a little more cumbersome to use than a whole material library, but it would make it unlimitedly flexible.

    Eventually, you could add a dropdown with all the materials you want and when you pick one, it could change the density value, or if you change the density value it would set the material dropdown to say "custom" kind of like the hole feature. This would use the Editing Logic Function which you can read about here.
    My first idea was to create a dropdown list of materials to select from but I like your idea. It sounds a bit more advanced than where I think I am but it could be an interesting challenge!  :)

    I particularly like this:  :D

  • Options
    Evan_ReeseEvan_Reese Member Posts: 2,064 PRO
    edited November 2022
    I may yet release a super annoying feature on April 1, haha

    If you decide to implement it, and want any pointers on structure ahead of time, or get stuck. I'm happy to help and I know others would be too. One hint is to make a map with all of your materials and densities (ignore my nonsense numbers):
    const materialDensitites = {
    "Steel" : 1000,
    "Foam" : 0.5,
    "Aluminum" : 300,
    };
    Then you can get at them with the enum from the drop down something a bit like this. This exact code may not be right, I've not checked, but the idea is there.
    const density = materialDensities[MaterialEnum];

    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • Options
    STEGSTEG Member, User Group Leader Posts: 76 PRO
    @Evan_Reese merci c'est très apprécié! Je vais y jeter un oeil prochainement.
Sign In or Register to comment.