1 Reply Latest reply on Mar 29, 2014 1:18 AM by Simon Turner

    Determine Intersection Coordinates

    Nick Baker

      Hello all,

       

      Will one of you please help me locate the (X,Y) coordinates of two intersecting entities? Here is how I'm creating the entities:

       

      Set swSketchSegment = swSketchMgr.CreateCircle(0, 0, 0, 0, PD / 2, 0)
      Set swSketchSegment = swSketchMgr.CreateEquationSpline2(Xeq, Yeq, "", ".3", ".4", False, 0, 0, 0, True, True)
      

       

      I realize that I might have to utilize InsertReferencePoint, but I'm not sure how to select the 2 previously created entities.

       

      Thanks in advance,

       

      Nick

        • Re: Determine Intersection Coordinates
          Simon Turner

          Just get the ICurve entity from each SketchSegment and then use IIntersectCurve.

          Something like:

           

          Set swSketchSegment1 = swSketchMgr.CreateCircle(0, 0, 0, 0, PD / 2, 0)
          Set swSketchSegment2 = swSketchMgr.CreateEquationSpline2(Xeq, Yeq, "", ".3", ".4", False, 0, 0, 0, True, True)

           

          Dim myCurve1 As Curve

          Dim myCurve2 As Curve

           

          Set myCurve1 = swSketchSegment1.GetCurve

          Set myCurve3 = swSketchSegment3.GetCurve

           

          'Need to find end parameters of the curves:

           

          Dim u1 as Double

          Dim u2 as Double

          Dim u3 as Double

          Dim u4 as Double

          Dim isClosed as Boolean

          Dim isPeriodic as Boolean

           

          myCurve1.GetEndParams u1, u2, isClosed, isPeriodic

          myCurve2.GetEndParams u3, u4, isClosed, isPeriodic

           

          Dim res As Variant

           

          res = myCurve1.IIntersectCurve(myCurve2, u1, u2, u3, u4)

           

          'Resulting intersections (if any) are stored in res