Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

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.

Defaults in Length Parameter

marcus_bernsteinmarcus_bernstein Member Posts: 15 EDU
Hi Onshape Community,

I am setting up a featurescript where I need a set of length parameters. Is it possible to set the UI default to something other than 1"? 1" Totally breaks the model and looks awful as a default, while setting the default to .125" or something similar would make the Featurescript look nice. Is this possible just in length? Do I need to set up an enum with a bunch of options?

Thanks for the help as always,



  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 694 ✭✭✭✭
    I find it not too convinient but seems like specifying new boundspec is the only way to do it. you don't really need all those options if you not care that your default parameter would look nice if to switch workspace units. the minimal definition of length bounds defaulting to 5 meters  is something like this
    const MY_LENGTH_BOUNDS = { (meter) : [-500, 5, 500] } as LengthBoundSpec;

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 983
    Jake Rosenfeld - Modeling Team
  • mahirmahir Member, Developers Posts: 803 ✭✭✭✭
    Also, if zero is an acceptible default, there are a couple built-in length specs that default to zero (ZERO_DEFAULT_LENGTH_BOUNDS, NONNEGATIVE_ZERO_DEFAULT_LENGTH_BOUNDS).
  • Not the easiest thing in the world but with enough futzing around it works great!

    Thanks for the help!!

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers Posts: 385
    edited December 2017
    A slightly more concise syntax for doing this is:
            annotation { "Name" : "My Length" }
            isLength(definition.myLength, { (inch) : [0, .125, 1e5] } as LengthBoundSpec);
    The three numbers after inch are the minimum, default, and maximum values (respectively).

Sign In or Register to comment.