Macro FCInfo/it

Descrizione
Fornisce una ampia serie di informazioni sulla forma selezionata quali lunghezza, angoli, superficie, volume e peso secondo la densità della forma selezionata, sia nelle unità del Sistema Internazionale che in quelle del Sistema Anglosassone.



Utilizzo
Selezionare un oggetto e avviare l'applicazione o viceversa. Viene visualizzata la tabella delle informazioni. I calcoli sono basati sull'unità di FreeCAD, che è il mm. Ogni nuova selezione ripristina il mm per l'unità di lunghezza e i gradi sessadecimali (°) per gli angoli.

Una volta lanciata la macro, essa rimane attiva e la finestra rimane visibile. Per chiudere la macro si deve usare il pulsante. Se si esce tramite la piccola croce, la macro rimane in memoria ed i dati vengono visualizzati nel report di FreeCAD.

Lunghezza :
km, hm, dam, m, dm, cm, mm, inch, link, foot, yard, perch, chain, furlong, mile, league, nautique.

Angoli :
gradi sessadecimali, sessagesimali, radianti, centesimali.

Peso :
tonne, quintal, kg, hg, dag, grammo, dg, cg, mg, gr (grain), dr (drachm), oz (once), oz t (once troy),

lb t (livre troy), lb (livre av), st (stone), qtr (quarter), cwt (hundredweight)

Il valore della massa volumica è preimpostato su 7,5 kg/dm3, che è la densità media dell'acciaio. Per impostare un valore predefinito diverso, modificare il valore della densità nella riga 126:

global densite      ; densite       = 7.5  # (acier = 7.5 kg par dm3)

Tramite il pulsante è possibile archiviare i dati ottenuti in un file di tipo csv e utilizzarli in una tabella.

Script
Copiare il contenuto della macro in un file chiamato "FCInfo.FCMacro" posto nella directory "C:\Program Files\FreeCAD0.13" per Windows e in "/usr/lib/freecad" con i privilegi di amministratore per Ubuntu.

Oppure copiare la macro direttamente nell'interfaccia di FreeCAD.

L'icona deve essere posizionata nella stessa directory della macro.

Per scaricare l'icona posizionarsi su questa immagine: poi fare clic con il tasto destro del mouse e scegliere l'opzione "Salva immagine con nome" (non modificare il nome).

FCInfo.FCMacro


 * 1) -*- coding: utf-8 -*-
 * 2) FCInfo.FCMacro
 * 3)       https://fr.wikipedia.org/wiki/Kilogramme
 * 4) donne des informations sur l'objet sélectionné
 * 5) les calculs son basés sur l'unité de FreeCAD, le mm
 * 6) Sélectionnez un objet et lancer l'application
 * 7) reviens toujours sur mm
 * 8) toujours quitter par le bouton "Quitter" si l'on quitte le programme sans passer par le bouton 'Quitter" le programme reste en mémoire
 * 9) il faut alors quitter FreeCAD pour l'éffacer de la mémoire
 * 10) seul les 200 objets premiers sont visibles dans le tableau s'il y en a plus un signal sera affiché par (! +200),
 * 11) la liste complète des données sont visible dans le fichier sauvé
 * 12) python 2.6
 * 13) WARNING! All changes made in this file will be lost!
 * 1) WARNING! All changes made in this file will be lost!

__title__  = "FCInfo" __author__ = "Mario52" __url__    = "http://www.freecadweb.org/index-fr.html" __version__ = "01.02" __date__   = "07/09/2013"

import Draft, Part, FreeCAD, math, PartGui, FreeCADGui, PyQt4 import Part from math import sqrt, pi, sin, cos, asin, degrees, radians from FreeCAD import Base from PyQt4 import QtGui ,QtCore from PyQt4.QtGui import QComboBox from PyQt4.QtGui import QMessageBox

from PyQt4.QtGui import * from PyQt4.QtCore import *

try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s

try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig)

from math import sqrt, pi, sin, cos, asin, acos, atan, atan2, degrees

def errorDialog(msg): diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",msg ) diag.setWindowFlags(PyQt4.QtCore.Qt.WindowStaysOnTopHint) # cette fonction met la fenêtre en avant diag.exec_
 * 1)    diag.setWindowModality(QtCore.Qt.ApplicationModal)       # la fonction a été désactivée pour favoriser "WindowStaysOnTopHint"

def iso8859(encoder): return unicode(encoder).encode('iso-8859-1')

def utf8(unio): return unicode(unio).encode('UTF8')

def heure: return QtCore.QTime.currentTime.toString('hh:mm:ss') def dateEu: return QtCore.QDate.currentDate.toString('dd/MM/yyyy')      # forme euro def dateUs: return QtCore.QDate.currentDate.toString('MM/dd/yyyy')      # forme us def dateComp: return QtCore.QDate.currentDate.toString('dddd d MMMM yyyy') # Retourne "dimanche 20 Juillet 69"

def degMinSec(angle0): # donner l'angle en degré try: deg = float(angle0) min = float((angle0 - deg)*60) sec = round (((((angle0 - deg)*60)-min)*60),6) angle = str(deg)+u"° "+str(min)+u"' "+str(sec)+u"''" return angle except: return 0

def angleGrade(angle0): # donner l'angle en degré try: angle = float(angle0) angle = (200 * angle) / 180 return angle except: return 0

def angle2(vecteur_x1,vecteur_y1,vecteur_x2,vecteur_y2,mode): try: deltaX = vecteur_x2 - vecteur_x1 deltaY = vecteur_y2 - vecteur_y1 if mode ==1: angle = degrees(atan2(float(deltaY),float(deltaX))) # degrès else: angle = atan2(float(deltaY),float(deltaX))         # radian return angle except: return 0
 * 1) calcul de l'inclinaison d'une ligne à partir de deux Vecteurs
 * 2) si "mode" = 1 alors affichage en degrès sinon en radian

global sel          ; sel           = "" global document_    ; document_     = "FCInfo" global object_      ; object_       = "" global typeObject   ; typeObject    = "" global element_     ; element_      = "" global position0    ; position0     = 0.0 global position1    ; position1     = 0.0 global position2    ; position2     = 0.0 global longueurObjet ; longueurObjet = 0.0 global perimetre    ; perimetre     = 0.0

global Plan_xy      ; Plan_xy       = 0.0 global Plan_xy_s    ; Plan_xy_s     = "" global Plan_yz      ; Plan_yz       = 0.0 global Plan_yz_s    ; Plan_yz_s     = "" global Plan_zx      ; Plan_zx       = 0.0 global Plan_zx_s    ; Plan_zx_s     = ""

global surface      ; surface       = 0.0 global surfaceFace  ; surfaceFace   = 0.0 global volume_      ; volume_       = 0.0 global densite      ; densite       = 7.5  # (acier = 7.5 kg par dm3) global poids        ; poids         = 0.0 global uniteM       ; uniteM        = 1.0  # unité de mesure longueur global uniteMs      ; uniteMs        = "mm" global uniteS       ; uniteS        = 1.0  # unité de mesure surface global uniteSs      ; uniteSs       = u"mm²" global uniteV       ; uniteV        = 1.0  # unité de mesure volume global uniteVs      ; uniteVs       = u"mm³" global uniteP       ; uniteP        = 1.0  # unité de mesure poids global unitePs      ; unitePs       = "g" global uniteDs      ; uniteDs       = u"°" # unité degré d'angle

global boundBoxCenterX ; boundBoxCenterX = 0.0 global boundBoxCenterY ; boundBoxCenterY = 0.0 global boundBoxCenterZ ; boundBoxCenterZ = 0.0

global boundBoxCenter; boundBoxCenter= 0.0

global CenterOfMassX ; CenterOfMassX = 0.0 global CenterOfMassY ; CenterOfMassY = 0.0 global CenterOfMassZ ; CenterOfMassZ = 0.0

global boundBox_    ; boundBox_     = 0.0 global MatrixX1     ; MatrixX1      = 0.0 global MatrixY1     ; MatrixY1      = 0.0 global MatrixZ1     ; MatrixZ1      = 0.0 global Matrix_1     ; Matrix_1      = 0.0 global MatrixX2     ; MatrixX2      = 0.0 global MatrixY2     ; MatrixY2      = 0.0 global MatrixZ2     ; MatrixZ2      = 0.0 global Matrix_2     ; Matrix_2      = 0.0 global MatrixX3     ; MatrixX3      = 0.0 global MatrixY3     ; MatrixY3      = 0.0 global MatrixZ3     ; MatrixZ3      = 0.0 global Matrix_3     ; Matrix_3      = 0.0 global Matrix12     ; Matrix12      = 0.0 global Matrix13     ; Matrix13      = 0.0 global Matrix14     ; Matrix14      = 0.0 global Matrix15     ; Matrix15      = 0.0

global Vertx        ; Vertx         = "" global Edges        ; Edges         = "" global EdgesLong    ; EdgesLong     = 0.0 global Faces        ; Faces         = "" global FacesSurf    ; FacesSurf     = 0.0 global compt_V      ; compt_V       = 0 global compt_E      ; compt_E       = 0 global compt_F      ; compt_F       = 0 global placement_   ; placement_    = "" global RowCount     ; RowCount      = 200 global RowCountTest ; RowCountTest  = 0 global path         ; path          = "" global SaveName     ; SaveName      = ""

path = FreeCAD.ConfigGet("AppHomePath")

def tableau: global sel global perimetre global Vertx global Edges global EdgesLong global Faces global FacesSurf global compt_V global compt_E global compt_F #global RowCount global RowCountTest global pas # tableau # Vertexes

sel = FreeCADGui.Selection.getSelection if len(sel) != 0: Vertx=[] Edges=[] Faces=[] compt_V=0 compt_E=0 compt_F=0 pas   =0 for num in sel[0].Shape.Vertexes: compt_V+=1 if pas == 0: Vertx.append("X1: "+str(num.Point[0])) Vertx.append("Y1: "+str(num.Point[1])) Vertx.append("Z1: "+str(num.Point[2])) pas=1 else: Vertx.append("X2: "+str(num.Point[0])) Vertx.append("Y2: "+str(num.Point[1])) Vertx.append("Z2: "+str(num.Point[2])) pas=0

