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.
What is wrong with my code
chisimdi_onyenze532
Member Posts: 2 EDU
// Feature to create the frame for combat robot
export const createCombatRobotFrame = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Width", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 }
definition.width is ValueWithUnits;
annotation { "Name" : "Length", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 }
definition.length is ValueWithUnits;
annotation { "Name" : "Height", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 }
definition.height is ValueWithUnits;
}
{
// Define parameters for the frame
const width = getParameter(definition, "width");
const length = getParameter(definition, "length");
const height = getParameter(definition, "height");
// Create sketch for the frame
const sketchPlane = plane(normalId: qCreatedBy(makeId("Top")), pointOnPlane: vector(0,0,0) * inch);
const sketch = newSketch(context, {
"sketchPlane" : sketchPlane
});
// Create frame geometry
skRectangle(sketch, "frame", {
"firstCorner" : vector(0, 0) * meter,
"secondCorner" : vector(width, length) * meter
});
// Extrude the sketch to create the frame
extrude(context, id + "frameExtrude", {
"entities" : qSketchRegion(id + "frameSketch", true),
"direction" : vector(0, 0, height) * meter,
"endBound" : BoundingType.BLIND,
"endBoundLength" : height * meter
});
}
);
0
Comments
FeatureScript is a powerful domain-specific language. It obeys programming language conventions you mostly know, but where it's different, it's quite different, particularly around working with topology and geometry. The tutorials are the place to start.
Without sharing the doc, it's hard to see your errors (look in the FeatureScript Notices panel). At the very least, nothing exists in your sketch until you `skSolve(..)` the sketch, but this should be apparent once you start doing the tutorials.