Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.First time visiting? Here are some places to start:
- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
How does the identity tracking/rebustness system work?
I'm having a lot of trouble tracking entities through operations (which I need to do since I'm implementing a feature that performs split and transform operations). Each function related to tracking and queries has some documentation, however I was unable to find any documentation to tie it together so I can understand the system as a whole and really predict what it will do if I write any given code. So here is my understanding and then a bunch of questions. If people can correct me and/or answer my questions that would be great. And I hope the Onshape folks can improve the documentation based on this. I think a section on the tracking system as a whole would really help writing more complex features. I'm not looking for a "how-to" answer here. I'm looking to understand the semantics of entity tracking, so I need abstract descriptions.
OnShape's system for tracking entity identity has two components visible from Featurescript and one(-ish) visible from the part studio:
- Featurescript functions to provide Onshape with tracking information: setExternalDisambiguation, unstableIdComponent
- Featurescript functions to track entities through operations: startTracking, startTrackingIdentity, makeRobustQuery, makeRobustQueriesBatched
- Features can take entities as parameters and those query specifications are robust to changes in previous features (as long as the features involved use #1 above correctly)
I think there are 3 ways a query can integrate with this system:
- Robust queries always select by "identity".
- Tracking queries select "new" entities that are created from existing entities.
- Transient queries do not track at all and become invalid (evaluate an undefined set of entities) if anything is changed.
I think the selections the user does in the part studio are Robust in the sense above and therefor query parameters to features are also robust in this sense. Most query constructors are evaluated everytime they are used, so they will not be stable (their results will change), but will continue to be valid in the sense that they will contain all entities they should. The main exception is evaluateQuery which generates transient queries. Any query which is based on another transient query is also transient.
- What is entity identity? How is it transferred? Is it a single linage for each identity or is it a tree?
- What exactly to tracking queries do and how do the two kinds differ?
- What does setExternalDisambiguation do with respect to the concepts we are talking about here? Does it allow identity to be transferred through an otherwise unstable operation and if so how?
- I was able to track an object through a series of split operations with qUnion(startTracking(context, references1), makeRobustQuery(context, references1)). What exactly does this do? And why is both startTracking and makeRobustQuery apparently needed to pick up all elements resulting form breaking up the object? (If I don't include both parts, I seem to lose entities in some cases, and I cannot figure out the specific situations that cause it.)
- I created a test document to play with this and I while I wasn't able to create a good "minimal example" I did find one case that I cannot explain: https://cad.onshape.com/documents/59879a597ac78c2818ccc58b/w/acd9932bed67765dd5050341/e/e0890c6397964303c0914c94 The feature fails despite the user of makeRobustQuery. If I remove all the messing with the queries everything works fine. How is the parameter query different from a robust query created in the FeatureScript?
I know this is a lot. However, it's all interconnected so I thought talking about it together would be more effective than trying to split it up and only getting "how-to" answers, which is not what I want.