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.
qAdjacent edge sequence
Hi,
I have a number of rectangular parts from which I'm deriving the edges using qAdjacent(part, AdjacencyType.EDGE, EntityType.EDGE)
I need to know the order of the edges but the results returned from qAdjacent seem to vary - the test document shows three parts with the edges highlighted via debug statements.
Is there a way to determine which edge is which, ie top, bottom, LHS, RHS?
https://cad.onshape.com/documents/ed4edba2105798681d7629df/w/5a8490b09dbcce1046e7fcad/e/16dc537a4d8436f6270266c8
Any help appreciated.
Thank you.
Best Answer
-
graham_lock Member Posts: 142 PRO
It seems the edge order doesn't matter as evPathLength evaluates correctly irrespective of edge order.
0
Answers
The order of qAdjacent is always going to be arbitrary. But you also need to define what you consider "top". Is it the edge in the most positive Z direction? Is it relative to the orientation of the face? Does it rely on other feature input?
You have options, but without knowing what your goal is its hard to suggest an answer:
qClosestTo, with a test point. Or qFarthestAlong and a direction.
You could use qParallel, but then that groups top/bottom, and LHS/RHS.
exBox3d for each edge and compare to the overall rectangle.
Custom FeatureScript and Onshape Integrated Applications
Thanks Caden.
So currently I have rectangular parts, eventually the parts will also consist of lines, splines and arcs but there will always be a longest vertical edge on the 'LHS' (least positive in X direction?).
Yes, 'top' will be the most positive Z direction.
My goal is to be able to place a point on the perimeter at a given percentage of its length from a given starting point which means I need to walk the edges in sequence summing their lengths to find the edge where the point will be placed, then use evEdgeTangentLines with a calculated percentage offset on that edge and then using the line origin as the location to place the opPoint?
I've updated the test document to show a representative part shape using a mix of lines and a spline.
https://cad.onshape.com/documents/ed4edba2105798681d7629df/w/5a8490b09dbcce1046e7fcad/e/16dc537a4d8436f6270266c8
Thank you.
If you are walking along the edges you probably want a constructPath.
You can use evPathTangentLines to find a point a percentage along the path.
Custom FeatureScript and Onshape Integrated Applications
Thank you.
evPathTangentLines works in my quick tests but the documentation for constructPath says:
"The edges are ordered with query evaluation order, so a
qUnion
should be used to ensure a stable ordering"Since I'm only interested in the offset along the path is the edge order passed to constructPath actually important?
It seems the edge order doesn't matter as evPathLength evaluates correctly irrespective of edge order.