Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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 ???

S1monS1mon 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

  • EvanReeseEvanReese Member, Mentor Posts: 2,776 PRO

    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.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • Konst_ShKonst_Sh Member Posts: 120 PRO

    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

  • EvanReeseEvanReese Member, Mentor Posts: 2,776 PRO

    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.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • S1monS1mon Member Posts: 3,886 PRO

    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):

    image.png

    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:

    image.png

    https://help.autodesk.com/view/ALIAS/2026/ENU/?guid=GUID-5BBF940A-0255-4BC6-B081-A10DFC22317B

    Simon Gatrall | Product Development Specialist | Open For Work

  • Konst_ShKonst_Sh Member Posts: 120 PRO

    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

  • Konst_ShKonst_Sh Member Posts: 120 PRO

    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.

    изображение.png
  • S1monS1mon Member Posts: 3,886 PRO

    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

  • Konst_ShKonst_Sh Member Posts: 120 PRO

    @S1mon yeah, sorry, its public now

  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 602 PRO

    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.

Sign In or Register to comment.