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.

Implicit mate connectors act differently than explicit ones

Evan_ReeseEvan_Reese Member Posts: 1,426 PRO
edited March 2021 in FeatureScript
I'm trying to troubleshoot an issue with Freeform Spline that prevents use of implicit mate connectors. Explicit ones made by the Mate Connector feature work as expected.

I've fiddled with a number of things and I think it has something to do with the editing logic function or UIHint.MATCH_LAST_ARRAY_ITEM or a combination of both. In some experiments in a very simplified test featurescript I can see that when I first select an implicit mate connector, it works fine, but when I do something to somehow invoke the editing logic and return the definition, my implicit mate connectors go from

queryType : UNION , subqueries : [ { bodyType : [ MATE_CONNECTOR ] , queryType : BODY_TYPE , subquery : { entityType : BODY , featureId : [ FfIsGModT0M1mWG ] , queryType : CREATED_BY } } ] }


{ queryType : UNION , subqueries : [ { entityType : BODY , historyType : CREATION , operationId : [ FfIsGModT0M1mWG.mateConnectorOp ] , queryType : DUMMY } ] }

What's going on here and is it something I can fix? What's a dummy query?

Other strange things happen too, like sometimes when I select an implicit mate it just says "missing entity", or looks fine, but doesn't place the point at the origin. It's possible that my feral code upbringing has created poor habits and I have just gotten myself tangled up in my spaghetti code. Any help is appreciated.
Evan Reese / Principal and Industrial Designer with Ovyl
Website: ovyl.io


  • Alex_KempenAlex_Kempen Member Posts: 219 EDU
    Okay, here's a few general comments about how you can improve your editing logic function. Generally, I think spending some time cleaning things up and ensuring the editing logic is running when you expect it to and isn't erroring out or ending out prematurely will go a long way towards making it easier to troubleshoot your issues.
    export function freeSplineEditingLogic(context is Context, id is Id, oldDefinition is map, definition is map,
       isCreating is boolean, specifiedParameters is map, hiddenBodies is Query) returns map
    If you aren't using hiddenBodies, you can remove it to get better performance
    I would recommend using the functions I wrote in the following document to more efficiently determine when your array parameter changes
    It will also help prevent errors from causing your editing logic to terminate early
    It can be found here:
    As to your issue with inputs becoming invalid, I think it has something to do with not handling mate connectors and vertices properly
    Remember, mate connectors are special types of point bodies; they have EntityType.BODY and BodyType.MATE_CONNECTOR
    Verticies, on the other hand, are points, and accordingly have EntityType.VERTEX
    Both can be evaluated with evVertexPoint
    I would double check anywhere you are updating the definition of your input query to make sure you are overriding it properly
    To make your code easier to troubleshoot, I would use only one return definition at the very end of your editing logic
    This will prevent the editing logic from returning prematurely
    I hope this helps!
  • Evan_ReeseEvan_Reese Member Posts: 1,426 PRO
    Thanks for this Alex. This helped me diagnose that I was using a flimsy method to check whether the query is a vertex/mate or an edge. I've got something a bit better now and it seems to work. I'm aware of at least one more bug I want to fix before I push out an update to the feature though. I appreciate the input.

    I'd still like to know what a dummy query is, though. Anybody?
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • Alex_KempenAlex_Kempen Member Posts: 219 EDU
    edited March 2021
    The documentation includes it, but does not say specifically what it is for. I think they're used for situations where you select a piece of geometry with a query, and then delete the thing that the query was pointing towards; the query still exists, but it doesn't point to anything specifically, and it no longer affects the feature.
  • mahirmahir Member, Developers Posts: 1,213 ✭✭✭✭✭
    I could be wrong, but it seems dummyQuery is used to convert a known entity into a query, possibly for debugging purposes when trying to test a feature/function that requires a query input.
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,120
    A dummy query is actually a query automatically generated by Onshape in cases when there isn't any information about the history of an entity, other than the feature id.

    BTW, I will be at the FeatureScript networking session tomorrow with Kevin and Lana (who knows more about FS queries, especially automatically generated ones, than anyone else).
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.