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.

new Featurescript: Statics Solver

joshtargojoshtargo Member Posts: 267 EDU
edited November 15 in FeatureScript

I needed to calculate the force on a cable for a robot, so I decided to do it the hard way, but writing a FS to do it.

Link: Statics Solver

Pick your force locations (where they touch the object, flip the direction as desired. Outputs curves that are named and scaled to the force magnitude..

Can only do up to 3 unknowns, due to math.

Need to add checks for planar, and also make it work for any plane, currently hard-coded for YZ

Comments

  • joshtargojoshtargo Member Posts: 267 EDU

    It gives live results as the sketch is changed with config variables

  • martin_kopplowmartin_kopplow Member Posts: 534 PRO

    Cool! :0) Could be helpful in conceptual design.

  • joshtargojoshtargo Member Posts: 267 EDU

    If I can make this, they can easily incorporate it.

    Lmk if you find some of the many deficiencies in my FS.

  • Ste_WilsonSte_Wilson Member Posts: 365 EDU

    Slightly (a lot) off topic but might be of interest to you @joshtargo, I created a document to calculate the forces in a simple frame using a Funicular polygon.

    It's just for the one frame, I don't know how it could be set up for a more general solution.

    It also can't determine if the members are struts or ties. I've no idea on where one might start getting directional information, though some discussions on here about vectors make me think it might be possible.

    https://cad.onshape.com/documents/30632144ce1febd02d23f53f/w/cedb008c7872131437eb95d8/e/758d3241e9b203083846ed97

  • joshtargojoshtargo Member Posts: 267 EDU

    Im not familiar with that method. Mine uses 3d force vectors and their moments to calculate the unknown forces and directions.

  • Ste_WilsonSte_Wilson Member Posts: 365 EDU

    I've a video that goes through it if your interested, but, it's 40 mins of your life you'll never get back :)

  • joshtargojoshtargo Member Posts: 267 EDU

    I think doing this in FS allows us to calculate the unknowns mathematically, but I could write something that does this.

  • joshtargojoshtargo Member Posts: 267 EDU
    edited November 18

    Updated Static Solver today to include multiple known forces, which the FS will combine into a single resultant force.

    Static Solver FS link

  • joshtargojoshtargo Member Posts: 267 EDU

  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO

    This is very cool!


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO
    edited November 18

    I really wish we could just click peoples names on the forum and see all of the custom features that they have published.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • joshtargojoshtargo Member Posts: 267 EDU

    Thanks! @MichaelPascoe I think so too, but nobody seems to care. this is an actual useful tool that I don't think exists yet. let me know if you have improvement ideas. I wish we could do code review so i learn how to do things more efficiently!

  • joshtargojoshtargo Member Posts: 267 EDU

    a few things are bugging me about the input ui.

    1. using array in the definition does not automatically select the correct input box like it does using normal individual queries
    2. when i ask for a force, I need both a location and direction, so I'm using implicit Mate connectors, but maybe there's a less confusing way. this is tricky because a force arrow might need to appear at either end of the chosen line, pointing either direction, and appear point first or tail first. this is essentially an ALLOWS_AXIS and two BOOLEANS (parameter 1 or 0) and extractDirection + or -

  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO
    edited November 19
    1. I believe the UIHint.FOCUS_INNER_QUERY will let you choose which input is auto focused when adding new items to an array. You could make your array selection driven, this way the user won't have to click the button every time they want to add a new force.
    2. You can add a manipulator arrow to the selected line and have it so that when the user clicks the arrow it toggles the direction. Manipulators are a great way to simplify the UI and make it more intuitive for the user.

    Regarding code review:
    Everything I have learned about FS I'm putting into the CADSharp FeatureScript Video Tutorials. If you learn the content from those lessons, then you will pretty much know what I know about FS. More lessons are still coming out weekly.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • joshtargojoshtargo Member Posts: 267 EDU

    I cleaned up the UI quite a bit today. I tried a linear manip, but decided to make it even more simple. And the focus thing worked well.

Sign In or Register to comment.