<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Intersection points of Sketchentities in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086221#M153229</link>
    <description>How to get Intersection points of 2D Sketch Entities?&lt;BR /&gt;
Problem:&lt;BR /&gt;
----------&lt;BR /&gt;
 if we select two entities(which are curved entities) then how to get the intersection points of the entities?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
SasiRajesh</description>
    <pubDate>Mon, 08 Oct 2007 06:13:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-10-08T06:13:27Z</dc:date>
    <item>
      <title>Intersection points of Sketchentities</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086221#M153229</link>
      <description>How to get Intersection points of 2D Sketch Entities?&lt;BR /&gt;
Problem:&lt;BR /&gt;
----------&lt;BR /&gt;
 if we select two entities(which are curved entities) then how to get the intersection points of the entities?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
SasiRajesh</description>
      <pubDate>Mon, 08 Oct 2007 06:13:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086221#M153229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-10-08T06:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection points of Sketchentities</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086222#M153230</link>
      <description>Good question.</description>
      <pubDate>Wed, 10 Oct 2007 18:43:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086222#M153230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-10-10T18:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection points of Sketchentities</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086223#M153231</link>
      <description>The API does not currently support general curve-curve intersection.  There &lt;BR /&gt;
is support for line-curve intersection.  The various Line objects support &lt;BR /&gt;
the IntersectWithCurve method.  Curve-curve intersection is something we &lt;BR /&gt;
need to do.&lt;BR /&gt;
-- &lt;BR /&gt;
Brian Ekins&lt;BR /&gt;
Autodesk Inventor API</description>
      <pubDate>Thu, 11 Oct 2007 17:28:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086223#M153231</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-10-11T17:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection points of Sketchentities</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086224#M153232</link>
      <description>This problem can be solved (with some limitations) by minimization of the distance between two points on two curves till it is less than user defined tolerance. &lt;BR /&gt;
&lt;BR /&gt;
Limitations originate from possibility of multiple intersections. With simple two-dimensional minimization it will be difficult to localize all intersection points.

Message was edited by: ALink</description>
      <pubDate>Sat, 13 Oct 2007 17:57:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086224#M153232</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-10-13T17:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection points of Sketchentities</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086225#M153233</link>
      <description>The following code is my attempt to find the intersection point in case of two splines. It is not the best method, There are a lot of limitations (see above). But I hope this gives you an idea. This code is for tests only, because of very limited testing. &lt;BR /&gt;
&lt;BR /&gt;
ALink&lt;BR /&gt;
--------&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Spline_Intersection_Sample()&lt;BR /&gt;
&lt;BR /&gt;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
'Setup important user-defined parameters:&lt;BR /&gt;
'````````````````````````````````````````&lt;BR /&gt;
'1) tolerance&lt;BR /&gt;
   Dim AbsTol As Double 'absolute tolerance in cm&lt;BR /&gt;
   AbsTol = 0.000001    ' &amp;lt;=== absolute deviation &amp;lt;= 0.01 mkm&lt;BR /&gt;
   &lt;BR /&gt;
'2) dimension of initial spline fragmentation&lt;BR /&gt;
   Dim N As Long&lt;BR /&gt;
   N = 100&lt;BR /&gt;
   &lt;BR /&gt;
'3) Upper limit for the quantity of iteration loops (for safety)&lt;BR /&gt;
   Dim ITERATIONS_MAX_LIMIT As Long&lt;BR /&gt;
   ITERATIONS_MAX_LIMIT = 1000&lt;BR /&gt;
&lt;BR /&gt;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
   'Basic preparations&lt;BR /&gt;
   'Основные приготовления&lt;BR /&gt;
