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.

FS 355 Bug: isInteger with (unitless) bounds throwing ValueWithUnits error in Part Studio

malory_heliotismalory_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:

  1. The Feature Studio notices show no errors; the function is recognized as "conforming" and the bounds are recognized as a "map" and a "range."
  2. The error value.min is ValueWithUnits suggests that the FS 355 runtime is incorrectly attempting to validate the unitless minimum value (3) against a physical length unit (likely millimeters or meters).
  3. I have attempted several workarounds, including:
    • Using isReal with RealBoundSpec.
    • Moving the map definition directly into the isInteger call (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").

Environment:

  • FeatureScript Version: 355
  • Standard Library: onshape/std/geometry.fs version 355.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?

Tagged:

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 6,023 image

    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.

    Senior Director, Technical Services, EMEA
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.