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.
Multiple Intersections with evDistance or ???
S1mon
Member Posts: 3,886 PRO
I'm trying to find all the potential intersections between two arbitrary 3D curves (edges). I've been playing with evDistance and discovering that it always comes up with a single result. There are some old threads and ideas around splitting or sampling curves to get more complete results.
What is the current recommendation for this?
Also, if the two input curves do not intersect, I found that the built-in extendSide0/1 only seems to work with lines. I assume I would have to use trimCurve to handle this. Does anyone have some example code for this?
Simon Gatrall | Product Development Specialist | Open For Work
Comments
hmm, tricky. I do think that sampling one of the curves with points, evDistance on those, then splitting at that point if the distance is below a threshhold would let you then calculate the distance for each segment, returning the actual intersections. You'd want to copy the input curve and split that instead of course. A bit of a roundabout workflow.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
Split edges of one curve with surface extruded from second one could be the solution here.
https://cad.onshape.com/FsDoc/library.html#opSplitEdges-Context-Id-map
That's a much better idea. You could sweep a small line on one of the curves in case it's not a good extrude candidate.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
Ultimately I want to be able to find the center of a virtual sphere (of a user selected radius) which is tangent to both curves. I'm focusing now on using offset curves (the 3D kind that are geodesic or euclidean on a surface) and then trimming those to each other. I'm lofting between the two inputs to get the reference surface, but if there are multiple intersections between the input curves, that's not going to work.
Here's a screenshot of my feature based prototype (blue surface is lofted between input curves, green are offset curves which are trimmed to each other, black are trimmed using the ends of the green curves, and red is the bridging curve):
The long term goal is to create something like Alias's Curve Fillet where the feature automatically trims the input curves, and has a few different ways to modify the shape symmetrically:
https://help.autodesk.com/view/ALIAS/2026/ENU/?guid=GUID-5BBF940A-0255-4BC6-B081-A10DFC22317B
Simon Gatrall | Product Development Specialist | Open For Work
I have idea to try multiparametric solver for the search of virtual center, from what I get it doesn't need to have highest accuracy, so the performance should be acceptable. I will get back with sample later
So thats how far I could go with numeric solver:
https://cad.onshape.com/documents/1b86ee796bef2029e6f14e05/w/c9553ae626e57286a7701cc2/e/87b602b735693a9eeba8668f
The solve function requires initial guess vector of curve path parameters, around which it should perform the search. However I noticed that it could jump around and in case of multiple possible solutions the one which it will choose is not well defined by initial condition of parameters vector. Its likely because I had to always take fractional part of path parameters on every iteration, because every next provided parameter vector from solver evaluation is not guarantied to fall between 0 and 1 - this is likely where the root to well behaving initial condition lies, if we could find good enough coercion from any number to path parameter, just taking fractional part is obviously too naive.
Thanks! I was wondering about solvers. I'm familiar with the idea, but have never coded one.
Looks like the document is not public. I'd love to take a look.
Simon Gatrall | Product Development Specialist | Open For Work
@S1mon yeah, sorry, its public now
I've been puzzling through a Largest Inscribed Circle problem that's a related class of problem set. I don't love the iterative solver approach but I've struck out on finding an analytical approach that works.
Derek Van Allen | Engineering Consultant | Meddler