&lt;BR /&gt;
   'reference to Transient Geometry&lt;BR /&gt;
   'ссылка на вспомогательную геометрию&lt;BR /&gt;
   Dim oTG As TransientGeometry&lt;BR /&gt;
   Set oTG = ThisApplication.TransientGeometry&lt;BR /&gt;
   &lt;BR /&gt;
   'reference to the 1st sketch (for simplicity)&lt;BR /&gt;
   'ссылка на первый эскиз&lt;BR /&gt;
   Dim oActiveSketch As PlanarSketch&lt;BR /&gt;
   Set oActiveSketch = ThisApplication.ActiveDocument. _&lt;BR /&gt;
                          ComponentDefinition.Sketches.Item(1)&lt;BR /&gt;
   &lt;BR /&gt;
   'reference to SketchPoints collection in oActiveSketch&lt;BR /&gt;
   'ссылка на коллекцию эскизных точек в активном эскизе&lt;BR /&gt;
   Dim oSketchPoints As SketchPoints&lt;BR /&gt;
   Set oSketchPoints = oActiveSketch.SketchPoints&lt;BR /&gt;
   &lt;BR /&gt;
   'In this example we'll use two first splines.&lt;BR /&gt;
   'Be sure you have at least two splines.&lt;BR /&gt;
   'Здесь для простоты используем два первых сплайна эскиза&lt;BR /&gt;
   'Убедитесь, что в эскизе есть хотя бы два сплайна)&lt;BR /&gt;
   Dim oSpline1 As SketchSpline&lt;BR /&gt;
   Dim oSpline2 As SketchSpline&lt;BR /&gt;
   Set oSpline1 = oActiveSketch.SketchSplines(1)&lt;BR /&gt;
   Set oSpline2 = oActiveSketch.SketchSplines(2)&lt;BR /&gt;
&lt;BR /&gt;
   'evaluator of the first curve&lt;BR /&gt;
   'ссылка на вычислитель сплайна 1&lt;BR /&gt;
   Dim oCurve2dEvaluator1 As Curve2dEvaluator&lt;BR /&gt;
   Set oCurve2dEvaluator1 = oSpline1.Geometry.Evaluator&lt;BR /&gt;
   &lt;BR /&gt;
   'evaluator of the second curve&lt;BR /&gt;
   'ссылка на вычислитель сплайна 2&lt;BR /&gt;
   Dim oCurve2dEvaluator2 As Curve2dEvaluator&lt;BR /&gt;
   Set oCurve2dEvaluator2 = oSpline2.Geometry.Evaluator&lt;BR /&gt;
   &lt;BR /&gt;
   Dim Distance As Double&lt;BR /&gt;
   Dim oPoint2d1 As Point2d&lt;BR /&gt;
   Dim oPoint2d2 As Point2d&lt;BR /&gt;
   Dim IterationFact As Long&lt;BR /&gt;
   &lt;BR /&gt;
   'call minimization procedure&lt;BR /&gt;
   Call FindIntersection_3( _&lt;BR /&gt;
            oCurve2dEvaluator1, _&lt;BR /&gt;
            oCurve2dEvaluator2, _&lt;BR /&gt;
            AbsTol, _&lt;BR /&gt;
            N, _&lt;BR /&gt;
            ITERATIONS_MAX_LIMIT, _&lt;BR /&gt;
            IterationFact, _&lt;BR /&gt;
            Distance, _&lt;BR /&gt;
            oPoint2d1, _&lt;BR /&gt;
            oPoint2d2)&lt;BR /&gt;
   &lt;BR /&gt;
   'let us know if maximum iteration limit was exceeded&lt;BR /&gt;
   'possibly we have a problem&lt;BR /&gt;
   If IterationFact &amp;gt; ITERATIONS_MAX_LIMIT Then&lt;BR /&gt;
      MsgBox "Maximum iteration limit was exceeded." &amp;amp; vbNewLine _&lt;BR /&gt;
           &amp;amp; "Stopped at: " &amp;amp; IterationFact &amp;amp; " iterations"&lt;BR /&gt;
   End If&lt;BR /&gt;
   &lt;BR /&gt;
   'ставим эскизную точку на кривой 1&lt;BR /&gt;
   'put sketch point on curve 1&lt;BR /&gt;
   Dim oP As SketchPoint&lt;BR /&gt;
   Set oP = oSketchPoints.Add(oPoint2d1, False)&lt;BR /&gt;
   &lt;BR /&gt;
   &lt;BR /&gt;
   MsgBox "Dist = " &amp;amp; Round(Distance * 10, 8) &amp;amp; " mm" &amp;amp; vbNewLine &amp;amp; _&lt;BR /&gt;
          "Iterations = " &amp;amp; IterationFact&lt;BR /&gt;
   &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
