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.

Re-apply attributes to patterned entities

leon_pootleon_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?
"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:

Best Answer

Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 863 ✭✭✭✭✭
    edited May 2017
    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)
  • lanalana Onshape Employees Posts: 446
    @leon_poot

    var trackingAQuery = startTracking(context, bodyA);
    opPattern(..)
    instancesA  = evaluateQuery(context, trackingAQuery) ;
    This should give you all the instances of bodyA created by pattern. 


  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭
    @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 Harmless
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭
    Ah of course! That should do the trick, thanks :smile:
    "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
Sign In or Register to comment.