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

Variables and Equations based Parametric Modeling Vs. FeatureScript

A_Reed048A_Reed048 Member Posts: 6
Hello,

I've been using solid modeling software since 2003 (Inventor then SolidWorks) and for the sake of our FIRST team I am considering switching to Onshape so I'm giving it a try to see if I can translate my knowledge and experience from the last 21 years into this new system.

The part linked below is one of the more complex examples of a parametric part we often use in Solidworks. Saved as a part template anyone with access can generate a new file, modify a few global variables in the equation editor, click 'Ok' to solve and regenerate the part, and have a new herringbone gear for use in one of our mechanisms. I was able to use variables and very similar modeling techniques to generate more or less the same file in OnShape but when I attempt to edit one of the variables as I would in SW something in the solve order doesn't work out and it doesn't properly rebuild.

Is this functionality something I can achieve with Variables and Equations or will it require me to learn a whole new skill set of coding in FeatureScript? I know full well I could probably find a close enough match in the community's MKCAD library but for maximum flexibility, especially with such a short season, I want to know what I can and can't generate on my own skills.

I should note that I am terrible at coding and I would hope there is a way to achieve this with modeling practices that have been pretty standard in terrestrial CAD for quite a while. Otherwise, I have the feeling I'll have to put in a couple hundred hours over the summer on the FS support page learning how to piece together bits of code.


https://cad.onshape.com/documents/0063b1f0a3bc50bd69b9f661/w/4476560b317452c345397837/e/9f3493a17ea3fb64f7b5ca85?renderMode=0&uiState=66229d47f532d9514b37e610

Best Answer

  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,414
    Answer ✓
    I dunno? Why not try it and see?
    Senior Director, Technical Services, EMEAI

Answers

  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,414
    edited April 19
    No need - already done - just add it to your toolbar rather than making a copy of the doc.
    https://cad.onshape.com/documents/5742c8cde4b06c68b362d748/w/b493e0cb681bbf9497d9f4b3/e/c72760543a0d4412e72f6d38
    Senior Director, Technical Services, EMEAI
  • Options
    A_Reed048A_Reed048 Member Posts: 6
    I get that there are spur gear FeatureScripts available, how do I use this to generate helical gears and even more importantly herringbone gears?

    NeilCooke said:
    No need - already done - just add it to your toolbar rather than making a copy of the doc.
    https://cad.onshape.com/documents/5742c8cde4b06c68b362d748/w/b493e0cb681bbf9497d9f4b3/e/c72760543a0d4412e72f6d38

  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,414
    Answer ✓
    I dunno? Why not try it and see?
    Senior Director, Technical Services, EMEAI
  • Options
    A_Reed048A_Reed048 Member Posts: 6
    NeilCooke said:
    I dunno? Why not try it and see?
    My apologies for not taking a few minutes to inspect it the first time, I feel like a dummy. This should work for this specific application but I do still question the solve order of parts causing conflicts and errors vs. learning FeatureScript. I'm the type that will take the extra hour to model something to be as parametrically flexible as possible because I know at some point I'm going to have to tweak it or make a copy at some point. I've done cams, cycloidal discs, EC gearing, multibody frames, linkages, etc. that were all driven by the equation page in SW without the model breaking due to solver errors. Am I better off learning to make these "template" files through FeatureScript or are they achievable with the equations features and solve order?

    I suppose it is somewhat a case by case basis but the last thing I want is a hard-stop stumbling block right in the middle of our very short season. Sorry, I'm probably overthinking a lot of this and need to just learn more about the software and become as flexible and agile with it as I am with SolidWorks.
  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,414
    Anything that you can do in SW you can do in Onshape (more or less). Not sure what you mean by "solve order", but you might be better off using configuration variables so parts can be configured on-the-fly without having to copy them each time.
    Senior Director, Technical Services, EMEAI
  • Options
    _anton_anton Member, Onshape Employees Posts: 279
    I think an implied question here is about the stability of this feature. The feature's source code is referenced at a version and is thus immutable; further, we practically guarantee that the same feature with the same inputs will generate exactly the same part forever.

    Neil is right about configs; if you need multiple similar gears, you can make a Part Studio with a feature that generates a gear, and configure that feature's inputs. Then you can get multiple variants of the same gear to import into other tabs.
  • Options
    A_Reed048A_Reed048 Member Posts: 6
    I don't have any doubts about the robustness of the FeatureScript and I get how it works as an insertable feature within a part studio.

    I am trying to compare it to my ability to create a part file in Solidworks, link a bunch of sketch dimensions and feature parameters to Global Variables and Equations and save it off as a part template to be used any time I need a gear, or cycloidal disc, or cam, etc. If done cleanly in Solidworks the software is able to figure out the solve order for the global variables and equations before rebuilding the part such that it generates a part with all of the changes and no errors. I tried to use the same techniques in the part file linked above and it appears to have stumbled on the order in which it regenerates the feature tree from the top down.

    I'm going to guess the answer to my own question at this point that FeatureScript is going to be a more robust solution to generating "toolbox" or "template" parts that can be used from year to year between different projects. Equations at the top of the tree are probably better off for single use parts.

    I guess I need to learn FeatureScript coding if I want to be as flexible with this as I am with Solidworks. Thanks.
  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,414
    OK, it's true that Onshape requires variables to be solved in the correct order. Perhaps you could spend the extra hour ordering them correclty :smiley:

    Joking aside, another option would be to build just the equations in FeatureScript (so you have a full programming language to do whatever calcs you need, but they will have to be in order :smiley:), then model everything manually using those variables.
    Senior Director, Technical Services, EMEAI
  • Options
    steve_shubinsteve_shubin Member Posts: 1,068 ✭✭✭✭
    edited April 23
    @A_Reed048

    Aside from what is discussed above, one thing about your document that could certainly be problematic is that Sketch 3 is not fully constrained

Sign In or Register to comment.