I made the code but formula not taking line reference , i have write the name of line but its not taking.
Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory
Dim hybridShapePointOnCurve1 As HybridShapePointOnCurve
Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromDistance(reference2, reference1, D * i, False)
Dim hybridShapePlaneNormal1 As HybridShapePlaneNormal
Set hybridShapePlaneNormal1 = hybridShapeFactory1.AddNewPlaneNormal(reference2, hybridShapePointOnCurve1)
'Intersection curve
Dim hybridShapeIntersection1 As HybridShapeIntersection
Set hybridShapeIntersection1 = hybridShapeFactory1.AddNewIntersection(hybridShapePlaneNormal1, surface)
Dim hybridShapeNear1 As HybridShapeNear
Set hybridShapeNear1 = hybridShapeFactory1.AddNewNear(hybridShapeIntersection1, hybridShapePointOnCurve1)
hybridBody1.AppendHybridShape hybridShapeNear1
part1.InWorkObject = hybridShapeNear1
' Making tangent curve on near curve
Dim reference21 As Reference
Set reference21 = part1.CreateReferenceFromObject(hybridShapeNear1)
Dim reference22 As Reference
Set reference22 = part1.CreateReferenceFromObject(hybridShapePointOnCurve1)
Dim reference23 As Reference
Set reference23 = part1.CreateReferenceFromObject(hybridShapePlaneNormal1)
Dim hybridShapeLineTangency1 As HybridShapeLineTangency
Set hybridShapeLineTangency1 = hybridShapeFactory1.AddNewLineTangencyOnSupport(reference21, reference22, reference23, 0#, 10#, False)
Dim hybridShapeLinePtDir1 As HybridShapeLinePtDir
Set hybridShapeLinePtDir1 = hybridShapeFactory1.AddNewLinePtDir(hybridShapePointOnCurve1, direction, 0#, 5#, False)
Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies1.Item("Geometrical Set.1")
Dim parameters1 As Parameters
Set parameters1 = part1.Parameters
Dim angle1 As Angle
Set angle1 = parameters1.CreateDimension("", "ANGLE", 0#)
Dim relations1 As Relations
Set relations1 = part1.Relations
Dim formula1 As Formula
Set formula1 = relations1.CreateFormula("Formula.6", "", angle1, "angle(`Geometrical Set.1\hybridShapeLineTangency1` ,`Geometrical Set.1\hybridBody2` ) ")