End Sub 'Spline_Intersection_Sample&lt;BR /&gt;
'&lt;BR /&gt;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;BR /&gt;
'&lt;BR /&gt;
'               FindIntersection_3&lt;BR /&gt;
'&lt;BR /&gt;
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;BR /&gt;
&lt;BR /&gt;
Private Sub FindIntersection_3( _&lt;BR /&gt;
   ByRef oCurve2dEvaluator1 As Curve2dEvaluator, _&lt;BR /&gt;
   ByRef oCurve2dEvaluator2 As Curve2dEvaluator, _&lt;BR /&gt;
   ByVal AbsTol As Double, _&lt;BR /&gt;
   ByVal N As Long, _&lt;BR /&gt;
   ByVal ITERATIONS_MAX_LIMIT As Long, _&lt;BR /&gt;
   ByRef IterationFact As Long, _&lt;BR /&gt;
   ByRef Distance As Double, _&lt;BR /&gt;
   ByRef oPoint2d1 As Point2d, _&lt;BR /&gt;
   ByRef oPoint2d2 As Point2d)&lt;BR /&gt;
&lt;BR /&gt;
   'reference to Transient Geometry&lt;BR /&gt;
   'ссылка на вспомогательную геометрию&lt;BR /&gt;
   Dim oTG As TransientGeometry&lt;BR /&gt;
   Set oTG = ThisApplication.TransientGeometry&lt;BR /&gt;
&lt;BR /&gt;
   'parameter range for the 1st curve&lt;BR /&gt;
   'вычислим границы диапазона изменения параметра кривой 1&lt;BR /&gt;
   Dim Param1_Min As Double&lt;BR /&gt;
   Dim Param1_Max As Double&lt;BR /&gt;
   Call oCurve2dEvaluator1.GetParamExtents(Param1_Min, Param1_Max)&lt;BR /&gt;
   &lt;BR /&gt;
   'parameter range for the 2nd curve&lt;BR /&gt;
   'вычислим границы диапазона изменения параметра кривой 2&lt;BR /&gt;
   Dim Param2_Min As Double&lt;BR /&gt;
   Dim Param2_Max As Double&lt;BR /&gt;
   Call oCurve2dEvaluator2.GetParamExtents(Param2_Min, Param2_Max)&lt;BR /&gt;
      &lt;BR /&gt;
      &lt;BR /&gt;
   'Step 1. A rough approximation for start points&lt;BR /&gt;
   'Шаг  1. Грубое начальное приближение для точки пересечения&lt;BR /&gt;
   &lt;BR /&gt;
   Dim i As Long, j As Long&lt;BR /&gt;
   Dim x1 As Double&lt;BR /&gt;
   Dim x2 As Double&lt;BR /&gt;
   Dim y1 As Double&lt;BR /&gt;
   Dim y2 As Double&lt;BR /&gt;
   &lt;BR /&gt;
   Dim dParams(0 To 0) As Double&lt;BR /&gt;
   Dim dPointsCoord() As Double&lt;BR /&gt;
   &lt;BR /&gt;
   Dim Coord1() As Double&lt;BR /&gt;
   Dim Coord2() As Double&lt;BR /&gt;
   ReDim Coord1(0 To N, 1 To 2)  'arrays for coordinates&lt;BR /&gt;
   ReDim Coord2(0 To N, 1 To 2)&lt;BR /&gt;
   &lt;BR /&gt;
   For i = 0 To N&lt;BR /&gt;
      dParams(0) = Param1_Min + i * (Param1_Max - Param1_Min) / N&lt;BR /&gt;
      Call oCurve2dEvaluator1.GetPointAtParam(dParams, dPointsCoord)&lt;BR /&gt;
      &lt;BR /&gt;
      'запоминаем координаты точки i&lt;BR /&gt;
      'save coordinates for index i&lt;BR /&gt;
      Coord1(i, 1) = dPointsCoord(0)&lt;BR /&gt;
      Coord1(i, 2) = dPointsCoord(1)&lt;BR /&gt;
   Next i&lt;BR /&gt;
      &lt;BR /&gt;
   For j = 0 To N&lt;BR /&gt;
      dParams(0) = Param2_Min + j * (Param2_Max - Param2_Min) / N&lt;BR /&gt;
      Call oCurve2dEvaluator2.GetPointAtParam(dParams, dPointsCoord)&lt;BR /&gt;
