I'll try to simplify this .
array(0) to array(2) determine the X vector
array(3) to array(5) determine the Y vector
array(6) to array(8) determine the Z vector
array(9) to array(11) determine the Translation of X, Y &
Z
array(0) = 1 'this value represents the sine value of 90 deg
array(1) = 0 'this value represents the sine value of 0 deg
array(2) = 0 'this value represents the sine value of 0 deg
array(3) = 0 'this value represents the sine value of 0 deg
array(4) = 1 'this value represents the sine value of 90
deg
array(5) = 0 'this value represents the sine value of 0 deg
array(6) = 0 'this value represents the sine value of 0 deg
array(7) = 0 'this value represents the sine value of 0
deg
array(8) = 1 'this value represents the sine value of 90
deg
Here is a script that will rotate a Part1 in a Product about X,
Y or Z
'******************************************************************************
'*
'* Rotate around X, Y or Z
'* Programmer: Dana Fiorucci
'* Date: 1/10/07
'*
'******************************************************************************
Sub CATMain()
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
Set product2 = products1.Item("Part1.1"
Dim degrad
degrad = .01745 ''This used to convert degrees to radians
which is what Catia uses
Dim Xrot
Dim Yrot
Dim Zrot
Xrot = InputBox("Key in the degrees to rotate around X","X
Rotation","0"
If Xrot = 0 Then
Xrot = 1
Else
Xrot = Xrot * degrad
Xrot = sin(Xrot)
End If
'MsgBox Xrot
Yrot = InputBox("Key in the degrees to rotate around Y","Y
Rotation","0"
If Yrot = 0 Then
Yrot = 1
Else
Yrot = Yrot * degrad
Yrot = sin(Yrot)
End If
'MsgBox Yrot
Zrot = InputBox("Key in the degrees to rotate around Z","Z
Rotation","0"
If Zrot = 0 Then
Zrot = 1
Else
Zrot = Zrot * degrad
Zrot = sin(Zrot)
End If
'MsgBox Zrot
Dim arrayx(11)
Dim arrayy(11)
Dim arrayz(11)
'**************************************
If Xrot 1 And Xrot > 0 Then
MsgBox "In X positive rotation"
Set move1 = product2.Move
Set move1 = move1.MovableObject
arrayx(0) = 1
arrayx(1) = 0
arrayx(2) = 0
arrayx(3) = 0
arrayx(4) = Xrot
arrayx(5) = Xrot
arrayx(6) = 0
arrayx(7) = - Xrot
arrayx(8) = Xrot
arrayx(9) = 0.000000
arrayx(10) = 0.000000
arrayx(11) = 0.000000
move1.Apply arrayx
End If
If Xrot 1 And Xrot < 0 Then
MsgBox "In X negative rotation"
Set move1 = product2.Move
Set move1 = move1.MovableObject
arrayx(0) = 1
arrayx(1) = 0
arrayx(2) = 0
arrayx(3) = 0
arrayx(4) = - Xrot
arrayx(5) = Xrot
arrayx(6) = 0
arrayx(7) = - Xrot
arrayx(8) = - Xrot
arrayx(9) = 0.000000
arrayx(10) = 0.000000
arrayx(11) = 0.000000
move1.Apply arrayx
End If
'**************************************
If Yrot 1 And Yrot > 0 Then
MsgBox "In Y positive rotation"
Set move2 = product2.Move
Set move2 = move2.MovableObject
arrayy(0) = Yrot
arrayy(1) = 0
arrayy(2) = - Yrot
arrayy(3) = 0
arrayy(4) = 1
arrayy(5) = 0
arrayy(6) = Yrot
arrayy(7) = 0
arrayy(8) = Yrot
arrayy(9) = 0.000000
arrayy(10) = 0.000000
arrayy(11) = 0.000000
move2.Apply arrayy
End If
If Yrot 1 And Yrot < 0 Then
MsgBox "In Y negative rotation"
Set move2 = product2.Move
Set move2 = move2.MovableObject
arrayy(0) = - Yrot
arrayy(1) = 0
arrayy(2) = - Yrot
arrayy(3) = 0
arrayy(4) = 1
arrayy(5) = 0
arrayy(6) = Yrot
arrayy(7) = 0
arrayy(8) = - Yrot
arrayy(9) = 0.000000
arrayy(10) = 0.000000
arrayy(11) = 0.000000
move2.Apply arrayy
End If
'**************************************
If Zrot 1 And Zrot > 0 Then
MsgBox "In Z positive rotation"
Set move3 = product2.Move
Set momove3e1 = move3.MovableObject
arrayz(0) = Zrot
arrayz(1) = Zrot
arrayz(2) = 0
arrayz(3) = - Zrot
arrayz(4) = Zrot
arrayz(5) = 0
arrayz(6) = 0
arrayz(7) = 0
arrayz(8) = 1
arrayz(9) = 0.000000
arrayz(10) = 0.000000
arrayz(11) = 0.000000
move3.Apply arrayz
End If
If Zrot 1 And Zrot < 0 Then
MsgBox "In Z negative rotation"
Set move3 = product2.Move
Set move3 = move3.MovableObject
arrayz(0) = - Zrot
arrayz(1) = Zrot
arrayz(2) = 0
arrayz(3) = - Zrot
arrayz(4) = - Zrot
arrayz(5) = 0
arrayz(6) = 0
arrayz(7) = 0
arrayz(8) = 1
arrayz(9) = 0.000000
arrayz(10) = 0.000000
arrayz(11) = 0.000000
move3.Apply arrayz
End If
End Sub