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.
Get corresponding queries in patterned things?
EvanReese
Member, Mentor Posts: 2,676 PRO
I'm toying around with something to do with patterned sketches, and would like to have users choose a point on the input sketch and let the feature query all of the "same point" in the patterned ones. Any ideas?
It seems like if I reference it with an external feature (like 3D points) then pattern both features it works, but how can I do it without having to create another feature? Can I perhaps create that feature inside of my feature and then pattern it all in one go? I wrote another feature that just adds points and tried this, but it doesn't seem to do what I want. I makes one point, but doesn't seem to pattern with applyPattern like the sketch does.
const featuresToPattern = mergeMaps(definition.sketches, {[id + "makeSketchPoints"] : addPoint(context, id + "makeSketchPoints", {points : definition.points})} as FeatureList);
Answers
what you need is :
startTracking(context is Context, subquery is Query) returns Query
given the subquery it returns you the query which will resolve to multiple child entities in pattern instances after pattern is created.
Sound like you doing something similar to Curve generator FS?
@Konst_Sh Thanks! yeah it's similar. tbh I was working with your feature and wasn't able to get it to do what I wanted in a certain case, and kinda went down a rabbit hole with it. Yours looks for sketch points, right? I'm hoping to allow the user to choose the points (even on a part), and to allow multiple variables in an array param. At this point, it's kind of morphing into a more general feature-patterning thing, with some ability to trace points if desired.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
When I was making mine I didn't know how to track entities with tracking query, but I found that evaluated entities order in every pattern instance query is consistent, so I just relied on that and it turned to be good enough - was just getting all the points in all the instances and then transpose that data set to get individual traces of each point.
Now I'm curious what was your case for that feature?
Well the thing that got me curious about it was a sliding door kind of a thing that traced an unintuitive path. I think should have worked with it, but I was struggling to do it, so I ended up patterning it manually. With the help of 3D points and Query Variable, I was still able to get a parametric query for the points to do a fit spline through.
Oh btw, now that approximateSpline is here I'm opting for that over fit spline, so that's another reason to explore. But mostly, I'm just following my curiosity and seeing where it goes.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
The topology utilities file in the std library has some functions that might be useful:
https://cad.onshape.com/documents/12312312345abcabcabcdeff/v/abf8418eca794c31e027950d/e/d7bf5b4a972f78db54f09203
connectedComponents
clusterBodies
Combined with some curve definitions, or just a geometric hash you might be able to guess the point that has been patterned.
You can use the power of knowing everything about the selected point (adjacent edges, their lengths, directions, etc).
Custom FeatureScript and Onshape Integrated Applications
Thanks, Caden. I've been meaning to dig in before I reply, but I'm side tracked and I don't wanna leave you hanging. On a skim that could be the ticket.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com