Problem Extruding using FeatureScript

Good afternoon, 

I am trying to learn Featurescript and I am having problems extruding when writing the code. I already went through multiple YouTube videos and other examples, though they are older versions! 

I want the Function to ask me what sketches I want to extrude, and then extrude them. 

My code looks like the following:
FeatureScript 2221;
import(path : "onshape/std/common.fs", version : "2221.0");

annotation { "Feature Type Name" : "SketchYInserter" }
export const SketchYInserter = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        // Define the parameters of the feature typea
        annotation { "Name" : "Location", "Filter" : EntityType.EDGE }
        definition.myQuery is Query;
    }
    {
        // Define the function's action
        opExtrude(context, id + "extrude1", {
                "entities" : definition.myQuery,
                // "entities" : entities,
                // "direction" : evOwnerSketchPlane(context, {"entity" : entities}).normal,
                "endBound" : BoundingType.BLIND,
                "endDepth" : 1 * inch
        });
        
        
    });

Best Answer

  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image
    Answer ✓
    For a start, you can only extrude a face (unless you want to extrude a surface) plus it looks like direction is commented out. 
    Senior Director, Technical Services, EMEA

Answers

  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image
    Answer ✓
    For a start, you can only extrude a face (unless you want to extrude a surface) plus it looks like direction is commented out. 
    Senior Director, Technical Services, EMEA