How to get the intersection Point between a curve and a curve

How to get the intersection Point between a curve and a curve

spascual
Collaborator Collaborator
773 Views
1 Reply
Message 1 of 2

How to get the intersection Point between a curve and a curve

spascual
Collaborator
Collaborator

Hi Sirs,

I have been looking for a method to get intersection between two curves, but I have not found in API.

Any idea wellcome ¡¡¡¡

Thanks,

0 Likes
Accepted solutions (1)
774 Views
1 Reply
Reply (1)
Message 2 of 2

wayne.brill
Collaborator
Collaborator
Accepted solution

Hi,

 

I am not sure if I fully understand what you need to do.

 

Does TransientGeometry.CurveCurveIntersection() help?

 

Here is a VBA example that is an update to one of the examples in the Programming help.

 

Public Sub DrawSketchLine()
    ' Check to make sure a sketch is open.
    If Not TypeOf ThisApplication.activeEditObject Is PlanarSketch Then
      MsgBox "A sketch must be active."
      Exit Sub
    End If

    ' Set a reference to the active sketch.
    Dim oSketch As PlanarSketch
    Set oSketch = ThisApplication.activeEditObject

    ' Set a reference to the transient geometry collection.
    Dim oTransGeom As TransientGeometry
    Set oTransGeom = ThisApplication.TransientGeometry

    ' Create a new transaction to wrap the construction of the three lines
    ' into a single undo.
    Dim oTrans As Transaction
    Set oTrans = ThisApplication.TransactionManager.StartTransaction( _
    ThisApplication.ActiveDocument, _
    "Create Triangle Sample")

     Dim oLines(1 To 3) As SketchLine
    Set oLines(1) = oSketch.SketchLines.AddByTwoPoints(oTransGeom.CreatePoint2d(0, 0), _
    oTransGeom.CreatePoint2d(4, 0))

    Set oLines(2) = oSketch.SketchLines.AddByTwoPoints(oLines(1).EndSketchPoint, _
    oTransGeom.CreatePoint2d(2, 3))

     Set oLines(3) = oSketch.SketchLines.AddByTwoPoints(oLines(2).EndSketchPoint, _
    oTransGeom.CreatePoint2d(2, -2))

    ' End the transaction for the triangle.
    oTrans.End
    
    Dim olineSeg_1 As LineSegment
    Set olineSeg_1 = oLines(1).Geometry3d
    
    Dim olineSeg_2 As LineSegment
    Set olineSeg_2 = oLines(3).Geometry3d
    
    Dim objsEnum As ObjectsEnumerator
    Set objsEnum = oTransGeom.CurveCurveIntersection(olineSeg_1, olineSeg_2)
    
   
End Sub

When I run that code the ObjectsEnumerator finds one point. (Screnshot below of the VBA Watch window.

 

Thanks,

Wayne

 

 

CurveCurveIntersect.ionjpg.jpg



Wayne Brill
Developer Technical Services
Autodesk Developer Network