Skip to content

Instantly share code, notes, and snippets.

@zjuhasz
Created July 5, 2016 05:48
Show Gist options
  • Save zjuhasz/5d955be88632149889ab9108b7a47604 to your computer and use it in GitHub Desktop.
Save zjuhasz/5d955be88632149889ab9108b7a47604 to your computer and use it in GitHub Desktop.
FeatureScript 369;
import(path : "onshape/std/geometry.fs", version : "369.0");
annotation { "Feature Type Name" : "Corrugated Extrude" }
export const corrugatedShell = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "Face to extrude", "Filter" : EntityType.FACE && SketchObject.YES, "MaxNumberOfPicks" : 1 }
definition.face is Query;
annotation { "Name" : "Depth" }
isLength(definition.depth, LENGTH_BOUNDS);
annotation { "Name" : "Individual Corrugation Width" }
isLength(definition.corrWidth, LENGTH_BOUNDS);
}
{
// Define the function's action
var plane1 = cPlane(context, id + "plane1", {
"entities" : definition.face,
"cplaneType" : CPlaneType.OFFSET,
"offset" : definition.depth
});
var sketch1 = newSketch(context, id + "sketch1", {
"sketchPlane" : qCreatedBy(id + "plane1", EntityType.FACE)
});
// Create sketch entities here
skCircle(sketch1, "circle1", {
"center" : vector(0, 0) * millimeter,
"radius" : 25 * millimeter
});
skSolve(sketch1);
loft(context, id, {
"sheetProfiles" : qIntersection([qCreatedBy(id + "circle1", EntityType.BODY), qCreatedBy(id + "sketch1", EntityType.BODY)]),
"profileSubqueries" : [qCreatedBy(id + "circle1", EntityType.BODY), qCreatedBy(id + "sketch1", EntityType.BODY)]
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment