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.
Re-apply attributes to patterned entities
leon_poot
Member, Developers Posts: 87 ✭✭✭
Let's say I'm (linear) patterning a couple of bodies. Some of these have been given a specific attribute using FeatureScript ({"A" : true}), some others another attribute ({"B" : true}). The new bodies apparently don't get the attributes, which I'll need for later boolean operations!
The instance count is based on a parametric variable, and there's no knowing how many instances there'll be, so I can't manually be setting the attributes for all the new instances. I'm thinking of somehow reading which parts have which attribute, and then re-applying these to each new instance.
So what I really need is to be able to query all patterned instances of a specific part. Any idea how do this, anyone?
The instance count is based on a parametric variable, and there's no knowing how many instances there'll be, so I can't manually be setting the attributes for all the new instances. I'm thinking of somehow reading which parts have which attribute, and then re-applying these to each new instance.
So what I really need is to be able to query all patterned instances of a specific part. Any idea how do this, anyone?
"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
Tagged:
0
Best Answer
-
lana Onshape Employees Posts: 704@leon_poot
To make sure I understand your use case correctly. It sounds like you expect to get the pattern seed body as an input of your custom feature and are looking for a way to find all the patterned instances. Would having the pattern feature as an input parameter work for you? In this case you can use qCreatedBy(). qDependency() should work for matching result with the source.5
Answers
var trackingAQuery = startTracking(context, bodyA);
opPattern(..)
instancesA = evaluateQuery(context, trackingAQuery) ;
This should give you all the instances of bodyA created by pattern.
To make sure I understand your use case correctly. It sounds like you expect to get the pattern seed body as an input of your custom feature and are looking for a way to find all the patterned instances. Would having the pattern feature as an input parameter work for you? In this case you can use qCreatedBy(). qDependency() should work for matching result with the source.