Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

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

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,688
    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, EMEAI

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,688
    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, EMEAI
Sign In or Register to comment.