perimetre = 0.0 EdgesLong = [] for j in enumerate(sel[0].Shape.Edges): compt_E+=1 Edges.append("Edge%d" % (j[0]+1)) EdgesLong.append(str(sel[0].Shape.Edges[compt_E-1].Length)) perimetre += (sel[0].Shape.Edges[compt_E-1].Length) print "Edge",str(compt_E)," > ",str(sel[0].Shape.Edges[compt_E-1].Length)," ",uniteMs print "Périmètre de la forme        : ",perimetre," ",uniteMs

FacesSurf = [] for j in enumerate(sel[0].Shape.Faces): compt_F+=1 Faces.append("Face%d" % (j[0]+1)) FacesSurf.append(str(sel[0].Shape.Faces[compt_F-1].Area)) print "Face",str(compt_F)," > ",sel[0].Shape.Faces[compt_F-1].Area," ",uniteSs

RowCountTest = compt_V + compt_E + compt_F

print "compteur ",compt_V ," ", compt_E," ", compt_F," (", RowCountTest,")"

for j in enumerate(Vertx): print j[1] for j in enumerate(Edges): print j[1] for j in enumerate(Faces): print j[1]

def affect: global sel global document_ global object_ global typeObject global element_ global longueurObjet

global Plan_xy global Plan_xy_s global Plan_yz global Plan_yz_s global Plan_zx global Plan_zx_s

global surface global surfaceFace global volume_ global densite global poids global uniteM global uniteMs #global uniteS global uniteSs #global uniteV global uniteVs global uniteP global unitePs global uniteDs

global boundBoxCenterX global boundBoxCenterY global boundBoxCenterZ

global boundBoxCenter

global CenterOfMassX global CenterOfMassY global CenterOfMassZ

global boundBox_ global MatrixX1 global MatrixY1 global MatrixZ1 global Matrix_1 global MatrixX2 global MatrixY2 global MatrixZ2 global Matrix_2 global MatrixX3 global MatrixY3 global MatrixZ3 global Matrix_3 global Matrix12 global Matrix13 global Matrix14 global Matrix15

global placement_ global SaveName

sel = FreeCADGui.Selection.getSelection mydoc = FreeCAD.activeDocument.Name document_ = mydoc print "Nom du document              : ",document_

try: object_ = sel[0].Label print "Nom de l'objet               : ",object_ except: object_ = "" print

try: SubElement = FreeCADGui.Selection.getSelectionEx element_ = SubElement[0].SubElementNames[0] print "Nom du sub élement           : ",element_ except: element_ = "" print # longueur Objet try: longueurObjet = Gui.Selection.getSelectionEx[0].SubObjects[0].Length print "Longueur de l'objet          : ",longueurObjet * uniteM," ",uniteMs except: longueurObjet = 0.0 print

# surface try: surface = sel[0].Shape.Area print "Surface totale de la forme   : ",surface," ",uniteSs except: surface = 0.0 print

try: surfaceFace = Gui.Selection.getSelectionEx[0].SubObjects[0].Area print "Surface de la face           : ",surfaceFace," ",uniteSs except: surfaceFace = 0.0 print

# volume try: volume_ = sel[0].Shape.Volume print "Volume de la forme           : ", volume_," ",uniteVs except: volume_ = 0.0 print

# densité poids = ((volume_ * densite) * uniteP) / 1000  # mm3   (mm base  FreeCAD) print "Densité de la forme          : ", poids," ",unitePs

# boundinbox (dimensions hors tout) try: boundBox_ = sel[0].Shape.BoundBox print "Dimensions hors tout         : ", boundBox_ except: boundBox_ = "" print

# centre de la forme try: boundBoxCenterX = boundBox_.Center[0] boundBoxCenterY = boundBox_.Center[1] boundBoxCenterZ = boundBox_.Center[2] print "Centre de la forme x         : ", boundBoxCenterX print "Centre de la forme y         : ", boundBoxCenterY print "Centre de la forme z         : ", boundBoxCenterZ except: boundBoxCenterX = 0.0 boundBoxCenterY = 0.0 boundBoxCenterZ = 0.0 print

# Inclinaison mode = 1 try: Plan_xy  = angle2(sel[0].Shape.Vertexes[0].Point[0],sel[0].Shape.Vertexes[0].Point[1],sel[0].Shape.Vertexes[1].Point[0],sel[0].Shape.Vertexes[1].Point[1],mode) Plan_xy_s = "["+str(sel[0].Shape.Vertexes[0].Point[0])+" "+str(sel[0].Shape.Vertexes[0].Point[1])+"], ["+str(sel[0].Shape.Vertexes[1].Point[0])+" "+str(sel[0].Shape.Vertexes[1].Point[1])+"]" print "Plan xy     : ",Plan_xy," ",Plan_xy_s except: Plan_xy = 0.0 Plan_xy_s = "" print "xy-" try: Plan_yz  = angle2(sel[0].Shape.Vertexes[0].Point[1],sel[0].Shape.Vertexes[0].Point[2],sel[0].Shape.Vertexes[1].Point[1],sel[0].Shape.Vertexes[1].Point[2],mode) Plan_yz_s = "["+str(sel[0].Shape.Vertexes[0].Point[1])+" "+str(sel[0].Shape.Vertexes[0].Point[2])+"], ["+str(sel[0].Shape.Vertexes[1].Point[1])+" "+str(sel[0].Shape.Vertexes[1].Point[2])+"]" print "Plan yz     : ",Plan_yz," ",Plan_yz_s except: Plan_yz  = 0.0 Plan_yz_s  = "" print "yz-" try: Plan_zx  = angle2(sel[0].Shape.Vertexes[0].Point[2],sel[0].Shape.Vertexes[0].Point[0],sel[0].Shape.Vertexes[1].Point[2],sel[0].Shape.Vertexes[1].Point[0],mode) Plan_zx_s = "["+str(sel[0].Shape.Vertexes[0].Point[2])+" "+str(sel[0].Shape.Vertexes[0].Point[0])+"], ["+str(sel[0].Shape.Vertexes[1].Point[2])+" "+str(sel[0].Shape.Vertexes[1].Point[0])+"]" print "Plan zx     : ",Plan_zx," ",Plan_zx_s except: Plan_zx  = 0.0 Plan_zx_s  = "" print "zx-" print
 * 1)         # Placement
 * 2)        placement_ = sel[0].Shape.Placement
 * 3)        print placement_

# tableau # Vertexes tableau

selEx = FreeCADGui.Selection.getSelectionEx objs = [selobj.Object for selobj in selEx] s = objs[0].Shape typeObject = "" try: typeObject = s.Solids[0].ShapeType except: print "Erreur type Objet" # centre de la masse try: c = s.Solids[0].CenterOfMass CenterOfMassX = c.x           CenterOfMassY = c.y            CenterOfMassZ = c.z            print "Centre de la masse X          : ", CenterOfMassX print "Centre de la masse Y         : ", CenterOfMassY print "Centre de la masse Z         : ", CenterOfMassZ except: CenterOfMassX = 0.0 CenterOfMassY = 0.0 CenterOfMassZ = 0.0 print
 * 1)            typeObject = App.ActiveDocument.ActiveObject.Shape.ShapeType

# inertie try: m = s.Solids[0].MatrixOfInertia print "Inertie " MatrixX1 = (m.A[0]) MatrixY1 = (m.A[1]) MatrixZ1 = (m.A[2]) Matrix_1 = (m.A[3])

MatrixX2 = (m.A[4]) MatrixY2 = (m.A[5]) MatrixZ2 = (m.A[6]) Matrix_2 = (m.A[7])

MatrixX3 = (m.A[8]) MatrixY3 = (m.A[9]) MatrixZ3 = (m.A[10]) Matrix_3 = (m.A[11])

Matrix12 = (m.A[12]) Matrix13 = (m.A[13]) Matrix14 = (m.A[14]) Matrix15 = (m.A[15])

print "Matrix : X                   : ", MatrixX1 print "Matrix : Y                   : ", MatrixY1 print "Matrix : Z                   : ", MatrixZ1 print "Matrix :                     : ", Matrix_1 print "Matrix : X                   : ", MatrixX2 print "Matrix : Y                   : ", MatrixY2 print "Matrix : Z                   : ", MatrixZ2 print "Matrix :                     : ", Matrix_2 print "Matrix : X                   : ", MatrixX3 print "Matrix : Y                   : ", MatrixY3 print "Matrix : Z                   : ", MatrixZ3 print "Matrix :                     : ", Matrix_3 print "Matrix :                     : ", Matrix12 print "Matrix :                     : ", Matrix13 print "Matrix :                     : ", Matrix14 print "Matrix :                     : ", Matrix15 except: print "Erreur Inertie " MatrixX1 = 0.0 MatrixY1 = 0.0 MatrixZ1 = 0.0 Matrix_1 = 0.0

MatrixX2 = 0.0 MatrixY2 = 0.0 MatrixZ2 = 0.0 Matrix_2 = 0.0

MatrixX3 = 0.0 MatrixY3 = 0.0 MatrixZ3 = 0.0 Matrix_3 = 0.0

Matrix12 = 0.0 Matrix13 = 0.0 Matrix14 = 0.0 Matrix15 = 0.0 print "Fin_________________________________________________________________________"

class Ui_MainWindow(object):      # fenêtre début

def __init__(self, MainWindow): global sel global document_ global object_ global typeObject global element_ global position0 global position1 global position2 global longueurObjet global perimetre global Plan_xy global Plan_xy_s global Plan_yz global Plan_yz_s global Plan_zx global Plan_zx_s global surface global surfaceFace global volume_ global densite global poids global uniteM global uniteMs global uniteS global uniteSs global uniteV global uniteVs global uniteP global unitePs global uniteDs global boundBoxCenterX global boundBoxCenterY global boundBoxCenterZ global boundBoxCenter global CenterOfMassX global CenterOfMassY global CenterOfMassZ global boundBox_

global MatrixX1 global MatrixY1 global MatrixZ1 global Matrix_1

global MatrixX2 global MatrixY2 global MatrixZ2 global Matrix_2

global MatrixX3 global MatrixY3 global MatrixZ3 global Matrix_3

global Matrix12 global Matrix13 global Matrix14 global Matrix15 global Vertx global Edges global EdgesLong global Faces global FacesSurf global compt_V global compt_E global compt_F global placement_ global RowCount global RowCountTest

