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
-
@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
-
maybe is worth to try to obtain the id of body pattern and select all bodies created by operation with corresponding id like this qCreatedBy(lastModifyingOperationId(qOwnerBody(query_of_some_item_of_the_pattern)),EntityType.BODY)0
-
@leon_poot
var trackingAQuery = startTracking(context, bodyA);
opPattern(..)
instancesA = evaluateQuery(context, trackingAQuery) ;
This should give you all the instances of bodyA created by pattern.
0 -
@lana That makes sense... but this would require me do the pattern by FS, I'd much rather be able to fiddle with the parts in the part studio. But I guess I could make a modified pattern script from the std library?"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless0
-
@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 -
Ah of course! That should do the trick, thanks

"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless0


