Code:
Sub CATMain()
Dim oSel As Selection
Set oSel = CATIA.ActiveDocument.Selection
oSel.Clear
oSel.Search ("(Name=*adapter* & 'Part Design'.Part);all")
Dim oPart1 As Part
Set oPart1 = oSel.Item(1).Value
oSel.Clear
ReDim strArray(0)
strArray(0) = "Edge"
'strArray(0) = "RectilinearBiDimFeatEdge"
Dim sStatus As String
Dim sSel As Object
Dim oRef1 As Reference
Dim oRef2 As Reference
Dim oLN1 As Reference
Dim oLN2 As Reference
Dim oPT As Reference
Dim oREF_PLN As Reference
Dim oAxis1 As Object
Dim oAxis As HybridShapeLinePtDir
Dim oAxis2 As Object
Dim oPLN As HybridShapePlane2Lines
Dim oSK As Sketch
Dim oDir As HybridShapeDirection
Dim oPart2 As Part
Dim oFace As Face
Dim Measure As Measurable
Dim oHSF As HybridShapeFactory
Dim oCutPlane As HybridShapePlaneAngle
Dim oIntersect As HybridShapeIntersection
Dim oHB As HybridBody
Dim measuredplane1 As HybridShapePlane2Lines
Set sSel = oSel
sStatus = sSel.SelectElement2(strArray, "Wskaż pierwszą oś rury", False)
Set oAxis1 = sSel.Item(1).Value
Set oRef1 = oAxis1
oSel.Clear
sStatus = sSel.SelectElement2(strArray, "Wskaż drugą oś rury", False)
Set oAxis2 = sSel.Item(1).Value
'Set oPart2 = oFace.Parent.Parent.Parent.Parent.Parent
Set oRef2 = oAxis2
oSel.Clear
Angle = Get_Angle(oRef1, oRef2) / 2
Set oHSF = oPart1.HybridShapeFactory
oSel.Add oPart1
oSel.Search ("'Part Design'.Sketch;sel")
Set oSK = oSel.Item(1).Value
Set oPLN = oHSF.AddNewPlane2Lines(oRef1, oRef2) '<------- das hier geht!
Set oHB = oPart1.HybridBodies.Item("Konstruktionselemente")
oHB.AppendHybridShape oPLN
oPart1.Update
Set oDir = oHSF.AddNewDirection(oPLN)
Set oIntersect = oHSF.AddNewIntersection(oRef1, oRef2) '<------- das hier gibt ein Fehler