&lt;BR /&gt;
      'запоминаем координаты точки j&lt;BR /&gt;
      'save coordinates for index j&lt;BR /&gt;
      Coord2(j, 1) = dPointsCoord(0)&lt;BR /&gt;
      Coord2(j, 2) = dPointsCoord(1)&lt;BR /&gt;
   Next j&lt;BR /&gt;
   &lt;BR /&gt;
   Dim Min As Double&lt;BR /&gt;
   Dim n1 As Long&lt;BR /&gt;
   Dim n2 As Long&lt;BR /&gt;
   Dim Dist As Double&lt;BR /&gt;
   &lt;BR /&gt;
   Min = 1E+199:     n1 = -1:     n2 = -1  ' initial values&lt;BR /&gt;
   &lt;BR /&gt;
   For i = 0 To N&lt;BR /&gt;
      For j = 0 To N&lt;BR /&gt;
         Dist = Sqr((Coord1(i, 1) - Coord2(j, 1)) ^ 2 + _&lt;BR /&gt;
                    (Coord1(i, 2) - Coord2(j, 2)) ^ 2)&lt;BR /&gt;
         If Dist &amp;lt; Min Then&lt;BR /&gt;
            Min = Dist&lt;BR /&gt;
            n1 = i&lt;BR /&gt;
            n2 = j&lt;BR /&gt;
         End If&lt;BR /&gt;
      Next j&lt;BR /&gt;
   Next i&lt;BR /&gt;
    &lt;BR /&gt;
&lt;BR /&gt;
      &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
   'Step 2. Find intersection point&lt;BR /&gt;
   'Шаг  2. Итерационный поиск точки пересечения&lt;BR /&gt;
   &lt;BR /&gt;
   ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;BR /&gt;
   ' %%%%%%%%%%     Start    %%%%%%%%%%&lt;BR /&gt;
   ' %%%%%%%%%% Minimization %%%%%%%%%%&lt;BR /&gt;
   ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;BR /&gt;
   &lt;BR /&gt;
   Dim p(0 To 8, 1 To 2) As Double  'cube vertex array&lt;BR /&gt;
   Dim D(0 To 8) As Double          'distances for each cube vertex&lt;BR /&gt;
   Dim Delta As Double              'cube size parameter&lt;BR /&gt;
   &lt;BR /&gt;
   Dim IterCounter As Long          'loop counter&lt;BR /&gt;
   IterCounter = -1&lt;BR /&gt;
   &lt;BR /&gt;
   'initial cube half size&lt;BR /&gt;
   Delta = (Param1_Max - Param1_Min + Param2_Max - Param2_Min) / N / 3&lt;BR /&gt;
   &lt;BR /&gt;
   'cube center -- "vertex" #0&lt;BR /&gt;
   p(0, 1) = Param1_Min + n1 * (Param1_Max - Param1_Min) / N&lt;BR /&gt;
   p(0, 2) = Param2_Min + n2 * (Param2_Max - Param2_Min) / N&lt;BR /&gt;
   &lt;BR /&gt;
   &lt;BR /&gt;
   '~~~~~ Start Iterations ~~~~~&lt;BR /&gt;
   &lt;BR /&gt;
   Do&lt;BR /&gt;
      IterCounter = IterCounter + 1    'iteration number&lt;BR /&gt;
      &lt;BR /&gt;
      'vertex 1&lt;BR /&gt;
      p(1, 1) = p(0, 1) + Delta&lt;BR /&gt;
      p(1, 2) = p(0, 2)&lt;BR /&gt;
      'vertex 2&lt;BR /&gt;
      p(2, 1) = p(0, 1) + Delta&lt;BR /&gt;
      p(2, 2) = p(0, 2) + Delta&lt;BR /&gt;
      'vertex 3&lt;BR /&gt;
      p(3, 1) = p(0, 1)&lt;BR /&gt;
      p(3, 2) = p(0, 2) + Delta&lt;BR /&gt;
      'vertex 4&lt;BR /&gt;
      p(4, 1) = p(0, 1) - Delta&lt;BR /&gt;
      p(4, 2) = p(0, 2) + Delta&lt;BR /&gt;
      'vertex 5&lt;BR /&gt;
      p(5, 1) = p(0, 1) - Delta&lt;BR /&gt;
      p(5, 2) = p(0, 2)&lt;BR /&gt;
      'vertex 6&lt;BR /&gt;
      p(6, 1) = p(0, 1) - Delta&lt;BR /&gt;
      p(6, 2) = p(0, 2) - Delta&lt;BR /&gt;
      'vertex 7&lt;BR /&gt;
      p(7, 1) = p(0, 1)&lt;BR /&gt;
      p(7, 2) = p(0, 2) - Delta&lt;BR /&gt;
      'vertex 8&lt;BR /&gt;
      p(8, 1) = p(0, 1) + Delta&lt;BR /&gt;
      p(8, 2) = p(0, 2) - Delta&lt;BR /&gt;
      &lt;BR /&gt;
      'Calculate distance for each cube vertex (#0..#8)&lt;BR /&gt;
      For i = 0 To 8&lt;BR /&gt;
         D(i) = CalcDistance(oCurve2dEvaluator1, oCurve2dEvaluator2, p(i, 1), p(i, 2))&lt;BR /&gt;
      Next i&lt;BR /&gt;
       &lt;BR /&gt;
      'calc minimal distance&lt;BR /&gt;
      Min = D(0)&lt;BR /&gt;
      n1 = 0&lt;BR /&gt;
      For i = 1 To 8&lt;BR /&gt;
         If D(i) &amp;lt; Min Then&lt;BR /&gt;
            Min = D(i)&lt;BR /&gt;
            n1 = i&lt;BR /&gt;
         End If&lt;BR /&gt;
      Next i&lt;BR /&gt;
      &lt;BR /&gt;
      'uncomment this line to see iterations in progress&lt;BR /&gt;
