Why does this editing Logic query not work
dave_cowden
Member, Developers Posts: 484 ✭✭✭
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:
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:
<br><div>FeatureScript 370;</div><div>import(path : "onshape/std/geometry.fs", version : "370.0");</div><div><br></div><div>annotation { "Feature Type Name" : "My Feature", "Editing Logic Function" : "editLogic" }</div><div>export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)</div><div> precondition</div><div> { </div><div> annotation { "Name" : "EDGE","Filter" : EntityType.EDGE }</div><div> definition.edge is Query; </div><div> </div><div> annotation { "Name" : "Surface","Filter" : EntityType.FACE }</div><div> definition.face is Query; </div><div> }</div><div> {</div><div> debug(context,definition.face); </div><div> });</div><div><br></div><div>//You can also add a boolean argument to the cPlaneLogic function as the last argument </div><div>//(this is currently undocumented but it makes the logic function run when the feature is edited, not just created).</div><div>export function editLogic(context is Context, id is Id, oldDefinition is map, definition is map,</div><div> isCreating is boolean, specifiedParameters is map, hiddenBodies is Query) returns map {</div><div> </div><div> if (oldDefinition == {} ){</div><div><br></div><div> var pnt = evEdgeTangentLine(context, {</div><div> "edge" : definition.edge,</div><div> "parameter" : 0</div><div> });</div><div> </div><div> var p = qNthElement(qContainsPoint(qEverything(EntityType.FACE),pnt.origin),1);</div><div> debug(context,p);</div><div> definition.face = p;</div><div> </div><div> }</div><div> return definition;</div><div> </div><div>}</div>0
Answers
-
This is a bug that will be fixed in the next update. Thanks for reporting it!1
-
alright thanks!0

