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.

Welcome to Feature Script - Modify to fSphere

bruce_williamsbruce_williams Member, Developers Posts: 842 EDU
edited January 2017 in FeatureScript
I am playing with Cody's simple intro of 90 second FS to make cylinder.  No problem with fCylinder and fCuboid.  

When I try fSphere I get error -- Precondition failed (isLength(definition.radius, NONNEGATIVE_LENGTH_BOUNDS))

Here is the code -

FeatureScript 477;
import(path : "onshape/std/geometry.fs", version : "477.0");

annotation { "Feature Type Name" : "My Feature" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        annotation { "Name" : "My Length" }
        isLength(definition.myLength, LENGTH_BOUNDS);
        // Define the parameters of the feature type
    }
    {
        fSphere(context, id, definition.myLength);
    });

What is the fSphere needing to work?


www.accuratepattern.com

Best Answer

Answers

  • William_BarronWilliam_Barron Member Posts: 5
    This works (I haven't looked at Cody's stuff)...

    annotation { "Feature Type Name" : "My Feature" }
    export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Radius" }
            isLength(definition.radius, LENGTH_BOUNDS);
            // Define the parameters of the feature type
        }
        {
            fSphere(context, id, definition);
        });

  • bruce_williamsbruce_williams Member, Developers Posts: 842 EDU
    Thank you for the quick answer @William_Barron !  It greatly helps to see your solution and not be 'stuck' on this point.  

    I have a LONG ways to go....  Folks like you that help out on the forum make it feel even more possible to learn FS.
    www.accuratepattern.com
Sign In or Register to comment.