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.

opRevolve help, syntax

scott_walsh809scott_walsh809 Member Posts: 2
I am very new learning FS.  I am trying to have the user select a plane, enter a few numbers and get a revolve to a solid body.  This code says "Cannot resolve entities", so something must be wrong with my entities query.  

FeatureScript 432;
import(path : "onshape/std/geometry.fs", version : "432.0");

annotation { "Feature Type Name" : "Irevolve" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
        // Define the parameters of the feature type
        annotation { "Name" : "My Query", "Filter" : GeometryType.PLANE, "MaxNumberOfPicks" : 1 }
        definition.myPlane is Query;

        annotation { "Name" : "Diameter 1" }
        isLength(definition.inletID, LENGTH_BOUNDS);

        annotation { "Name" : "Diameter 2" }
        isLength(definition.outletID, LENGTH_BOUNDS);

        annotation { "Name" : "Length" }
        isLength(definition.HubLength, LENGTH_BOUNDS);


        var thissketch = newSketch(context, id, { "sketchPlane" : definition.myPlane });

        skLineSegment(thissketch, "InletPlaneLine", {
                    "start" : vector(0, 0) * inch,
                    "end" : vector(0 * inch, definition.inletID / 2)
        skLineSegment(thissketch, "OutletPlaneLine", {
                    "start" : vector(definition.HubLength, 0 * inch),
                    "end" : vector(definition.HubLength, definition.outletID / 2)

        skLineSegment(thissketch, "HubAxis", {
                    "start" : vector(0, 0) * inch,
                    "end" : vector(definition.HubLength, 0 * inch)

        skLineSegment(thissketch, "HubContour", {
                    "start" : vector(0 * inch, definition.inletID / 2),
                    "end" : vector(definition.HubLength, definition.outletID / 2)

      //  var sketchEdges = qSketchRegion(id + "thissketch", false);

        var myCurves = qSketchRegion(id + "thissketch", true);
        var myAxis = sketchEntityQuery(id + "thissketch", EntityType.EDGE, "HubAxis");

                opRevolve(context, id + "revolve1", {
                        "entities" : myCurves,
                        "axis" : myAxis,
                        "angleForward" : 30 * degree


  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 980
    I can see two issues -- the first is like you suspect that your query is not resolving.  This is because, even though you named the sketch variable "thissketch", the sketch id is just id, whereas you're querying for id + "thissketch".  Changing the sketch creation line to:

    var thissketch = newSketch(context, id + "thissketch", { "sketchPlane" : definition.myPlane });
    makes the queries resolve.
    The second issue is that you're passing a query for an edge to opRevolve, when it takes a Line (at some point I hope to make operations more tolerant of things like that).  To get the revolve to work, change the "axis" line to:

    "axis" : evLine(context, { "edge" : myAxis }),

    which will turn the edge into a line.

    One suggestion for the future is to post a link to a version of your public document instead of copy/pasting text (that makes it easier for helpful folks on the forum to see the exact error).

    Hope this helps!
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • scott_walsh809scott_walsh809 Member Posts: 2
    That worked great!  This is slowly starting to make sense. Thanks for helping me get un-stuck for the moment.
Sign In or Register to comment.