FeatureScript - AguaClara/SWOT GitHub Wiki

Here you can find some tricks and tips with working with FeatureScript and completing Design Challenges in OnShape!

General best practices:

  • Leave a small description of your parameters when you define them, so you don't forget what they are
  • Monitor your design and check your answers often so you only need to find one bug at a time
  • If you have a computer mouse to use, I highly recommend it!
  • In these design challenges it is critical to understand the distinction between parameters and variables. Parameters are the ingredients of your design, and the variables are the results of executing functions on the parameters. In making bread: Your parameters are the water, flour, salt, yeast. Your variables are the dough from combining your parameters according to the recipe. The recipe is the functions you use in your design. If you change the parameters, the "recipe" of your design is the same, but the final product (and intermediate products) will be different.

FeatureScript Specific:

  • Relating the above analogy to the [min, default, max] set-up of FeatureScript: You can add less flour [min] and your dough will be wet (but may still make acceptable bread), you can follow the recipe exactly [default] , or you can add some extra flour [max] and your dough will be dry (but may still make acceptable bread). In all cases you will still get consumable bread. However, outside of those ranges your final design will not be bread. When thinking about your design, you are only using one value of a parameter at a time, similarly to how when you make bread you cannot (within the same loaf) use both less flour and more flour. You can only choose one at a time.
  • The unit naming convention can be tricky, be sure to use this link to remember which letters mean what
  • If you want a variable to have units it must either be 1) defined as a parameter using the naming conventions described in the above link or 2) calculated from previously defined parameters or variable.
  • If you can immediately identify a numerical value of a variable, it should probably be a parameter
  • Also on units: the most general rule is that the last capital letter (or set of capital letters) defines the unit of a parameter.
  • When working to debug, be sure to press commit between edits so your errors messages will update
  • Semicolons and commas can trip you up, be sure to check on them.