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.

Syntax for brackets in feature script

Tom_RTom_R Member Posts: 2

ChatGPT wrote this for me - I pasted it in to a new feature studio, refreshed the browser. No doubt a very noob error, any thoughts?

FeatureScript 2473;
import(path : "onshape/std/common.fs", version : "2473.0");

export const myBlade2D = defineFeature(function(context, id, definition)
{
precondition {
annotation { "Name" : "Circle Diameter" }
isLength(definition.circleDiameter, LENGTH_BOUNDS); // Ensuring valid length bounds
}

// Feature Logic Here
{
    // Blade dimensions
    const bladeWidth = 62.29 * millimeter;
    const bladeHeight = 120.12 * millimeter;

    // Create the blade shape with a spline
    var sketch = newSketch(context, id + "bladeSketch", {
        "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)
    });
    
    skSolve(sketch);
}

});

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671

    First error: ChatGPT produces garbage.

    Create a new Feature Studio and you’ll see the correct header format.

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