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
-
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.
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
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.
0 -
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.www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
Thank you.
evPathTangentLines works in my quick tests but the documentation for constructPath says:
"The edges are ordered with query evaluation order, so a
qUnionshould 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?
0 -
It seems the edge order doesn't matter as evPathLength evaluates correctly irrespective of edge order.
0
