I have made this code but its not working,,,,i want to give reference 1 and reference 2 using user selection. please help.
Sub CATMain()
Dim ActDoc As Object
Set ActDoc = CATIA.ActiveDocument
Dim part1 As Object
Set part1 = ActDoc.Part
Dim hybridBodies1 As Object
Set hybridBodies1 = part1.HybridBodies
Dim sSEL
Set sSEL = CATIA.ActiveDocument.Selection
sSEL.Clear
MsgBox "Please select Geometrical Set or Body where the curve is ..."
Dim EnableSelectionFor(1)
EnableSelectionFor(0) = "HybridBody"
EnableSelectionFor(1) = "Body"
Dim UserSelection
UserSelection = sSEL.SelectElement2(EnableSelectionFor, "Select Geometrical Set or Body ...", False)
Dim ohybridbody As Object
Set ohybridbody = sSEL.item(1).Value
MsgBox sSEL.item(1).Value.Name
Dim sSEL1
Set sSEL1 = CATIA.ActiveDocument.Selection
sSEL1.Clear
MsgBox "Please select Geometrical Set or Body where the points is ..."
Dim EnableSelectionFor1(1)
EnableSelectionFor1(0) = "HybridBody"
EnableSelectionFor1(1) = "Body"
Dim UserSelection1
UserSelection1 = sSEL1.SelectElement2(EnableSelectionFor1, "Select Geometrical Set or Body ...", False)
Dim ohybridbody1 As Object
Set ohybridbody1 = sSEL.item(1).Value
MsgBox sSEL1.item(1).Value.Name
Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromObject(ohybridbody)
MsgBox reference1.Name
Dim reference2 As Reference
Set reference2 = part1.CreateReferenceFromObject(ohybridbody1)
MsgBox reference2.Name
Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory
Dim hybridShapePointOnCurve1 As HybridShapePointOnCurve
Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromDistance(reference1, reference2, 5#, True)
hybridShapePointOnCurve1.DistanceType = 1
part1.InWorkObject = hybridShapePointOnCurve1
part1.Update
End Sub