Sub Achs_aus_Auswahl() Set oPart = CATIA.ActiveDocument.Part Set oAuswahl = CATIA.ActiveDocument.Selection oPart.Update ' Hier wählt der Nutzer eine Kante aus, die später die X-Richtung des Achsesystems vorgeben soll Dim WasE(0) WasE(0) = "Edge" oAuswahl.clear Eingabe = oAuswahl.SelectElement2(WasE, "Bitte Richtung selektieren", True) 'Hier wird der Text der Auswahl ' von z.B "Selection_BorderREdge:(BEdge:(Brp:(GSMBiDim.3;%1);None:(Limits1:();Limits2:();-1);Cf11:());GSMBiDim.3;Z0;G2198)" ' in z.B. "BorderREdge:(BEdge:(Brp:(GSMBiDim.3;%1);None:(Limits1:();Limits2:();-1);Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)" 'umgewandelt oText3 = "" oText1 = oAuswahl.Item(1).Value.Name oText2 = Right(oText1, Len(oText1) - Len("Selection_")) oTeilstring = Split(oText2, ";") For i = 0 To UBound(oTeilstring) - 3 oText3 = oText3 & oTeilstring(i) & ";" Next otext4 = oText3 & "WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)" 'Erzeugung des Achsensystem Set oAchs = oPart.AxisSystems.Add() Set oUrsprung = oPart.Parameters.Item("Startpunkt") Set oZ_Richt = oPart.Parameters.Item("Linie-normal") oAchs.OriginType = catAxisSystemOriginByPoint oAchs.XAxisType = catAxisSystemAxisSameDirection oAchs.YAxisType = catAxisSystemAxisSameDirection oAchs.ZAxisType = catAxisSystemAxisSameDirection oAchs.IsCurrent = False oAchs.OriginPoint = oPart.CreateReferenceFromObject(oUrsprung) oAchs.ZAxisDirection = oPart.CreateReferenceFromObject(oZ_Richt) oKante = otext4 Set oTraeger = oAuswahl.Item(1).Value.Parent oAchs.XAxisDirection = oPart.CreateReferenceFromBRepName(oKante, oTraeger) oPart.Update 'Abfrage, ob die Richtung paßt If MsgBox("Stimmt die Ausrichtung ?", 4) = 6 _ Then oAchs.XAxisType = catAxisSystemAxisSameDirection _ Else oAchs.XAxisType = catAxisSystemAxisOppositeDirection oPart.UpdateObject oAchs oPart.Update End Sub