self.window = MainWindow MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(339, 969) self.centralWidget = QtGui.QWidget(MainWindow) self.centralWidget.setObjectName(_fromUtf8("centralWidget")) MainWindow.setWindowModality(QtCore.Qt.NonModal) MainWindow.setFocusPolicy(QtCore.Qt.NoFocus) MainWindow.setIconSize(QtCore.QSize(30, 30)) MainWindow.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) MainWindow.setDocumentMode(True) MainWindow.setTabShape(QtGui.QTabWidget.Triangular) MainWindow.setDockOptions(QtGui.QMainWindow.AllowTabbedDocks|QtGui.QMainWindow.AnimatedDocks|QtGui.QMainWindow.VerticalTabs)
 * 1)        MainWindow.setMaximumSize(QtCore.QSize(339, 969))
 * 1)        MainWindow.verticalScrollBar

sel = FreeCADGui.Selection.getSelection if len(sel)==0: print "Sélectionnez un objet" errorDialog(u"Sélectionnez un objet") else: affect self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_1.setGeometry(QtCore.QRect(120, 10, 211, 22)) self.lineEdit_1.setObjectName(_fromUtf8("lineEdit_1")) self.lineEdit_1.setText(document_) self.lineEdit_1.setToolTip(_translate("MainWindow", "Nom du document actif.", None))
 * 1)         # Placement
 * 2)        placement_ = sel[0].Shape.Placement
 * 3)        print placement_
 * 1)        print placement_

self.lineEdit_2 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_2.setGeometry(QtCore.QRect(120, 40, 101, 22)) self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2")) self.lineEdit_2.setText(object_) self.lineEdit_2.setToolTip(_translate("MainWindow",u"Nom de l'objet séléctionné.", None))

self.lineEdit_2a = QtGui.QLineEdit(self.centralWidget) self.lineEdit_2a.setGeometry(QtCore.QRect(230, 40, 101, 22)) self.lineEdit_2a.setObjectName(_fromUtf8("lineEdit_2a")) self.lineEdit_2a.setText(typeObject) self.lineEdit_2a.setToolTip(_translate("MainWindow","Type de forme de l'objet.", None))

self.lineEdit_3 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_3.setGeometry(QtCore.QRect(120, 70, 211, 22)) self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3")) self.lineEdit_3.setText(str(element_)) self.lineEdit_3.setToolTip(_translate("MainWindow",u"Nom de l'élément sélectionné.", None))

self.lineEdit_4x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_4x.setGeometry(QtCore.QRect(10, 140, 101, 22)) self.lineEdit_4x.setObjectName(_fromUtf8("lineEdit_4x")) self.lineEdit_4x.setText(str(position0)) self.lineEdit_4x.setToolTip(_translate("MainWindow",u"Coordonnée X du clic de la souris.", None))

self.lineEdit_4y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_4y.setGeometry(QtCore.QRect(120, 140, 101, 22)) self.lineEdit_4y.setObjectName(_fromUtf8("lineEdit_4y")) self.lineEdit_4y.setText(str(position1)) self.lineEdit_4y.setToolTip(_translate("MainWindow",u"Coordonnée Y du clic de la souris.", None))

self.lineEdit_4z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_4z.setGeometry(QtCore.QRect(230, 140, 101, 22)) self.lineEdit_4z.setObjectName(_fromUtf8("lineEdit_4z")) self.lineEdit_4z.setText(str(position2)) self.lineEdit_4z.setToolTip(_translate("MainWindow",u"Coordonnée Z du clic de la souris.", None))

self.lineEdit_5 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_5.setGeometry(QtCore.QRect(120, 170, 211, 22)) self.lineEdit_5.setObjectName(_fromUtf8("lineEdit_5")) self.lineEdit_5.setText(str(longueurObjet)) self.lineEdit_5.setToolTip(_translate("MainWindow",u"Longueur de l'objet.\nSi une face est sélectionnée le périmètre de la face sera affiché.", None))

self.lineEdit_6 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_6.setGeometry(QtCore.QRect(120, 200, 211, 22)) self.lineEdit_6.setObjectName(_fromUtf8("lineEdit_6")) self.lineEdit_6.setText(str(perimetre)) self.lineEdit_6.setToolTip(_translate("MainWindow",u"Périmètre total de la forme.", None))

# tableau # Vertexes tableau

self.tableWidget = QtGui.QTableWidget(self.centralWidget) self.tableWidget.setGeometry(QtCore.QRect(10, 250, 320, 70)) self.tableWidget.setIconSize(QtCore.QSize(15, 15)) self.tableWidget.setRowCount(RowCount) self.tableWidget.setColumnCount(6) self.tableWidget.setObjectName(_fromUtf8("tableWidget")) self.tableWidget.horizontalHeader.setVisible(False)              # self.tableWidget.horizontalHeader.setDefaultSectionSize(100) self.tableWidget.horizontalHeader.setMinimumSectionSize(15) self.tableWidget.verticalHeader.setVisible(True) self.tableWidget.verticalHeader.setCascadingSectionResizes(False) # self.tableWidget.verticalHeader.setDefaultSectionSize(20) self.tableWidget.verticalHeader.setMinimumSectionSize(20) self.tableWidget.setToolTip(_translate("MainWindow",u"Tableau d'affichage du détail de la forme.\nSeul les 200 premiers détails de la forme sont affichés.\nTous les éléments seront visibles dans le fichier après l'avoir sauvé.", None))

co = 0 li = 0 for j in enumerate(Vertx): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,co, newitem) co += 1 if co == 6: li+= 1 co = 0 li+= 1 co=0 for j in enumerate(Edges): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,0, newitem) newitem = QtGui.QTableWidgetItem(str(float(EdgesLong[co]) * float(uniteM))+" "+uniteMs) self.tableWidget.setItem( li,1, newitem) co+=1 li+= 1 li+= 1 co=0

for j in enumerate(Faces): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,0, newitem) newitem = QtGui.QTableWidgetItem(str(float(FacesSurf[co]) * float(uniteM))+" "+uniteSs) self.tableWidget.setItem( li,1, newitem) co+=1 li+= 1

self.pushButton_Ra = QtGui.QPushButton(self.centralWidget) self.pushButton_Ra.setGeometry(QtCore.QRect(35, 338, 91, 20)) self.pushButton_Ra.setObjectName(_fromUtf8("pushButton_Ra")) self.pushButton_Ra.clicked.connect(self.on_pushButton_Ra_clicked) #connection pushButton_Ra "Radian" self.pushButton_Ra.setToolTip(_translate("MainWindow",u"Bascule entre Degrés décimal, Degrés minutes secondes\nRadian, Grade.", None))

self.lineEdit_8xy = QtGui.QLineEdit(self.centralWidget) self.lineEdit_8xy.setGeometry(QtCore.QRect(35, 360, 91, 22)) self.lineEdit_8xy.setObjectName(_fromUtf8("lineEdit_8xy")) self.lineEdit_8xy.setText(str(Plan_xy)+u"°") self.lineEdit_8xy.setToolTip(_translate("MainWindow",u"Angle dans le plan XY.", None))

self.lineEdit_8xya = QtGui.QLineEdit(self.centralWidget) self.lineEdit_8xya.setGeometry(QtCore.QRect(130, 360, 201, 22)) self.lineEdit_8xya.setObjectName(_fromUtf8("lineEdit_8xya")) self.lineEdit_8xya.setText(str(Plan_xy_s))

self.lineEdit_8yz = QtGui.QLineEdit(self.centralWidget) self.lineEdit_8yz.setGeometry(QtCore.QRect(35, 390, 91, 22)) self.lineEdit_8yz.setObjectName(_fromUtf8("lineEdit_8yz")) self.lineEdit_8yz.setText(str(Plan_yz)+u"°") self.lineEdit_8yz.setToolTip(_translate("MainWindow",u"Angle dans le plan YZ.", None))

self.lineEdit_8yza = QtGui.QLineEdit(self.centralWidget) self.lineEdit_8yza.setGeometry(QtCore.QRect(130, 390, 201, 22)) self.lineEdit_8yza.setObjectName(_fromUtf8("lineEdit_8yza")) self.lineEdit_8yza.setText(str(Plan_yz_s))

self.lineEdit_8zx = QtGui.QLineEdit(self.centralWidget) self.lineEdit_8zx.setGeometry(QtCore.QRect(35, 420, 91, 22)) self.lineEdit_8zx.setObjectName(_fromUtf8("lineEdit_8zx")) self.lineEdit_8zx.setText(str(Plan_zx)+u"°") self.lineEdit_8zx.setToolTip(_translate("MainWindow",u"Angle dans le plan ZX.", None))

self.lineEdit_8zxa = QtGui.QLineEdit(self.centralWidget) self.lineEdit_8zxa.setGeometry(QtCore.QRect(130, 420, 201, 22)) self.lineEdit_8zxa.setObjectName(_fromUtf8("lineEdit_8zxa")) self.lineEdit_8zxa.setText(str(Plan_zx_s))

self.lineEdit_9a = QtGui.QLineEdit(self.centralWidget) self.lineEdit_9a.setGeometry(QtCore.QRect(130, 450, 201, 22)) self.lineEdit_9a.setObjectName(_fromUtf8("lineEdit_9a")) self.lineEdit_9a.setText(str(surface)) self.lineEdit_9a.setToolTip(_translate("MainWindow",u"Surface totale de la forme.", None))

self.lineEdit_10a = QtGui.QLineEdit(self.centralWidget) self.lineEdit_10a.setGeometry(QtCore.QRect(130, 480, 201, 22)) self.lineEdit_10a.setObjectName(_fromUtf8("lineEdit_10a")) self.lineEdit_10a.setText(str(surfaceFace)) self.lineEdit_10a.setToolTip(_translate("MainWindow",u"Surface de la face.", None))

self.lineEdit_11a = QtGui.QLineEdit(self.centralWidget) self.lineEdit_11a.setGeometry(QtCore.QRect(130, 510, 201, 22)) self.lineEdit_11a.setObjectName(_fromUtf8("lineEdit_11a")) self.lineEdit_11a.setText(str(volume_)) self.lineEdit_11a.setToolTip(_translate("MainWindow",u"Volume total de la forme.", None))

