Hi Philipe,
I tried the following code, however, the AddTangent methods does not work in any of the last four calls.
Could you (or sb. else) help me out?
Thanks,
Don
'----------- Code start ----------------
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim oPtDoc As PartDocument = _invApp.ActiveDocument
Dim oTG As TransientGeometry = _invApp.TransientGeometry
Dim oCompDef As PartComponentDefinition = oPtDoc.ComponentDefinition
Dim oSketch As PlanarSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(1))
Dim oSkPoints(6) As SketchPoint
Dim x(6) As Double
Dim y(6) As Double
Dim oLines(3) As SketchLine
Dim oCircle(3) As SketchCircle
x(0) = 0
y(0) = 0
oSkPoints(0) = oSketch.SketchPoints.Add(oTG.CreatePoint2d(x(0), y(0)))
oCircle(0) = oSketch.SketchCircles.AddByCenterRadius(oSkPoints(0), 60)
x(1) = 100
y(1) = 0
oSkPoints(1) = oSketch.SketchPoints.Add(oTG.CreatePoint2d(x(1), y(1)))
x(2) = 0
y(2) = 80
oSkPoints(2) = oSketch.SketchPoints.Add(oTG.CreatePoint2d(x(2), y(2)))
x(3) = 0
y(3) = -80
oSkPoints(3) = oSketch.SketchPoints.Add(oTG.CreatePoint2d(x(3), y(3)))
oLines(0) = oSketch.SketchLines.AddByTwoPoints(oSkPoints(1), oSkPoints(0))
oLines(1) = oSketch.SketchLines.AddByTwoPoints(oSkPoints(1), oSkPoints(2))
oLines(2) = oSketch.SketchLines.AddByTwoPoints(oSkPoints(1), oSkPoints(3))
'try to create Tangent constraint between oLines(0) and oCircle(0) and make the tangential point close to oSkPoint(2)
Call oSketch.GeometricConstraints.AddTangent(oLines(0), oCircle(0), oSkPoints(2))
'try to create Tangent constraint between oLines(0) and oCircle(0) and make the tangential point close to oSkPoint(3)
Call oSketch.GeometricConstraints.AddTangent(oLines(0), oCircle(0), oSkPoints(3))
'try to create Tangent constraint between oLines(1) and oCircle(0) and make the tangential point close to oSkPoint(2)
Call oSketch.GeometricConstraints.AddTangent(oLines(1), oCircle(0), oSkPoints(2))
'try to create Tangent constraint between oLines(1) and oCircle(0) and make the tangential point close to oSkPoint(3)
Call oSketch.GeometricConstraints.AddTangent(oLines(1), oCircle(0), oSkPoints(3))
End Sub