Code:
Sub CATMain()
Dim ADoc As Document
Set ADoc = CATIA.ActiveDocumentDim AProduct As Product
Set AProduct = ADoc.Product
Dim ASel As Selection
Set ASel = ADoc.Selection
Dim AObj As Object
'Set AObj = ADoc.object
Dim AAxis As Variant
ASel.Clear
Dim sSelection
Dim sFilter(0)
Dim Coord(2)
Dim Vx_A (2)
Dim Vy_A (2)
Dim Vz_A (2)
Dim xa
Dim ya
Dim za
Dim xx
Dim xy
Dim xz
Dim yx
Dim yy
Dim yz
Dim zx
Dim zy
Dim zz
MsgBox "Bitte Koordinatensystem auswählen."
ASel.Clear
sFilter(0)="AxisSystem"
sSelection=ASel.SelectElement2(sFilter,"Bitte das Achsensystem anklicken,auf welches sich die Koordinaten bezihen sollen",False)
If sSelection="Normal" Then
Set AAxis=ASel.Item2(1).Value
End If
' Ursprungskoordinaten des ausgewählten Koordinatensystemes als Array speichern
AAxis.GetOrigin Coord
' Ausrichtung des Ausgewaehlten Koordinatensystemes
AAxis.GetXAxis Vx_A
AAxis.GetYAxis Vy_A
AAxis.GetZAXis Vz_A
'Werte des Arrays "Coord2" variablen zuweisen
xa=Coord(0)
ya=Coord(1)
za=Coord(2)
xx = Vx_A (0)
xy=Vx_A (1)
xz=Vx_A (2)
yx = Vy_A (0)
yy=Vy_A (1)
yz=Vy_A (2)
zx = Vz_A (0)
zy=Vz_A (1)
zz=Vz_A (2)
MsgBox _
xx&" "&xy&" "&xz &chr(10)&_
yx&" "&yy&" "&yz&chr(10)& _
zx&" "&zy&" "&zz,0,"Einheitsmatix"
MsgBox "x"&" "&xa&chr(10)&"y"&" "&ya&chr(10)&"z"&" "&za&chr(10),0,"Lokaler Koordinatenursprung"
Dim BSections As Sections
Set BSections = AProduct.GetTechnologicalObject("Sections")
Dim MasterSec As Section
Set MasterSec = BSections.Add
MasterSec.Width = 5000
MasterSec.Height = 5000
Dim MatrixPos (11) As Variant
'X-Vektor
MartixPos (0) = xx
MartixPos (1) = xy
MartixPos (2) = xz
'Y-Vektor
MartixPos (3) =yx
MartixPos (4) =yy
MartixPos (5) =yz
'z-Vektor
MartixPos (6) =zx
MartixPos (7) =zy
MartixPos (8) =zz
'Ursprung
MartixPos (9) =xa
MartixPos (10) =ya
MartixPos (11) =za
MasterSec.SetPosition MatrixPos
MasterSec.GetPosition MatrixPos
MasterSe.Name ="Schnittansicht 1"
MasterSec.CutMode = 1
End Sub