Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
variable default value with MIN and MAX for length input
georg_von_vietinghoff
Member Posts: 9 ✭✭
How can I specify a default value for a length input and also specify a minimum and maximum value? The values are again dependent on a previously made selection.
I found the defineLengthTolerance command in hole.fs, but I can't reproduce it.
I found the defineLengthTolerance command in hole.fs, but I can't reproduce it.
Tagged:
1
Comments
-
A length parameter is specified likeannotation { "Name" : "My Length" }isLength(definition.myLength, LENGTH_BOUNDS);
That LENGTH_BOUNDS is just a map, and you can write your own. For example:annotation { "Name" : "My Length" }isLength(definition.myLength, { (centimeter): [0, 1, 500] } as LengthBoundSpec);0 -
A good autocomplete for this is "Length parameter (custom bounds)" so you can fill in the following:
annotation { "Name" : "My Length" } isLength(definition.myLength, { (inch) : [ -10000, /* min (inclusive) */ 1.0, /* default */ 10000 /* max (inclusive) */ ] } as LengthBoundSpec );One thing to keep in mind is that your defaults can be different in workspaces using different units, which you can do by adding more items to that map. This helps avoid issues where you see defaults with strange decimal values. For example, the default LENGTH_BOUNDS is defined as:export const LENGTH_BOUNDS = { (meter) : [-500, 0.025, 500], (centimeter) : 2.5, (millimeter) : 25.0, (inch) : 1.0, (foot) : 0.1, (yard) : 0.025 } as LengthBoundSpec;0 -
ok, that's the first step in the right direction! Thank you very much for that!If now the values could stand as variable (default, min, max) in the tolerance definition, then I would be again a step further.0
-
something like this

1


