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.

# How to find all intersections points of an edge chain with a plane

brad_phelan
Member Posts:

**89**✭✭
For example I have the loop of a face by

var loop = qLoopEdges(def.face);

and I have a plane p

var p = plane(....);

and I would like to find all the intersection points of this loop with the plane. Is there an inbuilt function to do this?

More precisley if I have selected the sketch face in grey I would like to find the intersection of all the dashed planes with the loop of the face. The dashed planes are not sketched by hand they just represent the planes I wish to cut with.

The spacing and direction of the planes can be assumed to be known.

var direction = vector(...);

var spacing = ...;

For each line I want the list of intersection points with this loop.

var loop = qLoopEdges(def.face);

and I have a plane p

var p = plane(....);

and I would like to find all the intersection points of this loop with the plane. Is there an inbuilt function to do this?

More precisley if I have selected the sketch face in grey I would like to find the intersection of all the dashed planes with the loop of the face. The dashed planes are not sketched by hand they just represent the planes I wish to cut with.

The spacing and direction of the planes can be assumed to be known.

var direction = vector(...);

var spacing = ...;

For each line I want the list of intersection points with this loop.

Tagged:

0

## Comments

1,221✭✭✭✭✭89✭✭1,221✭✭✭✭✭you can look for builtin project curve feature in standart library source, it uses some hidden parameter in opBoolean to find intersection curve of two surfaces

1,206Another option is to require your loop to consist of monotone segments w.r.t. the direction perpendicular to the lines, group them into monotone chains, and do evDistance between each line and each chain -- I think I've seen a version of your code that does that -- any reason that's not working for you?

One potential performance pitfall is the time to construct the array of lines, say for evDistance: it's fastest to construct one line and then construct the others by copying it and modifying just one of the coordinates on the origin.

89✭✭and the following are not

The challenge would be to identify the left chain and the right chain automatically from the face selection given the above monotone restriction.

Once the two monotone chains are identified then I could use the evDistance trick ( which I stole from konstantin's code )

89✭✭https://dl.dropboxusercontent.com/s/o1lytztzcp4aior/2018-02-07_15-12-14.mp4

You can select a face from a sketch but you can't select the sub part of an edge that belongs to only one face. This is a bit onerous on the user to force them to split their edges all the time.

1,206Use qFarthestAlong in two directions perpendicular to your line direction to get the chain endpoints. Use constructPath, passing one of the endpoints as referenceGeometry to sort the loop in order around the face. Walk along the edges in the returned path, until you hit one that is adjacent to the other endpoint -- that is the last edge in your first chain, and the rest of the path is the second chain.

1,221✭✭✭✭✭89✭✭evTangentLines on the edge using the arc length parameterization. That will give me a series of points around the loop and their tangents.

(1) To validate check that there are only two tangent flips from up to down

(2) Split the returned curves into two groups based on if their tangent is up or down.

1,206