Created
February 25, 2015 16:49
-
-
Save mario52a/6c6b6131b0c14d800033 to your computer and use it in GitHub Desktop.
Gives a series of informations about the selected shape and can display a conversion of length, inclination (degrees, radians, grades, pourcent) shape, surface, volume and the weight of the form in the density selected in different units of quantities international and Anglo-Saxon. (Version Française)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
*************************************************************************** | |
* Copyright (c) 2014 <mario52> * | |
* * | |
* This file is a supplement to the FreeCAD CAx development system. * | |
* * | |
* This program is free software; you can redistribute it and/or modify * | |
* it under the terms of the GNU Lesser General Public License (LGPL) * | |
* as published by the Free Software Foundation; either version 2 of * | |
* the License, or (at your option) any later version. * | |
* for detail see the LICENCE text file. * | |
* * | |
* This software is distributed in the hope that it will be useful, * | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
* GNU Library General Public License for more details. * | |
* * | |
* You should have received a copy of the GNU Library General Public * | |
* License along with this macro; if not, write to the Free Software * | |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * | |
* USA * | |
*************************************************************************** | |
* WARNING! All changes in this file will be lost and * | |
* may cause malfunction of the program * | |
*************************************************************************** | |
""" | |
# FCInfo.FCMacro | |
# https://fr.wikipedia.org/wiki/Kilogramme | |
# donne des informations sur l'objet sélectionné | |
# les calculs son basés sur l'unité de FreeCAD, le mm | |
# Sélectionnez un objet et lancer l'application | |
# reviens toujours sur mm | |
# toujours quitter par le bouton "Quitter" si l'on quitte le programme sans passer par le bouton 'Quitter" le programme reste en mémoire | |
# il faut alors quitter FreeCAD pour l'éffacer de la mémoire | |
# seul les 200 objets premiers sont visibles dans le tableau s'il y en a plus un signal sera affiché par (!+ 200), | |
# la liste complète des données est visible dans le fichier sauvé | |
# 05_01 01/13 Volant | |
# Windows Vista SP2 / FreeCAD Ver 0.13 1828 # Ubuntu 13.10 saucy / FreeCAD Ver 0.13 1830 | |
# python 2.6 | |
__title__ = "FCInfo" | |
__author__ = "Mario52" | |
__url__ = "http://www.freecadweb.org/wiki/index.php?title=Main_Page" | |
__version__ = "01.12.U.b" | |
__date__ = "10/03/2014" | |
import Draft, Part, FreeCAD, math, PartGui, FreeCADGui, PyQt4 | |
import Part | |
from math import sqrt, pi, sin, cos, asin, degrees, radians, tan | |
from FreeCAD import Base | |
from PyQt4 import QtGui ,QtCore | |
from PyQt4.QtGui import QComboBox | |
from PyQt4.QtGui import QMessageBox | |
from PyQt4.QtGui import QTableWidget, QApplication | |
from PyQt4.QtGui import * | |
from PyQt4.QtCore import * | |
import csv | |
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.setWindowModality(QtCore.Qt.ApplicationModal) # la fonction a été désactivée pour favoriser "WindowStaysOnTopHint" | |
diag.exec_() | |
def iso8859(encoder): | |
return unicode(encoder).encode('iso-8859-1') | |
def utf8(unio): | |
return unicode(unio).encode('UTF8') | |
def uniBuntu(coder): | |
if ord(coder[0]) == 181: | |
if len(coder) == 2: | |
return unichr(ord(coder[0])) + unichr(ord(coder[1])) | |
else: | |
return unichr(ord(coder[0])) + unichr(ord(coder[1])) + unichr(ord(coder[2])) | |
else: | |
return coder[:-1] + unichr(ord(coder[-1])) | |
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 dateUk(): | |
return QtCore.QDate().currentDate().toString('yyyy/MM/dd') # forme Uk | |
def dateComp(): | |
return QtCore.QDate().currentDate().toString('dddd d MMMM yyyy') # Return "dimanche 20 Juillet 2013" | |
def degMinSec(angle0): | |
# donner l'angle en degré | |
global uniteAs | |
try: | |
deg = int(angle0) | |
min = int((angle0 - deg)*60) | |
sec = round (((((angle0 - deg)*60)-min)*60),6) | |
angle = str(deg)+iso8859(unichr(176))+" "+str(min)+iso8859("' ")+str(sec)+iso8859("''") | |
uniteAs = iso8859("") | |
return angle | |
except: | |
return 0 | |
def angleGrade(angle0): | |
# donner l'angle en degré | |
global uniteAs | |
try: | |
angle = float(angle0) | |
angle = (200 * angle) / 180 | |
uniteAs = " gon" | |
return round(angle,6) | |
except: | |
return 0 | |
def anglePourcent(angle0): | |
# donner l'angle en degré | |
global uniteAs | |
angle0 = round(abs(angle0)) | |
if (angle0 == 90): | |
return 0.0 | |
else: | |
try: | |
if angle0 in range(90 ,181): angle0 = 180 - angle0 | |
if angle0 in range(180,271): angle0 = angle0 - 180 | |
if angle0 in range(270,361): angle0 = 360 - angle0 | |
angle = abs(round((tan(radians(angle0))*100),2)) | |
uniteAs = iso8859(unichr(37))# pourcent | |
return round(angle,6) | |
except: | |
return 0.0 | |
def angle2(vecteur_x1,vecteur_y1,vecteur_x2,vecteur_y2,mode): | |
# calcul de l'inclinaison d'une ligne à partir de deux Vecteurs | |
# si "mode" = 1 alors affichage en degrès sinon en radian | |
global uniteAs | |
try: | |
deltaX = vecteur_x2 - vecteur_x1 | |
deltaY = vecteur_y2 - vecteur_y1 | |
if mode ==1: | |
angle = degrees(atan2(float(deltaY),float(deltaX))) # degrès | |
uniteAs = iso8859(unichr(176)) | |
else: | |
angle = atan2(float(deltaY),float(deltaX)) # radian | |
uniteAs = " rad" | |
return round(angle,6) | |
except: | |
return 0 | |
############################################################# | |
global ui ; ui = "" | |
global sel ; sel = "" | |
global document_ ; document_ = "FCInfo" | |
global object_Label ; object_Label = "" | |
global object_Name ; object_Name = "" | |
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_V ; Plan_xy_V = "" | |
global Plan_yz ; Plan_yz = 0.0 | |
global Plan_yz_V ; Plan_yz_V = "" | |
global Plan_zx ; Plan_zx = 0.0 | |
global Plan_zx_V ; Plan_zx_V = "" | |
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 = "mm"+iso8859(unichr(178)) | |
global uniteV ; uniteV = 1.0 # unité de mesure volume | |
global uniteVs ; uniteVs = "mm"+iso8859(unichr(179)) | |
global uniteP ; uniteP = 1.0 # unité de mesure poids | |
global unitePs ; unitePs = "g" | |
global uniteAs ; uniteAs = iso8859(unichr(176)) | |
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 boundBoxLX ; boundBoxLX = 0.0 | |
global boundBoxLY ; boundBoxLy = 0.0 | |
global boundBoxLZ ; boundBoxLZ = 0.0 | |
global boundBox_S ; boundBox_S = "" | |
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 ReperEdge ; ReperEdge = 0 | |
global EdgesLong ; EdgesLong = 0.0 | |
global Faces ; Faces = "" | |
global FacesSurf ; FacesSurf = 0.0 | |
global FacesCoor ; FacesCoor = 0.0 | |
global compt_E ; compt_E = 0 | |
global compt_F ; compt_F = 0 | |
global compt_VF ; compt_VF = 0 | |
global placement_ ; placement_ = "" | |
global RowCount ; RowCount = 200 | |
global RowCountTest ; RowCountTest = 0 | |
global path ; path = "" | |
global SaveName ; SaveName = "" | |
global angleX1 ; angleX1 = 0.0 | |
global angleY1 ; angleY1 = 0.0 | |
global angleZ1 ; angleZ1 = 0.0 | |
global angleX2 ; angleX2 = 0.0 | |
global angleY2 ; angleY2 = 0.0 | |
global angleZ2 ; angleZ2 = 0.0 | |
path = FreeCAD.ConfigGet("AppHomePath") | |
#path = FreeCAD.ConfigGet("UserAppData") | |
def tableau(): | |
global ui | |
global sel | |
global element_ | |
global perimetre | |
global Vertx | |
global Edges | |
global ReperEdge | |
global EdgesLong | |
global Faces | |
global FacesSurf | |
global FacesCoor | |
global compt_E | |
global compt_F | |
global compt_VF | |
global RowCount | |
global RowCountTest | |
global pas | |
global angleX1 | |
global angleY1 | |
global angleZ1 | |
global angleX2 | |
global angleY2 | |
global angleZ2 | |
# tableau | |
# Vertexes | |
if len(sel) != 0: | |
Vertx=[] | |
Edges=[] | |
Faces=[] | |
compt_E = 0 | |
compt_F = 0 | |
compt_VF = 0 | |
pas = 0 | |
perimetre = 0.0 | |
EdgesLong = [] | |
angleX1 = 0.0 | |
angleY1 = 0.0 | |
angleZ1 = 0.0 | |
angleX2 = 0.0 | |
angleY2 = 0.0 | |
angleZ2 = 0.0 | |
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) | |
a = sel[0].Shape.Edges[compt_E-1].Vertexes[0] | |
Vertx.append("X1: "+str(a.Point.x)) | |
Vertx.append("Y1: "+str(a.Point.y)) | |
Vertx.append("Z1: "+str(a.Point.z)) | |
if element_ == "Edge%d" % (j[0]+1): | |
angleX1 = a.Point.x | |
angleY1 = a.Point.y | |
angleZ1 = a.Point.z | |
try: | |
a = sel[0].Shape.Edges[compt_E-1].Vertexes[1] | |
Vertx.append("X2: "+str(a.Point.x)) | |
Vertx.append("Y2: "+str(a.Point.y)) | |
Vertx.append("Z2: "+str(a.Point.z)) | |
if element_ == "Edge%d" % (j[0]+1): | |
angleX2 = a.Point.x | |
angleY2 = a.Point.y | |
angleZ2 = a.Point.z | |
except: | |
Vertx.append("-") | |
Vertx.append("-") | |
Vertx.append("-") | |
FacesSurf = [] | |
FacesCoor = [] | |
for j in enumerate(sel[0].Shape.Faces): # Faces du Shape | |
compt_F+=1 | |
Faces.append("Face%d" % (j[0]+1)) | |
FacesSurf.append(str(sel[0].Shape.Faces[compt_F-1].Area)) # Surface de la Face | |
fco = 0 | |
for f0 in sel[0].Shape.Faces[compt_F-1].Vertexes: # Vertexes de la face | |
fco += 1 | |
FacesCoor.append("X"+str(fco)+": "+str(f0.Point.x)) | |
FacesCoor.append("Y"+str(fco)+": "+str(f0.Point.y)) | |
FacesCoor.append("Z"+str(fco)+": "+str(f0.Point.z)) | |
compt_VF += 1 | |
FacesCoor += ("T",) | |
RowCountTest = compt_E + compt_F + compt_VF | |
def affect(): | |
global ui | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global ReperEdge | |
global Plan_xy | |
global Plan_xy_V | |
global Plan_yz | |
global Plan_yz_V | |
global Plan_zx | |
global Plan_zx_V | |
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 uniteAs | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global boundBoxCenter | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global boundBox_ | |
global boundBoxLX | |
global boundBoxLY | |
global boundBoxLZ | |
global boundBox_S | |
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 | |
global FacesSurf | |
global EdgesLong | |
global FacesCoor | |
global angleX1 | |
global angleY1 | |
global angleZ1 | |
global angleX2 | |
global angleY2 | |
global angleZ2 | |
try: | |
atest = sel[0].Shape.Vertexes | |
except: | |
App.Console.PrintMessage(u"Sélection invalide"+"\n") | |
errorDialog(u"Sélection invalide") | |
sel = "" | |
else: | |
sel = FreeCADGui.Selection.getSelection() | |
mydoc = FreeCAD.activeDocument().Name | |
document_ = mydoc | |
try: | |
object_Label = sel[0].Label | |
object_Name = sel[0].Name | |
except: | |
object_Label = "" | |
object_Name = "" | |
try: | |
SubElement = FreeCADGui.Selection.getSelectionEx() | |
element_ = SubElement[0].SubElementNames[0] | |
except: | |
element_ = "" | |
# longueur Objet | |
try: | |
longueurObjet = Gui.Selection.getSelectionEx()[0].SubObjects[0].Length | |
except: | |
longueurObjet = 0.0 | |
# tableau | |
tableau() | |
# surface | |
try: | |
surface = sel[0].Shape.Area | |
except: | |
surface = 0.0 | |
try: | |
surfaceFace = Gui.Selection.getSelectionEx()[0].SubObjects[0].Area | |
except: | |
surfaceFace = 0.0 | |
# volume | |
try: | |
volume_ = sel[0].Shape.Volume | |
except: | |
volume_ = 0.0 | |
# densité | |
poids = ((volume_ * densite) * uniteP) / 1000 # mm3 (mm base FreeCAD) | |
# boundinbox (dimensions hors tout) | |
try: | |
boundBox_ = sel[0].Shape.BoundBox | |
boundBoxLX = boundBox_.XLength | |
boundBoxLY = boundBox_.YLength | |
boundBoxLZ = boundBox_.ZLength | |
boundBox_S = "[X: "+str(boundBoxLX * uniteM)+" "+uniBuntu(uniteMs)+"] x [Y: "+str(boundBoxLY * uniteM)+" "+uniBuntu(uniteMs)+"] x [Z:"+str(boundBoxLZ * uniteM)+" "+uniBuntu(uniteMs)+"]" | |
except: | |
boundBox_ = 0.0 | |
boundBoxLX = 0.0 | |
boundBoxLY = 0.0 | |
boundBoxLZ = 0.0 | |
boundBox_S = "" | |
# centre de la forme | |
try: | |
boundBoxCenterX = boundBox_.Center[0] | |
boundBoxCenterY = boundBox_.Center[1] | |
boundBoxCenterZ = boundBox_.Center[2] | |
except: | |
boundBoxCenterX = 0.0 | |
boundBoxCenterY = 0.0 | |
boundBoxCenterZ = 0.0 | |
mode = 1 | |
# # Placement | |
try: | |
Plan_xy = angle2(angleX1,angleY1,angleX2,angleY2,mode) | |
Plan_xy_V = "[,"+str(angleX1)+" , "+str(angleY1)+",] [,"+str(angleX2)+" , "+str(angleY2)+",]" | |
except: | |
Plan_xy = 0.0 | |
Plan_xy_V = "" | |
try: | |
Plan_yz = angle2(angleY1,angleZ1,angleY2,angleZ2,mode) | |
Plan_yz_V = "[,"+str(angleY1)+" , "+str(angleZ1)+",] [,"+str(angleY2)+" , "+str(angleZ2)+",]" | |
except: | |
Plan_yz = 0.0 | |
Plan_yz_V = "" | |
try: | |
Plan_zx = angle2(angleZ1,angleX1,angleZ2,angleX2,mode) | |
Plan_zx_V = "[,"+str(angleZ1)+" , "+str(angleX1)+",] [,"+str(angleZ2)+" , "+str(angleX2)+",]" | |
except: | |
Plan_zx = 0.0 | |
Plan_zx_V = "" | |
# Placement | |
try: | |
typeObject = sel[0].Shape.ShapeType | |
except: | |
App.Console.PrintMessage("Erreur type objet"+"\n") | |
typeObject = "" | |
selEx = FreeCADGui.Selection.getSelectionEx() | |
objs = [selobj.Object for selobj in selEx] | |
s = objs[0].Shape | |
# center of mass | |
try: | |
c = s.Solids[0].CenterOfMass | |
CenterOfMassX = c.x | |
CenterOfMassY = c.y | |
CenterOfMassZ = c.z | |
except: | |
CenterOfMassX = 0.0 | |
CenterOfMassY = 0.0 | |
CenterOfMassZ = 0.0 | |
# inertia | |
try: | |
m = s.Solids[0].MatrixOfInertia | |
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]) | |
except: | |
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 | |
######################################################## | |
App.Console.PrintMessage(u"Début_______________________________________________________________________"+"\n") | |
App.Console.PrintMessage("Nom du document : "+document_+"\n") | |
App.Console.PrintMessage("Label de l'objet : "+object_Label+"\n") | |
App.Console.PrintMessage("Nom interne de l'objet : "+object_Name+"\n") | |
App.Console.PrintMessage(u"Nom de l'élément : "+str(element_)+"\n") | |
App.Console.PrintMessage("Type d'objet : "+typeObject+"\n") | |
App.Console.PrintMessage(u"Coordonnées de la souris : X: "+str(position0)+", Y: "+str(position1)+", Z: "+str(position2)+"\n") | |
App.Console.PrintMessage("Longueur de l'objet : "+str(longueurObjet * uniteM)+", "+uniBuntu(uniteMs)+"\n") | |
App.Console.PrintMessage(u"Périmetre de la forme : "+str(perimetre * uniteM)+", "+uniBuntu(uniteMs)+"\n\n") | |
App.Console.PrintMessage(u"Vertexes et détails : ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+") ("+str(RowCountTest)+")\n") | |
co = 0 | |
aa = 0 | |
for j in enumerate(Edges): | |
App.Console.PrintMessage(str(j[1])+" = "+str(float(EdgesLong[co]) * float(uniteM))+" "+uniBuntu(uniteMs)+"\n") | |
try: | |
for a in range(aa,aa+6): | |
App.Console.PrintMessage(Vertx[a]+"\n") | |
except: | |
None | |
co += 1 | |
aa += 6 | |
App.Console.PrintMessage("\n") | |
co=0 | |
cco=0 | |
for j in enumerate(Faces): | |
App.Console.PrintMessage(str(j[1])+" = "+str(float(FacesSurf[co]) * float(uniteS))+" "+uniBuntu(uniteSs)+"\n") | |
for jj in range(cco,len(FacesCoor)): | |
cco+=1 | |
if FacesCoor[jj] == "T": | |
break | |
else: | |
App.Console.PrintMessage(FacesCoor[jj]+"\n") | |
App.Console.PrintMessage("\n") | |
co += 1 | |
cco=0 | |
App.Console.PrintMessage("Plan : XY: " + str(Plan_xy)+uniBuntu(uniteAs)+u" coordonnées: " + str(Plan_xy_V)+"\n") | |
App.Console.PrintMessage("Plan : YZ: " + str(Plan_yz)+uniBuntu(uniteAs)+u" coordonnées: " + str(Plan_yz_V)+"\n") | |
App.Console.PrintMessage("Plan : ZX: " + str(Plan_zx)+uniBuntu(uniteAs)+u" coordonnées: " + str(Plan_zx_V)+"\n\n") | |
App.Console.PrintMessage("Surface de la forme : "+str(surface * uniteS)+" "+uniBuntu(uniteSs)+"\n") | |
App.Console.PrintMessage("Surface de la face : "+str(surfaceFace * uniteS)+" "+uniBuntu(uniteSs)+"\n\n") | |
App.Console.PrintMessage("Volume de la forme : "+str(volume_ * uniteV)+" "+uniBuntu(uniteVs)+"\n") | |
App.Console.PrintMessage("Poids : "+str(poids)+" "+uniBuntu(unitePs)+u" (Densité : "+str(densite)+")\n\n") | |
App.Console.PrintMessage("Centre de la forme : X: "+str(boundBoxCenterX)+" Y: "+str(boundBoxCenterY)+" Z: "+str(boundBoxCenterZ)+"\n") | |
App.Console.PrintMessage("Centre de la masse : X: "+str(CenterOfMassX) +" Y: "+str(CenterOfMassY) +" Z: "+str(CenterOfMassZ)+"\n") | |
App.Console.PrintMessage("Dimensions hors tout : "+boundBox_S+"\n\n") | |
App.Console.PrintMessage("Matrix of inertia : X: "+str(MatrixX1)+" Y: "+str(MatrixY1)+" Z: "+str(MatrixZ1)+" : "+str(Matrix_1)+"\n") | |
App.Console.PrintMessage(" : X: "+str(MatrixX2)+" Y: "+str(MatrixY2)+" Z: "+str(MatrixZ2)+" : "+str(Matrix_2)+"\n") | |
App.Console.PrintMessage(" : X: "+str(MatrixX3)+" Y: "+str(MatrixY3)+" Z: "+str(MatrixZ3)+" : "+str(Matrix_3)+"\n") | |
App.Console.PrintMessage(" : X: "+str(Matrix12)+" Y: "+str(Matrix13)+" Z: "+str(Matrix14)+" : "+str(Matrix15)+"\n") | |
App.Console.PrintMessage("Fin_"+str(element_)+"_______________________________________________________"+"\n") | |
#################################### | |
class Ui_MainWindow(object): # fenêtre début | |
def __init__(self, MainWindow): | |
global ui | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global perimetre | |
global Plan_xy | |
global Plan_xy_V | |
global Plan_yz | |
global Plan_yz_V | |
global Plan_zx | |
global Plan_zx_V | |
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 uniteAs | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global boundBoxCenter | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global boundBox_ | |
global boundBoxLX | |
global boundBoxLY | |
global boundBoxLZ | |
global boundBox_S | |
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 FacesCoor | |
global compt_E | |
global compt_F | |
global compt_VF | |
global placement_ | |
global RowCount | |
global RowCountTest | |
self.window = MainWindow | |
MainWindow.setObjectName(_fromUtf8("MainWindow")) | |
MainWindow.resize(370, 695) | |
MainWindow.setMinimumSize(QtCore.QSize(370, 695)) | |
MainWindow.setMaximumSize(QtCore.QSize(370, 695)) | |
self.centralWidget = QtGui.QWidget(MainWindow) | |
self.centralWidget.setMinimumSize(QtCore.QSize(370, 695)) # dimensions min fenetre | |
self.centralWidget.setMaximumSize(QtCore.QSize(370, 695)) # dimensions max fenetre | |
self.centralWidget.setBaseSize(QtCore.QSize(0, 0)) | |
self.centralWidget.setObjectName(_fromUtf8("centralWidget")) | |
self.scrollArea = QtGui.QScrollArea(self.centralWidget) | |
self.scrollArea.setGeometry(QtCore.QRect(5, 5, 360, 640)) # cadre de scrollarea | |
self.scrollArea.setMaximumSize(QtCore.QSize(360, 890)) # cadre interne qui allume le scrollarea | |
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) | |
self.scrollArea.setWidgetResizable(True) | |
self.scrollArea.setObjectName(_fromUtf8("scrollArea")) | |
self.scrollAreaWidgetContents_2 = QtGui.QWidget() | |
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 335, 890)) | |
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) | |
sizePolicy.setHorizontalStretch(0) | |
sizePolicy.setVerticalStretch(0) | |
sizePolicy.setHeightForWidth(self.scrollAreaWidgetContents_2.sizePolicy().hasHeightForWidth()) | |
self.scrollAreaWidgetContents_2.setSizePolicy(sizePolicy) | |
self.scrollAreaWidgetContents_2.setMinimumSize(QtCore.QSize(335, 900)) # cadre de la fenetre scrollarea | |
self.scrollAreaWidgetContents_2.setObjectName(_fromUtf8("scrollAreaWidgetContents_2")) | |
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) | |
sel = FreeCADGui.Selection.getSelection() | |
if len(sel)==0: | |
App.Console.PrintMessage(u"Sélectionnez un objet"+"\n") | |
errorDialog(u"Sélectionnez un objet") | |
else: | |
affect() | |
################################################### | |
# # Placement | |
# placement_ = sel[0].Shape.Placement | |
# App.Console.PrintMessage(placement_+"\n") | |
################################################### | |
self.lineEdit_1 = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
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)) | |
self.lineEdit_2 = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_2.setGeometry(QtCore.QRect(120, 40, 101, 22)) | |
self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2")) | |
self.lineEdit_2.setText(object_Label) | |
self.lineEdit_2.setToolTip(_translate("MainWindow",u"Label de l'élément séléctionné.", None)) | |
self.lineEdit_2a = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_2a.setGeometry(QtCore.QRect(230, 40, 101, 22)) | |
self.lineEdit_2a.setObjectName(_fromUtf8("lineEdit_2a")) | |
self.lineEdit_2a.setText(object_Name) | |
self.lineEdit_2a.setToolTip(_translate("MainWindow",u"Nom interne de l'élément sélectionné.", None)) | |
self.lineEdit_3 = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_3.setGeometry(QtCore.QRect(120, 70, 101, 22)) | |
self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3")) | |
self.lineEdit_3.setText(str(element_)) | |
self.lineEdit_3.setToolTip(_translate("MainWindow",u"Nom du sub objet sélectionné.", None)) | |
self.lineEdit_3a = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_3a.setGeometry(QtCore.QRect(230, 70, 101, 22)) | |
self.lineEdit_3a.setObjectName(_fromUtf8("lineEdit_3")) | |
self.lineEdit_3a.setText(str(typeObject)) | |
self.lineEdit_3a.setToolTip(_translate("MainWindow",u"Type de l'objet sélectionné.", None)) | |
self.lineEdit_4x = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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)) | |
self.tableWidget = QtGui.QTableWidget(self.scrollAreaWidgetContents_2) | |
self.tableWidget.setGeometry(QtCore.QRect(10, 250, 320, 70)) | |
self.tableWidget.setIconSize(QtCore.QSize(15, 15)) | |
self.tableWidget.setRowCount(RowCount) | |
self.tableWidget.setColumnCount(8) # nombre de colonnes | |
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)) | |
self.pushButton_Ra = QtGui.QPushButton(self.scrollAreaWidgetContents_2) | |
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, Pourcent.", None)) | |
self.lineEdit_8xy = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_8xy.setGeometry(QtCore.QRect(35, 360, 91, 22)) | |
self.lineEdit_8xy.setObjectName(_fromUtf8("lineEdit_8xy")) | |
self.lineEdit_8xy.setText(str(Plan_xy)+uniteAs) | |
self.lineEdit_8xy.setToolTip(_translate("MainWindow",u"Angle dans le plan XY.", None)) | |
self.lineEdit_8xya = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_8xya.setGeometry(QtCore.QRect(130, 360, 201, 22)) | |
self.lineEdit_8xya.setObjectName(_fromUtf8("lineEdit_8xya")) | |
self.lineEdit_8xya.setText(str(Plan_xy_V)) | |
self.lineEdit_8yz = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_8yz.setGeometry(QtCore.QRect(35, 390, 91, 22)) | |
self.lineEdit_8yz.setObjectName(_fromUtf8("lineEdit_8yz")) | |
self.lineEdit_8yz.setText(str(Plan_yz)+uniteAs) | |
self.lineEdit_8yz.setToolTip(_translate("MainWindow",u"Angle dans le plan YZ.", None)) | |
self.lineEdit_8yza = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_8yza.setGeometry(QtCore.QRect(130, 390, 201, 22)) | |
self.lineEdit_8yza.setObjectName(_fromUtf8("lineEdit_8yza")) | |
self.lineEdit_8yza.setText(str(Plan_yz_V)) | |
self.lineEdit_8zx = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_8zx.setGeometry(QtCore.QRect(35, 420, 91, 22)) | |
self.lineEdit_8zx.setObjectName(_fromUtf8("lineEdit_8zx")) | |
self.lineEdit_8zx.setText(str(Plan_zx)+uniteAs) | |
self.lineEdit_8zx.setToolTip(_translate("MainWindow",u"Angle dans le plan ZX.", None)) | |
self.lineEdit_8zxa = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
self.lineEdit_8zxa.setGeometry(QtCore.QRect(130, 420, 201, 22)) | |
self.lineEdit_8zxa.setObjectName(_fromUtf8("lineEdit_8zxa")) | |
self.lineEdit_8zxa.setText(str(Plan_zx_V)) | |
self.lineEdit_9a = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
self.lineEdit_15.setGeometry(QtCore.QRect(120, 710, 211, 22)) | |
self.lineEdit_15.setObjectName(_fromUtf8("lineEdit_15")) | |
self.lineEdit_15.setText(boundBox_S) | |
self.lineEdit_15.setToolTip(_translate("MainWindow",u"Dimensions hors tout de la forme.", None)) | |
self.lineEdit_16_1x = QtGui.QLineEdit(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.window) #centralWidget | |
self.pushButton_Raf.setGeometry(QtCore.QRect(300, 655, 36, 28)) | |
self.pushButton_Raf.setObjectName(_fromUtf8("pushButton_Raf")) | |
self.pushButton_Raf.clicked.connect(self.on_pushButton_Raf_clicked) #connection pushButton_Raf "Rafraichir" | |
self.pushButton_Raf.setToolTip(_translate("MainWindow",u"Rafaîchir la vue rapport.", None)) | |
self.pushButton_Lec = QtGui.QPushButton(self.window) | |
self.pushButton_Lec.setGeometry(QtCore.QRect(15, 655, 86, 28)) | |
self.pushButton_Lec.setObjectName(_fromUtf8("pushButton_Lec")) | |
self.pushButton_Lec.clicked.connect(self.on_pushButton_Lec_clicked) #connection pushButton_Lec "Lecture" | |
self.pushButton_Lec.setToolTip(_translate("MainWindow",u"Lecture d'un fichier disque.", None)) | |
self.pushButton_En = QtGui.QPushButton(self.window) | |
self.pushButton_En.setGeometry(QtCore.QRect(110, 655, 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_En.setToolTip(_translate("MainWindow",u"Enregistrement des données sur disque.", None)) | |
self.pushButton_Q = QtGui.QPushButton(self.window) | |
self.pushButton_Q.setGeometry(QtCore.QRect(205, 655, 86, 28)) | |
self.pushButton_Q.setObjectName(_fromUtf8("pushButton_Q")) | |
self.pushButton_Q.clicked.connect(self.on_pushButton02_clicked) #connection pushButton02 "Quitter" | |
self.pushButton_Q.setToolTip(_translate("MainWindow",u"Quitte et éfface de la mémoire FCInfo.", None)) | |
self.label_1 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_1.setGeometry(QtCore.QRect(10, 10, 111, 16)) | |
self.label_1.setObjectName(_fromUtf8("label_1")) | |
self.label_2 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_2.setGeometry(QtCore.QRect(10, 40, 101, 16)) | |
self.label_2.setObjectName(_fromUtf8("label_2")) | |
self.label_3 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_3.setGeometry(QtCore.QRect(10, 70, 111, 16)) | |
self.label_3.setObjectName(_fromUtf8("label_3")) | |
self.label_4 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_4.setGeometry(QtCore.QRect(10, 100, 171, 16)) | |
self.label_4.setObjectName(_fromUtf8("label_4")) | |
self.label_4x = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
self.label_5.setGeometry(QtCore.QRect(10, 172, 121, 16)) | |
self.label_5.setObjectName(_fromUtf8("label_5")) | |
self.comboBox = QtGui.QComboBox(self.scrollAreaWidgetContents_2) | |
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.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.scrollAreaWidgetContents_2) | |
self.label_6.setGeometry(QtCore.QRect(10, 200, 131, 16)) | |
self.label_6.setObjectName(_fromUtf8("label_6")) | |
self.label_7 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_7.setGeometry(QtCore.QRect(10, 230, 320, 16)) | |
self.label_7.setObjectName(_fromUtf8("label_7")) | |
self.label_8 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_8.setGeometry(QtCore.QRect(10, 320, 71, 16)) | |
self.label_8.setObjectName(_fromUtf8("label_8")) | |
self.label_8a = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_8a.setGeometry(QtCore.QRect(10, 340, 31, 16)) | |
self.label_8a.setObjectName(_fromUtf8("label_8a")) | |
self.label_8a_2 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
self.label_9.setGeometry(QtCore.QRect(10, 450, 121, 16)) | |
self.label_9.setObjectName(_fromUtf8("label_9")) | |
self.label_10 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_10.setGeometry(QtCore.QRect(10, 480, 121, 16)) | |
self.label_10.setObjectName(_fromUtf8("label_10")) | |
self.label_11 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_11.setGeometry(QtCore.QRect(10, 510, 121, 16)) | |
self.label_11.setObjectName(_fromUtf8("label_11")) | |
self.label_12 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_12.setGeometry(QtCore.QRect(10, 542, 81, 16)) | |
self.label_12.setObjectName(_fromUtf8("label_12")) | |
self.comboBox2 = QtGui.QComboBox(self.scrollAreaWidgetContents_2) | |
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.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.scrollAreaWidgetContents_2) | |
self.doubleSpinBox.setGeometry(QtCore.QRect(270, 540, 61, 22)) | |
self.doubleSpinBox.setSingleStep(0.01) | |
self.doubleSpinBox.setProperty("value", densite) | |
self.doubleSpinBox.setObjectName(_fromUtf8("doubleSpinBox")) | |
self.doubleSpinBox.setToolTip(_translate("MainWindow",u"Sélectionne la densite du volume en Kg par dm3.", None)) | |
self.doubleSpinBox.valueChanged.connect(self.on_doubleSpinBox_valueChanged) #connection doubleSpinBox | |
self.label_13 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_13.setGeometry(QtCore.QRect(10, 570, 141, 16)) | |
self.label_13.setObjectName(_fromUtf8("label_13")) | |
self.label_13x = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
self.label_14.setGeometry(QtCore.QRect(10, 640, 141, 16)) | |
self.label_14.setObjectName(_fromUtf8("label_14")) | |
self.label_14x = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
self.label_15.setGeometry(QtCore.QRect(10, 710, 131, 16)) | |
self.label_15.setObjectName(_fromUtf8("label_15")) | |
self.label_16 = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
self.label_16.setGeometry(QtCore.QRect(10, 740, 101, 16)) | |
self.label_16.setObjectName(_fromUtf8("label_16")) | |
self.label_16x = QtGui.QLabel(self.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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.scrollAreaWidgetContents_2) | |
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")) | |
###########################################################scrollArea | |
self.scrollArea.setWidget(self.scrollAreaWidgetContents_2) | |
MainWindow.setCentralWidget(self.centralWidget) | |
###########################################################scrollArea | |
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", "Label / Nom inter.", None)) | |
# self.label_2a.setText(_translate("MainWindow", "Nom de l'objet", None)) | |
self.label_3.setText(_translate("MainWindow", "Sub. objet / Type", None)) | |
# self.label_3a.setText(_translate("MainWindow", "Type", 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", "µm", None)) #µm # = 0.001 micro | |
self.comboBox.setItemText(8, _translate("MainWindow", "nm", None)) #nm # * = 0.000001 nano | |
self.comboBox.setItemText(9, _translate("MainWindow", "pm", None)) #pm # = 0.000000001 pico | |
self.comboBox.setItemText(10, _translate("MainWindow", "fm", None)) #fm # = 0.000000000001 femto | |
self.comboBox.setItemText(11, _translate("MainWindow", "inch", None)) #in # inch pouce = 25.400 | |
self.comboBox.setItemText(12, _translate("MainWindow", "link", None)) #lk # link chaînon = 201.168 | |
self.comboBox.setItemText(13, _translate("MainWindow", "foot", None)) #ft # foot pied = 304.800 | |
self.comboBox.setItemText(14, _translate("MainWindow", "yard", None)) #yd # yard verge = 914.400 | |
self.comboBox.setItemText(15, _translate("MainWindow", "perch", None)) #rd # rod ou perch perche = 5029.200 | |
self.comboBox.setItemText(16, _translate("MainWindow", "chain", None)) #ch # chain chaîne = 20116.800 | |
self.comboBox.setItemText(17, _translate("MainWindow", "furlong", None)) #fur# furlong = 201168 | |
self.comboBox.setItemText(18, _translate("MainWindow", "mile", None)) #mi # mile = 1609344 | |
self.comboBox.setItemText(19, _translate("MainWindow", "league", None)) #lea# league lieue = 4828032 | |
self.comboBox.setItemText(20, _translate("MainWindow", "nautique", None)) #nmi# mile nautique = 1852000 | |
self.label_6.setText(_translate("MainWindow", "Périm. de la forme", None)) | |
if RowCountTest > RowCount: | |
self.label_7.setText(_translate("MainWindow", "Détails ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+") (!+ "+str(RowCount)+") "+str(RowCountTest), None)) | |
else: | |
self.label_7.setText(_translate("MainWindow", "Vertexes et détails ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+")", 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)) | |
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", "microgramme", None)) #µg # = 0.000001 | |
self.comboBox2.setItemText(10, _translate("MainWindow", "nanogramme", None)) #ng # = 0.000000001 | |
self.comboBox2.setItemText(11, _translate("MainWindow", "picogramme", None)) #pg # = 0.000000000001 | |
self.comboBox2.setItemText(12, _translate("MainWindow", "grain", None)) #gr # = 0.06479891 g | |
self.comboBox2.setItemText(13, _translate("MainWindow", "drachm", None)) #dr # = 1.7718451953125 g | |
self.comboBox2.setItemText(14, _translate("MainWindow", "once", None)) #oz # = 28.3495231250 g | |
self.comboBox2.setItemText(15, _translate("MainWindow", "once troy", None)) #oz t # = 31.1034768 g once troy | |
self.comboBox2.setItemText(16, _translate("MainWindow", "livre troy", None)) #lb t # = 373.2417216 g livre de troy | |
self.comboBox2.setItemText(17, _translate("MainWindow", "livre av", None)) #lb # = 453.59237 g livre avoirdupois pound | |
self.comboBox2.setItemText(18, _translate("MainWindow", "stone", None)) #st # = 6350.29318 g | |
self.comboBox2.setItemText(19, _translate("MainWindow", "quarter", None)) #qtr # = 12700.58636 g | |
self.comboBox2.setItemText(20, _translate("MainWindow", "hundredweight", None)) #cwt # = 50802.34544 g | |
self.comboBox2.setItemText(21, _translate("MainWindow", "tonneau fr", None)) # # = 0.00000102145045965 g | |
self.comboBox2.setItemText(22, _translate("MainWindow", "carat", None)) #ct # = 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", "Raf", None)) | |
self.pushButton_Lec.setText(_translate("MainWindow", "Lecture", None)) | |
self.pushButton_En.setText(_translate("MainWindow", "Enregistrer", None)) | |
self.pushButton_Q.setText(_translate("MainWindow", "Quitter", None)) | |
def SIGNAL_comboPoids_Changed(self,text): | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global perimetre | |
global Plan_xy | |
global Plan_xy_V | |
global Plan_yz | |
global Plan_yz_V | |
global Plan_zx | |
global Plan_zx_V | |
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 uniteAs | |
global Vertx | |
global Edges | |
global EdgesLong | |
global Faces | |
global FacesSurf | |
global compt_E | |
global compt_F | |
global compt_VF | |
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 == "microgramme": #µg # = 0.000001 | |
uniteP = 1000000 | |
unitePs= iso8859(unichr(181))+"g" | |
elif text == "nanogramme": #ng # = 0.000000001 | |
uniteP = 1000000000 | |
unitePs= "ng" | |
elif text == "picogramme": #pg # = 0.000000000001 | |
uniteP = 1000000000000 | |
unitePs= "pg" | |
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 == "tonneau fr": # # tonneau fr = 0.00000102145045965 | |
uniteP = 0.00000102145045965 | |
unitePs= "tonneau fr" | |
elif text == "carat": #ct # = 0.2 | |
uniteP = 5 | |
unitePs= "ct" | |
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 ui | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global perimetre | |
global Plan_xy | |
global Plan_xy_V | |
global Plan_yz | |
global Plan_yz_V | |
global Plan_zx | |
global Plan_zx_V | |
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 uniteAs | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global boundBoxCenter | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global boundBox_ | |
global boundBoxLX | |
global boundBoxLY | |
global boundBoxLZ | |
global boundBox_S | |
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 FacesCoor | |
global compt_E | |
global compt_F | |
global compt_VF | |
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= "km"+iso8859(unichr(178)) | |
uniteV = 0.000000000000000001 | |
uniteVs= "km"+iso8859(unichr(179)) | |
elif text == "hm": # = 100000 | |
uniteM = 0.00001 | |
uniteMs= "hm" | |
uniteS = 0.0000000001 | |
uniteSs= "hm"+iso8859(unichr(178)) | |
uniteV = 0.000000000000001 | |
uniteVs= "hm"+iso8859(unichr(179)) | |
elif text == "dam": # = 10000 | |
uniteM = 0.0001 | |
uniteMs= "dam" | |
uniteS = 0.00000001 | |
uniteSs= "dam"+iso8859(unichr(178)) | |
uniteV = 0.000000000001 | |
uniteVs= "dam"+iso8859(unichr(179)) | |
elif text == "m": # = 1000 | |
uniteM = 0.001 | |
uniteMs= "m" | |
uniteS = 0.000001 | |
uniteSs= "m"+iso8859(unichr(178)) | |
uniteV = 0.000000001 | |
uniteVs= "m"+iso8859(unichr(179)) | |
elif text == "dm": # = 100 | |
uniteM = 0.01 | |
uniteMs= "dm" | |
uniteS = 0.0001 | |
uniteSs= "dm"+iso8859(unichr(178)) | |
uniteV = 0.000001 | |
uniteVs= "dm"+iso8859(unichr(179)) | |
elif text == "cm": # = 10 | |
uniteM = 0.1 | |
uniteMs= "cm" | |
uniteS = 0.01 | |
uniteSs= "cm"+iso8859(unichr(178)) | |
uniteV = 0.001 | |
uniteVs= "cm"+iso8859(unichr(179)) | |
elif text == "mm": # = 1 ############################### | |
uniteM = 1.0 | |
uniteMs= "mm" | |
uniteS = 1.0 | |
uniteSs= "mm"+iso8859(unichr(178)) | |
uniteV = 1.0 | |
uniteVs= "mm"+iso8859(unichr(179)) | |
elif text == "µm": # = 1000 # | |
uniteM = 1000.0 | |
uniteMs= iso8859(unichr(181))+"m" | |
uniteS = 1000.0**2 | |
uniteSs= iso8859(unichr(181))+"m"+iso8859(unichr(178)) | |
uniteV = 1000.0**3 | |
uniteVs= iso8859(unichr(181))+"m"+iso8859(unichr(179)) | |
elif text == "nm": # = 1000000 | |
uniteM = 1000000.0 | |
uniteMs= "nm" | |
uniteS = 1000000.0**2 | |
uniteSs= "nm"+iso8859(unichr(178)) | |
uniteV = 1000000.0**3 | |
uniteVs= "nm"+iso8859(unichr(179)) | |
elif text == "pm": # = 1000000000 | |
uniteM = 1000000000.0 | |
uniteMs= "pm" | |
uniteS = 1000000000.0**2 | |
uniteSs= "pm"+iso8859(unichr(178)) | |
uniteV = 1000000000.0**3 | |
uniteVs= "pm"+iso8859(unichr(179)) | |
elif text == "fm": # = 1000000000000 | |
uniteM = 1000000000000.0 | |
uniteMs= "fm" | |
uniteS = 1000000000000.0**2 | |
uniteSs= "fm"+iso8859(unichr(178)) | |
uniteV = 1000000000000.0**3 | |
uniteVs= "fm"+iso8859(unichr(179)) | |
elif text == "inch": # inch = 25.400 | |
uniteM = 1.0/25.400 | |
uniteMs= "in" | |
uniteS = uniteM**2 | |
uniteSs= "sq in" | |
uniteV = uniteM**3 | |
uniteVs= "in"+iso8859(unichr(179)) | |
elif text == "link": # link = 201.168 | |
uniteM = 1.0/201.168 | |
uniteMs= "lk" | |
uniteS = uniteM**2 | |
uniteSs= "sq lk" | |
uniteV = uniteM**3 | |
uniteVs= "lk"+iso8859(unichr(179)) | |
elif text == "foot": # foot = 304.800 | |
uniteM = 1.0/304.800 | |
uniteMs= "ft" | |
uniteS = uniteM**2 | |
uniteSs= "sq ft" | |
uniteV = uniteM**3 | |
uniteVs= "ft"+iso8859(unichr(179)) | |
elif text == "yard": # yard = 914.400 | |
uniteM = 1.0/914.400 | |
uniteMs= "yd" | |
uniteS = uniteM**2 | |
uniteSs= "sq yd" | |
uniteV = uniteM**3 | |
uniteVs= "yd"+iso8859(unichr(179)) | |
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= "rd"+iso8859(unichr(179)) | |
elif text == "chain": # chain = 20116.800 | |
uniteM = 1.0/20116.800 | |
uniteMs= "ch" | |
uniteS = uniteM**2 | |
uniteSs= "sq ch" | |
uniteV = uniteM**3 | |
uniteVs= "ch"+iso8859(unichr(179)) | |
elif text == "furlong": # furlong= 201168 | |
uniteM = 1.0/201168 | |
uniteMs= "fur" | |
uniteS = uniteM**2 | |
uniteSs= "sq fur" | |
uniteV = uniteM**3 | |
uniteVs= "fur"+iso8859(unichr(179)) | |
elif text == "mile": # mile = 1609344 | |
uniteM = 1.0/1609344 | |
uniteMs= "mi" | |
uniteS = uniteM**2 | |
uniteSs= "sq mi" | |
uniteV = uniteM**3 | |
uniteVs= "mi"+iso8859(unichr(179)) | |
elif text == "league": # league = 4828032 | |
uniteM = 1.0/4828032 | |
uniteMs= "lea" | |
uniteS = uniteM**2 | |
uniteSs= "sq lea" | |
uniteV = uniteM**3 | |
uniteVs= "lea"+iso8859(unichr(179)) | |
elif text == "nautique": # nautique = 1852000 | |
uniteM = 1.0/1852000 | |
uniteMs= "nmi" | |
uniteS = uniteM**2 | |
uniteSs= "sq nmi" | |
uniteV = uniteM**3 | |
uniteVs= "nmi"+iso8859(unichr(179)) | |
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("") | |
try: | |
boundBox_S = "[X: "+str(boundBoxLX * uniteM)+" "+uniteMs+"] x [Y: "+str(boundBoxLY * uniteM)+" "+uniteMs+"] x [Z: "+str(boundBoxLZ * uniteM)+" "+uniteMs+"]" | |
self.lineEdit_15.setText(boundBox_S) | |
except: | |
self.lineEdit_15.setText("") | |
co = 0 | |
li = 0 | |
for li in range(RowCount): # Zero | |
for co in range(8): | |
newitem = QtGui.QTableWidgetItem("") | |
self.tableWidget.setItem( li,co, newitem) | |
co = 0 | |
li = 0 | |
aa = 0 | |
for j in enumerate(Edges): # Edges | |
newitem = QtGui.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtGui.QTableWidgetItem(str(float(EdgesLong[li]) * float(uniteM))+" "+uniteMs) | |
self.tableWidget.setItem( li,1, newitem) | |
co+=1 | |
try: | |
for a in range(aa,aa+6): # Vertexes | |
co += 1 | |
newitem = QtGui.QTableWidgetItem(str(Vertx[a])) | |
self.tableWidget.setItem( li,co, newitem) | |
except: | |
None | |
aa += 6 | |
co = 0 | |
li+= 1 | |
li += 1 | |
co = 0 | |
cco = 0 | |
co2 = 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(uniteS))+" "+uniteSs) | |
self.tableWidget.setItem( li,1, newitem) | |
li+= 1 | |
for jj in range(cco,len(FacesCoor)):# Faces coordonnées | |
cco+=1 | |
if FacesCoor[jj] == "T": | |
break | |
else: | |
newitem = QtGui.QTableWidgetItem(FacesCoor[jj]) | |
self.tableWidget.setItem( li,co2, newitem) | |
co2 += 1 | |
if co2 == 3: | |
li += 1 | |
co2 = 0 | |
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_Label | |
global object_Name | |
global typeObject | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global perimetre | |
global Plan_xy | |
global Plan_xy_V | |
global Plan_yz | |
global Plan_yz_V | |
global Plan_zx | |
global Plan_zx_V | |
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 uniteAs | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global boundBoxCenter | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global boundBox_ | |
global boundBoxLX | |
global boundBoxLY | |
global boundBoxLZ | |
global boundBox_S | |
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 FacesCoor | |
global compt_E | |
global compt_F | |
global compt_VF | |
global placement_ | |
global RowCount | |
global RowCountTest | |
global path | |
global SaveName | |
sel = FreeCADGui.Selection.getSelection() | |
if len(sel)==0: | |
App.Console.PrintMessage("Sélectionnez un objet"+"\n") | |
errorDialog(u"Sélectionnez un objet") | |
else: | |
affect() | |
self.lineEdit_1.setText(document_) | |
self.lineEdit_2.setText(object_Label) | |
self.lineEdit_2a.setText(object_Name) | |
self.lineEdit_3.setText(str(element_)) | |
self.lineEdit_3a.setText(str(typeObject)) | |
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 > RowCount: | |
self.label_7.setText(_translate("MainWindow", u"Détails ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+") (!+ "+str(RowCount)+") "+str(RowCountTest), None)) | |
else: | |
self.label_7.setText(_translate("MainWindow", u"Vertexes et détails ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+")", None))#str(RowCount) | |
co = 0 | |
li = 0 | |
for li in range(RowCount): # Zero | |
for co in range(8): | |
newitem = QtGui.QTableWidgetItem("") | |
self.tableWidget.setItem( li,co, newitem) | |
co = 0 | |
li = 0 | |
aa = 0 | |
for j in enumerate(Edges): # Edges | |
newitem = QtGui.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtGui.QTableWidgetItem(str(float(EdgesLong[li]) * float(uniteM))+" "+uniteMs) | |
self.tableWidget.setItem( li,1, newitem) | |
co+=1 | |
try: | |
for a in range(aa,aa+6): # Vertexes | |
co += 1 | |
newitem = QtGui.QTableWidgetItem(str(Vertx[a])) | |
self.tableWidget.setItem( li,co, newitem) | |
except: | |
None | |
aa += 6 | |
co = 0 | |
li += 1 | |
li += 1 | |
co = 0 | |
cco = 0 | |
co2 = 0 | |
for j in enumerate(Faces): # Faces | |
newitem = QtGui.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtGui.QTableWidgetItem(str(float(FacesSurf[co]) * float(uniteS))+" "+uniteSs) | |
self.tableWidget.setItem( li,1, newitem) | |
li += 1 | |
for jj in range(cco,len(FacesCoor)):# Faces coordonnées | |
cco+=1 | |
if FacesCoor[jj] == "T": | |
break | |
else: | |
newitem = QtGui.QTableWidgetItem(FacesCoor[jj]) | |
self.tableWidget.setItem( li,co2, newitem) | |
co2 += 1 | |
if co2 == 3: | |
li += 1 | |
co2 = 0 | |
co += 1 | |
li += 1 | |
self.lineEdit_8xy.setText(str(Plan_xy)+uniteAs) | |
self.lineEdit_8xya.setText(str(Plan_xy_V)) | |
self.lineEdit_8yz.setText(str(Plan_yz)+uniteAs) | |
self.lineEdit_8yza.setText(str(Plan_yz_V)) | |
self.lineEdit_8zx.setText(str(Plan_zx)+uniteAs) | |
self.lineEdit_8zxa.setText(str(Plan_zx_V)) | |
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_S)) | |
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_Lec_clicked(self): # lecture | |
OpenName = "" | |
OpenName = QFileDialog.getOpenFileName(None,QString.fromLocal8Bit("Lire un fichier txt"),path,"*.FCInfo *.txt") | |
try: | |
if OpenName != "": | |
App.Console.PrintMessage("Lecture du fichier "+OpenName+"\n") | |
file = "" | |
file = open(OpenName, "rb") | |
reader = csv.reader(file) | |
Count0 = 0 | |
ligne = 0 | |
colonne = 0 | |
try: # | |
for row in reader: | |
ligne += 1 # | |
for field in row: | |
Count0 += 1 # | |
if Count0 > colonne: | |
colonne = Count0 | |
Count0 = 0 | |
finally: | |
file.close() | |
self.table = QTableWidget( ligne , colonne) | |
self.table.setWindowTitle(_translate("MainWindow", "FCInfo Patience lecture en cours", None)) | |
self.table.resize(700, 500) | |
self.table.setWindowModality(QtCore.Qt.NonModal) | |
self.table.setWindowFlags(PyQt4.QtCore.Qt.WindowStaysOnTopHint) # cette fonction met la fenêtre en avant | |
self.table.setWindowIcon(QtGui.QIcon(path+'FCInfoSpreadsheet.png'))# change l'icône de la fenêtre principale | |
self.table.show() | |
file = open(OpenName, "rb") | |
reader = csv.reader(file) | |
lignes = ligne | |
colonne = 0 | |
ligne = 0 | |
try: | |
for row in reader: | |
for field in row: | |
newitem = QtGui.QTableWidgetItem(unicode(str(field), 'UTF-8')) | |
self.table.setItem(ligne, colonne, (newitem)) | |
colonne += 1 | |
ligne += 1 | |
colonne = 0 | |
self.table.setWindowTitle(_translate("MainWindow", "FCInfo Patience lecture en cours "+str(ligne)+"/"+str(lignes), None)) | |
finally: | |
file.close() | |
self.table.setWindowTitle(_translate("MainWindow", "FCInfo Tableau " + OpenName, None)) | |
except: | |
App.Console.PrintMessage("Erreur en lecture du fichier "+OpenName+"\n") | |
errorDialog(u"Erreur en lecture du fichier "+OpenName) | |
################################################################################################################## | |
def on_pushButton_En_clicked(self,text): # enregistrement | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global perimetre | |
global Plan_xy | |
global Plan_xy_V | |
global Plan_yz | |
global Plan_yz_V | |
global Plan_zx | |
global Plan_zx_V | |
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 uniteAs | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global boundBoxCenter | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global boundBox_ | |
global boundBoxLX | |
global boundBoxLY | |
global boundBoxLZ | |
global boundBox_S | |
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 FacesCoor | |
global compt_E | |
global compt_F | |
global compt_VF | |
global placement_ | |
global RowCount | |
global RowCountTest | |
global path | |
global SaveName | |
SaveName = "" | |
SaveName = QFileDialog.getSaveFileName(None,QString.fromLocal8Bit("Sauver un fichier FCInfo"),path,"*.FCInfo") | |
if SaveName == "": | |
App.Console.PrintMessage(u"Procédure abandonnée"+"\n") | |
errorDialog(u"Procédure abandonnée") | |
else: | |
App.Console.PrintMessage("Enregistrement de "+SaveName+"\n") | |
try: | |
f = open(SaveName, 'w') # write | |
f.write(utf8(u"Info sur l'élément"+"\n")) | |
f.write(utf8(u"___________________"+"\n")) | |
f.write(utf8(dateComp()+" "+heure()+"\n\n")) | |
f.write(utf8(u"Nom du document :, "+document_+"\n")) | |
f.write(utf8(u"Label de l'objet :, "+object_Label+"\n")) | |
f.write(utf8(u"Nom interne de l'objet :, "+object_Name+"\n")) | |
f.write(utf8(u"Nom de l'élément :, "+str(element_)+"\n")) | |
f.write(utf8( "Type d'objet :, "+typeObject+"\n")) | |
f.write(utf8(u"Coordonnées de la souris :, X:, "+str(position0)+", Y:, "+str(position1)+", Z:, "+str(position2)+"\n")) | |
f.write(utf8(u"Longueur de l'objet :, "+str(longueurObjet * uniteM)+", "+uniBuntu(uniteMs)+"\n")) | |
f.write(utf8(u"Périmetre de la forme :, "+str(perimetre * uniteM)+", "+uniBuntu(uniteMs)+"\n\n")) | |
f.write(utf8(u"Vertexes et détails :, Edges :,"+ str(compt_E) +", Faces :,"+ str(compt_F)+", Vertexes faces :,"+ str(compt_VF)+", Total :,"+str(RowCountTest)+"\n\n")) | |
co = 0 | |
aa = 0 | |
for j in enumerate(Edges): | |
f.write(str(j[1])+" , "+utf8(str(float(EdgesLong[co]) * float(uniteM))+" , "+uniBuntu(uniteMs)+","))#"\n" | |
co+=1 | |
for a in range(aa,aa+6): | |
try: | |
# f.write(str(Vertx[a][0:3])+" , "+str(Vertx[a][4:len(Vertx[a])])+" , ") | |
chaine = str(Vertx[a]).split(":") | |
f.write(chaine[0]+" , "+chaine[1]+" , ") | |
except: | |
None | |
aa += 6 | |
f.write("\n") | |
f.write("\n") | |
co = 0 | |
cco = 0 | |
co2 = 0 | |
for j in enumerate(Faces): | |
f.write(str(j[1])+" , "+utf8(str(float(FacesSurf[co]) * float(uniteS))+" , "+uniBuntu(uniteSs)+"\n")) | |
co += 1 | |
for jj in range(cco,len(FacesCoor)):# Faces coordonnées | |
cco+=1 | |
if FacesCoor[jj] == "T": | |
f.write("\n") | |
break | |
else: | |
chaine = str(FacesCoor[jj]).split(":") | |
f.write(chaine[0]+" , "+chaine[1]+" , ") | |
co2 += 1 | |
if co2 == 3: | |
f.write("\n") | |
co2 = 0 | |
f.write("\n") | |
f.write(utf8("Plan :, XY:, " + self.lineEdit_8xy.text() + "," +u" coordonnées:, " + str(Plan_xy_V)+"\n")) | |
f.write(utf8("Plan :, YZ:, " + self.lineEdit_8yz.text() + "," +u" coordonnées:, " + str(Plan_yz_V)+"\n")) | |
f.write(utf8("Plan :, ZX:, " + self.lineEdit_8zx.text() + "," +u" coordonnées:, " + str(Plan_zx_V)+"\n\n")) | |
f.write("Surface de la forme :, "+utf8(str(surface * uniteS)+" , "+uniBuntu(uniteSs)+"\n")) | |
f.write("Surface de la face :, "+utf8(str(surfaceFace * uniteS)+" , "+uniBuntu(uniteSs)+"\n\n")) | |
f.write("Volume de la forme :, "+utf8(str(volume_ * uniteV)+" , "+uniBuntu(uniteVs)+"\n")) | |
f.write("Poids :, "+utf8(str(poids)+" , "+uniBuntu(unitePs)+u", Densité:, "+str(densite)+"\n\n")) | |
f.write("Centre de la forme :, X:, "+utf8(str(boundBoxCenterX)+", Y:, "+str(boundBoxCenterY)+", Z:, "+str(boundBoxCenterZ)+"\n")) | |
f.write("Centre de la masse :, X:, "+utf8(str(CenterOfMassX) +", Y:, "+str(CenterOfMassY) +", Z:, "+str(CenterOfMassZ)+"\n")) | |
f.write("Dimensions hors tout :, X:, "+utf8(str(boundBoxLX * uniteM)+","+uniBuntu(uniteMs)+", Y:, "+str(boundBoxLY * uniteM)+","+uniBuntu(uniteMs)+", Z:, "+str(boundBoxLZ * uniteM)+","+uniBuntu(uniteMs)+"\n\n")) | |
f.write("Matrix of inertia :, X:, "+utf8(str(MatrixX1)+", Y:, "+str(MatrixY1)+", Z:, "+str(MatrixZ1)+", :, "+str(Matrix_1)+"\n")) | |
f.write(" :, X:, "+utf8(str(MatrixX2)+", Y:, "+str(MatrixY2)+", Z:, "+str(MatrixZ2)+", :, "+str(Matrix_2)+"\n")) | |
f.write(" :, X:, "+utf8(str(MatrixX3)+", Y:, "+str(MatrixY3)+", Z:, "+str(MatrixZ3)+", :, "+str(Matrix_3)+"\n")) | |
f.write(" :, X:, "+utf8(str(Matrix12)+", Y:, "+str(Matrix13)+", Z:, "+str(Matrix14)+", :, "+str(Matrix15)+"\n")) | |
f.close() | |
except: | |
App.Console.PrintMessage( u"Erreur en écriture du fichier "+SaveName+"\n") | |
errorDialog(u"Erreur en écriture du fichier "+SaveName) | |
def on_pushButton_Ra_clicked(self): # clicked() pressed(), released() Bouton radian/degrees | |
global uniteAs | |
Plan_xy2 = 0.0 | |
Plan_yz2 = 0.0 | |
Plan_zx2 = 0.0 | |
if self.pushButton_Ra.text() == u"Degré": | |
uniteAs = "" | |
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": | |
uniteAs = " rad" | |
self.pushButton_Ra.setText(_translate("MainWindow", "Radian", None)) | |
Plan_xy2 = radians(Plan_xy) | |
self.lineEdit_8xy.setText(str(Plan_xy2)+uniteAs) | |
Plan_yz2 = radians(Plan_yz) | |
self.lineEdit_8yz.setText(str(Plan_yz2)+uniteAs) | |
Plan_zx2 = radians(Plan_zx) | |
self.lineEdit_8zx.setText(str(Plan_zx2)+uniteAs) | |
elif self.pushButton_Ra.text() == "Radian": | |
uniteAs = " gon" | |
self.pushButton_Ra.setText(_translate("MainWindow", "Grade", None)) | |
Plan_xy2 = angleGrade(Plan_xy) | |
self.lineEdit_8xy.setText(str(Plan_xy2)+uniteAs) #angleGrade | |
Plan_yz2 = angleGrade(Plan_yz) | |
self.lineEdit_8yz.setText(str(Plan_yz2)+uniteAs) | |
Plan_zx2 = angleGrade(Plan_zx) | |
self.lineEdit_8zx.setText(str(Plan_zx2)+uniteAs) | |
elif self.pushButton_Ra.text() == "Grade": | |
uniteAs = iso8859(unichr(37)) # pourcent | |
self.pushButton_Ra.setText(_translate("MainWindow", "Pourcent", None)) | |
Plan_xy2 = anglePourcent(Plan_xy) | |
self.lineEdit_8xy.setText(str(Plan_xy2)+uniteAs) #anglePourcent | |
Plan_yz2 = anglePourcent(Plan_yz) | |
self.lineEdit_8yz.setText(str(Plan_yz2)+uniteAs) | |
Plan_zx2 = anglePourcent(Plan_zx) | |
self.lineEdit_8zx.setText(str(Plan_zx2)+uniteAs) | |
elif self.pushButton_Ra.text() == "Pourcent": | |
uniteAs = iso8859(unichr(176)) # degré | |
try: | |
self.pushButton_Ra.setText(_translate("MainWindow", u"Degré", None)) | |
self.lineEdit_8xy.setText(str(Plan_xy)+uniteAs) | |
self.lineEdit_8yz.setText(str(Plan_yz)+uniteAs) | |
self.lineEdit_8zx.setText(str(Plan_zx)+uniteAs) | |
except: | |
None | |
def on_pushButton02_clicked(self): # Bouton Quitter | |
App.Console.PrintMessage("Fin FCInfo\r\n") | |
FreeCADGui.Selection.removeObserver(s) # désinstalle la fonction résidente | |
self.window.hide() | |
######################################################################################################################### | |
class SelObserver: | |
def addSelection(self,document, object, element, position): # Selection | |
global sel | |
global document_ | |
global object_Label | |
global element_ | |
global position0 | |
global position1 | |
global position2 | |
sel = FreeCADGui.Selection.getSelection() | |
document_ = document # Nom du document | |
object_Label = object # Label de l'objet | |
element_ = element # Nom de la partie de l'objet | |
position0 = position[0] | |
position1 = position[1] | |
position2 = position[2] | |
if len(sel)==0: | |
App.Console.PrintMessage(u"Sélectionnez un objet"+"\n") | |
errorDialog(u"Sélectionnez un objet") | |
else: | |
ff = ui | |
ff.on_pushButton_Raf_clicked() | |
##################################################################################### | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This macro utility is intended for the use of the program FreeCAD http://www.freecadweb.org/
rename in FCInfo.png
rename in FCInfoSpreadsheet.png
The icon for your toolbar, it is to place in your macros directory (in the same location of the macro)
toolbar