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.
Syntax for brackets in feature script
Tom_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); }
});
0
Comments
First error: ChatGPT produces garbage.
Create a new Feature Studio and you’ll see the correct header format.