bonjour tout le monde, :) j ai un petit dev a faire pour catia v5, je cherche a ouvrir un fichier catiaV4 en tant que catpart. je m'explique : le but principal de cette manipe est de pouvoir recupéré le current axys du fichier model et dans sortir les vecteurs. le probléme est que pour pouvoir récup les axys a l aide de la fonction monfichier_catia.AxisSystems je doit etre dans un catproduct et non pas dans un je ne sais pas trop quoi quand je double click sur mon fichier model autrement je ne suis pas utilisateur catia et le dev est a faire sous vba excel pour d autre raison technique merci d'avance je joint le code Sub CATMain(MyPartDocument As Object) Set AxisSystemColl = MyPartDocument.Part.AxisSystems i = 0 For Each Axes In AxisSystemColl i = i + 1 Set ThisAxisSystem = AxisSystemColl.Item(i) If ThisAxisSystem.IsCurrent = 1 Then 'recuperation des vecteurs du systeme d'axes Dim vectX(2) ThisAxisSystem.GetXAxis vectX 'MsgBox ("Xx: " & vectX(0)) 'MsgBox ("Xy: " & vectX(1)) 'MsgBox ("Xz: " & vectX(2)) Dim vectY(2) ThisAxisSystem.GetYAxis vectY 'MsgBox ("Yx: " & vectY(0)) 'MsgBox ("Yy: " & vectY(1)) 'MsgBox ("Yz: " & vectY(2)) Dim vectZ(2) ThisAxisSystem.GetZAxis vectZ 'MsgBox ("Zx: " & vectZ(0)) 'MsgBox ("Zy: " & vectZ(1)) 'MsgBox ("Zz: " & vectZ(2)) Dim matInverse As Variant Dim M(2, 2) As Double 'CREATION DE LA MATRICE M pour l'inverser M(0, 0) = vectX(0) M(0, 1) = vectY(0) 'vectX(0) vectY(0) vectZ(0) M(0, 2) = vectZ(0) 'vectX(1) vectY(1) vectZ(1) M(1, 0) = vectX(1) 'vectX(2) vectY(2) vectZ(2) M(1, 1) = vectY(1) M(1, 2) = vectZ(1) ' M(2, 0) = vectX(2) M(2, 1) = vectY(2) M(2, 2) = vectZ(2) matInverse = MInverse(M) 'invertion 'coordonnee Dim originCoord(2) ThisAxisSystem.GetOrigin originCoord 'MsgBox ("coord x: " & originCoord(0)) 'MsgBox ("coord y: " & originCoord(1)) 'MsgBox ("coord z: " & originCoord(2)) Dim pret16(15) As Double 'matrice pret pour exporter Dim j As Integer For j = 0 To 11 pret16(j) = matInverse(j) Next j pret16(12) = -originCoord(0) pret16(13) = -originCoord(1) pret16(14) = -originCoord(2) pret16(15) = 1 Dim str As String str = "16 chiffres pret: " & Chr(10) For j = 0 To 15 str = str & pret16(j) & Chr(10) Next j MsgBox (str) Exit Sub End If Next Axes End Sub Function MInverse(M) 'prend la forme de table 2 dimesions, sort le variable variant a la forme d'une table 1 dimesion ordre par colonne Dim det As Double Dim M_1(0 To 2, 0 To 2) As Double det = ((M(0, 0) * ((M(1, 1) * M(2, 2)) - (M(1, 2) * M(2, 1)))) - (M(0, 1) * ((M(1, 0) * M(2, 2)) - (M(1, 2) * M(2, 0)))) + (M(0, 2) * ((M(1, 0) * M(2, 1)) - (M(1, 1) * M(2, 0))))) M_1(0, 0) = (((M(1, 1) * M(2, 2) - M(1, 2) * M(2, 1))) / det) M_1(0, 1) = (((M(0, 2) * M(2, 1) - M(0, 1) * M(2, 2))) / det) M_1(0, 2) = (((M(0, 1) * M(1, 2) - M(0, 2) * M(1, 1))) / det) M_1(1, 0) = (((M(1, 2) * M(2, 0) - M(1, 0) * M(2, 2))) / det) M_1(1, 1) = (((M(0, 0) * M(2, 2) - M(0, 2) * M(2, 0))) / det) M_1(1, 2) = (((M(0, 2) * M(1, 0) - M(0, 0) * M(1, 2))) / det) M_1(2, 0) = (((M(1, 0) * M(2, 1) - M(1, 1) * M(2, 0))) / det) M_1(2, 1) = (((M(0, 1) * M(2, 0) - M(0, 0) * M(2, 1))) / det) M_1(2, 2) = (((M(0, 0) * M(1, 1) - M(0, 1) * M(1, 0))) / det) 'avec 0 entre les vecteurs MInverse = Array(M_1(0, 0), M_1(1, 0), M_1(2, 0), 0, M_1(0, 1), M_1(1, 1), M_1(2, 1), 0, M_1(0, 2), M_1(1, 2), M_1(2, 2), 0) End Function Function init() Dim TypeFichier As Integer Dim PtDoc As Object Set PtDoc = GetCATIAPartDocument1 End Function Function GetCATIAPartDocument1() As Object Set CATIA = GetCATIA1 Dim MyPartDocument As Object Set MyPartDocument = CATIA.ActiveDocument Set GetCATIAPartDocument = MyPartDocument 'Call CATMain(MyPartDocument) Call copie_model(MyPartDocument) End Function Function GetCATIA1() As Object Set CATIA = GetObject(, "CATIA.Application") If CATIA Is Nothing Then Set CATIA = CreateObject("CATIA.Application") CATIA.Visible = True End If Set GetCATIA1 = CATIA End Function [Edité le 11/4/2006 par legato]