'      Debug.Print "Iter="; IterCounter, "Dist,(mm)= "; Min * 10#&lt;BR /&gt;
      &lt;BR /&gt;
      If n1 = 0 Then&lt;BR /&gt;
         Delta = Delta * 0.7              'controls cube size&lt;BR /&gt;
      Else&lt;BR /&gt;
         p(0, 1) = p(n1, 1)&lt;BR /&gt;
         p(0, 2) = p(n1, 2)&lt;BR /&gt;
      End If&lt;BR /&gt;
      'move cube center to the vertex n1 (with min distance)&lt;BR /&gt;
&lt;BR /&gt;
      &lt;BR /&gt;
   Loop Until (Min &amp;lt; AbsTol) Or (IterCounter &amp;gt; ITERATIONS_MAX_LIMIT)&lt;BR /&gt;
   &lt;BR /&gt;
   '~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
   '~~~~~ Stop iterations ~~~~&lt;BR /&gt;
   '~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
   &lt;BR /&gt;
   Distance = Min                'output&lt;BR /&gt;
   IterationFact = IterCounter   'output&lt;BR /&gt;
   &lt;BR /&gt;
   'Calculate 1-st point coordinates&lt;BR /&gt;
   dParams(0) = p(0, 1)&lt;BR /&gt;
   Call oCurve2dEvaluator1.GetPointAtParam(dParams, dPointsCoord)&lt;BR /&gt;
   'создаем 2d точки для вызывающей процедуры&lt;BR /&gt;
   'create output 2d point  for curve 1&lt;BR /&gt;
   Set oPoint2d1 = oTG.CreatePoint2d(dPointsCoord(0), dPointsCoord(1))&lt;BR /&gt;
   &lt;BR /&gt;
   'Calculate 2-nd point coordinates&lt;BR /&gt;
   dParams(0) = p(0, 2)&lt;BR /&gt;
   Call oCurve2dEvaluator2.GetPointAtParam(dParams, dPointsCoord)&lt;BR /&gt;
   'создаем 2d точки для вызывающей процедуры&lt;BR /&gt;
   'create output 2d point for curve 2&lt;BR /&gt;
   Set oPoint2d2 = oTG.CreatePoint2d(dPointsCoord(0), dPointsCoord(1))&lt;BR /&gt;
   &lt;BR /&gt;
