Code:
Language="VBSCRIPT"Sub CATMain()
Dim sel As Selection
Set sel = CATIA.ActiveDocument.Selection
Dim oPartDocument As PartDocument
Set oPartDocument = CATIA.ActiveDocument
Dim oPart As Part
Set oPart = oPartDocument.Part
sel.clear
Dim sFilter(0)
sFilter(0) = "HybridBody"
Dim Status As String
Status = sel.selectelement2(sFilter,"GeometricalSet Selektieren in dem sich die Flaeche befindet",false)
Dim oHybridbody As Hybridbody
Set oHybridbody = sel.item(1).value
sel.clear
Dim oHybridshape As Hybridshape
Set oHybridshape = oHybridbody.Hybridshapes.item(1)
Dim oHybridShapeFact 'As HybridShapeFactory
Set oHybridShapeFact = oPart.HybridShapeFactory
Dim refSurface As Reference
Set refSurface = oPart.CreateReferenceFromObject(oHybridshape)
sel.Search "CATPrtSearch.Point,all"
Dim i as Integer
for i = 1 to sel.Count2
Dim oLineNormal As HybridShapeLineNormal
Set oLineNormal = oHybridShapeFact.AddNewLineNormal(refSurface, sel.Item2(1).Reference, 20, -20, false)
oHybridbody.AppendHybridShape oLineNormal
oPart.InWorkObject = oLineNormal
oPart.Update()
next
sel.Clear
End Sub