self.lineEdit_12a = QtGui.QLineEdit(self.centralWidget) self.lineEdit_12a.setGeometry(QtCore.QRect(130, 540, 131, 22)) self.lineEdit_12a.setObjectName(_fromUtf8("lineEdit_12a")) self.lineEdit_12a.setText(str(poids)+" "+unitePs) self.lineEdit_12a.setToolTip(_translate("MainWindow",u"Poids de la forme dans l'unité sélectionnée.", None))

self.lineEdit_13x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_13x.setGeometry(QtCore.QRect(10, 610, 101, 22)) self.lineEdit_13x.setObjectName(_fromUtf8("lineEdit_13x")) self.lineEdit_13x.setText(str(boundBoxCenterX)) self.lineEdit_13x.setToolTip(_translate("MainWindow",u"Coordonnée X du centre de la forme.", None))

self.lineEdit_13y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_13y.setGeometry(QtCore.QRect(120, 610, 101, 22)) self.lineEdit_13y.setObjectName(_fromUtf8("lineEdit_13y")) self.lineEdit_13y.setText(str(boundBoxCenterY)) self.lineEdit_13y.setToolTip(_translate("MainWindow",u"Coordonnée Y du centre de la forme.", None))

self.lineEdit_13z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_13z.setGeometry(QtCore.QRect(230, 610, 101, 22)) self.lineEdit_13z.setObjectName(_fromUtf8("lineEdit_13z")) self.lineEdit_13z.setText(str(boundBoxCenterZ)) self.lineEdit_13z.setToolTip(_translate("MainWindow",u"Coordonnée Z du centre de la forme.", None))

self.lineEdit_14x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_14x.setGeometry(QtCore.QRect(10, 680, 101, 22)) self.lineEdit_14x.setObjectName(_fromUtf8("lineEdit_14x")) self.lineEdit_14x.setText(str(CenterOfMassX)) self.lineEdit_14x.setToolTip(_translate("MainWindow",u"Coordonnée X du centre de la masse", None))

self.lineEdit_14y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_14y.setGeometry(QtCore.QRect(120, 680, 101, 22)) self.lineEdit_14y.setObjectName(_fromUtf8("lineEdit_14y")) self.lineEdit_14y.setText(str(CenterOfMassY)) self.lineEdit_14y.setToolTip(_translate("MainWindow",u"Coordonnée Y du centre de la masse", None))

self.lineEdit_14z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_14z.setGeometry(QtCore.QRect(230, 680, 101, 22)) self.lineEdit_14z.setObjectName(_fromUtf8("lineEdit_14z")) self.lineEdit_14z.setText(str(CenterOfMassZ)) self.lineEdit_14z.setToolTip(_translate("MainWindow",u"Coordonnée Z du centre de la masse", None))

self.lineEdit_15 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_15.setGeometry(QtCore.QRect(120, 710, 211, 22)) self.lineEdit_15.setObjectName(_fromUtf8("lineEdit_15")) self.lineEdit_15.setText(str(boundBox_)) self.lineEdit_15.setToolTip(_translate("MainWindow",u"Dimensions hors tout de la forme.", None))

self.lineEdit_16_1x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_1x.setGeometry(QtCore.QRect(10, 780, 86, 22)) self.lineEdit_16_1x.setObjectName(_fromUtf8("lineEdit_16_1x")) self.lineEdit_16_1x.setText(str(MatrixX1))

self.lineEdit_16_1y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_1y.setGeometry(QtCore.QRect(105, 780, 86, 22)) self.lineEdit_16_1y.setObjectName(_fromUtf8("lineEdit_16_1y")) self.lineEdit_16_1y.setText(str(MatrixY1))

self.lineEdit_16_1z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_1z.setGeometry(QtCore.QRect(200, 780, 86, 22)) self.lineEdit_16_1z.setObjectName(_fromUtf8("lineEdit_16_1z")) self.lineEdit_16_1z.setText(str(MatrixZ1))

self.lineEdit_16_01 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_01.setGeometry(QtCore.QRect(295, 780, 36, 22)) self.lineEdit_16_01.setObjectName(_fromUtf8("lineEdit_16_01")) self.lineEdit_16_01.setText(str(Matrix_1))

self.lineEdit_16_2x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_2x.setGeometry(QtCore.QRect(10, 810, 86, 22)) self.lineEdit_16_2x.setObjectName(_fromUtf8("lineEdit_16_2x")) self.lineEdit_16_2x.setText(str(MatrixX2))

self.lineEdit_16_2y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_2y.setGeometry(QtCore.QRect(105, 810, 86, 22)) self.lineEdit_16_2y.setObjectName(_fromUtf8("lineEdit_16_2y")) self.lineEdit_16_2y.setText(str(MatrixY2))

self.lineEdit_16_2z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_2z.setGeometry(QtCore.QRect(200, 810, 86, 22)) self.lineEdit_16_2z.setObjectName(_fromUtf8("lineEdit_16_2z")) self.lineEdit_16_2z.setText(str(MatrixZ2))

self.lineEdit_16_02 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_02.setGeometry(QtCore.QRect(295, 810, 36, 22)) self.lineEdit_16_02.setObjectName(_fromUtf8("lineEdit_16_02")) self.lineEdit_16_02.setText(str(Matrix_2))

self.lineEdit_16_3x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_3x.setGeometry(QtCore.QRect(10, 840, 86, 22)) self.lineEdit_16_3x.setObjectName(_fromUtf8("lineEdit_16_3x")) self.lineEdit_16_3x.setText(str(MatrixX3))

self.lineEdit_16_3y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_3y.setGeometry(QtCore.QRect(105, 840, 86, 22)) self.lineEdit_16_3y.setObjectName(_fromUtf8("lineEdit_16_3y")) self.lineEdit_16_3y.setText(str(MatrixY3))

self.lineEdit_16_3z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_3z.setGeometry(QtCore.QRect(200, 840, 86, 22)) self.lineEdit_16_3z.setObjectName(_fromUtf8("lineEdit_16_3z")) self.lineEdit_16_3z.setText(str(MatrixZ3))

self.lineEdit_16_03 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_03.setGeometry(QtCore.QRect(295, 840, 36, 22)) self.lineEdit_16_03.setObjectName(_fromUtf8("lineEdit_16_03")) self.lineEdit_16_03.setText(str(Matrix_3))

self.lineEdit_16_4x = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_4x.setGeometry(QtCore.QRect(10, 870, 86, 22)) self.lineEdit_16_4x.setObjectName(_fromUtf8("lineEdit_16_4x")) self.lineEdit_16_4x.setText(str(Matrix12))

self.lineEdit_16_4y = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_4y.setGeometry(QtCore.QRect(105, 870, 86, 22)) self.lineEdit_16_4y.setObjectName(_fromUtf8("lineEdit_16_4y")) self.lineEdit_16_4y.setText(str(Matrix13))

self.lineEdit_16_4z = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_4z.setGeometry(QtCore.QRect(200, 870, 86, 22)) self.lineEdit_16_4z.setObjectName(_fromUtf8("lineEdit_16_4z")) self.lineEdit_16_4z.setText(str(Matrix14))

self.lineEdit_16_04 = QtGui.QLineEdit(self.centralWidget) self.lineEdit_16_04.setGeometry(QtCore.QRect(295, 870, 36, 22)) self.lineEdit_16_04.setObjectName(_fromUtf8("lineEdit_16_04")) self.lineEdit_16_04.setText(str(Matrix15))

self.pushButton_Raf = QtGui.QPushButton(self.centralWidget) self.pushButton_Raf.setGeometry(QtCore.QRect(10, 900, 86, 28)) self.pushButton_Raf.setObjectName(_fromUtf8("pushButton_Ra")) self.pushButton_Raf.clicked.connect(self.on_pushButton_Raf_clicked) #connection pushButton_Raf "Rafraichir"

self.pushButton_En = QtGui.QPushButton(self.centralWidget) self.pushButton_En.setGeometry(QtCore.QRect(105, 900, 86, 28)) self.pushButton_En.setObjectName(_fromUtf8("pushButton_En")) self.pushButton_En.clicked.connect(self.on_pushButton_En_clicked) #connection pushButton_En "Enregistrer"

self.pushButton_Q = QtGui.QPushButton(self.centralWidget) self.pushButton_Q.setGeometry(QtCore.QRect(200, 900, 86, 28)) self.pushButton_Q.setObjectName(_fromUtf8("pushButton_Q")) self.pushButton_Q.clicked.connect(self.on_pushButton02_clicked) #connection pushButton02 "Quitter"

