Code:
Sub CATMain()Dim Language As String
Language = "VBScript"
Dim Document1 As Document
Set Document1 = CATIA.ActiveDocument
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = Document1.Part.HybridBodies
Dim Status, oSelection, oSelectedElement, oDoc, oInstance, oRef, TheSPAWorkbench, TheMeasurable As Object
Dim InputObjectType(0)
Dim bType As Boolean
Dim dLength As Double
InputObjectType(0) = "HybridShape"
If TypeName(CATIA.ActiveDocument) = "ProductDocument" Then
bType = 0
ElseIf TypeName(CATIA.ActiveDocument) = "PartDocument" Then
bType = 1
Else
MsgBox "The Root is not a CATPart or a CATProduct ! ", 48, "Wrong FileType of opend Document"
Exit Sub
End If
Set oSelection = CATIA.ActiveDocument.Selection
oSelection.Clear
Status = oSelection.SelectElement2(InputObjectType, " Bitte selektieren Sie ein Kurve / Schweißnaht ", False)
Dim reference1 As reference
Set reference1 = Document1.Part.CreateReferenceFromObject(InputObjectType)
Dim hybridShapeFactory1 As HybridShapeFactory
Dim hybridShapePointOnCurve1 As HybridShapePointOnCurve
Set hybridShapePointOnCurve1 = _
hybridShapeFactory1.AddNewPointOnCurveFromPercent(reference1, 0.2, False)
Dim hybridBody1 As HybridBody
HybridBody.AppendHybridShape hybridShapePointOnCurve1
Document.Part.Update
userSel.Clear
End Sub