&lt;BR /&gt;
End Sub   'FindIntersection_3&lt;BR /&gt;
'&lt;BR /&gt;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Private Function CalcDistance( _&lt;BR /&gt;
            ByRef oCurve2dEvaluator1 As Curve2dEvaluator, _&lt;BR /&gt;
            ByRef oCurve2dEvaluator2 As Curve2dEvaluator, _&lt;BR /&gt;
            ByVal param1 As Double, _&lt;BR /&gt;
            ByVal param2 As Double) As Double&lt;BR /&gt;
            &lt;BR /&gt;
   Dim x1 As Double&lt;BR /&gt;
   Dim x2 As Double&lt;BR /&gt;
   Dim y1 As Double&lt;BR /&gt;
   Dim y2 As Double&lt;BR /&gt;
   &lt;BR /&gt;
   Dim dParams(0 To 0) As Double&lt;BR /&gt;
   Dim dPointsCoord() As Double&lt;BR /&gt;
&lt;BR /&gt;
   'Calculate 1-st point coordinates (curve 1)&lt;BR /&gt;
   dParams(0) = param1&lt;BR /&gt;
   Call oCurve2dEvaluator1.GetPointAtParam(dParams, dPointsCoord)&lt;BR /&gt;
   x1 = dPointsCoord(0)&lt;BR /&gt;
   y1 = dPointsCoord(1)&lt;BR /&gt;
   &lt;BR /&gt;
   'Calculate 2-nd point coordinates (curve 2)&lt;BR /&gt;
   dParams(0) = param2&lt;BR /&gt;
   Call oCurve2dEvaluator2.GetPointAtParam(dParams, dPointsCoord)&lt;BR /&gt;
   x2 = dPointsCoord(0)&lt;BR /&gt;
   y2 = dPointsCoord(1)&lt;BR /&gt;
   'distance between two points (cm)&lt;BR /&gt;
   CalcDistance = Sqr((x1 - x2) ^ 2 + (y1 - y2) ^ 2)&lt;BR /&gt;
&lt;BR /&gt;
End Function   'CalcDistance&lt;BR /&gt;
'&lt;BR /&gt;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message was edited by: ALink</description>
      <pubDate>Sun, 14 Oct 2007 12:11:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086225#M153233</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-10-14T12:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection points of Sketchentities</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086226#M153234</link>
      <description>KISS principle lead me to better solution which use INVENTOR’s internal optimization mathematics. &lt;BR /&gt;
&lt;BR /&gt;
This example also finds the intersection (if any) between two given planar splines.&lt;BR /&gt;
This program:&lt;BR /&gt;
1. Generates N points belongs each given spline, finds two closest points and uses the first one as initial position of the intersection point.&lt;BR /&gt;
2. Grounds both splines.&lt;BR /&gt;
3. Put new sketch point into this position.&lt;BR /&gt;
4. Constraints it with the 1st spline (coincidence).&lt;BR /&gt;
5. Constraints it with the 2nd spline (coincidence). If successful it’s a desired intersection.&lt;BR /&gt;
6. Restores constraint status for all fit points in both splines.&lt;BR /&gt;
&lt;BR /&gt;
If it is no error then intersection was found, constrained sketch point indicates intersection point.&lt;BR /&gt;
&lt;BR /&gt;
Unsuccessful initial position can prevent to find desired point even when intersection really exists (like local minimum can prevent to find the global one). You may test this manually in GUI repeating steps 3..5.&lt;BR /&gt;
&lt;BR /&gt;
In this case you may try to increase fragmentation parameter N.&lt;BR /&gt;
&lt;BR /&gt;
I like this method more than posted previously.&lt;BR /&gt;
See attachment.&lt;BR /&gt;
&lt;BR /&gt;
ALink</description>
      <pubDate>Sat, 20 Oct 2007 19:36:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/intersection-points-of-sketchentities/m-p/2086226#M153234</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-10-20T19:36:57Z</dc:date>
    </item>
  </channel>
</rss>

