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.
How to write triangular pyramid in feature script!
yan_myo251
Member Posts: 3 EDU
i've a problem when i write feature script for triangular pyramid,here a prbolem ,Please tell me what i need?
annotation { "Feature Type Name" : "pyramid" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "A" }
isInteger(definition.A, POSITIVE_COUNT_BOUNDS);
annotation { "Name" : "c" }
isInteger(definition.c, POSITIVE_COUNT_BOUNDS);
annotation { "Name" : "n" }
isInteger(definition.n, POSITIVE_COUNT_BOUNDS);
}
{
var L = definition.A; //x
var B = definition.c; // y
// Define the function's action
var sketch1 = newSketch(context, id + "sketch1", {
"sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)
});
skLineSegment(sketch1, "line1", {
"start" : vector(-(L/2), 0) * inch,
"end" : vector(-(L/2), * inch
});
skLineSegment(sketch1, "line2", {
"start" : vector(-(L/2), 0) * inch,
"end" : vector((L/2), 0) * inch
});
skLineSegment(sketch1, "line3", {
"start" : vector(-(L/2), * inch,
"end" : vector(L/2, 0) * inch
});
skSolve(sketch1);
opExtrude(context, id + "extrude1", {
"entities" : qSketchRegion(id + "sketch1"),
"direction" : evPlane(context, {"face" : qSketchRegion(id )}).normal,
//"oppositeDirection" : true
"endBound" : BoundingType.BLIND,
"endDepth" : definition.n
});
});
Tagged:
0