self.label_1 = QtGui.QLabel(self.centralWidget) self.label_1.setGeometry(QtCore.QRect(10, 10, 111, 16)) self.label_1.setObjectName(_fromUtf8("label_1")) self.label_2 = QtGui.QLabel(self.centralWidget) self.label_2.setGeometry(QtCore.QRect(10, 40, 101, 16)) self.label_2.setObjectName(_fromUtf8("label_2")) self.label_3 = QtGui.QLabel(self.centralWidget) self.label_3.setGeometry(QtCore.QRect(10, 70, 111, 16)) self.label_3.setObjectName(_fromUtf8("label_3")) self.label_4 = QtGui.QLabel(self.centralWidget) self.label_4.setGeometry(QtCore.QRect(10, 100, 171, 16)) self.label_4.setObjectName(_fromUtf8("label_4")) self.label_4x = QtGui.QLabel(self.centralWidget) self.label_4x.setGeometry(QtCore.QRect(20, 120, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_4x.setFont(font) self.label_4x.setObjectName(_fromUtf8("label_4x")) self.label_4y = QtGui.QLabel(self.centralWidget) self.label_4y.setGeometry(QtCore.QRect(130, 120, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_4y.setFont(font) self.label_4y.setObjectName(_fromUtf8("label_4y")) self.label_4z = QtGui.QLabel(self.centralWidget) self.label_4z.setGeometry(QtCore.QRect(240, 120, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_4z.setFont(font) self.label_4z.setObjectName(_fromUtf8("label_4z")) self.label_5 = QtGui.QLabel(self.centralWidget) self.label_5.setGeometry(QtCore.QRect(10, 172, 121, 16)) self.label_5.setObjectName(_fromUtf8("label_5"))

self.comboBox = QtGui.QComboBox(self.centralWidget) self.comboBox.setGeometry(QtCore.QRect(30, 170, 81, 22)) self.comboBox.setObjectName(_fromUtf8("comboBox")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.setToolTip(_translate("MainWindow",u"Sélectionne une unité de longueur.", None)) QtCore.QObject.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.SIGNAL_comboBox_Changed) #sans accentué

self.label_6 = QtGui.QLabel(self.centralWidget) self.label_6.setGeometry(QtCore.QRect(10, 200, 131, 16)) self.label_6.setObjectName(_fromUtf8("label_6")) self.label_7 = QtGui.QLabel(self.centralWidget) self.label_7.setGeometry(QtCore.QRect(10, 230, 320, 16)) self.label_7.setObjectName(_fromUtf8("label_7")) self.label_8 = QtGui.QLabel(self.centralWidget) self.label_8.setGeometry(QtCore.QRect(10, 320, 71, 16)) self.label_8.setObjectName(_fromUtf8("label_8")) self.label_8a = QtGui.QLabel(self.centralWidget) self.label_8a.setGeometry(QtCore.QRect(10, 340, 31, 16)) self.label_8a.setObjectName(_fromUtf8("label_8a")) self.label_8a_2 = QtGui.QLabel(self.centralWidget) self.label_8a_2.setGeometry(QtCore.QRect(135, 340, 91, 16)) self.label_8a_2.setObjectName(_fromUtf8("label_8a")) self.label_8xy = QtGui.QLabel(self.centralWidget) self.label_8xy.setGeometry(QtCore.QRect(13, 360, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_8xy.setFont(font) self.label_8xy.setObjectName(_fromUtf8("label_8xy")) self.label_8yz = QtGui.QLabel(self.centralWidget) self.label_8yz.setGeometry(QtCore.QRect(13, 390, 16, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_8yz.setFont(font) self.label_8yz.setObjectName(_fromUtf8("label_8yz")) self.label_8zx = QtGui.QLabel(self.centralWidget) self.label_8zx.setGeometry(QtCore.QRect(13, 420, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_8zx.setFont(font) self.label_8zx.setObjectName(_fromUtf8("label_8zx")) self.label_9 = QtGui.QLabel(self.centralWidget) self.label_9.setGeometry(QtCore.QRect(10, 450, 121, 16)) self.label_9.setObjectName(_fromUtf8("label_9")) self.label_10 = QtGui.QLabel(self.centralWidget) self.label_10.setGeometry(QtCore.QRect(10, 480, 121, 16)) self.label_10.setObjectName(_fromUtf8("label_10")) self.label_11 = QtGui.QLabel(self.centralWidget) self.label_11.setGeometry(QtCore.QRect(10, 510, 121, 16)) self.label_11.setObjectName(_fromUtf8("label_11")) self.label_12 = QtGui.QLabel(self.centralWidget) self.label_12.setGeometry(QtCore.QRect(10, 542, 81, 16)) self.label_12.setObjectName(_fromUtf8("label_12"))

self.comboBox2 = QtGui.QComboBox(self.centralWidget) self.comboBox2.setGeometry(QtCore.QRect(10, 540, 115, 22)) self.comboBox2.setObjectName(_fromUtf8("comboPoids")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.addItem(_fromUtf8("")) self.comboBox2.setToolTip(_translate("MainWindow",u"Sélectionne une unité de masse.", None)) QtCore.QObject.connect(self.comboBox2, QtCore.SIGNAL("currentIndexChanged(QString)"), self.SIGNAL_comboPoids_Changed) #sans accentué

self.doubleSpinBox = QtGui.QDoubleSpinBox(self.centralWidget) self.doubleSpinBox.setGeometry(QtCore.QRect(270, 540, 61, 22)) self.doubleSpinBox.setSingleStep(0.01) self.doubleSpinBox.setProperty("value", 1) self.doubleSpinBox.setObjectName(_fromUtf8("doubleSpinBox")) self.doubleSpinBox.setToolTip(_translate("MainWindow",u"Sélectionne la densite du volume.", None)) self.doubleSpinBox.valueChanged.connect(self.on_doubleSpinBox_valueChanged) #connection doubleSpinBox

self.label_13 = QtGui.QLabel(self.centralWidget) self.label_13.setGeometry(QtCore.QRect(10, 570, 141, 16)) self.label_13.setObjectName(_fromUtf8("label_13")) self.label_13x = QtGui.QLabel(self.centralWidget) self.label_13x.setGeometry(QtCore.QRect(20, 590, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_13x.setFont(font) self.label_13x.setObjectName(_fromUtf8("label_13x")) self.label_13y = QtGui.QLabel(self.centralWidget) self.label_13y.setGeometry(QtCore.QRect(130, 590, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_13y.setFont(font) self.label_13y.setObjectName(_fromUtf8("label_13y")) self.label_13z = QtGui.QLabel(self.centralWidget) self.label_13z.setGeometry(QtCore.QRect(240, 590, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_13z.setFont(font) self.label_13z.setObjectName(_fromUtf8("label_13z")) self.label_14 = QtGui.QLabel(self.centralWidget) self.label_14.setGeometry(QtCore.QRect(10, 640, 141, 16)) self.label_14.setObjectName(_fromUtf8("label_14")) self.label_14x = QtGui.QLabel(self.centralWidget) self.label_14x.setGeometry(QtCore.QRect(20, 660, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_14x.setFont(font) self.label_14x.setObjectName(_fromUtf8("label_14x")) self.label_14y = QtGui.QLabel(self.centralWidget) self.label_14y.setGeometry(QtCore.QRect(130, 660, 16, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_14y.setFont(font) self.label_14y.setObjectName(_fromUtf8("label_14y")) self.label_14z = QtGui.QLabel(self.centralWidget) self.label_14z.setGeometry(QtCore.QRect(240, 660, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_14z.setFont(font) self.label_14z.setObjectName(_fromUtf8("label_14z"))

self.label_15 = QtGui.QLabel(self.centralWidget) self.label_15.setGeometry(QtCore.QRect(10, 710, 131, 16)) self.label_15.setObjectName(_fromUtf8("label_15"))

self.label_16 = QtGui.QLabel(self.centralWidget) self.label_16.setGeometry(QtCore.QRect(10, 740, 101, 16)) self.label_16.setObjectName(_fromUtf8("label_16"))

self.label_16x = QtGui.QLabel(self.centralWidget) self.label_16x.setGeometry(QtCore.QRect(20, 760, 31, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_16x.setFont(font) self.label_16x.setObjectName(_fromUtf8("label_16x"))

self.label_16y = QtGui.QLabel(self.centralWidget) self.label_16y.setGeometry(QtCore.QRect(110, 760, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_16y.setFont(font) self.label_16y.setObjectName(_fromUtf8("label_16y"))

self.label_16z = QtGui.QLabel(self.centralWidget) self.label_16z.setGeometry(QtCore.QRect(210, 760, 21, 16)) font = QtGui.QFont font.setBold(True) font.setWeight(75) self.label_16z.setFont(font) self.label_16z.setObjectName(_fromUtf8("label_16z"))

MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtGui.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 410, 26)) self.menuBar.setObjectName(_fromUtf8("menuBar")) MainWindow.setMenuBar(self.menuBar) self.statusBar = QtGui.QStatusBar(MainWindow) self.statusBar.setObjectName(_fromUtf8("statusBar")) MainWindow.setStatusBar(self.statusBar)

self.retranslateUi(MainWindow) self.comboBox.setCurrentIndex(6) QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "FCInfo", None)) MainWindow.setWindowFlags(PyQt4.QtCore.Qt.WindowStaysOnTopHint) # cette fonction met la fenêtre en avant MainWindow.setWindowIcon(QtGui.QIcon(path+'FCInfo.png'))        # change l'icône de la fenêtre principale self.label_1.setText(_translate("MainWindow", "Nom du document", None)) self.label_2.setText(_translate("MainWindow", "Nom \ Type", None)) self.label_3.setText(_translate("MainWindow", "Nom du sub. objet", None)) self.label_4.setText(_translate("MainWindow", "Coordonnées au clic de souris", None)) self.label_4x.setText(_translate("MainWindow", "X", None)) self.label_4y.setText(_translate("MainWindow", "Y", None)) self.label_4z.setText(_translate("MainWindow", "Z", None)) self.label_5.setText(_translate("MainWindow", "Lg.", None)) #http://fr.wikipedia.org/wiki/Unit%C3%A9s_de_mesure_anglo-saxonnes self.comboBox.setItemText(0, _translate("MainWindow", "km", None))        #km #        = 1000000 self.comboBox.setItemText(1, _translate("MainWindow", "hm", None))        #hm #        = 100000 self.comboBox.setItemText(2, _translate("MainWindow", "dam", None))       #dam#        = 10000 self.comboBox.setItemText(3, _translate("MainWindow", "m", None))         #m  #        = 1000 self.comboBox.setItemText(4, _translate("MainWindow", "dm", None))        #dm #        = 100 self.comboBox.setItemText(5, _translate("MainWindow", "cm", None))        #cm #        = 10 self.comboBox.setItemText(6, _translate("MainWindow", "mm", None))        #mm #        = 1 self.comboBox.setItemText(7, _translate("MainWindow", "inch", None))      #in # inch  pouce    = 25.400 self.comboBox.setItemText(8, _translate("MainWindow", "link", None))      #lk # link  chaînon  = 201.168 self.comboBox.setItemText(9, _translate("MainWindow", "foot", None))      #ft # foot  pied     = 304.800 self.comboBox.setItemText(10, _translate("MainWindow", "yard", None))     #yd # yard  verge    = 914.400 self.comboBox.setItemText(11, _translate("MainWindow", "perch", None))    #rd # rod ou perch   perche   = 5029.200 self.comboBox.setItemText(12, _translate("MainWindow", "chain", None))    #ch # chain chaîne   = 20116.800 self.comboBox.setItemText(13, _translate("MainWindow", "furlong", None))  #fur# furlong        = 201168 self.comboBox.setItemText(14, _translate("MainWindow", "mile", None))     #mi # mile           = 1609344 self.comboBox.setItemText(15, _translate("MainWindow", "league", None))   #lea# league lieue   = 4828032 self.comboBox.setItemText(16, _translate("MainWindow", "nautique", None)) #nmi# mile nautique  = 1852000 self.label_6.setText(_translate("MainWindow", "Périm. de la forme", None)) if RowCountTest > 200: self.label_7.setText(_translate("MainWindow", "Vertexes et détails ("+str(compt_V) +") ("+ str(compt_E) +") ("+ str(compt_F)+") (!+ "+RowCount+") "+str(RowCountTest), None)) else: self.label_7.setText(_translate("MainWindow", "Vertexes et détails ("+str(compt_V) +") ("+ str(compt_E) +") ("+ str(compt_F)+")", None))#str(RowCount) self.label_8.setText(_translate("MainWindow", "Inclinaisons", None)) self.pushButton_Ra.setText(_translate("MainWindow", "Degré", None)) self.label_8a.setText(_translate("MainWindow", "Plan", None)) self.label_8a_2.setText(_translate("MainWindow", "Coordonnées", None)) self.label_8xy.setText(_translate("MainWindow", "XY", None)) self.label_8yz.setText(_translate("MainWindow", "YZ", None)) self.label_8zx.setText(_translate("MainWindow", "ZX", None)) self.label_9.setText(_translate("MainWindow", "Surface de la forme", None)) self.label_10.setText(_translate("MainWindow", "Surface de la face", None)) self.label_11.setText(_translate("MainWindow", "Volume de la forme", None)) self.label_12.setText(_translate("MainWindow", "Po.", None))
 * 1)        MainWindow.setWindowFlags(PyQt4.QtCore.Qt.FramelessWindowHint)  # cette fonction supprime le cadre et les bouton de la fenêtre
 * 1)        self.label_2a.setText(_translate("MainWindow", "Nom de l\'objet", None))

self.comboBox2.setCurrentIndex(5) self.comboBox2.setItemText(0, _translate("MainWindow", "tonne", None))         #t    #   = 1000000 self.comboBox2.setItemText(1, _translate("MainWindow", "quintal", None))       #q    #   = 100000 self.comboBox2.setItemText(2, _translate("MainWindow", "kilo gramme", None))   #kg   #   = 1000 self.comboBox2.setItemText(3, _translate("MainWindow", "hecto gramme", None))  #hg   #   = 100 self.comboBox2.setItemText(4, _translate("MainWindow", "décagramme", None))    #dag  #   = 10 self.comboBox2.setItemText(5, _translate("MainWindow", "gramme", None))        #g    #   = 1 self.comboBox2.setItemText(6, _translate("MainWindow", "décigramme", None))    #dg   #   = 0.1 self.comboBox2.setItemText(7, _translate("MainWindow", "centigramme", None))   #cg   #   = 0.01 self.comboBox2.setItemText(8, _translate("MainWindow", "milligramme", None))   #mg   #   = 0.001 self.comboBox2.setItemText(9, _translate("MainWindow", "grain", None))         #gr   #   = 0.06479891 g        self.comboBox2.setItemText(10, _translate("MainWindow", "drachm", None))        #dr   #   = 1.7718451953125 g        self.comboBox2.setItemText(11, _translate("MainWindow", "once", None))          #oz   #   = 28.3495231250 g        self.comboBox2.setItemText(12, _translate("MainWindow", "once troy", None))     #oz t #   = 31.1034768 g  once troy self.comboBox2.setItemText(13, _translate("MainWindow", "livre troy", None))   #lb t #   = 373.2417216 g  livre de troy self.comboBox2.setItemText(14, _translate("MainWindow", "livre av", None))     #lb   #   = 453.59237 g  livre avoirdupois pound self.comboBox2.setItemText(15, _translate("MainWindow", "stone", None))        #st   #   = 6350.29318 g        self.comboBox2.setItemText(16, _translate("MainWindow", "quarter", None))       #qtr  #   = 12700.58636 g        self.comboBox2.setItemText(17, _translate("MainWindow", "hundredweight", None)) #cwt  #   = 50802.34544 g        self.comboBox2.setItemText(18, _translate("MainWindow", "carat", None))         #cd   #   = 0.2 g

self.label_13.setText(_translate("MainWindow", "Centre de la forme", None)) self.label_13x.setText(_translate("MainWindow", "X", None)) self.label_13y.setText(_translate("MainWindow", "Y", None)) self.label_13z.setText(_translate("MainWindow", "Z", None)) self.label_14.setText(_translate("MainWindow", "Centre de la masse", None)) self.label_14x.setText(_translate("MainWindow", "X", None)) self.label_14y.setText(_translate("MainWindow", "Y", None)) self.label_14z.setText(_translate("MainWindow", "Z", None)) self.label_15.setText(_translate("MainWindow", "Dim. hors tout", None)) self.label_16.setText(_translate("MainWindow", "Moment d'inertie", None)) self.label_16x.setText(_translate("MainWindow", "X", None)) self.label_16y.setText(_translate("MainWindow", "Y", None)) self.label_16z.setText(_translate("MainWindow", "Z", None)) self.pushButton_Raf.setText(_translate("MainWindow", u"Rafraîchir", None)) self.pushButton_En.setText(_translate("MainWindow", "Enregistrer", None)) self.pushButton_Q.setText(_translate("MainWindow", "Quit", None))

def SIGNAL_comboPoids_Changed(self,text): global sel global document_ global object_ global typeObject global element_ global position0 global position1 global position2 global longueurObjet global perimetre

global Plan_xy global Plan_xy_s global Plan_yz global Plan_yz_s global Plan_zx global Plan_zx_s

global surface global surfaceFace global volume_ global densite global poids global uniteM global uniteMs global uniteS global uniteSs global uniteV global uniteVs global uniteP global unitePs

global Vertx global Edges global EdgesLong global Faces global FacesSurf global compt_V global compt_E global compt_F global placement_ global RowCount global RowCountTest global pas text = unicode(text, 'ISO-8859-1').encode('UTF-8') if text == "tonne":         #t  #0.00001        = 1000000 uniteP = 0.000001 unitePs= "t" elif text == "quintal":     #q  #0.00001        = 100000 uniteP = 0.00001 unitePs= "q" elif text == "kilo gramme": #kg # 0.001       = 1000 uniteP = 0.001 unitePs= "kg" elif text == "hecto gramme": #hg # 0.01      = 100 uniteP = 0.01 unitePs= "hg" elif text == "décagramme":  #dag#   0.1     = 10 uniteP = 0.1 unitePs= "dag" elif text == "gramme":      #g  #  1      = 1 uniteP = 1.00 unitePs= "g" elif text == "décigramme":  #dg   # = 0.1 uniteP = 10 unitePs= "dg" elif text == "centigramme": #cg   # = 0.01 uniteP = 100 unitePs= "cg" elif text == "milligramme": #mg   # = 0.001 uniteP = 1000 unitePs= "mg" elif text == "grain":       #gr   # = 0.06479891 uniteP = 0.06479891 unitePs= "gr" elif text == "drachm":      #dr   # = 1.7718451953125 uniteP = 0.56438339189006794681850148894339 unitePs= "dr" elif text == "once":        #oz   # = 28.3495231250 uniteP = 0.035273961949580412915675808215204 unitePs= "oz" elif text == "once troy":   #oz t # = once troy   = 31.1034768 uniteP = 0.032150746568627980522100346029483 unitePs= "oz t"       elif text == "livre troy":   #lb t # = 373.2417216 livre de troy (pound) uniteP = 0.0026792288807189983768416955024569 unitePs= "lb t"       elif text == "livre av":     #lb   # = 453.59237   livre avoirdupois (pound) uniteP = 0.0022046226218487758072297380134503 unitePs= "lb" elif text == "stone":       #st   # = 6350.29318  1 stone     = 14 livres uniteP = 0.00015747304441776970051640985810359 unitePs= "st" elif text == "quarter":     #qtr  # = 12700.58636 uniteP = 0.000078736522208884850258204929051795 unitePs= "qtr" elif text == "hundredweight":#cwt # = 50802.34544 uniteP = 0.000019684130552221212564551232262949 unitePs= "cwt" elif text == "carat":       #cd   # = 0.2 uniteP = 5 unitePs= "cd" try: poids = ((volume_ * densite) * uniteP) / 1000 self.lineEdit_12a.setText(str(poids)+" "+unitePs) except: self.lineEdit_12a.setText("")

def SIGNAL_comboBox_Changed(self,text): global sel global document_ global object_ global typeObject global element_ global position0 global position1 global position2 global longueurObjet global perimetre

global Plan_xy global Plan_xy_s global Plan_yz global Plan_yz_s global Plan_zx global Plan_zx_s

global surface global surfaceFace global volume_ global densite global poids global uniteM global uniteMs global uniteS global uniteSs global uniteV global uniteVs global uniteP global unitePs

global boundBoxCenterX global boundBoxCenterY global boundBoxCenterZ

global boundBoxCenter

global CenterOfMassX global CenterOfMassY global CenterOfMassZ

global boundBox_ global MatrixX1 global MatrixY1 global MatrixZ1 global Matrix_1 global MatrixX2 global MatrixY2 global MatrixZ2 global Matrix_2 global MatrixX3 global MatrixY3 global MatrixZ3 global Matrix_3 global Matrix12 global Matrix13 global Matrix14 global Matrix15

global Vertx global Edges global EdgesLong global Faces global FacesSurf global compt_V global compt_E global compt_F global placement_ global RowCount global RowCountTest global pas text = unicode(text, 'ISO-8859-1').encode('UTF-8') if text == "km":       #        = 1000000 uniteM = 0.000001 uniteMs= "km" uniteS = 0.000000000001 uniteSs= u"km²" uniteV = 0.000000000000000001 uniteVs= u"km³" elif text == "hm":     #        = 100000 uniteM = 0.00001 uniteMs= "hm" uniteS = 0.0000000001 uniteSs= u"hm²" uniteV = 0.000000000000001 uniteVs= u"hm³" elif text == "dam":    #        = 10000 uniteM = 0.0001 uniteMs= "dam" uniteS = 0.00000001 uniteSs= u"dam²" uniteV = 0.000000000001 uniteVs= u"dam³" elif text == "m":      #        = 1000 uniteM = 0.001 uniteMs= "m" uniteS = 0.000001 uniteSs= u"m²" uniteV = 0.000000001 uniteVs= u"m³" elif text == "dm":     #        = 100 uniteM = 0.01 uniteMs= "dm" uniteS = 0.0001 uniteSs= u"dm²" uniteV = 0.000001 uniteVs= u"dm³" elif text == "cm":     #        = 10 uniteM = 0.1 uniteMs= "cm" uniteS = 0.01 uniteSs= u"cm²" uniteV = 0.001 uniteVs= u"cm³" elif text == "mm":     #        = 1 ############################### uniteM = 1.0 uniteMs= "mm" uniteS = 1.0 uniteSs= u"mm²" uniteV = 1.0 uniteVs= u"mm³" elif text == "inch":   # inch   = 25.400 uniteM = 1.0/25.400 uniteMs= "in" uniteS = uniteM**2 uniteSs= "sq in" uniteV = uniteM**3 uniteVs= u"in³" elif text == "link":   # link   = 201.168 uniteM = 1.0/201.168 uniteMs= "lk" uniteS = uniteM**2 uniteSs= "sq lk" uniteV = uniteM**3 uniteVs= u"lk³" elif text == "foot":   # foot   = 304.800 uniteM = 1.0/304.800 uniteMs= "ft" uniteS = uniteM**2 uniteSs= "sq ft" uniteV = uniteM**3 uniteVs= u"ft³" elif text == "yard":   # yard   = 914.400 uniteM = 1.0/914.400 uniteMs= "yd" uniteS = uniteM**2 uniteSs= "sq yd" uniteV = uniteM**3 uniteVs= u"yd³" elif text == "perch":  #rd # rod   perche    = 5029.200 uniteM = 1.0/5029.200 uniteMs= "rd" uniteS = uniteM**2 uniteSs= "sq rd" uniteV = uniteM**3 uniteVs= u"rd³" elif text == "chain":  # chain  = 20116.800 uniteM = 1.0/20116.800 uniteMs= "ch" uniteS = uniteM**2 uniteSs= "sq ch" uniteV = uniteM**3 uniteVs= u"ch³" elif text == "furlong": # furlong= 201168 uniteM = 1.0/201168 uniteMs= "fur" uniteS = uniteM**2 uniteSs= "sq fur" uniteV = uniteM**3 uniteVs= u"fur³" elif text == "mile":    # mile   = 1609344 uniteM = 1.0/1609344 uniteMs= "mi" uniteS = uniteM**2 uniteSs= "sq mi" uniteV = uniteM**3 uniteVs= u"mi³" elif text == "league":  # league = 4828032 uniteM = 1.0/4828032 uniteMs= "lea" uniteS = uniteM**2 uniteSs= "sq lea" uniteV = uniteM**3 uniteVs= u"lea³" elif text == "nautique": # nautique = 1852000 uniteM = 1.0/1852000 uniteMs= "nmi" uniteS = uniteM**2 uniteSs= "sq nmi" uniteV = uniteM**3 uniteVs= u"nmi³"

try: self.lineEdit_5.setText(str(float(longueurObjet) * float(uniteM))+" "+uniteMs) except: self.lineEdit_5.setText("") try: self.lineEdit_6.setText(str(float(perimetre) * float(uniteM))+" "+uniteMs) except: self.lineEdit_6.setText("") try: self.lineEdit_9a.setText(str(float(surface) * float(uniteS))+" "+uniteSs) except: self.lineEdit_9a.setText("") try: self.lineEdit_10a.setText(str(float(surfaceFace) * float(uniteS))+" "+uniteSs) except: self.lineEdit_10a.setText("") try: self.lineEdit_11a.setText(str(float(volume_) * float(uniteV))+" "+uniteVs) except: self.lineEdit_11a.setText("")

co = 0 li = 0 for li in range(RowCount): for co in range(6): newitem = QtGui.QTableWidgetItem("") self.tableWidget.setItem( li,co, newitem) co = 0 li = 0 for j in enumerate(Vertx): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,co, newitem) co += 1 if co == 6: li+= 1 co = 0 li += 1 co=0 for j in enumerate(Edges): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,0, newitem) newitem = QtGui.QTableWidgetItem(str(float(EdgesLong[co]) * float(uniteM))+" "+uniteMs) self.tableWidget.setItem( li,1, newitem) co+=1 li+= 1 li+= 1 co=0

for j in enumerate(Faces): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,0, newitem) newitem = QtGui.QTableWidgetItem(str(float(FacesSurf[co]) * float(uniteM))+" "+uniteSs) self.tableWidget.setItem( li,1, newitem) co+=1 li+= 1

# doubleSpinBox_1 poids def on_doubleSpinBox_valueChanged(self,densiteSB):   # SpinBox global volume_ global uniteP global unitePs global densite global poids densite = densiteSB poids = ((volume_ * densite) * uniteP) / 1000 # base FreeCAD = mm       self.lineEdit_12a.setText(str(poids) +" "+ unitePs)

def on_pushButton_Raf_clicked(self): # réinitialisation global sel global document_ global object_ global typeObject global element_ global position0 global position1 global position2 global longueurObjet global perimetre

global Plan_xy global Plan_xy_s global Plan_yz global Plan_yz_s global Plan_zx global Plan_zx_s

global surface global surfaceFace global volume_ global densite global poids global uniteM global uniteMs global uniteS global uniteSs global uniteV global uniteVs global uniteP global unitePs global uniteDs

global boundBoxCenterX global boundBoxCenterY global boundBoxCenterZ

global boundBoxCenter

global CenterOfMassX global CenterOfMassY global CenterOfMassZ

global boundBox_ global MatrixX1 global MatrixY1 global MatrixZ1 global Matrix_1 global MatrixX2 global MatrixY2 global MatrixZ2 global Matrix_2 global MatrixX3 global MatrixY3 global MatrixZ3 global Matrix_3 global Matrix12 global Matrix13 global Matrix14 global Matrix15

global Vertx global Edges global EdgesLong global Faces global FacesSurf global compt_V global compt_E global compt_F global placement_ global RowCount global RowCountTest global path global SaveName

if len(sel)==0: print "Sélectionnez un objet" errorDialog(u"Sélectionnez un objet") else: affect self.lineEdit_1.setText(document_) self.lineEdit_2.setText(object_) self.lineEdit_2a.setText(typeObject) self.lineEdit_3.setText(str(element_)) self.lineEdit_4x.setText(str(position0)) self.lineEdit_4y.setText(str(position1)) self.lineEdit_4z.setText(str(position2)) self.lineEdit_5.setText(str(longueurObjet * uniteM)+" "+uniteMs) self.comboBox.setCurrentIndex(6) self.lineEdit_6.setText(str(perimetre * uniteM)+" "+uniteMs) self.pushButton_Ra.setText(_translate("MainWindow", u"Degré", None)) if RowCountTest > 200: self.label_7.setText(_translate("MainWindow", "Vertexes et détails ("+str(compt_V) +") ("+ str(compt_E) +") ("+ str(compt_F)+") (!+ "+RowCount+") "+str(RowCountTest), None)) else: self.label_7.setText(_translate("MainWindow", "Vertexes et détails ("+str(compt_V) +") ("+ str(compt_E) +") ("+ str(compt_F)+")", None))#str(RowCount) co = 0 li = 0 for li in range(RowCount): for co in range(6): newitem = QtGui.QTableWidgetItem("") self.tableWidget.setItem( li,co, newitem) co = 0 li = 0 for j in enumerate(Vertx): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,co, newitem) co += 1 if co == 6: li+= 1 co = 0 li+= 1 co=0 for j in enumerate(Edges): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,0, newitem) newitem = QtGui.QTableWidgetItem(str(float(EdgesLong[co]) * float(uniteM))+" "+uniteMs) self.tableWidget.setItem( li,1, newitem) co+=1 li+= 1 li+= 1 co=0

for j in enumerate(Faces): newitem = QtGui.QTableWidgetItem(str(j[1])) self.tableWidget.setItem( li,0, newitem) newitem = QtGui.QTableWidgetItem(str(float(FacesSurf[co]) * float(uniteM))+" "+uniteSs) self.tableWidget.setItem( li,1, newitem) co+=1 li+= 1 self.lineEdit_8xy.setText(str(Plan_xy)+u"°") self.lineEdit_8xya.setText(str(Plan_xy_s)) self.lineEdit_8yz.setText(str(Plan_yz)+u"°") self.lineEdit_8yza.setText(str(Plan_yz_s)) self.lineEdit_8zx.setText(str(Plan_zx)+u"°") self.lineEdit_8zxa.setText(str(Plan_zx_s)) self.lineEdit_9a.setText(str(surface * uniteS)+" "+uniteSs) self.lineEdit_10a.setText(str(surfaceFace * uniteS)+" "+uniteSs) self.lineEdit_11a.setText(str(volume_ * uniteV)+" "+uniteVs) self.lineEdit_12a.setText(str(poids)+" "+unitePs) self.lineEdit_13x.setText(str(boundBoxCenterX)) self.lineEdit_13y.setText(str(boundBoxCenterY)) self.lineEdit_13z.setText(str(boundBoxCenterZ)) self.lineEdit_14x.setText(str(CenterOfMassX)) self.lineEdit_14y.setText(str(CenterOfMassY)) self.lineEdit_14z.setText(str(CenterOfMassZ)) self.lineEdit_15.setText(str(boundBox_)) self.lineEdit_16_1x.setText(str(MatrixX1)) self.lineEdit_16_1y.setText(str(MatrixY1)) self.lineEdit_16_1z.setText(str(MatrixZ1)) self.lineEdit_16_01.setText(str(Matrix_1)) self.lineEdit_16_2x.setText(str(MatrixX2)) self.lineEdit_16_2y.setText(str(MatrixY2)) self.lineEdit_16_2z.setText(str(MatrixZ2)) self.lineEdit_16_02.setText(str(Matrix_2)) self.lineEdit_16_3x.setText(str(MatrixX3)) self.lineEdit_16_3y.setText(str(MatrixY3)) self.lineEdit_16_3z.setText(str(MatrixZ3)) self.lineEdit_16_03.setText(str(Matrix_3)) self.lineEdit_16_4x.setText(str(Matrix12)) self.lineEdit_16_4y.setText(str(Matrix13)) self.lineEdit_16_4z.setText(str(Matrix14)) self.lineEdit_16_04.setText(str(Matrix15))

def on_pushButton_En_clicked(self,text):     # enregistrement global sel global document_ global object_ global typeObject global element_ global position0 global position1 global position2 global longueurObjet global perimetre

global Plan_xy global Plan_xy_s global Plan_yz global Plan_yz_s global Plan_zx global Plan_zx_s

global surface global surfaceFace global volume_ global densite global poids global uniteM global uniteMs global uniteS global uniteSs global uniteV global uniteVs global uniteP global unitePs global uniteDs

global boundBoxCenterX global boundBoxCenterY global boundBoxCenterZ

global boundBoxCenter

global CenterOfMassX global CenterOfMassY global CenterOfMassZ

global boundBox_ global MatrixX1 global MatrixY1 global MatrixZ1 global Matrix_1 global MatrixX2 global MatrixY2 global MatrixZ2 global Matrix_2 global MatrixX3 global MatrixY3 global MatrixZ3 global Matrix_3 global Matrix12 global Matrix13 global Matrix14 global Matrix15

global Vertx global Edges global EdgesLong global Faces global FacesSurf global compt_V global compt_E global compt_F global placement_ global RowCount global RowCountTest global path global SaveName

print "Enregistrement" affect SaveName = "" SaveName = QFileDialog.getSaveFileName(None,QString.fromLocal8Bit("Sauver un fichier FCInfo"),path,"*.FCInfo") if SaveName == "": print "Procédure abandonnée" errorDialog(u"Procédure abandonnée") else: try: f = open(SaveName, 'w') # write f.write(iso8859(u"Info sur l'élément\n")) f.write(iso8859(u"__________________\n")) f.write(iso8859(dateComp+" "+dateEu+"\n\n")) f.write(iso8859(u"Nom du document         :, "+document_+"\n")) f.write(iso8859(u"Nom de l'objet          :, "+object_+"\n")) f.write(iso8859( "Type d'objet            :, "+typeObject+"\n")) f.write(iso8859(u"Nom de l'élément        :, "+str(element_)+"\n")) f.write(iso8859(u"Coordonnées de la souris :, X:, "+str(position0)+",  Y:, "+str(position1)+",  Z:, "+str(position2)+"\n")) f.write(iso8859(u"Longueur de l'objet     :, "+str(longueurObjet * uniteM)+", "+uniteMs+"\n")) f.write(iso8859(u"Périmetre de la forme   :, "+str(perimetre * uniteM)+", "+uniteMs+")\n\n"))                f.write(iso8859(u"Vertexes et détails      :,("+str(compt_V) +"),("+ str(compt_E) +"),("+ str(compt_F)+")\n\n"))                co = 0                for j in enumerate(Vertx):                    f.write(str(j[1][0:3])+", "+str(j[1][4:len(j[1])])+" , ")                    co += 1                    if co == 6:                        f.write("\n")                        co = 0                f.write("\n")                co=0                for j in enumerate(Edges):                    f.write(str(j[1])+" , "+iso8859(str(float(EdgesLong[co]) * float(uniteM))+" "+uniteMs+"\n"))                    co+=1                f.write("\n")                co=0                        for j in enumerate(Faces):                    f.write(str(j[1])+" , "+iso8859(str(float(FacesSurf[co]) * float(uniteM))+" "+uniteSs+"\n")) co+=1
 * 1)                    f.write(str(j[1])+", ")

f.write("\n") f.write(iso8859(u"Plan                    :, XY:, " + str(Plan_xy)+u"°,"+u" coordonnées:, " + str(Plan_xy_s)+"\n")) f.write(iso8859(u"Plan                    :, YZ:, " + str(Plan_yz)+u"°,"+u" coordonnées:, " + str(Plan_yz_s)+"\n")) f.write(iso8859(u"Plan                    :, ZX:, " + str(Plan_zx)+u"°,"+u" coordonnées:, " + str(Plan_zx_s)+"\n")) f.write("Surface de la forme     :, "+iso8859(str(surface * uniteS)+", "+uniteSs+"\n")) f.write("Surface de la face      :, "+iso8859(str(surfaceFace * uniteS)+", "+uniteSs+"\n")) f.write("Volume de la forme      :, "+iso8859(str(volume_ * uniteV)+", "+uniteVs+"\n")) f.write("Poids                   :, "+iso8859(str(poids)+" "+unitePs+"\n")) f.write("Centre de la forme      :, X:, "+iso8859(str(boundBoxCenterX)+", Y:, "+str(boundBoxCenterY)+", Z:, "+str(boundBoxCenterZ)+"\n")) f.write("Centre de la masse      :, X:, "+iso8859(str(CenterOfMassX)  +", Y:, "+str(CenterOfMassY)  +", Z:, "+str(CenterOfMassZ)+"\n")) f.write("Dimensions hors tout    :, "+iso8859(str(boundBox_)+"\n")) print "**************************************************************" f.write("Matrix of inertia       :, X:, "+iso8859(str(MatrixX1)+", Y:, "+str(MatrixY1)+", Z:, "+str(MatrixZ1)+", :, "+str(Matrix_1)+"\n")) f.write("                        :, X:, "+iso8859(str(MatrixX2)+", Y:, "+str(MatrixY2)+", Z:, "+str(MatrixZ2)+", :, "+str(Matrix_2)+"\n")) f.write("                        :, X:, "+iso8859(str(MatrixX3)+", Y:, "+str(MatrixY3)+", Z:, "+str(MatrixZ3)+", :, "+str(Matrix_3)+"\n")) f.write("                        :, X:, "+iso8859(str(Matrix12)+", Y:, "+str(Matrix13)+", Z:, "+str(Matrix14)+", :, "+str(Matrix15)+"\n")) f.close except: print "Erreur en écriture du fichier ",SaveName errorDialog(u"Erreur en écriture du fichier "+SaveName) f = ui       f.on_pushButton_Raf_clicked

def on_pushButton_Ra_clicked(self):   # clicked pressed, released Bouton radian/degrés global uniteDs Plan_xy2 =0.0 Plan_yz2 =0.0 Plan_zx2 =0.0 if self.pushButton_Ra.text == u"Degré": print "DegMinSec" self.pushButton_Ra.setText(_translate("MainWindow", "DegMinSec", None)) self.lineEdit_8xy.setText(degMinSec(Plan_xy)) self.lineEdit_8yz.setText(degMinSec(Plan_yz)) self.lineEdit_8zx.setText(degMinSec(Plan_zx)) elif self.pushButton_Ra.text == "DegMinSec": print "Radian" self.pushButton_Ra.setText(_translate("MainWindow", "Radian", None)) Plan_xy2 = radians(Plan_xy) self.lineEdit_8xy.setText(str(Plan_xy2)+" rad") Plan_yz2 = radians(Plan_yz) self.lineEdit_8yz.setText(str(Plan_yz2)+" rad") Plan_zx2 = radians(Plan_zx) self.lineEdit_8zx.setText(str(Plan_zx2)+" rad") elif self.pushButton_Ra.text == "Radian": print "Grade " self.pushButton_Ra.setText(_translate("MainWindow", "Grade", None)) Plan_xy2 = angleGrade(Plan_xy) self.lineEdit_8xy.setText(str(Plan_xy2)+" gon") #angleGrade Plan_yz2 = angleGrade(Plan_yz) self.lineEdit_8yz.setText(str(Plan_yz2)+" gon") Plan_zx2 = angleGrade(Plan_zx) self.lineEdit_8zx.setText(str(Plan_zx2)+" gon") elif self.pushButton_Ra.text == "Grade": print "Degré" try: self.pushButton_Ra.setText(_translate("MainWindow", u"Degré", None)) self.lineEdit_8xy.setText(str(Plan_xy)+u"°") self.lineEdit_8yz.setText(str(Plan_yz)+u"°") self.lineEdit_8zx.setText(str(Plan_zx)+u"°") except: None
 * 1)            Plan_xy2 = degMinSec(Plan_xy)
 * 1)            Plan_yz2 = degMinSec(Plan_yz)
 * 1)            Plan_zx2 = degMinSec(Plan_zx)

def on_pushButton02_clicked(self):                  # Bouton Quitter App.Console.PrintMessage("Terminé\r\n") FreeCADGui.Selection.removeObserver(s)          # désinstalle la fonction résidente self.window.hide def removeSelection(self,document, object, element): # Effacer l'objet sélectionné print "removeSelection" def setSelection(self,document):                    # Sélection dans ComboView print "setSelection" def clearSelection(self,document):                  # Si clic sur l'écran, éffacer la sélection print "clearSelection"                          # Si clic sur un autre objet, éfface le précédent

class SelObserver: def addSelection(self,document, object, element, position): # Sélection global sel global document_ global object_ global element_ global position0 global position1 global position2 sel = FreeCADGui.Selection.getSelection print "____________________________________________________________________________"

document_ = document print "Nom du document              : ",document_    # Nom du document object_ = object print "Nom de l'objet               : ",object_      # Nom de l'objet element_ = element print "Nom de la partie de l'objet  : ",element_     # Nom de la partie de l'objet

position0 = position[0] position1 = position[1] position2 = position[2]

print "Coordonnées du clic de souris : ",position0," ", position1," ", position2 # Coordonnées du clic de souris sur l'objet print "____________________________________________________________________________" if len(sel)==0: print "Sélectionnez un objet" errorDialog(u"Sélectionnez un objet") else: affect f = ui           f.on_pushButton_Raf_clicked #####################################################################################
 * 1)        FreeCADGui.Selection.removeObserver(s)      # désinstalle la fonction résidente

sel = FreeCADGui.Selection.getSelection

s=SelObserver FreeCADGui.Selection.addObserver(s)         # installe la fonction en mode résident

MainWindow = QtGui.QMainWindow ui = Ui_MainWindow(MainWindow) MainWindow.show

Limitazioni
Uscire sempre dalla macro tramite il pulsante altrimenti il programma rimane in memoria e continua a funzionare e si è obbligati a chiudere FreeCAD per disattivarlo.

Nella tabella sono riportati solo i primi 200 elementi dell'oggetto, quando l'oggetto contiene più di 200 elementi viene visualizzato l'avviso (! +200). L'elenco completo dei dati è visibile nel file csv che viene creato e salvato cliccando sul pulsante.

Attenzione : Questa versione non è definitiva.

In progetto :

leggere i dati direttamente in una tabella.

mappare degli spigoli ("Edges") e le loro coordinate

associare una sostanza alla sua massa volumica

angoli di inclinazione riferiti all'elemento piuttosto che all'oggetto globale

un pulsante sulla barra degli strumenti

alloggiamento a destra nell'interfaccia di FreeCAD

attualmente :

ver 1.02, 7/09/2013 : picole modifi

ver 1.0, 6/09/2013

Si può commentare questa macro nel forum Info Workbench - Help with icons please.