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.

Why does this editing Logic query not work

dave_cowdendave_cowden Member, Developers Posts: 445 ✭✭✭
I have a feature that accepts both an edge and a face.  My goal is to use an editing logic function to pre-populate the face that contains the provide edge, if there is one.

In the example below, you can see that the editing logic does select a face. But then there is an error assigning it to the definition: "Editing logic result Parameter "face" does not satisfy spec. But it should, because it is clearly a query.

What am I missing?

Complete code:

FeatureScript 370;import(path : "onshape/std/geometry.fs", version : "370.0");
annotation { "Feature Type Name" : "My Feature", "Editing Logic Function" : "editLogic" }export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)    precondition    {                annotation { "Name" : "EDGE","Filter" : EntityType.EDGE }        definition.edge is Query;                                 annotation { "Name" : "Surface","Filter" : EntityType.FACE }        definition.face is Query;             }    {        debug(context,definition.face);        });
//You can also add a boolean argument to the cPlaneLogic function as the last argument //(this is currently undocumented but it makes the logic function run when the feature is edited, not just created).export function editLogic(context is Context, id is Id, oldDefinition is map, definition is map,                              isCreating is boolean, specifiedParameters is map, hiddenBodies is Query) returns map {        if (oldDefinition == {} ){
        var pnt = evEdgeTangentLine(context, {                "edge" : definition.edge,                "parameter" : 0        });                var p = qNthElement(qContainsPoint(qEverything(EntityType.FACE),pnt.origin),1);        debug(context,p);        definition.face = p;                }    return definition;    }


  • korikori Onshape Employees Posts: 17
    This is a bug that will be fixed in the next update.  Thanks for reporting it!
  • dave_cowdendave_cowden Member, Developers Posts: 445 ✭✭✭
    alright thanks!
Sign In or Register to comment.