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.
FS 355 Bug: isInteger with (unitless) bounds throwing ValueWithUnits error in Part Studio
malory_heliotis
Member Posts: 2 ✭
Description
Issue:
I am developing a custom Sprocket Tool using FeatureScript 355. I am encountering a persistent runtime error in the Part Studio that prevents the feature from regenerating, despite the code passing the Feature Studio's static analysis.
Error Message in Part Studio:
Precondition of defineBounds failed (canBeBoundSpec(boundSpec))onshape/std/valueBounds.fs:388:9 (value.min is ValueWithUnits)
The Code:The error is triggered by the following unitless parameter definition:
export const MY_Teeth_Bounds = { (unitless) : [3, 18, 500] } as IntegerBoundSpec;
annotation { "Name" : "Number of Teeth" }
isInteger(definition.numTeeth, MY_Teeth_Bounds);
Observations:
- The Feature Studio notices show no errors; the function is recognized as "conforming" and the bounds are recognized as a "map" and a "range."
- The error
value.min is ValueWithUnitssuggests that the FS 355 runtime is incorrectly attempting to validate theunitlessminimum value (3) against a physical length unit (likely millimeters or meters). - I have attempted several workarounds, including:
- Using
isRealwithRealBoundSpec. - Moving the map definition directly into the
isIntegercall (late-binding). - Using raw arrays
[3, 18, 500](which clears the Part Studio error but causes the Feature Studio to mark the function as "Nonconforming").
- Using
Environment:
- FeatureScript Version: 355
- Standard Library:
onshape/std/geometry.fsversion355.0
Is this a known issue with the legacy valueBounds.fs in version 355, and is there a recommended way to define unitless integer ranges in this version that satisfies both the static analyzer and the Part Studio runtime?
Answers
Any particular reason you are using a version of the standard library from May 16th 2016? Try it with the latest (2945) and report back.