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.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Instantiate and Query Preservation?
chadstoltzfus
Member, Developers, csevp Posts: 138 PRO
I am attempting to store queries(of edges) in a FeatureScript attribute of parts, and then derive those parts into another context. It seems to not preserve the query when using the instantiate function and I'm guessing that's because opMergeContexts() doesn't go into FeatureScript attributes. Is there a way I can go and merge the contexts of the queries stored in FeatureScript attributes or do I have to do some other kind of workaround?
Applications Developer at Premier Custom Built
chadstoltzfus@premiercb.com
chadstoltzfus@premiercb.com
Tagged:
0
Comments
The attributes should stay, I'm surprised if they were lost in opMergeContexts() but the queries stashed in those attributes would not be valid in the context calling merge. Notice that opMergeContexts can accept trackThroughMerge array of queries and return array of corresponding evaluation results after merge. That would be a better way of handling this.
chadstoltzfus@premiercb.com
The likely issue you're seeing here is that getAttributes(...{"entities" : oldQuery )) doesn't work because oldQuery doesn't resolve to anything in the new context. That can be solved by replacing oldQuery with a working query (such as a specific qAttributeQuery()), or by passing in oldQuery in the "trackThroughMerge" argument to opMergeContexts, or the "queriesToTrack" option of derive().
To your last question: If you're rolling your own code with opMergeContexts, it's perfectly possible to resolve a query in another context e.g.
..but I wouldn't recommend writing code like that for most applications, since the high-level instantiator (or the less-high-level derive()) are easier to work with than low-level code like above.
chadstoltzfus@premiercb.com
@kevin_o_toole_1
@lana
I did modify my copy of instantiator.fs a little while ago to enable tracking through the instantiate.
This was so I could track a sketch region through the instantiate (The feature I was using it for is also in the document)
See the link below:
https://cad.onshape.com/documents/2ad339efe44128f5171291fa/w/400f27295a4447ca3ac2d504/e/30d9197c261899fd3f9c28f4
IR for AS/NZS 1100
IR for AS/NZS 1100