Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rmu75/b165147bd1c2f2659c014103793ae1d8 to your computer and use it in GitHub Desktop.
Save rmu75/b165147bd1c2f2659c014103793ae1d8 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. (English version)
# -*- coding: utf-8 -*-
"""
***************************************************************************
* Copyright (c) 2014 2015 2016 2017 2018 2019 <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. *
** **
* Use at your own risk. The author assumes no liability for data loss. *
* It is advised to backup your data frequently. *
* If you do not trust the software do not use it. *
** **
* 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 en
# https://fr.wikipedia.org/wiki/Kilogramme
# Select an object or launch the application and select an object, and a series of information appear.
# Calculations FreeCAD unit, which is the mm on each new selection, the unit of length-based his return still on mm and decimal degrees angle.
# Always leave by the "Exit" button if it exits the program without going through the button "Exit" the program remains in memory and continues to run.
# Should leave FreeCAD to erase memory.
# Only the first 200 objects are visible in the table if there are more than 200 items in the object a signal will be displayed by '(!+ 200),
# The complete list of data is visible in the backup file
#
# 05_01 01/14 Docked PyQt4 + PySide 19/12/2015 suppression de PyQt4 21/06/2017 ajout style 8 points et nouveau path
# 12/12/2017 upgrade de la section Matrix of inertia de "pinq" voir "https://forum.freecadweb.org/viewtopic.php?f=22&t=23888"
# ajout de Plans, Axes, Points et optimisation
# 16/04/2019 upgrade pour 0.17.13541 (Git), 0.18.16093 (Git), 0.19.16474 (Git)Qt: 5.6.2 Python: 3.6.6 OCC: 7.3.0
# 30/05/2019 rmu change fixed positions to qt layouts
#
#
#OS: Windows Vista SP2 #OS: Windows 8 #OS: Ubuntu 14.04.2 LTS #OS: Windows 10
#Word size: 32-bit #Word size of OS: 64-bit #Word size of OS: 64-bit #Word size of OS: 64-bit
#Version: 0.14.3700 (Git) #Word size of FreeCAD: 64-bit #Word size of FreeCAD: 64-bit #Word size of FreeCAD: 64-bit
#Branch: releases/FreeCAD-0-14 #Version: 0.16.6037 (Git) #Version: 0.16.6062 (Git) #Version: 0.19.16474 (Git)
#Hash: 32f5aae0a64333ec8d5d160dbc46e690510c8fe1 #Build type: Release #Build type: None #Build type: Release
#Python version: 2.6.2 #Branch: master #Branch: master #Branch: master
#Qt version: 4.5.2 #Hash: be9920a132b57fbcf049d6a53d17cc34df1cbe30 #Hash: 61e1a5ca2fee4ea7a95965afdbb510a450d46660 #Hash: 746997e48411f22a150b95b6fdbb9b02cbe741d5
#Coin version: 3.1.0 #Python version: 2.7.8 #Python version: 2.7.6 #Python version: 3.6.6
#SoQt version: 1.4.1 #Qt version: 4.8.6 #Qt version: 4.8.6 #Qt version: 5.6.2
#OCC version: 6.5.1 #Coin version: 4.0.0a #Coin version: 4.0.0a #Coin version: 4.0.0a
#OCC version: 6.8.0.oce-0.17 #OCC version: 6.8.0.oce-0.17 #OCC version: 7.3.0
#
__title__ = "FCInfo"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-en.html"
__version__ = "01.21-rµ"
__date__ = "30/05/2019"
__Comment__ = "gives different information about the selected object with the possibility of saving information"
__Web__ = "http://forum.freecadweb.org/viewtopic.php?f=10&t=3185"
__Wiki__ = "http://www.freecadweb.org/wiki/index.php?title=Macro_FCInfo"
__IconL__ = ""
__IconW__ = "C:/Users/xxxxx/AppData/Roaming/FreeCAD/Macro"
__Help__ = "Start the macro select an object and read the info displayed"
__Status__ = "stable"
__Requires__ = "freecad 0.15 and more"
__Communication__ = "http://forum.freecadweb.org/viewtopic.php?f=10&t=3185"
import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import QComboBox
from PySide.QtGui import QMessageBox
from PySide.QtGui import QTableWidget, QApplication
from PySide.QtGui import *
from PySide.QtCore import *
import Draft, Part, FreeCAD, math, PartGui, FreeCADGui
import Part
import decimal
from math import sqrt, pi, sin, cos, asin, degrees, radians, tan
from FreeCAD import Base
import csv
import codecs
import sys
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,"Error Message",msg )
diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # PySide # This function updates the window forward
# diag.setWindowModality(QtCore.Qt.ApplicationModal) # the function has been disabled to promote "WindowStaysOnTopHint"
diag.exec_()
def iso8859(encoder):
# ori 0.18 Py 27 return unicode(encoder).encode('iso-8859-1')
verPython = sys.version_info
if verPython.major < 3:
return unicode(encoder).encode('iso-8859-1')
else:
encoder = str(encoder)
return encoder
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 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):
# give the angle in degrees
global uniteAs
try:
deg = int(angle0)
min = int((angle0 - deg)*60)
sec = round (((((angle0 - deg)*60)-min)*60),6)
angle = str(deg)+u"° "+str(min)+u"' "+str(sec)+u"''"
uniteAs = ""
return angle
except Exception:
return 0
def angleGrade(angle0):
# give the angle in degrees
global uniteAs
try:
angle = float(angle0)
angle = (200.0 * angle) / 180.0
uniteAs = " gon"
return round(angle,6)
except Exception:
return 0
def anglePourcent(angle0):
# give the angle in degrees
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 = u"%"
return round(angle,6)
except Exception:
return 0.0
def angle2(vecteur_x1,vecteur_y1,vecteur_x2,vecteur_y2,mode):
# calculation of the slope of a line using two vectors
# If 'mode' = 1 then display in degrees or radians
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 = u"°"
else:
angle = atan2(float(deltaY),float(deltaX)) # radian
uniteAs = " rad"
return round(angle,6)
except Exception:
return 0
####tools#########################################################################
global ui ; ui = ""
global testing ; testing = 2 # if testing == 1 MainWindow separate
# if testing == 2 RightDock
# else == other LeftDock
global FCmw ; FCmw = "" # RightDock LeftDock
global myNewFreeCADWidget; myNewFreeCADWidget = ""
#############################################################
global densite ; densite = 1.00 # (steel = 7.5 kg by dm3)
global arrondi ; arrondi = 4 # many numbers after the decimal point "defaut = 4"
#############################################################
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 rayonObjet ; rayonObjet = 0.0
global perimetre ; perimetre = 0.0
global numberEdges ; numberEdges = 0
global typeLongueur ; typeLongueur = "Length of object "
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 poids ; poids = 0.0
global uniteM ; uniteM = 1.0 # unit of measurement length
global uniteMs ; uniteMs = u"mm"
global uniteS ; uniteS = 1.0 # unit of measurement surface
global uniteSs ; uniteSs = u"mm²"
global uniteV ; uniteV = 1.0 # unit of measurement volume
global uniteVs ; uniteVs = u"mm³"
global uniteP ; uniteP = 1.0 # unit of measure weight
global unitePs ; unitePs = u"g"
global uniteAs ; uniteAs = u"°"
global boundBoxCenterX ; boundBoxCenterX = 0.0
global boundBoxCenterY ; boundBoxCenterY = 0.0
global boundBoxCenterZ ; boundBoxCenterZ = 0.0
global boundBoxCenter; boundBoxCenter= 0.0
global boundBoxDiag ; boundBoxDiag = 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 MatrixX1_16 ; MatrixX1_16 = 0.0
global MatrixY1_16 ; MatrixY1_16 = 0.0
global MatrixZ1_16 ; MatrixZ1_16 = 0.0
global MatrixX2_16 ; MatrixX2_16 = 0.0
global MatrixY2_16 ; MatrixY2_16 = 0.0
global MatrixZ2_16 ; MatrixZ2_16 = 0.0
global MatrixX3_16 ; MatrixX3_16 = 0.0
global MatrixY3_16 ; MatrixY3_16 = 0.0
global MatrixZ3_16 ; MatrixZ3_16 = 0.0
global MatrixX1_17 ; MatrixX1_17 = 0.0
global MatrixY1_17 ; MatrixY1_17 = 0.0
global MatrixZ1_17 ; MatrixZ1_17 = 0.0
global MatrixX2_17 ; MatrixX2_17 = 0.0
global MatrixY2_17 ; MatrixY2_17 = 0.0
global MatrixZ2_17 ; MatrixZ2_17 = 0.0
global MatrixX3_17 ; MatrixX3_17 = 0.0
global MatrixY3_17 ; MatrixY3_17 = 0.0
global MatrixZ3_17 ; MatrixZ3_17 = 0.0
global DeterminantM ; DeterminantM = 0.0
global refreshMatrix ; refreshMatrix = 1
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 SaveName ; SaveName = ""
global ESCAPE ; ESCAPE = "\t" # tabulation SpreadSheet separation
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
global directionObj ; directionObj = 0.0
global direcValueAt ; direcValueAt = 0.0
global InfoReportView; InfoReportView= 0
global switchInertia ; switchInertia = 0 # for create plane without refresh
global switchClipBoard; switchClipBoard = 0 # for clipBoard
global switchPoint ; switchPoint = 0 # for point False
global switchAxis ; switchAxis = 1 # for axis True
global switchPlane ; switchPlane = 1 # for plane True
####path#########################################################################
global path ; path = "" #
#path = FreeCAD.ConfigGet("AppHomePath") # path FreeCAD installation
#path = FreeCAD.ConfigGet("UserAppData") # path FreeCAD User data
#path = "your path" # your directory path
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path
path = param.GetString("MacroPath","") + "/" # macro path
path = path.replace("\\","/") # convert the "\" to "/"
#print( "Path for the icons : " , path ) #
#################################################################################
def Around(a) :
global arrondi
if arrondi == -1:
arrondi = 1000
return round(a,arrondi)
def axisPlane( posX = 0.0, posY = 0.0, posZ = 0.0, namePlane = "FCPlane"): # plane creation
global sel
global document_
global object_Name
global path
global boundBoxDiag
global switchInertia
global switchClipBoard
global switchPoint
global switchAxis
global switchPlane
global directionObj
sel = FreeCADGui.Selection.getSelection()
retour = path + "Macro_FCInfo_05.png"
switchInertia = 1
if switchClipBoard == 1: # memo clipBoard
memo = QtGui.QApplication.clipboard()
memo.clear(mode=memo.Clipboard )
memo.setText("FreeCAD.Vector("+str(posX)+", "+str(posY)+", "+str(posZ)+")", mode = memo.Clipboard) # FreeCAD.Vector(x, y, z)
#memo.setText(str(posX)+", "+str(posY)+", "+str(posZ), mode = memo.Clipboard) # x, y, z
if switchPoint == 1:
try: # create point
point = Draft.makePoint( posX, posY, posZ)
point.ViewObject.PointColor = (1.0,0.0,0.0)
point.Label = "FCPoint" + namePlane
retour = path + "Macro_FCInfo_06.png"
FreeCADGui.updateGui() # updateGui
App.ActiveDocument.recompute()
except Exception:
retour = path + "Macro_FCInfo_07.png"
if switchPlane == 1:
try: # create plane
doc = App.activeDocument()
if boundBoxDiag == 0.0:
boundBoxDiag = 10.0
boundBoxLX = boundBoxLY = boundBoxLZ = boundBoxDiag
FCSpring = doc.addObject("App::DocumentObjectGroup", "FCPlane" + namePlane)
plr = FreeCAD.Placement()
plr.Base = FreeCAD.Vector( posX, posY, posZ)
### PlaneX-R
plan = App.ActiveDocument.addObject("Part::Plane","PlaneX-R")
plan.Length=boundBoxLZ
plan.Width=boundBoxLX
plan.Placement = plr
plan.Placement.Rotation = plan.Placement.Rotation.multiply(App.Rotation(0.0,-90.0,0.0))
plan.Placement = plan.Placement.multiply(App.Placement(App.Vector(-float(plan.Length)/2.0,-float(plan.Width)/2.0,0.0), App.Rotation(App.Vector(0.0,0.0,0.0),0.0), App.Vector(0.0,0.0,0.0)))
plan.ViewObject.LineColor = (1.0,0.66667,0.0)
plan.ViewObject.ShapeColor = (0.6, 0.0, 0.0)
plan.ViewObject.Transparency = 90
plan.ViewObject.LineWidth = 1.0
FCSpring.addObject(plan)
### PlaneY-V
plan = App.ActiveDocument.addObject("Part::Plane","PlaneY-V")
plan.Length=boundBoxLY
plan.Width=boundBoxLZ
plan.Placement = plr
plan.Placement.Rotation = plan.Placement.Rotation.multiply(App.Rotation(0.0,0.0,90.0))
plan.Placement = plan.Placement.multiply(App.Placement(App.Vector(-float(plan.Length)/2.0,-float(plan.Width)/2.0,0.0), App.Rotation(App.Vector(0.0,0.0,0.0),0.0), App.Vector(0.0,0.0,0.0)))
plan.ViewObject.LineColor = (1.0, 0.66667, 0.0)
plan.ViewObject.ShapeColor = (0.0, 0.6, 0.0)
plan.ViewObject.Transparency = 90
plan.ViewObject.LineWidth = 1.0
FCSpring.addObject(plan)
### PlaneZ-B
plan = App.ActiveDocument.addObject("Part::Plane","PlaneZ-B")
plan.Length=boundBoxLX
plan.Width=boundBoxLY
plan.Placement = plr
plan.Placement = plan.Placement.multiply(App.Placement(App.Vector(-float(plan.Length)/2.0,-float(plan.Width)/2.0,0.0), App.Rotation(App.Vector(0.0,0.0,0.0),0.0), App.Vector(0.0,0.0,0.0)))
plan.ViewObject.LineColor = (1.0,1.0,1.0)
plan.ViewObject.ShapeColor = (0.0,0.0,0.6)
plan.ViewObject.Transparency = 90
plan.ViewObject.LineWidth = 1.0
FCSpring.addObject(plan)
FreeCADGui.updateGui() # updateGui
App.ActiveDocument.recompute()
retour = path + "Macro_FCInfo_06.png"
except Exception:
retour = path + "Macro_FCInfo_07.png"
if switchAxis == 1: # create axis
try:
doc = App.activeDocument()
if boundBoxDiag == 0.0:
boundBoxDiag = 10.0
boundBoxLX = boundBoxLY = boundBoxLZ = boundBoxDiag
FCSpring = doc.addObject("App::DocumentObjectGroup", "FCAxis" + namePlane)
plr = FreeCAD.Placement()
plr.Base = FreeCAD.Vector( posX, posY, posZ)
#create axis
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(0.0,0.0,boundBoxLX)]
centerX = Draft.makeWire(points,closed=False,face=False,support=None)
centerX.Placement = plr
centerX.Placement.Rotation = centerX.Placement.Rotation.multiply(App.Rotation(0.0,90.0,0.0))
centerX.Placement = centerX.Placement.multiply(App.Placement(App.Vector(0.0,0.0,-float(boundBoxLX)/2.0), App.Rotation(App.Vector(0.0,0.0,0.0),0.0), App.Vector(0.0,0.0,0.0)))
centerX.ViewObject.LineColor = (1.0,1.0,1.0)
centerX.ViewObject.LineWidth = 1.0
centerX.ViewObject.DrawStyle = str("Dashdot")
centerX.Label = str("Axis White PlaneX")
FCSpring.addObject(centerX)
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(0.0,0.0,boundBoxLX)]
centerY = Draft.makeWire(points,closed=False,face=False,support=None)
centerY.Placement = plr
centerY.Placement.Rotation = centerY.Placement.Rotation.multiply(App.Rotation(0.0,90.0,90.0))
centerY.Placement = centerY.Placement.multiply(App.Placement(App.Vector(0.0,0.0,-float(boundBoxLX)/2.0), App.Rotation(App.Vector(0.0,0.0,0.0),0.0), App.Vector(0.0,0.0,0.0)))
centerY.ViewObject.LineColor = (1.0,1.0,1.0)
centerY.ViewObject.LineWidth = 1.0
centerY.ViewObject.DrawStyle = str("Dashdot")
centerY.Label = str("Axis White PlaneY")
FCSpring.addObject(centerY)
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(0.0,0.0,boundBoxLX)]
centerZ = Draft.makeWire(points,closed=False,face=False,support=None)
centerZ.Placement = plr
centerZ.Placement.Rotation = centerZ.Placement.Rotation.multiply(App.Rotation(0,0,0))
centerZ.Placement = centerZ.Placement.multiply(App.Placement(App.Vector(0.0,0.0,-float(boundBoxLX)/2.0), App.Rotation(App.Vector(0.0,0.0,0.0),0.0), App.Vector(0.0,0.0,0.0)))
centerZ.ViewObject.LineColor = (1.0,1.0,1.0)
centerZ.ViewObject.LineWidth = 1.0
centerZ.ViewObject.DrawStyle = str("Dashdot")
centerZ.Label = str("Axis White PlaneZ")
FCSpring.addObject(centerZ)
FreeCADGui.updateGui() # updateGui
App.ActiveDocument.recompute()
retour = path + "Macro_FCInfo_06.png"
except Exception:
retour = path + "Macro_FCInfo_07.png"
try:
Gui.Selection.addSelection(App.ActiveDocument.getObject(object_Name))
except Exception:
None
FreeCADGui.updateGui() # updateGui
switchInertia = 0
return retour
def tableau():
global sel
global element_
global perimetre
global numberEdges
global Vertx
global Edges
global EdgesLong
global Faces
global FacesSurf
global FacesCoor
global compt_E
global compt_F
global compt_VF
global RowCountTest
global angleX1
global angleY1
global angleZ1
global angleX2
global angleY2
global angleZ2
if len(sel) != 0:
Vertx=[]
Edges=[]
Faces=[]
compt_E = 0
compt_F = 0
compt_VF = 0
perimetre = 0.0
EdgesLong = []
angleX1 = 0.0
angleY1 = 0.0
angleZ1 = 0.0
angleX2 = 0.0
angleY2 = 0.0
angleZ2 = 0.0
numberEdges = len(sel[0].Shape.Edges)
for j in enumerate(sel[0].Shape.Edges): # search 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] # search Vertexes Edges
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 Exception:
Vertx.append("-")
Vertx.append("-")
Vertx.append("-")
FacesSurf = []
FacesCoor = []
for j in enumerate(sel[0].Shape.Faces): # search Faces
compt_F+=1
Faces.append("Face%d" % (j[0]+1))
FacesSurf.append(str(sel[0].Shape.Faces[compt_F-1].Area))
fco = 0
for f0 in sel[0].Shape.Faces[compt_F-1].Vertexes: # search Vertexes 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(passTableau):
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 rayonObjet
global perimetre
global numberEdges
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 boundBoxDiag
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 DeterminantM
global FacesSurf
global EdgesLong
global FacesCoor
global angleX1
global angleY1
global angleZ1
global angleX2
global angleY2
global angleZ2
global directionObj
global direcValueAt
global InfoReportView
global MatrixX1_16
global MatrixY1_16
global MatrixZ1_16
global MatrixX2_16
global MatrixY2_16
global MatrixZ2_16
global MatrixX3_16
global MatrixY3_16
global MatrixZ3_16
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
global refreshMatrix
global typeLongueur
try:
atest = sel[0].Shape.Vertexes
except Exception:
####################
selEx = FreeCADGui.Selection.getSelectionEx()
objs = [selobj.Object for selobj in selEx]
detected = ""
if len(objs) >= 1:
if hasattr(objs[0], "Shape"):
s = objs[0].Shape
elif hasattr(objs[0], "Mesh"):
s = objs[0].Mesh
detected = str(s)
elif hasattr(objs[0], "Points"):
s = objs[0].Points
detected = str(s)
########################################
App.Console.PrintMessage("Invalid selection"+"\n")
errorDialog("Invalid selection"+ "\n" +
detected )
sel = selEx = ""
else:
sel = FreeCADGui.Selection.getSelection()
mydoc = FreeCAD.activeDocument().Name
document_ = mydoc
try:
object_Label = sel[0].Label
object_Name = sel[0].Name
except Exception:
object_Label = ""
object_Name = ""
try:
SubElement = FreeCADGui.Selection.getSelectionEx()
element_ = SubElement[0].SubElementNames[0]
except Exception:
element_ = ""
# longueur Objet
try:
longueurObjet = Gui.Selection.getSelectionEx()[0].SubObjects[0].Length
if str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:5] == "Face":
typeLongueur = "Perimeter of face "
else:
typeLongueur = "Length of object "
except Exception:
longueurObjet = 0.0
# rayon Objet cas cercle
try:
rayonObjet = Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.Radius
except Exception:
rayonObjet = 0.0
# tableau
if passTableau == 1:
tableau()
# surface
try:
surface = sel[0].Shape.Area
except Exception:
surface = 0.0
try:
surfaceFace = Gui.Selection.getSelectionEx()[0].SubObjects[0].Area
except Exception:
surfaceFace = 0.0
# volume
try:
volume_ = sel[0].Shape.Volume
except Exception:
volume_ = 0.0
# poids
poids = ((volume_ * densite) * uniteP) / 1000.0 # mm3 (mm base FreeCAD)
# boundinbox (dimensions hors tout)
try:
boundBox_ = sel[0].Shape.BoundBox
boundBoxLX = boundBox_.XLength
boundBoxLY = boundBox_.YLength
boundBoxLZ = boundBox_.ZLength
boundBoxDiag = boundBox_.DiagonalLength
boundBox_S = "[X: "+str(boundBoxLX * uniteM)+" "+uniteMs+"] x [Y: "+str(boundBoxLY * uniteM)+" "+uniteMs+"] x [Z: "+str(boundBoxLZ * uniteM)+" "+uniteMs+"] Diagonal: " + str(boundBoxDiag * uniteM)+" "+uniteMs
except Exception:
boundBox_ = 0.0
boundBoxLX = 0.0
boundBoxLY = 0.0
boundBoxLZ = 0.0
boundBoxDiag = 0.0
boundBox_S = ""
# centre de la forme
try:
boundBoxCenterX = boundBox_.Center[0]
boundBoxCenterY = boundBox_.Center[1]
boundBoxCenterZ = boundBox_.Center[2]
except Exception:
boundBoxCenterX = 0.0
boundBoxCenterY = 0.0
boundBoxCenterZ = 0.0
mode = 1
# Perimetre tous les bords
select = FreeCADGui.Selection.getSelection()
numberEdges = len(select[0].Shape.Edges)
perimetre = 0.0
try:
for i in select[0].Shape.Edges:
perimetre += i.Length
except Exception:
perimetre = 0.0
# vertexes pour les angles
try:
selectionObjects = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]
if str(selectionObjects)[1:5] == "Edge":
points = selectionObjects.Edges[0].Vertexes[0].Point
angleX1 = points.x
angleY1 = points.y
angleZ1 = points.z
points = selectionObjects.Edges[0].Vertexes[1].Point
angleX2 = points.x
angleY2 = points.y
angleZ2 = points.z
except Exception:
angleX1 = angleY1 = angleZ1 = 0.0
angleX2 = angleY2 = angleZ2 = 0.0
try:
Plan_xy = angle2(angleX1,angleY1,angleX2,angleY2,mode)
Plan_xy_V = "[,"+str(angleX1)+" , "+str(angleY1)+",] [,"+str(angleX2)+" , "+str(angleY2)+",]"
except Exception:
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 Exception:
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 Exception:
Plan_zx = 0.0
Plan_zx_V = ""
# angle Placement
try:
typeObject = sel[0].Shape.ShapeType
except Exception:
typeObject = ""
# center of mass
try:
c = FreeCADGui.Selection.getSelection()[0].Shape.CenterOfMass
except Exception:
try:
selEx = FreeCADGui.Selection.getSelectionEx()
objs = [selobj.Object for selobj in selEx]
s = objs[0].Shape
c = s.Solids[0].CenterOfMass
except Exception:
c = ""
try:
CenterOfMassX = c.x
CenterOfMassY = c.y
CenterOfMassZ = c.z
except Exception:
CenterOfMassX = 0.0
CenterOfMassY = 0.0
CenterOfMassZ = 0.0
try: # inertia DeterminantM
DeterminantM = FreeCADGui.Selection.getSelection()[0].Shape.MatrixOfInertia.determinant()
except Exception:
try:
selEx = FreeCADGui.Selection.getSelectionEx()
objs = [selobj.Object for selobj in selEx]
s = objs[0].Shape
DeterminantM = s.Solids[0].MatrixOfInertia.determinant()
except Exception:
DeterminantM = 0.0
try: # inertia
m = FreeCADGui.Selection.getSelection()[0].Shape.MatrixOfInertia
except Exception:
try:
selEx = FreeCADGui.Selection.getSelectionEx()
objs = [selobj.Object for selobj in selEx]
s = objs[0].Shape
m = s.Solids[0].MatrixOfInertia
except Exception:
m = ""
try: # Matrix
MatrixX1_16 = MatrixX1 = (m.A[0])
MatrixY1_16 = MatrixY1 = (m.A[1])
MatrixZ1_16 = MatrixZ1 = (m.A[2])
Matrix_1 = (m.A[3])
MatrixX2_16 = MatrixX2 = (m.A[4])
MatrixY2_16 = MatrixY2 = (m.A[5])
MatrixZ2_16 = MatrixZ2 = (m.A[6])
Matrix_2 = (m.A[7])
MatrixX3_16 = MatrixX3 = (m.A[8])
MatrixY3_16 = MatrixY3 = (m.A[9])
MatrixZ3_16 = 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])
refreshMatrix = 1
except Exception:
MatrixX1_16 = MatrixX1 = 0.0
MatrixY1_16 = MatrixY1 = 0.0
MatrixZ1_16 = MatrixZ1 = 0.0
Matrix_1 = 0.0
MatrixX2_16 = MatrixX2 = 0.0
MatrixY2_16 = MatrixY2 = 0.0
MatrixZ2_16 = MatrixZ2 = 0.0
Matrix_2 = 0.0
MatrixX3_16 = MatrixX3 = 0.0
MatrixY3_16 = MatrixY3 = 0.0
MatrixZ3_16 = MatrixZ3 = 0.0
Matrix_3 = 0.0
Matrix12 = 0.0
Matrix13 = 0.0
Matrix14 = 0.0
Matrix15 = 0.0
refreshMatrix = 0
try: # Direction
edgeObject = Gui.Selection.getSelection()[0].Shape.Edges[0]
directionObj = edgeObject.Vertexes[1].Point.sub(edgeObject.Vertexes[0].Point)
except Exception:
directionObj = 0.0
try: # valueAt
direcValueAt = Gui.Selection.getSelectionEx()[0].SubObjects[0].Edges[0].valueAt(0)
except Exception:
direcValueAt = 0.0
########################################################
if InfoReportView == 1 :
App.Console.PrintMessage(u"Beginning_"+str(element_) +"______________________________________________________"+"\n")
App.Console.PrintMessage(u"Document name : "+document_+"\n")
App.Console.PrintMessage(u"Label of the object : "+object_Label+"\n")
App.Console.PrintMessage(u"Internal name : "+object_Name+"\n")
App.Console.PrintMessage(u"Element name : "+str(element_)+"\n")
App.Console.PrintMessage(u"Object type : "+typeObject+"\n")
App.Console.PrintMessage(u"Mouse coordinates : X: "+str(position0 * uniteM) + " " + uniteMs + " Y:" + str(position1 * uniteM) + " " + uniteMs + " Z:" + str(position2 * uniteM) + " " + uniteMs + "\n")
App.Console.PrintMessage(typeLongueur + " : "+str(longueurObjet * uniteM)+", "+uniteMs+"\n")
if rayonObjet != 0.0:
App.Console.PrintMessage(u"Radius of the object : "+str(rayonObjet * uniteM)+", "+uniteMs +"\n")
App.Console.PrintMessage(u"Perimeter of the shape : "+str(perimetre * uniteM)+", "+uniteMs+"\n\n")
############### detail of object begin
if passTableau == 1: #
App.Console.PrintMessage(u"Vertexes and details : ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+") ("+str(RowCountTest)+")\n")
co = 0
aa = 0
for j in enumerate(Edges):
App.Console.PrintMessage(u"Length "+str(j[1])+" = "+str(float(EdgesLong[co]) * float(uniteM))+" "+uniteMs+"\n")
try:
for a in range(aa,aa+6):
chaine = str(Vertx[a]).split(":")
App.Console.PrintMessage(chaine[0] + ": " + str(float(chaine[1]) * float(uniteM))+" "+uniteMs+"\n")
except Exception:
None
co += 1
aa += 6
App.Console.PrintMessage("\n")
co=0
cco=0
for j in enumerate(Faces):
App.Console.PrintMessage(u"Surface "+str(j[1])+" = "+str(float(FacesSurf[co]) * float(uniteS))+" "+uniteSs+"\n")
for jj in range(cco,len(FacesCoor)):
cco+=1
if FacesCoor[jj] == "T":
break
else:
chaine = str(FacesCoor[jj]).split(":")
App.Console.PrintMessage(chaine[0] + ": " + str(float(chaine[1]) * float(uniteM))+" "+uniteMs+"\n")
App.Console.PrintMessage("\n")
co += 1
cco=0
else:
App.Console.PrintMessage("\n")
############### end
App.Console.PrintMessage(u"Plan : XY: " + str(Plan_xy)+uniteAs+" coordinates: " + str(Plan_xy_V)+"\n")
App.Console.PrintMessage(u"Plan : YZ: " + str(Plan_yz)+uniteAs+" coordinates: " + str(Plan_yz_V)+"\n")
App.Console.PrintMessage(u"Plan : ZX: " + str(Plan_zx)+uniteAs+" coordinates: " + str(Plan_zx_V)+"\n\n")
App.Console.PrintMessage(u"The form surface : "+str(surface * uniteS)+" "+uniteSs+"\n")
App.Console.PrintMessage(u"The face surface : "+str(surfaceFace * uniteS)+" "+uniteSs+"\n\n")
App.Console.PrintMessage(u"Volume of the form : "+str(volume_ * uniteV)+" "+uniteVs+"\n")
App.Console.PrintMessage(u"Weight : "+str(poids)+" "+unitePs+" (Density : "+str(densite)+")\n\n")
App.Console.PrintMessage(u"Center of the shape : X: "+str(boundBoxCenterX * uniteM)+" "+uniteMs+" Y: "+str(boundBoxCenterY * uniteM)+" "+uniteMs+" Z: "+str(boundBoxCenterZ * uniteM)+" "+uniteMs+"\n")
App.Console.PrintMessage(u"Center of mass : X: "+str(CenterOfMassX * uniteM)+" "+uniteMs +" Y: "+str(CenterOfMassY * uniteM)+" "+uniteMs +" Z: "+str(CenterOfMassZ * uniteM)+" "+uniteMs+"\n")
App.Console.PrintMessage(u"Overall dimensions : "+boundBox_S+"\n\n")
App.Console.PrintMessage(u"Direction : "+str(directionObj)+"\n")
App.Console.PrintMessage(u"ValueAt : "+str(direcValueAt)+"\n\n")
App.Console.PrintMessage(u"Matrix of inertia : " +uniteMs+"^5" + "\n")
App.Console.PrintMessage(u" : X: "+str(MatrixX1_16)+" Y: "+str(MatrixY1_16)+" Z: "+str(MatrixZ1_16)+" : "+str(Matrix_1)+"\n")
App.Console.PrintMessage(u" : X: "+str(MatrixX2_16)+" Y: "+str(MatrixY2_16)+" Z: "+str(MatrixZ2_16)+" : "+str(Matrix_2)+"\n")
App.Console.PrintMessage(u" : X: "+str(MatrixX3_16)+" Y: "+str(MatrixY3_16)+" Z: "+str(MatrixZ3_16)+" : "+str(Matrix_3)+"\n")
App.Console.PrintMessage(u" : X: "+str(Matrix12)+" Y: "+str(Matrix13)+" Z: "+str(Matrix14)+" : "+str(Matrix15)+"\n\n")
App.Console.PrintMessage(u"Matrix inertia with mass : " +unitePs + uniteSs + "\n")
App.Console.PrintMessage(u" : X: "+str(MatrixX1_17)+" Y: "+str(MatrixY1_17)+" Z: "+str(MatrixZ1_17)+"\n")
App.Console.PrintMessage(u" : X: "+str(MatrixX2_17)+" Y: "+str(MatrixY2_17)+" Z: "+str(MatrixZ2_17)+"\n")
App.Console.PrintMessage(u" : X: "+str(MatrixX3_17)+" Y: "+str(MatrixY3_17)+" Z: "+str(MatrixZ3_17)+"\n\n")
App.Console.PrintMessage(u"Determinant : " + str(DeterminantM)+"\n")
App.Console.PrintMessage(u"Determinant decimal : " + str(decimal.Decimal(DeterminantM))+"\n")
App.Console.PrintMessage(u"End_"+str(element_)+ "____________________________________________________________"+"\n")
####################################
class Ui_MainWindow(object):
def setupUi(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 rayonObjet
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 directionObj
global direcValueAt
global uniteAs
global boundBoxCenterX
global boundBoxCenterY
global boundBoxCenterZ
global CenterOfMassX
global CenterOfMassY
global CenterOfMassZ
global boundBoxLX
global boundBoxLY
global boundBoxLZ
global boundBoxDiag
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 DeterminantM
global compt_E
global compt_F
global compt_VF
global placement_
global RowCount
global RowCountTest
global path
global switchInertia ; switchInertia = 0
global switchClipBoard
global switchPoint
global switchAxis
global switchPlane
global InfoReportView
self.window = MainWindow
#################################
if testing == 1:
MainWindow.setObjectName(_fromUtf8("MainWindow")) # volant
MainWindow.resize(380, 590)
MainWindow.setMinimumSize(QtCore.QSize(380, 590))
#MainWindow.setMaximumSize(QtCore.QSize(380, 590))
# MainWindow.move(1300, 120) # deplace la fenetre
##################################
self.centralWidget = QtGui.QWidget(MainWindow)
#self.centralWidget.setMinimumSize(QtCore.QSize(500, 500))
self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
grid = QtGui.QGridLayout()
self.centralWidget.setLayout(grid)
self.scrollArea = QtGui.QScrollArea(self.centralWidget) # cadre scrollarea contenant le widget GUI
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
grid.addWidget(self.scrollArea, 0, 0)
vbox = QtGui.QVBoxLayout()
self.scrollArea.setLayout(vbox)
self.scrollAreaWidgetContents_2 = QtGui.QWidget() #widget contenant le GUI
self.scrollAreaWidgetContents_2.setObjectName(_fromUtf8("scrollAreaWidgetContents_2"))
vbox.addWidget(self.scrollAreaWidgetContents_2)
sel = FreeCADGui.Selection.getSelection()
if len(sel)==0:
App.Console.PrintMessage(u"Select an object"+"\n")
errorDialog(u"Select an object")
else:
affect(0)
###################################################
# # Placement
# placement_ = sel[0].Shape.Placement
# p = Gui.Selection.getSelectionEx()[0].SubObjects[0].Placement # donne aussi pitch ...
# App.Console.PrintMessage(placement_+"\n")
###################################################
vbox = QtGui.QVBoxLayout()
self.scrollAreaWidgetContents_2.setLayout(vbox)
grid = QtGui.QGridLayout()
self.GBox_001_Document = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_001_Document.setObjectName(_fromUtf8("GBox_001_Document"))
self.GBox_001_Document.setLayout(grid)
vbox.addWidget(self.GBox_001_Document)
self.label_1 = QtGui.QLabel(self.GBox_001_Document)
self.label_1.setObjectName(_fromUtf8("label_1"))
self.lineEdit_1 = QtGui.QLineEdit(self.GBox_001_Document)
self.lineEdit_1.setObjectName(_fromUtf8("lineEdit_1"))
self.lineEdit_1.setText(document_)
self.lineEdit_1.setToolTip(u"Name of the active document.")
grid.addWidget(self.label_1, 0, 0)
grid.addWidget(self.lineEdit_1, 0, 1, 1, 3)
self.label_2 = QtGui.QLabel(self.GBox_001_Document)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.lineEdit_2 = QtGui.QLineEdit(self.GBox_001_Document)
self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))
self.lineEdit_2.setText(object_Label)
self.lineEdit_2.setToolTip(u"Label of the selected object.")
self.lineEdit_2a = QtGui.QLineEdit(self.GBox_001_Document)
self.lineEdit_2a.setObjectName(_fromUtf8("lineEdit_2a"))
self.lineEdit_2a.setText(object_Name)
self.lineEdit_2a.setToolTip(u"Internal name.")
grid.addWidget(self.label_2, 1, 0)
grid.addWidget(self.lineEdit_2, 1, 1)
grid.addWidget(self.lineEdit_2a, 1, 2)
self.label_3 = QtGui.QLabel(self.GBox_001_Document)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.lineEdit_3 = QtGui.QLineEdit(self.GBox_001_Document)
self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3"))
self.lineEdit_3.setText(str(element_))
self.lineEdit_3.setToolTip(u"Name of the selected SubObject.")
self.lineEdit_3a = QtGui.QLineEdit(self.GBox_001_Document)
self.lineEdit_3a.setObjectName(_fromUtf8("lineEdit_3"))
self.lineEdit_3a.setText(str(typeObject))
self.lineEdit_3a.setToolTip(u"Type of the selected object.")
grid.addWidget(self.label_3, 2, 0)
grid.addWidget(self.lineEdit_3, 2, 1)
grid.addWidget(self.lineEdit_3a, 2, 2)
grid = QtGui.QGridLayout()
self.GBox_002_Coordinate_Mouse = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_002_Coordinate_Mouse.setObjectName(_fromUtf8("GBox_002_Coordinate_Mouse"))
self.GBox_002_Coordinate_Mouse.setLayout(grid)
vbox.addWidget(self.GBox_002_Coordinate_Mouse)
self.label_4x = QtGui.QLabel(self.GBox_002_Coordinate_Mouse)
self.label_4x.setStyleSheet("color : #ff0000")
self.label_4x.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold)) #
self.label_4x.setObjectName(_fromUtf8("label_4x"))
self.label_4y = QtGui.QLabel(self.GBox_002_Coordinate_Mouse)
self.label_4y.setStyleSheet("color : #008500")
self.label_4y.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold)) #
self.label_4y.setObjectName(_fromUtf8("label_4y"))
self.label_4z = QtGui.QLabel(self.GBox_002_Coordinate_Mouse)
self.label_4z.setStyleSheet("color : #0000ff")
self.label_4z.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold)) #
self.label_4z.setObjectName(_fromUtf8("label_4z"))
self.lineEdit_4x = QtGui.QLineEdit(self.GBox_002_Coordinate_Mouse)
self.lineEdit_4x.setObjectName(_fromUtf8("lineEdit_4x"))
self.lineEdit_4x.setText(str(position0))
self.lineEdit_4x.setToolTip(u"X coordinate of the click of the mouse.")
self.lineEdit_4y = QtGui.QLineEdit(self.GBox_002_Coordinate_Mouse)
self.lineEdit_4y.setObjectName(_fromUtf8("lineEdit_4y"))
self.lineEdit_4y.setText(str(position1))
self.lineEdit_4y.setToolTip(u"Y coordinate of the click of the mouse.")
self.lineEdit_4z = QtGui.QLineEdit(self.GBox_002_Coordinate_Mouse)
self.lineEdit_4z.setObjectName(_fromUtf8("lineEdit_4z"))
self.lineEdit_4z.setText(str(position2))
self.lineEdit_4z.setToolTip(u"Z coordinate of the click of the mouse.")
grid.addWidget(self.label_4x, 0, 0)
grid.addWidget(self.lineEdit_4x, 1, 0)
grid.addWidget(self.label_4y, 0, 1)
grid.addWidget(self.lineEdit_4y, 1, 1)
grid.addWidget(self.label_4z, 0, 2)
grid.addWidget(self.lineEdit_4z, 1, 2)
self.pushButton_Axis_01 = QtGui.QPushButton(self.GBox_002_Coordinate_Mouse)
self.pushButton_Axis_01.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_01.setObjectName(_fromUtf8("pushButton_Axis_01"))
self.pushButton_Axis_01.clicked.connect(self.on_pushButton_Axis_Mouse) #connection pushButton_Axis
self.pushButton_Axis_01.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"Mouse coordinates" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_01, 1, 4)
grid = QtGui.QGridLayout()
self.GBox_003_Value = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_003_Value.setObjectName(_fromUtf8("GBox_003_Value"))
self.GBox_003_Value.setLayout(grid)
vbox.addWidget(self.GBox_003_Value)
self.comboBox = QtGui.QComboBox(self.GBox_003_Value)
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(u"Selects a unit of length.")
QtCore.QObject.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.SIGNAL_comboBox_Changed)
grid.addWidget(self.comboBox, 1, 0)
self.label_5 = QtGui.QLabel(self.GBox_003_Value)
self.label_5.setObjectName(_fromUtf8("label_5"))
grid.addWidget(self.label_5, 0, 1)
self.label_5b = QtGui.QLabel(self.GBox_003_Value)
self.label_5b.setObjectName(_fromUtf8("label_5b"))
grid.addWidget(self.label_5b, 2, 0)
self.lineEdit_5 = QtGui.QLineEdit(self.GBox_003_Value)
self.lineEdit_5.setObjectName(_fromUtf8("lineEdit_5"))
self.lineEdit_5.setText(str(longueurObjet))
self.lineEdit_5.setToolTip(u"Length of the object." + "\n"
u"If one side is selected the perimeter of the face will be displayed.")
grid.addWidget(self.lineEdit_5, 1, 1)
self.lineEdit_5b = QtGui.QLineEdit(self.GBox_003_Value)
self.lineEdit_5b.setObjectName(_fromUtf8("lineEdit_5b"))
self.lineEdit_5b.setText(str(rayonObjet))
self.lineEdit_5b.setToolTip(u"Radius detected.")
if rayonObjet != 0:
self.label_5b.setVisible(True)
self.lineEdit_5b.setVisible(True)
else:
self.label_5b.setVisible(False)
self.lineEdit_5b.setVisible(False)
rayonObjet = 0.0
grid.addWidget(self.lineEdit_5b, 2, 1)
self.label_6 = QtGui.QLabel(self.GBox_003_Value)
self.label_6.setObjectName(_fromUtf8("label_6"))
grid.addWidget(self.label_6, 3, 0)
self.lineEdit_6 = QtGui.QLineEdit(self.GBox_003_Value)
self.lineEdit_6.setObjectName(_fromUtf8("lineEdit_6"))
self.lineEdit_6.setText(str(perimetre))
self.lineEdit_6.setToolTip(u"Total perimeter of the shape." + "\n"
u"Display the total Edge sum of the shape")
grid.addWidget(self.lineEdit_6, 3, 1)
grid = QtGui.QGridLayout()
self.GBox_004_SpreadSheet = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_004_SpreadSheet.setCheckable(True)
self.GBox_004_SpreadSheet.setChecked(False)
self.GBox_004_SpreadSheet.setStyleSheet("color : #ff0000")
self.GBox_004_SpreadSheet.setObjectName(_fromUtf8("GBox_004_SpreadSheet"))
self.GBox_004_SpreadSheet.clicked.connect(self.on_GBox_004_SpreadSheet)
self.GBox_004_SpreadSheet.setLayout(grid)
vbox.addWidget(self.GBox_004_SpreadSheet)
self.tableWidget = QtGui.QTableWidget(self.GBox_004_SpreadSheet)
self.tableWidget.setIconSize(QtCore.QSize(15, 15))
self.tableWidget.setRowCount(RowCount)
self.tableWidget.setColumnCount(8) # number of columns
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(u"Details of the form :" + "\n"
u"If the checkBox is checked, a complete scan of the selected form is done" + "\n"
u"(Using this option may take a long time for a large object" + "\n"
u"a full scan is done with each mouse click (Unchecked by default coloured re))" + "\n" + "\n"
u"If not checked the principal data are displayed" + "\n" + "\n"
u"Vertexes and details : (Edges) (Faces) (Vertex Faces) ...(Total)" + "\n"
u"Scoreboard only the first 200 details of the form are displayed." + "\n"
u"All the elements will be visible in the file after saving it.")
grid.addWidget(self.tableWidget, 0, 0, 4, 4)
grid = QtGui.QGridLayout()
self.GBox_005_Inclination = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_005_Inclination.setObjectName(_fromUtf8("GBox_005_Inclination"))
self.GBox_005_Inclination.setToolTip(u"Inclination compared XY, YZ, XZ")
self.GBox_005_Inclination.setLayout(grid)
vbox.addWidget(self.GBox_005_Inclination)
self.label_8a = QtGui.QLabel(self.GBox_005_Inclination)
self.label_8a.setObjectName(_fromUtf8("label_8a"))
grid.addWidget(self.label_8a, 0, 0)
self.pushButton_Ra = QtGui.QPushButton(self.GBox_005_Inclination)
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(u"Toggles between decimal degrees, degrees minutes second" + "\n"
u"Radian, Grade, Percent.")
grid.addWidget(self.pushButton_Ra, 0, 0)
self.label_8a_2 = QtGui.QLabel(self.GBox_005_Inclination)
self.label_8a_2.setObjectName(_fromUtf8("label_8a"))
grid.addWidget(self.label_8a_2, 0, 1, 1, 3)
self.label_8xy = QtGui.QLabel(self.GBox_005_Inclination)
self.label_8xy.setStyleSheet("color : #ff0000")
self.label_8xy.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold)) #
self.label_8xy.setObjectName(_fromUtf8("label_8xy"))
grid.addWidget(self.label_8xy, 1, 0)
self.lineEdit_8xy = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_8xy.setObjectName(_fromUtf8("lineEdit_8xy"))
self.lineEdit_8xy.setText(str(Plan_xy)+uniteAs)
self.lineEdit_8xy.setToolTip(u"Angle in the XY plane.")
grid.addWidget(self.lineEdit_8xy, 1, 1)
self.lineEdit_8xya = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_8xya.setObjectName(_fromUtf8("lineEdit_8xya"))
self.lineEdit_8xya.setText(str(Plan_xy_V))
grid.addWidget(self.lineEdit_8xya, 1, 2)
self.label_8yz = QtGui.QLabel(self.GBox_005_Inclination)
self.label_8yz.setStyleSheet("color : #008500")
self.label_8yz.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold)) #
self.label_8yz.setObjectName(_fromUtf8("label_8yz"))
grid.addWidget(self.label_8yz, 2, 0)
self.lineEdit_8yz = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_8yz.setObjectName(_fromUtf8("lineEdit_8yz"))
self.lineEdit_8yz.setText(str(Plan_yz)+uniteAs)
self.lineEdit_8yz.setToolTip(u"Angle in the YZ plane.")
grid.addWidget(self.lineEdit_8yz, 2, 1)
self.lineEdit_8yza = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_8yza.setObjectName(_fromUtf8("lineEdit_8yza"))
self.lineEdit_8yza.setText(str(Plan_yz_V))
grid.addWidget(self.lineEdit_8yza, 2, 2)
self.label_8zx = QtGui.QLabel(self.GBox_005_Inclination)
self.label_8zx.setStyleSheet("color : #0000ff")
self.label_8zx.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold)) #
self.label_8zx.setObjectName(_fromUtf8("label_8zx"))
grid.addWidget(self.label_8zx, 3, 0)
self.lineEdit_8zx = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_8zx.setObjectName(_fromUtf8("lineEdit_8zx"))
self.lineEdit_8zx.setText(str(Plan_zx)+uniteAs)
self.lineEdit_8zx.setToolTip(u"Angle in the ZX plane.")
grid.addWidget(self.lineEdit_8zx, 3, 1)
self.lineEdit_8zxa = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_8zxa.setObjectName(_fromUtf8("lineEdit_8zxa"))
self.lineEdit_8zxa.setText(str(Plan_zx_V))
grid.addWidget(self.lineEdit_8zxa, 3, 2)
self.label_9_Direction = QtGui.QLabel(self.GBox_005_Inclination)
self.label_9_Direction.setObjectName(_fromUtf8("label_9_Direction"))
grid.addWidget(self.label_9_Direction, 4, 0)
self.pushButton_Line_01 = QtGui.QPushButton(self.GBox_005_Inclination)
self.pushButton_Line_01.setObjectName(_fromUtf8("pushButton_Line_01"))
self.pushButton_Line_01.clicked.connect(self.on_pushButton_Line_01) #connection pushButton_Line_01
self.pushButton_Line_01.setToolTip(u"Create line in direction displayed" + "\n" +
u"0.0, 0.0, 0.0 to ")
grid.addWidget(self.pushButton_Line_01, 4, 1)
self.lineEdit_9_Direction = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_9_Direction.setObjectName(_fromUtf8("lineEdit_9_Direction"))
self.lineEdit_9_Direction.setText(str(directionObj))
self.lineEdit_9_Direction.setToolTip(u"Direction of object" + "\n")
grid.addWidget(self.lineEdit_9_Direction, 4, 2)
self.label_10_ValueAt = QtGui.QLabel(self.GBox_005_Inclination)
self.label_10_ValueAt.setObjectName(_fromUtf8("label_10_ValueAt"))
grid.addWidget(self.label_10_ValueAt, 6, 0)
self.lineEdit_10_ValueAt = QtGui.QLineEdit(self.GBox_005_Inclination)
self.lineEdit_10_ValueAt.setToolTip(u"Returns the 3D vector corresponding to a parameter value. ")
self.lineEdit_10_ValueAt.setObjectName(_fromUtf8("lineEdit_10_ValueAt"))
self.lineEdit_10_ValueAt.setText(str(direcValueAt))
grid.addWidget(self.lineEdit_10_ValueAt, 6, 1, 1, 2)
#####
grid = QtGui.QGridLayout()
self.GBox_006_Surface_and_Volume = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_006_Surface_and_Volume.setObjectName(_fromUtf8("GBox_006_Surface_and_Volume"))
self.GBox_006_Surface_and_Volume.setLayout(grid)
vbox.addWidget(self.GBox_006_Surface_and_Volume)
self.label_9 = QtGui.QLabel(self.GBox_006_Surface_and_Volume)
self.label_9.setObjectName(_fromUtf8("label_9"))
grid.addWidget(self.label_9, 0, 0)
self.lineEdit_9a = QtGui.QLineEdit(self.GBox_006_Surface_and_Volume)
self.lineEdit_9a.setObjectName(_fromUtf8("lineEdit_9a"))
self.lineEdit_9a.setText(str(surface))
self.lineEdit_9a.setToolTip(u"Total area of the form.")
grid.addWidget(self.lineEdit_9a, 0, 1)
self.label_10 = QtGui.QLabel(self.GBox_006_Surface_and_Volume)
self.label_10.setObjectName(_fromUtf8("label_10"))
grid.addWidget(self.label_10, 1, 0)
self.lineEdit_10a = QtGui.QLineEdit(self.GBox_006_Surface_and_Volume)
self.lineEdit_10a.setObjectName(_fromUtf8("lineEdit_10a"))
self.lineEdit_10a.setText(str(surfaceFace))
self.lineEdit_10a.setToolTip(u"Surface of the face.")
grid.addWidget(self.lineEdit_10a, 1, 1)
self.label_11 = QtGui.QLabel(self.GBox_006_Surface_and_Volume)
self.label_11.setObjectName(_fromUtf8("label_11"))
grid.addWidget(self.label_11, 2, 0)
self.lineEdit_11a = QtGui.QLineEdit(self.GBox_006_Surface_and_Volume)
self.lineEdit_11a.setObjectName(_fromUtf8("lineEdit_11a"))
self.lineEdit_11a.setText(str(volume_))
self.lineEdit_11a.setToolTip(u"Total volume of the form.")
grid.addWidget(self.lineEdit_11a, 2, 1)
self.label_Unit = QtGui.QLabel(self.GBox_006_Surface_and_Volume)
self.label_Unit.setObjectName(_fromUtf8("label_Unit"))
grid.addWidget(self.label_Unit, 3, 0)
self.comboBox2 = QtGui.QComboBox(self.GBox_006_Surface_and_Volume)
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(u"Select a unit of mass.")
QtCore.QObject.connect(self.comboBox2, QtCore.SIGNAL("currentIndexChanged(QString)"), self.SIGNAL_comboPoids_Changed)
grid.addWidget(self.comboBox2, 3, 1)
self.label_Weight = QtGui.QLabel(self.GBox_006_Surface_and_Volume)
self.label_Weight.setObjectName(_fromUtf8("label_Weight"))
grid.addWidget(self.label_Weight, 4, 0)
self.lineEdit_12a = QtGui.QLineEdit(self.GBox_006_Surface_and_Volume)
self.lineEdit_12a.setObjectName(_fromUtf8("lineEdit_12a"))
self.lineEdit_12a.setText(str(poids)+" "+unitePs)
self.lineEdit_12a.setToolTip(u"Weight of the form in the selected unit.")
grid.addWidget(self.lineEdit_12a, 4, 1)
self.label_Density = QtGui.QLabel(self.GBox_006_Surface_and_Volume)
self.label_Density.setObjectName(_fromUtf8("label_Unit"))
grid.addWidget(self.label_Density, 5, 0)
self.doubleSpinBox = QtGui.QDoubleSpinBox(self.GBox_006_Surface_and_Volume)
self.doubleSpinBox.setDecimals(3)
self.doubleSpinBox.setSingleStep(0.01)
self.doubleSpinBox.setProperty("value", densite)
self.doubleSpinBox.setObjectName(_fromUtf8("doubleSpinBox"))
self.doubleSpinBox.setToolTip(u"Select the volume density in Kg by dm3.")
self.doubleSpinBox.valueChanged.connect(self.on_doubleSpinBox_valueChanged) #connection doubleSpinBox
grid.addWidget(self.doubleSpinBox, 5, 1)
#####
grid = QtGui.QGridLayout()
self.GBox_007_BoundBox = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_007_BoundBox.setObjectName(_fromUtf8("GBox_007_BoundBox"))
self.GBox_007_BoundBox.setLayout(grid)
vbox.addWidget(self.GBox_007_BoundBox)
self.LA_007_01_Xlength = QtGui.QLabel(self.GBox_007_BoundBox)
self.LA_007_01_Xlength.setObjectName(_fromUtf8("LA_007_01_Xlength"))
grid.addWidget(self.LA_007_01_Xlength, 0, 0)
self.LA_007_02_Ylength = QtGui.QLabel(self.GBox_007_BoundBox)
self.LA_007_02_Ylength.setObjectName(_fromUtf8("LA_007_02_Ylength"))
grid.addWidget(self.LA_007_02_Ylength, 0, 1)
self.LA_007_03_Zlength = QtGui.QLabel(self.GBox_007_BoundBox)
self.LA_007_03_Zlength.setObjectName(_fromUtf8("LA_007_03_Zlength"))
grid.addWidget(self.LA_007_03_Zlength, 0, 2)
self.LA_007_04_Diagonallength = QtGui.QLabel(self.GBox_007_BoundBox)
self.LA_007_04_Diagonallength.setObjectName(_fromUtf8("LA_007_04_Diagonallength"))
grid.addWidget(self.LA_007_04_Diagonallength, 0, 3)
self.LE_007_BB_01_XLength = QtGui.QLineEdit(self.GBox_007_BoundBox)
self.LE_007_BB_01_XLength.setObjectName(_fromUtf8("LE_007_BB_01_XLength"))
self.LE_007_BB_01_XLength.setText(str(boundBoxLX))
self.LE_007_BB_01_XLength.setToolTip(u"Dimensions of the form:" + "\n"
u"Direction X")
grid.addWidget(self.LE_007_BB_01_XLength, 1, 0)
self.LE_007_BB_02_YLength = QtGui.QLineEdit(self.GBox_007_BoundBox)
self.LE_007_BB_02_YLength.setObjectName(_fromUtf8("LE_007_BB_02_YLength"))
self.LE_007_BB_02_YLength.setText(str(boundBoxLY))
self.LE_007_BB_02_YLength.setToolTip(u"Dimensions of the form:" + "\n"
u"Direction Y")
grid.addWidget(self.LE_007_BB_02_YLength, 1, 1)
self.LE_007_BB_03_ZLength = QtGui.QLineEdit(self.GBox_007_BoundBox)
self.LE_007_BB_03_ZLength.setObjectName(_fromUtf8("LE_007_BB_03_ZLength"))
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ))
self.LE_007_BB_03_ZLength.setToolTip(u"Dimensions of the form:" + "\n"
u"Direction Z")
grid.addWidget(self.LE_007_BB_03_ZLength, 1, 2)
self.LE_007_BB_04_Diagonal = QtGui.QLineEdit(self.GBox_007_BoundBox)
self.LE_007_BB_04_Diagonal.setObjectName(_fromUtf8("LE_007_BB_04_Diagonal"))
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag))
self.LE_007_BB_04_Diagonal.setToolTip("Dimensions diagonal boundBox of the form.")
grid.addWidget(self.LE_007_BB_04_Diagonal, 1, 3)
#####
grid = QtGui.QGridLayout()
self.GBox_008_Center = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_008_Center.setObjectName(_fromUtf8("GBox_008_Center"))
self.GBox_008_Center.setLayout(grid)
vbox.addWidget(self.GBox_008_Center)
self.label_13 = QtGui.QLabel(self.GBox_008_Center)
self.label_13.setObjectName(_fromUtf8("label_13"))
grid.addWidget(self.label_13, 0, 0, 1, 4)
self.label_13x = QtGui.QLabel(self.GBox_008_Center)
self.label_13x.setStyleSheet("color : #ff0000")
self.label_13x.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_13x.setObjectName(_fromUtf8("label_13x"))
grid.addWidget(self.label_13x, 1, 0)
self.label_13y = QtGui.QLabel(self.GBox_008_Center)
self.label_13y.setStyleSheet("color : #008500")
self.label_13y.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_13y.setObjectName(_fromUtf8("label_13y"))
grid.addWidget(self.label_13y, 1, 1)
self.label_13z = QtGui.QLabel(self.GBox_008_Center)
self.label_13z.setStyleSheet("color : #0000ff")
self.label_13z.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_13z.setObjectName(_fromUtf8("label_13z"))
grid.addWidget(self.label_13z, 1, 2)
self.lineEdit_13x = QtGui.QLineEdit(self.GBox_008_Center)
self.lineEdit_13x.setObjectName(_fromUtf8("lineEdit_13x"))
self.lineEdit_13x.setText(str(boundBoxCenterX))
self.lineEdit_13x.setToolTip(u"X coordinate of the center of the shape.")
grid.addWidget(self.lineEdit_13x, 2, 0)
self.lineEdit_13y = QtGui.QLineEdit(self.GBox_008_Center)
self.lineEdit_13y.setObjectName(_fromUtf8("lineEdit_13y"))
self.lineEdit_13y.setText(str(boundBoxCenterY))
self.lineEdit_13y.setToolTip(u"Y coordinate of the center of the shape.")
grid.addWidget(self.lineEdit_13y, 2, 1)
self.lineEdit_13z = QtGui.QLineEdit(self.GBox_008_Center)
self.lineEdit_13z.setObjectName(_fromUtf8("lineEdit_13z"))
self.lineEdit_13z.setText(str(boundBoxCenterZ))
self.lineEdit_13z.setToolTip(u"Z coordinate of the center of the shape.")
grid.addWidget(self.lineEdit_13z, 2, 2)
self.pushButton_Axis_02 = QtGui.QPushButton(self.GBox_008_Center)
self.pushButton_Axis_02.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_02.setObjectName(_fromUtf8("pushButton_Axis_02"))
self.pushButton_Axis_02.clicked.connect(self.on_pushButton_Axis_Center_Shape) #connection pushButton_Axis
self.pushButton_Axis_02.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"Center Shape" + "\n" +
u"In clipBoard the coordinates form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_02, 2, 3)
self.label_14 = QtGui.QLabel(self.GBox_008_Center)
self.label_14.setObjectName(_fromUtf8("label_14"))
grid.addWidget(self.label_14, 3, 0, 1, 4)
self.label_14x = QtGui.QLabel(self.GBox_008_Center)
self.label_14x.setStyleSheet("color : #ff0000")
self.label_14x.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_14x.setObjectName(_fromUtf8("label_14x"))
grid.addWidget(self.label_14x, 4, 0)
self.label_14y = QtGui.QLabel(self.GBox_008_Center)
self.label_14y.setStyleSheet("color : #008500")
self.label_14y.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_14y.setObjectName(_fromUtf8("label_14y"))
grid.addWidget(self.label_14y, 4, 1)
self.label_14z = QtGui.QLabel(self.GBox_008_Center)
self.label_14z.setStyleSheet("color : #0000ff")
self.label_14z.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_14z.setObjectName(_fromUtf8("label_14z"))
grid.addWidget(self.label_14z, 4, 2)
self.lineEdit_14x = QtGui.QLineEdit(self.GBox_008_Center)
self.lineEdit_14x.setObjectName(_fromUtf8("lineEdit_14x"))
self.lineEdit_14x.setText(str(CenterOfMassX))
self.lineEdit_14x.setToolTip(u"X coordinate of the center of mass")
grid.addWidget(self.lineEdit_14x, 5, 0)
self.lineEdit_14y = QtGui.QLineEdit(self.GBox_008_Center)
self.lineEdit_14y.setObjectName(_fromUtf8("lineEdit_14y"))
self.lineEdit_14y.setText(str(CenterOfMassY))
self.lineEdit_14y.setToolTip("Y coordinate of the center of mass")
grid.addWidget(self.lineEdit_14y, 5, 1)
self.lineEdit_14z = QtGui.QLineEdit(self.GBox_008_Center)
self.lineEdit_14z.setObjectName(_fromUtf8("lineEdit_14z"))
self.lineEdit_14z.setText(str(CenterOfMassZ))
self.lineEdit_14z.setToolTip("Z coordinate of the center of mass")
grid.addWidget(self.lineEdit_14z, 5, 2)
self.pushButton_Axis_03 = QtGui.QPushButton(self.GBox_008_Center)
self.pushButton_Axis_03.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_03.setObjectName(_fromUtf8("pushButton_Axis_03"))
self.pushButton_Axis_03.clicked.connect(self.on_pushButton_Axis_Center_Mass) #connection pushButton_Axis
self.pushButton_Axis_03.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"Center of Mass" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_03, 5, 3)
#####
grid = QtGui.QGridLayout()
self.GBox_009_Inertia = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GBox_009_Inertia.setObjectName(_fromUtf8("GBox_009_Inertia"))
self.GBox_009_Inertia.setToolTip(u"The moment of inertia, otherwise known as the angular mass or" + "\n"
u"rotational inertia, of a rigid body is a tensor that determines" + "\n"
u"the torque needed for a desired angular acceleration about a rotational axis." + "\n"
u"It depends on the body's mass distribution and the axis chosen," + "\n"
u"with larger moments requiring more torque to change the body's rotation." + "\n"
u"see https://en.wikipedia.org/wiki/Moment_of_inertia")
self.GBox_009_Inertia.setLayout(grid)
vbox.addWidget(self.GBox_009_Inertia)
self.label_16 = QtGui.QLabel(self.GBox_009_Inertia)
self.label_16.setObjectName(_fromUtf8("label_16"))
grid.addWidget(self.label_16, 0, 0, 1, 3)
self.lineEdit_16_M = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_M.setAlignment(QtCore.Qt.AlignCenter)
self.lineEdit_16_M.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.lineEdit_16_M.setObjectName(_fromUtf8("lineEdit_16_M"))
self.lineEdit_16_M.setText(uniteMs + "^5")
grid.addWidget(self.lineEdit_16_M, 0, 3, 1, 2)
self.label_16x = QtGui.QLabel(self.GBox_009_Inertia)
self.label_16x.setStyleSheet("color : #ff0000")
self.label_16x.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_16x.setObjectName(_fromUtf8("label_16x"))
grid.addWidget(self.label_16x, 1, 0)
self.label_16y = QtGui.QLabel(self.GBox_009_Inertia)
self.label_16y.setStyleSheet("color : #008500")
self.label_16y.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_16y.setObjectName(_fromUtf8("label_16y"))
grid.addWidget(self.label_16y, 1, 1)
self.label_16z = QtGui.QLabel(self.GBox_009_Inertia)
self.label_16z.setStyleSheet("color : #0000ff")
self.label_16z.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_16z.setObjectName(_fromUtf8("label_16z"))
grid.addWidget(self.label_16z, 1, 2)
self.lineEdit_16_1x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_1x.setObjectName(_fromUtf8("lineEdit_16_1x"))
self.lineEdit_16_1x.setText(str(MatrixX1))
grid.addWidget(self.lineEdit_16_1x, 2, 0)
self.lineEdit_16_1y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_1y.setObjectName(_fromUtf8("lineEdit_16_1y"))
self.lineEdit_16_1y.setText(str(MatrixY1))
grid.addWidget(self.lineEdit_16_1y, 2, 1)
self.lineEdit_16_1z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_1z.setObjectName(_fromUtf8("lineEdit_16_1z"))
self.lineEdit_16_1z.setText(str(MatrixZ1))
grid.addWidget(self.lineEdit_16_1z, 2, 2)
self.lineEdit_16_01 = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_01.setEnabled(False)
self.lineEdit_16_01.setObjectName(_fromUtf8("lineEdit_16_01"))
self.lineEdit_16_01.setText(str(Matrix_1))
grid.addWidget(self.lineEdit_16_01, 2, 3)
self.pushButton_Axis_04_16_1 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_04_16_1.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_04_16_1.setObjectName(_fromUtf8("pushButton_Axis_04_16_1"))
self.pushButton_Axis_04_16_1.clicked.connect(self.on_pushButton_Axis_04_16_1) #connection pushButton_Axis
self.pushButton_Axis_04_16_1.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X1 ,Y1 ,Z1" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_04_16_1, 2, 4)
self.lineEdit_16_2x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_2x.setObjectName(_fromUtf8("lineEdit_16_2x"))
self.lineEdit_16_2x.setText(str(MatrixX2))
grid.addWidget(self.lineEdit_16_2x, 3, 0)
self.lineEdit_16_2y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_2y.setObjectName(_fromUtf8("lineEdit_16_2y"))
self.lineEdit_16_2y.setText(str(MatrixY2))
grid.addWidget(self.lineEdit_16_2y, 3, 1)
self.lineEdit_16_2z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_2z.setObjectName(_fromUtf8("lineEdit_16_2z"))
self.lineEdit_16_2z.setText(str(MatrixZ2))
grid.addWidget(self.lineEdit_16_2z, 3, 2)
self.lineEdit_16_02 = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_02.setEnabled(False)
self.lineEdit_16_02.setObjectName(_fromUtf8("lineEdit_16_02"))
self.lineEdit_16_02.setText(str(Matrix_2))
grid.addWidget(self.lineEdit_16_02, 3, 3)
self.pushButton_Axis_05_16_2 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_05_16_2.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_05_16_2.setObjectName(_fromUtf8("pushButton_Axis_05_16_2"))
self.pushButton_Axis_05_16_2.clicked.connect(self.on_pushButton_Axis_05_16_2) #connection pushButton_Axis
self.pushButton_Axis_05_16_2.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X2 ,Y2 ,Z2" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_05_16_2, 3, 4)
self.lineEdit_16_3x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_3x.setObjectName(_fromUtf8("lineEdit_16_3x"))
self.lineEdit_16_3x.setText(str(MatrixX3))
grid.addWidget(self.lineEdit_16_3x, 4, 0)
self.lineEdit_16_3y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_3y.setObjectName(_fromUtf8("lineEdit_16_3y"))
self.lineEdit_16_3y.setText(str(MatrixY3))
grid.addWidget(self.lineEdit_16_3y, 4, 1)
self.lineEdit_16_3z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_3z.setObjectName(_fromUtf8("lineEdit_16_3z"))
self.lineEdit_16_3z.setText(str(MatrixZ3))
grid.addWidget(self.lineEdit_16_3z, 4, 2)
self.lineEdit_16_03 = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_03.setEnabled(False)
self.lineEdit_16_03.setObjectName(_fromUtf8("lineEdit_16_03"))
self.lineEdit_16_03.setText(str(Matrix_3))
grid.addWidget(self.lineEdit_16_03, 4, 3)
self.pushButton_Axis_06_16_3 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_06_16_3.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_06_16_3.setObjectName(_fromUtf8("pushButton_Axis_06_16_3"))
self.pushButton_Axis_06_16_3.clicked.connect(self.on_pushButton_Axis_06_16_3) #connection pushButton_Axis
self.pushButton_Axis_06_16_3.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X3 ,Y3 ,Z3" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_06_16_3, 4, 4)
self.lineEdit_16_4x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_4x.setEnabled(False)
self.lineEdit_16_4x.setObjectName(_fromUtf8("lineEdit_16_4x"))
self.lineEdit_16_4x.setText(str(Matrix12))
grid.addWidget(self.lineEdit_16_4x, 5, 0)
self.lineEdit_16_4y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_4y.setEnabled(False)
self.lineEdit_16_4y.setObjectName(_fromUtf8("lineEdit_16_4y"))
self.lineEdit_16_4y.setText(str(Matrix13))
grid.addWidget(self.lineEdit_16_4y, 5, 1)
self.lineEdit_16_4z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_4z.setEnabled(False)
self.lineEdit_16_4z.setObjectName(_fromUtf8("lineEdit_16_4z"))
self.lineEdit_16_4z.setText(str(Matrix14))
grid.addWidget(self.lineEdit_16_4z, 5, 2)
self.lineEdit_16_04 = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_16_04.setEnabled(False)
self.lineEdit_16_04.setObjectName(_fromUtf8("lineEdit_16_04"))
self.lineEdit_16_04.setText(str(Matrix15))
grid.addWidget(self.lineEdit_16_04, 5, 3)
self.pushButton_Axis_07_16_4 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_07_16_4.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_07_16_4.setObjectName(_fromUtf8("pushButton_Axis_07_16_4"))
self.pushButton_Axis_07_16_4.clicked.connect(self.on_pushButton_Axis_07_16_4) #connection pushButton_Axis
self.pushButton_Axis_07_16_4.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X1 ,Y2 ,Z3" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_07_16_4, 5, 4)
self.label_17 = QtGui.QLabel(self.GBox_009_Inertia)
self.label_17.setObjectName(_fromUtf8("label_17"))
grid.addWidget(self.label_17, 6, 0, 1, 3)
self.lineEdit_17_M = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_M.setAlignment(QtCore.Qt.AlignCenter)
self.lineEdit_17_M.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.lineEdit_17_M.setObjectName(_fromUtf8("lineEdit_17_M"))
self.lineEdit_17_M.setText(unitePs+uniteSs)
grid.addWidget(self.lineEdit_17_M, 6, 3, 1, 2)
self.label_17x = QtGui.QLabel(self.GBox_009_Inertia)
self.label_17x.setStyleSheet("color : #ff0000")
self.label_17x.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_17x.setObjectName(_fromUtf8("label_17x"))
grid.addWidget(self.label_17x, 7, 0)
self.label_17y = QtGui.QLabel(self.GBox_009_Inertia)
self.label_17y.setStyleSheet("color : #008500")
self.label_17y.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_17y.setObjectName(_fromUtf8("label_17y"))
grid.addWidget(self.label_17y, 7, 1)
self.label_17z = QtGui.QLabel(self.GBox_009_Inertia)
self.label_17z.setStyleSheet("color : #0000ff")
self.label_17z.setFont(QtGui.QFont("",weight=QtGui.QFont.Bold))
self.label_17z.setObjectName(_fromUtf8("label_17z"))
grid.addWidget(self.label_17z, 7, 2)
self.lineEdit_17_1x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_1x.setObjectName(_fromUtf8("lineEdit_17_1x"))
self.lineEdit_17_1x.setText(str(MatrixX1*densite))
grid.addWidget(self.lineEdit_17_1x, 8, 0)
self.lineEdit_17_1y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_1y.setObjectName(_fromUtf8("lineEdit_17_1y"))
self.lineEdit_17_1y.setText(str(MatrixY1*densite*uniteP))
grid.addWidget(self.lineEdit_17_1y, 8, 1)
self.lineEdit_17_1z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_1z.setObjectName(_fromUtf8("lineEdit_17_1z"))
self.lineEdit_17_1z.setText(str(MatrixZ1*densite))
grid.addWidget(self.lineEdit_17_1z, 8, 2)
self.pushButton_Axis_08_17_1 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_08_17_1.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_08_17_1.setObjectName(_fromUtf8("pushButton_Axis_08_17_1"))
self.pushButton_Axis_08_17_1.clicked.connect(self.on_pushButton_Axis_08_17_1) #connection pushButton_Axis
self.pushButton_Axis_08_17_1.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X1 ,Y1 ,Z1" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_08_17_1, 8, 4)
self.lineEdit_17_2x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_2x.setObjectName(_fromUtf8("lineEdit_17_2x"))
self.lineEdit_17_2x.setText(str(MatrixX2*densite))
grid.addWidget(self.lineEdit_17_2x, 9, 0)
self.lineEdit_17_2y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_2y.setObjectName(_fromUtf8("lineEdit_17_2y"))
self.lineEdit_17_2y.setText(str(MatrixY2*densite))
grid.addWidget(self.lineEdit_17_2y, 9, 1)
self.lineEdit_17_2z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_2z.setObjectName(_fromUtf8("lineEdit_17_2z"))
self.lineEdit_17_2z.setText(str(MatrixZ2*densite))
grid.addWidget(self.lineEdit_17_2z, 9, 2)
self.pushButton_Axis_09_17_2 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_09_17_2.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_09_17_2.setObjectName(_fromUtf8("pushButton_Axis_09_17_2"))
self.pushButton_Axis_09_17_2.clicked.connect(self.on_pushButton_Axis_09_17_2) #connection pushButton_Axis
self.pushButton_Axis_09_17_2.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X2 ,Y2 ,Z2" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_09_17_2, 9, 4)
self.lineEdit_17_3x = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_3x.setObjectName(_fromUtf8("lineEdit_17_3x"))
self.lineEdit_17_3x.setText(str(MatrixX3*densite))
grid.addWidget(self.lineEdit_17_3x, 10, 0)
self.lineEdit_17_3y = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_3y.setObjectName(_fromUtf8("lineEdit_17_3y"))
self.lineEdit_17_3y.setText(str(MatrixY3*densite))
grid.addWidget(self.lineEdit_17_3y, 10, 1)
self.lineEdit_17_3z = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_17_3z.setObjectName(_fromUtf8("lineEdit_17_3z"))
self.lineEdit_17_3z.setText(str(MatrixZ3*densite))
grid.addWidget(self.lineEdit_17_3z, 10, 2)
self.pushButton_Axis_10_17_3 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_10_17_3.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_10_17_3.setObjectName(_fromUtf8("pushButton_Axis_10_17_3"))
self.pushButton_Axis_10_17_3.clicked.connect(self.on_pushButton_Axis_10_17_3) #connection pushButton_Axis
self.pushButton_Axis_10_17_3.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X3 ,Y3 ,Z3" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_10_17_3, 10, 4)
self.pushButton_Axis_11_17_4 = QtGui.QPushButton(self.GBox_009_Inertia)
self.pushButton_Axis_11_17_4.setIcon(QtGui.QIcon(path + "Macro_FCInfo_05.png"))
self.pushButton_Axis_11_17_4.setObjectName(_fromUtf8("pushButton_Axis_11_17_4"))
self.pushButton_Axis_11_17_4.clicked.connect(self.on_pushButton_Axis_11_17_4) #connection pushButton_Axis
self.pushButton_Axis_11_17_4.setToolTip(u"Create Point or Axis or Plane or Clipboard" + "\n" +
u"X1 ,Y2 ,Z3" + "\n" +
u"The coordinates are cliped to this form" + "\n" +
u"FreeCAD.Vector(-24.0, 240.0, 7.0)")
grid.addWidget(self.pushButton_Axis_11_17_4, 11, 4)
self.label_determinant = QtGui.QLabel(self.GBox_009_Inertia)
self.label_determinant.setObjectName(_fromUtf8("label_determinant"))
grid.addWidget(self.label_determinant, 12, 0, 1, 2)
self.label_determinantDecimal = QtGui.QLabel(self.GBox_009_Inertia)
self.label_determinantDecimal.setObjectName(_fromUtf8("label_determinantDecimal"))
grid.addWidget(self.label_determinantDecimal, 13, 0, 1, 2)
self.lineEdit_18_determinant = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_18_determinant.setObjectName(_fromUtf8("lineEdit_18_determinant"))
self.lineEdit_18_determinant.setText(str(DeterminantM))
self.lineEdit_18_determinant.setToolTip(u"Determinant of Matrix." + "\n"
u"In linear algebra, the determinant is a useful value that can be computed" + "\n"
u"from the elements of a square matrix." + "\n"
u"The determinant of a matrix A is denoted det(A), det A, or " + chr(124) + "A"+ chr(124)+ "." + "\n"
u"It can be viewed as the scaling factor of the transformation described by the matrix." + "\n"
u"see https://en.wikipedia.org/wiki/Determinant")
grid.addWidget(self.lineEdit_18_determinant, 12, 2, 1, 3)
self.lineEdit_18_determinantDecim = QtGui.QLineEdit(self.GBox_009_Inertia)
self.lineEdit_18_determinantDecim.setObjectName(_fromUtf8("lineEdit_18_determinant"))
self.lineEdit_18_determinantDecim.setText(str(decimal.Decimal(DeterminantM)))
self.lineEdit_18_determinantDecim.setToolTip("Determinant Decimal format.")
grid.addWidget(self.lineEdit_18_determinantDecim, 13, 2, 1, 3)
#options CSV debut
grid = QtGui.QGridLayout()
self.GB_010_SpreadSheet_Disk = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GB_010_SpreadSheet_Disk.setObjectName(_fromUtf8("GB_010_SpreadSheet_Disk"))
self.GB_010_SpreadSheet_Disk.setToolTip(u"Option for save or read the data in spreadSheet" + "\n"
u"with different separator" + "\n"
u"Tabulation, Comma, Semicolon, Space" + "\n"
u"Tabulation are the separator for the FreeCAD spreadSheet module" + "\n"
u"The number of this four separator are calculate for help if unknown" + "\n\n"
u"The COMMA are the old (01.16 and before) separator of the FCInfo macro" + "\n"
u"Now for compatibility with the FreeCAD spreadSheet and since 01.17 version" + "\n"
u"the TABULATION is the separator by default" + "\n\n"
u"If you want to convert your old FCInfo spreadsheet :" + "\n"
u"Open it in FCInfo and save it with the Tabulation option checked")
self.GB_010_SpreadSheet_Disk.setLayout(grid)
vbox.addWidget(self.GB_010_SpreadSheet_Disk)
self.pushButton_Lec = QtGui.QPushButton(self.GB_010_SpreadSheet_Disk)
self.pushButton_Lec.setIcon(QtGui.QIcon(path + "Macro_FCInfo_04.png"))
self.pushButton_Lec.setObjectName(_fromUtf8("pushButton_Lec"))
self.pushButton_Lec.clicked.connect(self.on_pushButton_Lec_clicked) #connection pushButton_Lec "Read"
self.pushButton_Lec.setToolTip(u"Read the file from disk.")
grid.addWidget(self.pushButton_Lec, 0, 0, 1, 2)
self.pushButton_En = QtGui.QPushButton(self.GB_010_SpreadSheet_Disk)
self.pushButton_En.setIcon(QtGui.QIcon(path + "Macro_FCInfo_03.png"))
self.pushButton_En.setObjectName(_fromUtf8("pushButton_En"))
self.pushButton_En.clicked.connect(self.on_pushButton_En_clicked) #connection pushButton_En "Save"
self.pushButton_En.setToolTip(u"Save the file to disk.")
grid.addWidget(self.pushButton_En, 0, 2, 1, 2)
self.LA_01_Tabulation = QtGui.QLabel(self.GB_010_SpreadSheet_Disk)
self.LA_01_Tabulation.setObjectName(_fromUtf8("LA_01_Tabulation"))
self.RB_01_Tabulation = QtGui.QRadioButton(self.GB_010_SpreadSheet_Disk)
self.RB_01_Tabulation.setObjectName(_fromUtf8("RB_01_Tabulation"))
self.RB_01_Tabulation.setChecked(True)
self.RB_01_Tabulation.clicked.connect(self.on_RB_Separation)
grid.addWidget(self.RB_01_Tabulation, 1, 0)
grid.addWidget(self.LA_01_Tabulation, 1, 1)
self.LA_02_Virgule = QtGui.QLabel(self.GB_010_SpreadSheet_Disk)
self.LA_02_Virgule.setObjectName(_fromUtf8("LA_02_Virgule"))
self.RB_02_Virgule = QtGui.QRadioButton(self.GB_010_SpreadSheet_Disk)
self.RB_02_Virgule.setObjectName(_fromUtf8("RB_02_Virgule"))
self.RB_02_Virgule.clicked.connect(self.on_RB_Separation)
grid.addWidget(self.RB_02_Virgule, 1, 2)
grid.addWidget(self.LA_02_Virgule, 1, 3)
self.LA_03_Point_Virgule = QtGui.QLabel(self.GB_010_SpreadSheet_Disk)
self.LA_03_Point_Virgule.setObjectName(_fromUtf8("LA_03_Point_Virgule"))
self.RB_03_Point_Virgule = QtGui.QRadioButton(self.GB_010_SpreadSheet_Disk)
self.RB_03_Point_Virgule.setObjectName(_fromUtf8("RB_03_Point_Virgule"))
#self.RB_03_Point_Virgule.setChecked(True)
self.RB_03_Point_Virgule.clicked.connect(self.on_RB_Separation)
grid.addWidget(self.RB_03_Point_Virgule, 1, 4)
grid.addWidget(self.LA_03_Point_Virgule, 1, 5)
self.LA_04_Espace = QtGui.QLabel(self.GB_010_SpreadSheet_Disk)
self.LA_04_Espace.setObjectName(_fromUtf8("LA_04_Espace"))
self.RB_04_Espace = QtGui.QRadioButton(self.GB_010_SpreadSheet_Disk)
self.RB_04_Espace.setObjectName(_fromUtf8("RB_04_Espace"))
#self.RB_04_Espace.setChecked(True)
self.RB_04_Espace.clicked.connect(self.on_RB_Separation)
grid.addWidget(self.RB_04_Espace, 1, 6)
grid.addWidget(self.LA_04_Espace, 1, 7)
#options CSV fin
grid = QtGui.QGridLayout()
self.GB_011_Main_Tools = QtGui.QGroupBox(self.scrollAreaWidgetContents_2)
self.GB_011_Main_Tools.setObjectName(_fromUtf8("GB_011_Main_Tools"))
# self.GB_011_Main_Tools.setToolTip("Main options" + "\n"
self.GB_011_Main_Tools.setLayout(grid)
vbox.addWidget(self.GB_011_Main_Tools)
self.CB_01_ClipBoard = QtGui.QCheckBox(self.GB_011_Main_Tools)
self.CB_01_ClipBoard.setChecked(False)
self.CB_01_ClipBoard.setObjectName(_fromUtf8("CB_01_ClipBoard"))
self.CB_01_ClipBoard.clicked.connect(self.on_CB_01_ClipBoard) #connection checkBox
switchClipBoard = 0
grid.addWidget(self.CB_01_ClipBoard, 0, 0)
self.CB_02_Point = QtGui.QCheckBox(self.GB_011_Main_Tools)
self.CB_02_Point.setChecked(False)
self.CB_02_Point.setObjectName(_fromUtf8("CB_02_Point"))
self.CB_02_Point.clicked.connect(self.on_CB_02_Point) #connection checkBox
switchPoint = 0
grid.addWidget(self.CB_02_Point, 0, 1)
self.CB_03_Axis = QtGui.QCheckBox(self.GB_011_Main_Tools)
self.CB_03_Axis.setChecked(True) #False
self.CB_03_Axis.setObjectName(_fromUtf8("CB_03_Axis"))
self.CB_03_Axis.clicked.connect(self.on_CB_03_Axis) #connection checkBox
switchAxis = 1
grid.addWidget(self.CB_03_Axis, 0, 2)
self.CB_04_Plane = QtGui.QCheckBox(self.GB_011_Main_Tools)
self.CB_04_Plane.setChecked(True) #False
self.CB_04_Plane.setObjectName(_fromUtf8("CB_04_Plane"))
self.CB_04_Plane.clicked.connect(self.on_CB_04_Plane) #connection checkBox
switchPlane = 1
grid.addWidget(self.CB_04_Plane, 0, 3)
self.CB_05_Info = QtGui.QCheckBox(self.GB_011_Main_Tools)
self.CB_05_Info.setChecked(False)
self.CB_05_Info.setObjectName(_fromUtf8("CB_05_Info"))
self.CB_05_Info.clicked.connect(self.on_CB_05_Info) #connection checkBox
InfoReportView = 0
grid.addWidget(self.CB_05_Info, 1, 0, 1, 2)
self.CB_05_Position = QtGui.QCheckBox(self.GB_011_Main_Tools)
if testing == 1:
self.CB_05_Position.setVisible(False)
self.CB_05_Position.setChecked(False)
self.CB_05_Position.setObjectName(_fromUtf8("CB_05_Position"))
self.CB_05_Position.clicked.connect(self.on_CB_05_Position) #connection checkBox
grid.addWidget(self.CB_05_Position, 1, 2, 1, 2)
self.PB_01_Refrech = QtGui.QPushButton(self.GB_011_Main_Tools)
self.PB_01_Refrech.setIcon(QtGui.QIcon(path + "Macro_FCInfo_02.png"))
self.PB_01_Refrech.setObjectName(_fromUtf8("PB_01_Refrech"))
self.PB_01_Refrech.clicked.connect(self.on_pushButton_Raf_clicked) #connection pushButton_Raf "Refresh"
self.PB_01_Refrech.setToolTip(u"Refresh the report view.")
grid.addWidget(self.PB_01_Refrech, 2, 0, 1, 2)
self.PB_04_Quit = QtGui.QPushButton(self.GB_011_Main_Tools)
self.PB_04_Quit.setIcon(QtGui.QIcon(path + "Macro_FCInfo_01.png"))
self.PB_04_Quit.setObjectName(_fromUtf8("PB_04_Quit"))
self.PB_04_Quit.clicked.connect(self.on_pushButton02_clicked) #connection pushButton02 "Exit"
self.PB_04_Quit.setToolTip(u"Exit FCInfo.")
grid.addWidget(self.PB_04_Quit, 2, 2, 1, 2)
###########################################################scrollArea
self.scrollArea.setWidget(self.scrollAreaWidgetContents_2)
###########################################################scrollArea
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
if testing == 1: # 1=MainWindow separate
MainWindow.setWindowTitle(__title__ + u" (" + __version__ + " (" + __date__ + "))")
MainWindow.setCentralWidget(self.centralwidget)
else:
MainWindow.setWindowTitle(__title__ + u" (" + __version__ + ")")
#MainWindow.setWindowTitle(__title__ + u" (" + __version__ + ")modified")
MainWindow.setWidget(self.centralWidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
global typeLongueur
global path
MainWindow.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) #PySide
MainWindow.setWindowIcon(QtGui.QIcon(path+'FCInfo.png')) #
self.GBox_001_Document.setTitle(u"Document")
self.label_1.setText(u"Document name")
self.label_2.setText(u"Label / Int. Name")
self.label_3.setText(u"Sub. object / Type")
self.GBox_002_Coordinate_Mouse.setTitle(u"Coordinate click mouse")
# self.label_4.setText(u"Coordinates mouse click")
self.label_4x.setText(u"X")
self.label_4y.setText(u"Y")
self.label_4z.setText(u"Z")
#self.pushButton_Axis_01.setText(u"Axis")
self.GBox_003_Value.setTitle(u"Unit")
self.label_5.setText(typeLongueur)
self.label_5b.setText(u"Radius")
#http://fr.wikipedia.org/wiki/Unit%C3%A9s_de_mesure_anglo-saxonnes
self.comboBox.setCurrentIndex(6)
self.comboBox.setItemText(0, "km") #km # = 1000000
self.comboBox.setItemText(1, "hm") #hm # = 100000
self.comboBox.setItemText(2, "dam") #dam# = 10000
self.comboBox.setItemText(3, "m") #m # = 1000
self.comboBox.setItemText(4, "dm") #dm # = 100
self.comboBox.setItemText(5, "cm") #cm # = 10
self.comboBox.setItemText(6, "mm") #mm # = 1
self.comboBox.setItemText(7, u"µm") #µm # = 0.001 micro
self.comboBox.setItemText(8, "nm") #nm # * = 0.000001 nano
self.comboBox.setItemText(9, "pm") #pm # = 0.000000001 pico
self.comboBox.setItemText(10, "fm") #fm # = 0.000000000001 femto
self.comboBox.setItemText(11, "inch") #in # inch pouce = 25.400
self.comboBox.setItemText(12, "link") #lk # link chainon = 201.168
self.comboBox.setItemText(13, "foot") #ft # foot pied = 304.800
self.comboBox.setItemText(14, "yard") #yd # yard verge = 914.400
self.comboBox.setItemText(15, "perch") #rd # rod ou perch perche = 5029.200
self.comboBox.setItemText(16, "chain") #ch # chain chaine = 20116.800
self.comboBox.setItemText(17, "furlong") #fur# furlong = 201168
self.comboBox.setItemText(18, "mile") #mi # mile = 1609344
self.comboBox.setItemText(19, "league") #lea# league lieue = 4828032
self.comboBox.setItemText(20, "nautique") #nmi# mile nautique = 1852000
self.label_6.setText("Perim. the shape")
self.GBox_004_SpreadSheet.setTitle("Disabled module")
self.GBox_005_Inclination.setTitle("Inclination")
self.label_8a.setText("Plan")
self.pushButton_Ra.setText("Degree")
self.label_8a_2.setText("Coordinates")
self.label_8xy.setText("XY")
self.label_8yz.setText("YZ")
self.label_8zx.setText("ZX")
self.label_9_Direction.setText("Direction Object")
self.pushButton_Line_01.setText("Line")
self.label_10_ValueAt.setText("ValueAt")
self.GBox_006_Surface_and_Volume.setTitle("Surface and Volume")
self.label_9.setText("Surface of the form")
self.label_10.setText("Surface of the face")
self.label_11.setText("Volume of the form")
self.label_Unit.setText("Unit")
self.label_Weight.setText("Weight")
self.label_Density.setText("Density")
self.comboBox2.setCurrentIndex(5)
self.comboBox2.setItemText(0, "tonne") #t # = 1000000
self.comboBox2.setItemText(1, "quintal") #q # = 100000
self.comboBox2.setItemText(2, "kilo gram") #kg # = 1000
self.comboBox2.setItemText(3, "hecto gram") #hg # = 100
self.comboBox2.setItemText(4, "decagram") #dag # = 10
self.comboBox2.setItemText(5, "gram") #g # = 1
self.comboBox2.setItemText(6, "decigram") #dg # = 0.1
self.comboBox2.setItemText(7, "centigram") #cg # = 0.01
self.comboBox2.setItemText(8, "milligram") #mg # = 0.001
self.comboBox2.setItemText(9, "microgram") #µg # = 0.000001
self.comboBox2.setItemText(10, "nanogram") #ng # = 0.000000001
self.comboBox2.setItemText(11, "picogram") #pg # = 0.000000000001
self.comboBox2.setItemText(12, "femtogram") #fg # = 0.000000000000001 femtogram
self.comboBox2.setItemText(13, "grain") #gr # = 0.06479891 g
self.comboBox2.setItemText(14, "drachm") #dr # = 1.7718451953125 g
self.comboBox2.setItemText(15, "once") #oz # = 28.3495231250 g
self.comboBox2.setItemText(16, "once troy") #oz t # = 31.1034768 g once troy
self.comboBox2.setItemText(17, "livre troy") #lb t # = 373.2417216 g livre de troy
self.comboBox2.setItemText(18, "livre av") #lb # = 453.59237 g livre avoirdupois pound
self.comboBox2.setItemText(19, "stone") #st # = 6350.29318 g
self.comboBox2.setItemText(20, "quarter") #qtr # = 12700.58636 g
self.comboBox2.setItemText(21, "hundredweight") #cwt # = 50802.34544 g
self.comboBox2.setItemText(22, "tonneau fr") # # = 0.00000102145045965 g
self.comboBox2.setItemText(23, "carat") #ct # = 0.2 g
self.GBox_007_BoundBox.setTitle("BoundBox")
self.LA_007_01_Xlength.setText("XLength")
self.LA_007_02_Ylength.setText("YLength")
self.LA_007_03_Zlength.setText("ZLength")
self.LA_007_04_Diagonallength.setText("DiagonalLength")
self.GBox_008_Center.setTitle("Center of :")
self.label_13.setText("Forme")
self.label_13x.setText("X")
self.label_13y.setText("Y")
self.label_13z.setText("Z")
#self.pushButton_Axis_02.setText("Axis")
self.label_14.setText("Masse")
self.label_14x.setText("X")
self.label_14y.setText("Y")
self.label_14z.setText("Z")
#self.pushButton_Axis_03.setText("Axis")
self.GBox_009_Inertia.setTitle("Inertia")
self.label_16.setText("Moment of inertia")
self.label_16x.setText("X")
self.label_16y.setText("Y")
self.label_16z.setText("Z")
#self.pushButton_Axis_04_16_1.setText("Axis")
#self.pushButton_Axis_05_16_2.setText("Axis")
#self.pushButton_Axis_06_16_3.setText("Axis")
#self.pushButton_Axis_07_16_4.setText("Axis")
self.label_17.setText("Moment of inertia with mass")
self.label_17x.setText("X")
self.label_17y.setText("Y")
self.label_17z.setText("Z")
#self.pushButton_Axis_08_17_1.setText("Axis")
#self.pushButton_Axis_09_17_2.setText("Axis")
#self.pushButton_Axis_10_17_3.setText("Axis")
#self.pushButton_Axis_11_17_4.setText("Axis")
self.label_determinant.setText("Determinant")
self.label_determinantDecimal.setText("Determinant Dec.")
# self.label_15.setText("BoundBox")
self.GB_010_SpreadSheet_Disk.setTitle("SpreadSheet")
self.pushButton_Lec.setText("Read")
self.pushButton_En.setText("Save")
self.LA_01_Tabulation.setText("")
self.RB_01_Tabulation.setText("Tabulation")
self.LA_02_Virgule.setText("")
self.RB_02_Virgule.setText("Comma")
self.LA_03_Point_Virgule.setText("")
self.RB_03_Point_Virgule.setText("Semicolon")
self.LA_04_Espace.setText("")
self.RB_04_Espace.setText("Space")
self.GB_011_Main_Tools.setTitle("Main")
self.CB_01_ClipBoard.setText("Clip Board")
self.CB_01_ClipBoard.setToolTip("<img src=" + path + "Macro_FCInfo_05.png" + " />" + "\n" +
"If checked the coordinate are copy in the clipBoard" + "\n" +
"Form : FreeCAD.Vector(X.0, Y.0, Z.0)")
self.CB_02_Point.setText("Point")
self.CB_02_Point.setToolTip("<img src=" + path + "Macro_FCInfo_05.png" + " />" + "\n" +
"If checked Create point")
self.CB_03_Axis.setText("Axis")
self.CB_03_Axis.setToolTip("<img src=" + path + "Macro_FCInfo_05.png" + " />" + "\n" +
"If checked Create axis")
self.CB_04_Plane.setText("Plane")
self.CB_04_Plane.setToolTip("<img src=" + path + "Macro_FCInfo_05.png" + " />" + "\n" +
"If checked Create Plane")
self.CB_05_Info.setText("Info R.View")
self.CB_05_Info.setToolTip("If checked Display Infos in Rapport View")
self.CB_05_Position.setText("Left/Right")
self.CB_05_Position.setToolTip("Change the window macro position Right of Left")
self.PB_01_Refrech.setText("Ref")
self.PB_04_Quit.setText("Exit")
def on_pushButton_Line_01(self):
global object_Label
global directionObj
global switchInertia
if directionObj != 0.0:
switchInertia = 1
try:
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(directionObj)]
line0 = Draft.makeWire(points,closed=False,face=False,support=None)
line0.Label = u"Direction_" + object_Label
line0.ViewObject.LineColor = (1.0,0.0,0.0)
App.ActiveDocument.recompute()
except Exception:
None
switchInertia = 0
def paletteBase(self):
#setStyleSheet("background-color: QPalette.Base") # origin system
qpBase = "background: QPalette.Base"
qpIcon = QtGui.QIcon(path + "Macro_FCInfo_05.png")
self.lineEdit_4x.setStyleSheet(qpBase)
self.lineEdit_4y.setStyleSheet(qpBase)
self.lineEdit_4z.setStyleSheet(qpBase)
self.pushButton_Axis_01.setIcon(qpIcon) # icon
self.lineEdit_13x.setStyleSheet(qpBase)
self.lineEdit_13y.setStyleSheet(qpBase)
self.lineEdit_13z.setStyleSheet(qpBase)
self.pushButton_Axis_02.setIcon(qpIcon) # icon
self.lineEdit_14x.setStyleSheet(qpBase)
self.lineEdit_14y.setStyleSheet(qpBase)
self.lineEdit_14z.setStyleSheet(qpBase)
self.pushButton_Axis_03.setIcon(qpIcon) # icon
self.lineEdit_16_1x.setStyleSheet(qpBase)
self.lineEdit_16_1y.setStyleSheet(qpBase)
self.lineEdit_16_1z.setStyleSheet(qpBase)
self.pushButton_Axis_04_16_1.setIcon(qpIcon) # icon
self.lineEdit_16_2x.setStyleSheet(qpBase)
self.lineEdit_16_2y.setStyleSheet(qpBase)
self.lineEdit_16_2z.setStyleSheet(qpBase)
self.pushButton_Axis_05_16_2.setIcon(qpIcon) # icon
self.lineEdit_16_3x.setStyleSheet(qpBase)
self.lineEdit_16_3y.setStyleSheet(qpBase)
self.lineEdit_16_3z.setStyleSheet(qpBase)
self.pushButton_Axis_06_16_3.setIcon(qpIcon) # icon
self.pushButton_Axis_07_16_4.setIcon(qpIcon) # icon
self.lineEdit_17_1x.setStyleSheet(qpBase)
self.lineEdit_17_1y.setStyleSheet(qpBase)
self.lineEdit_17_1z.setStyleSheet(qpBase)
self.pushButton_Axis_08_17_1.setIcon(qpIcon) # icon
self.lineEdit_17_2x.setStyleSheet(qpBase)
self.lineEdit_17_2y.setStyleSheet(qpBase)
self.lineEdit_17_2z.setStyleSheet(qpBase)
self.pushButton_Axis_09_17_2.setIcon(qpIcon) # icon
self.lineEdit_17_3x.setStyleSheet(qpBase)
self.lineEdit_17_3y.setStyleSheet(qpBase)
self.lineEdit_17_3z.setStyleSheet(qpBase)
self.pushButton_Axis_10_17_3.setIcon(qpIcon) # icon
self.pushButton_Axis_11_17_4.setIcon(qpIcon) # icon
def on_GBox_004_SpreadSheet(self):
global ui
if self.GBox_004_SpreadSheet.isChecked():
self.GBox_004_SpreadSheet.setStyleSheet("color : QPalette.Base;") # origin system
ui.on_pushButton_Raf_clicked()
else:
self.GBox_004_SpreadSheet.setStyleSheet("color : #ff0000;")
self.GBox_004_SpreadSheet.setTitle("Disabled module")
co = 0
li = 0
for li in range(RowCount): # Zero
for co in range(10):
newitem = QtGui.QTableWidgetItem("")
self.tableWidget.setItem( li,co, newitem)
def on_pushButton_Axis_Mouse(self):
global position0
global position1
global position2
global ui
ui.paletteBase()
self.lineEdit_4x.setStyleSheet("border:2px solid red") #
self.lineEdit_4y.setStyleSheet("border:2px solid green")
self.lineEdit_4z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_01.setIcon(QtGui.QIcon(axisPlane(position0, position1, position2, "Mouse")))
def on_pushButton_Axis_Center_Shape(self):
global boundBoxCenterX
global boundBoxCenterY
global boundBoxCenterZ
global ui
ui.paletteBase()
self.lineEdit_13x.setStyleSheet("border:2px solid red") #red
self.lineEdit_13y.setStyleSheet("border:2px solid green")
self.lineEdit_13z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_02.setIcon(QtGui.QIcon(axisPlane(boundBoxCenterX, boundBoxCenterY, boundBoxCenterZ, "BBCenter")))
def on_pushButton_Axis_Center_Mass(self):
global CenterOfMassX
global CenterOfMassY
global CenterOfMassZ
global ui
ui.paletteBase()
self.lineEdit_14x.setStyleSheet("border:2px solid red") #
self.lineEdit_14y.setStyleSheet("border:2px solid green")
self.lineEdit_14z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_03.setIcon(QtGui.QIcon(axisPlane(CenterOfMassX, CenterOfMassY, CenterOfMassZ, "CenterOfMass")))
def on_pushButton_Axis_04_16_1(self):
global MatrixX1_16
global MatrixY1_16
global MatrixZ1_16
global ui
ui.paletteBase()
self.lineEdit_16_1x.setStyleSheet("border:2px solid red") #
self.lineEdit_16_1y.setStyleSheet("border:2px solid green")
self.lineEdit_16_1z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_04_16_1.setIcon(QtGui.QIcon(axisPlane(MatrixX1_16, MatrixY1_16, MatrixZ1_16, "Matrix1")))
def on_pushButton_Axis_05_16_2(self):
global MatrixX2_16
global MatrixY2_16
global MatrixZ2_16
global ui
ui.paletteBase()
self.lineEdit_16_2x.setStyleSheet("border:2px solid red") #
self.lineEdit_16_2y.setStyleSheet("border:2px solid green")
self.lineEdit_16_2z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_05_16_2.setIcon(QtGui.QIcon(axisPlane(MatrixX2_16, MatrixY2_16, MatrixZ2_16, "Matrix2")))
def on_pushButton_Axis_06_16_3(self):
global MatrixX3_16
global MatrixY3_16
global MatrixZ3_16
global ui
ui.paletteBase()
self.lineEdit_16_3x.setStyleSheet("border:2px solid red") #
self.lineEdit_16_3y.setStyleSheet("border:2px solid green")
self.lineEdit_16_3z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_06_16_3.setIcon(QtGui.QIcon(axisPlane(MatrixX3_16, MatrixY3_16, MatrixZ3_16, "Matrix3")))
def on_pushButton_Axis_07_16_4(self):
global MatrixX1_16
global MatrixY2_16
global MatrixZ3_16
global ui
ui.paletteBase()
self.lineEdit_16_1x.setStyleSheet("border:2px solid red") #
self.lineEdit_16_2y.setStyleSheet("border:2px solid green")
self.lineEdit_16_3z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_07_16_4.setIcon(QtGui.QIcon(axisPlane(MatrixX1_16, MatrixY2_16, MatrixZ3_16, "Matrix123")))
def on_pushButton_Axis_08_17_1(self):
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global ui
ui.paletteBase()
self.lineEdit_17_1x.setStyleSheet("border:2px solid red") #
self.lineEdit_17_1y.setStyleSheet("border:2px solid green")
self.lineEdit_17_1z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_08_17_1.setIcon(QtGui.QIcon(axisPlane(MatrixX1_17, MatrixY1_17, MatrixZ1_17, "MatrixW1")))
def on_pushButton_Axis_09_17_2(self):
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global ui
ui.paletteBase()
self.lineEdit_17_2x.setStyleSheet("border:2px solid red") #
self.lineEdit_17_2y.setStyleSheet("border:2px solid green")
self.lineEdit_17_2z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_09_17_2.setIcon(QtGui.QIcon(axisPlane(MatrixX2_17, MatrixY2_17, MatrixZ2_17, "MatrixW2")))
def on_pushButton_Axis_10_17_3(self):
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
global ui
ui.paletteBase()
self.lineEdit_17_3x.setStyleSheet("border:2px solid red") #
self.lineEdit_17_3y.setStyleSheet("border:2px solid green")
self.lineEdit_17_3z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_10_17_3.setIcon(QtGui.QIcon(axisPlane(MatrixX3_17, MatrixY3_17, MatrixZ3_17, "MatrixW3")))
def on_pushButton_Axis_11_17_4(self):
global MatrixX1_17
global MatrixY2_17
global MatrixZ3_17
global ui
ui.paletteBase()
self.lineEdit_17_1x.setStyleSheet("border:2px solid red") #
self.lineEdit_17_2y.setStyleSheet("border:2px solid green")
self.lineEdit_17_3z.setStyleSheet("border:2px solid blue")
self.pushButton_Axis_11_17_4.setIcon(QtGui.QIcon(axisPlane(MatrixX1_17, MatrixY2_17, MatrixZ3_17, "MatrixW123")))
def SIGNAL_comboPoids_Changed(self,text):
global volume_
global densite
global poids
global uniteM
global uniteS
global uniteSs
global uniteV
global uniteP
global unitePs
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
# ori 0.18 Py 27 text = text.encode('utf-8') # PySide
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 gram": #kg # 0.001 = 1000
uniteP = 0.001
unitePs= "kg"
elif text == "hecto gram": #hg # 0.01 = 100
uniteP = 0.01
unitePs= "hg"
elif text == "decagram": #dag# 0.1 = 10
uniteP = 0.1
unitePs= "dag"
elif text == "gram": #g # 1 = 1
uniteP = 1.00
unitePs= "g"
elif text == "decigram": #dg # = 0.1
uniteP = 10.0
unitePs= "dg"
elif text == "centigram": #cg # = 0.01
uniteP = 100.0
unitePs= "cg"
elif text == "milligram": #mg # = 0.001
uniteP = 1000.0
unitePs= "mg"
elif text == "microgram": #µg # = 0.000001
uniteP = 1000000.0
unitePs= u"µg"
elif text == "nanogram": #ng # = 0.000000001
uniteP = 1000000000.0
unitePs= "ng"
elif text == "picogram": #pg # = 0.000000000001
uniteP = 1000000000000.0
unitePs= "pg"
elif text == "femtogram": #fg # = 0.000000000000001
uniteP = 1000000000000000.0
unitePs= "fg"
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.0
unitePs= "ct"
try:
poids = ((volume_ * densite) * uniteP) / 1000.0
self.lineEdit_12a.setText(str(poids)+" "+unitePs)
self.lineEdit_17_M.setText(unitePs+uniteSs)
except Exception:
self.lineEdit_12a.setText("")
self.lineEdit_17_M.setText("")
try:
MatrixX1_17 = MatrixX1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY1_17 = MatrixY1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ1_17 = MatrixZ1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX2_17 = MatrixX2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY2_17 = MatrixY2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ2_17 = MatrixZ2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX3_17 = MatrixX3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY3_17 = MatrixY3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ3_17 = MatrixZ3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
except Exception:
MatrixX1_17 = MatrixY1_17 = MatrixZ1_17 = 0.0
MatrixX2_17 = MatrixY2_17 = MatrixZ2_17 = 0.0
MatrixX3_17 = MatrixY3_17 = MatrixZ3_17 = 0.0
self.lineEdit_17_1x.setText(str(MatrixX1_17))
self.lineEdit_17_1y.setText(str(MatrixY1_17))
self.lineEdit_17_1z.setText(str(MatrixZ1_17))
self.lineEdit_17_2x.setText(str(MatrixX2_17))
self.lineEdit_17_2y.setText(str(MatrixY2_17))
self.lineEdit_17_2z.setText(str(MatrixZ2_17))
self.lineEdit_17_3x.setText(str(MatrixX3_17))
self.lineEdit_17_3y.setText(str(MatrixY3_17))
self.lineEdit_17_3z.setText(str(MatrixZ3_17))
def SIGNAL_comboBox_Changed(self,text):
global position0
global position1
global position2
global longueurObjet
global rayonObjet
global perimetre
global numberEdges
global surface
global surfaceFace
global volume_
global densite
global uniteM
global uniteMs
global uniteS
global uniteSs
global uniteV
global uniteVs
global uniteP
global unitePs
global boundBoxCenterX
global boundBoxCenterY
global boundBoxCenterZ
global CenterOfMassX
global CenterOfMassY
global CenterOfMassZ
global boundBoxLX
global boundBoxLY
global boundBoxLZ
global boundBoxDiag
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 RowCount
global MatrixX1_16
global MatrixY1_16
global MatrixZ1_16
global MatrixX2_16
global MatrixY2_16
global MatrixZ2_16
global MatrixX3_16
global MatrixY3_16
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
# ori 0.18 Py 27 text = text.encode('utf-8') # PySide
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 == u"µm": # = 1000 #http://fr.wiktionary.org/wiki/%CE%BCm#conv
uniteM = 1000.0
uniteMs= u"µm"
uniteS = 1000.0**2
uniteSs= u"µm²"
uniteV = 1000.0**3
uniteVs= u"µm³"
elif text == "nm": # = 1000000
uniteM = 1000000.0
uniteMs= u"nm"
uniteS = 1000000.0**2
uniteSs= u"nm²"
uniteV = 1000000.0**3
uniteVs= u"nm³"
elif text == "pm": # = 1000000000
uniteM = 1000000000.0
uniteMs= u"pm"
uniteS = 1000000000.0**2
uniteSs= u"pm²"
uniteV = 1000000000.0**3
uniteVs= u"pm³"
elif text == "fm": # = 1000000000000
uniteM = 1000000000000.0
uniteMs= u"fm"
uniteS = 1000000000000.0**2
uniteSs= u"fm²"
uniteV = 1000000000000.0**3
uniteVs= u"fm³"
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_4x.setText(str(position0 * uniteM) + " " + uniteMs)
self.lineEdit_4y.setText(str(position1 * uniteM) + " " + uniteMs)
self.lineEdit_4z.setText(str(position2 * uniteM) + " " + uniteMs)
except Exception:
position0 = position1 = position2 = 0.0
self.lineEdit_4x.setText(str(position0))
self.lineEdit_4y.setText(str(position1))
self.lineEdit_4z.setText(str(position2))
try:
self.lineEdit_13x.setText(str(boundBoxCenterX * uniteM) + " " + uniteMs)
self.lineEdit_13y.setText(str(boundBoxCenterY * uniteM) + " " + uniteMs)
self.lineEdit_13z.setText(str(boundBoxCenterZ * uniteM) + " " + uniteMs)
except Exception:
boundBoxCenterX = boundBoxCenterY = boundBoxCenterZ = 0.0
self.lineEdit_13x.setText(str(boundBoxCenterX))
self.lineEdit_13y.setText(str(boundBoxCenterY))
self.lineEdit_13z.setText(str(boundBoxCenterZ))
try:
self.lineEdit_14x.setText(str(CenterOfMassX * uniteM) + " " + uniteMs)
self.lineEdit_14y.setText(str(CenterOfMassY * uniteM) + " " + uniteMs)
self.lineEdit_14z.setText(str(CenterOfMassZ * uniteM) + " " + uniteMs)
except Exception:
CenterOfMassX = CenterOfMassY = CenterOfMassZ = 0.0
self.lineEdit_14x.setText(str(CenterOfMassX))
self.lineEdit_14y.setText(str(CenterOfMassY))
self.lineEdit_14z.setText(str(CenterOfMassZ))
try:
self.LE_007_BB_01_XLength.setText(str(boundBoxLX * uniteM) + " " + uniteMs)
self.LE_007_BB_02_YLength.setText(str(boundBoxLY * uniteM) + " " + uniteMs)
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ * uniteM) + " " + uniteMs)
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag * uniteM) + " " + uniteMs)
except Exception:
boundBoxLX = boundBoxLY = boundBoxLZ = 0.0
self.LE_007_BB_01_XLength.setText(str(boundBoxLX))
self.LE_007_BB_02_YLength.setText(str(boundBoxLY))
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ))
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag))
try:
self.lineEdit_5.setText(str(float(longueurObjet) * float(uniteM))+" "+uniteMs)
except Exception:
self.lineEdit_5.setText("")
if rayonObjet != 0.0:
try:
self.lineEdit_5b.setVisible(True)
self.label_5b.setVisible(True)
self.lineEdit_5b.setText(str(rayonObjet * uniteM)+" "+uniteMs)
except Exception:
self.lineEdit_5b.setVisible(False)
self.label_5b.setVisible(False)
rayonObjet = 0.0
else:
self.lineEdit_5b.setVisible(False)
self.label_5b.setVisible(False)
rayonObjet = 0.0
ui.label_6.setText(u"Perim. of shape (" + str(numberEdges) + ")")
try:
self.lineEdit_6.setText(str(float(perimetre) * float(uniteM))+" "+uniteMs)
except Exception:
perimetre = 0.0
self.lineEdit_6.setText(str(perimetre))
try:
self.lineEdit_9a.setText(str(float(surface) * float(uniteS))+" "+uniteSs)
except Exception:
self.lineEdit_9a.setText("")
try:
self.lineEdit_10a.setText(str(float(surfaceFace) * float(uniteS))+" "+uniteSs)
except Exception:
self.lineEdit_10a.setText("")
try:
self.lineEdit_11a.setText(str(float(volume_) * float(uniteV))+" "+uniteVs)
except Exception:
self.lineEdit_11a.setText("")
try:
self.lineEdit_16_M.setText(uniteMs+"^5")
MatrixX1_16 = MatrixX1*uniteM**5
MatrixY1_16 = MatrixY1*uniteM**5
MatrixZ1_16 = MatrixZ1*uniteM**5
MatrixX2_16 = MatrixX2*uniteM**5
MatrixY2_16 = MatrixY2*uniteM**5
MatrixZ2_16 = MatrixZ2*uniteM**5
MatrixX3_16 = MatrixX3*uniteM**5
MatrixY3_16 = MatrixY3*uniteM**5
MatrixZ3_16 = MatrixZ3*uniteM**5
except Exception:
MatrixX1_16 = MatrixY1_16 = MatrixZ1_16 = 0.0
MatrixX2_16 = MatrixY2_16 = MatrixZ2_16 = 0.0
MatrixX3_16 = MatrixY3_16 = MatrixZ3_16 = 0.0
self.lineEdit_16_M.setText("")
self.lineEdit_16_1x.setText(str(MatrixX1_16))
self.lineEdit_16_1y.setText(str(MatrixY1_16))
self.lineEdit_16_1z.setText(str(MatrixZ1_16))
self.lineEdit_16_2x.setText(str(MatrixX2_16))
self.lineEdit_16_2y.setText(str(MatrixY2_16))
self.lineEdit_16_2z.setText(str(MatrixZ2_16))
self.lineEdit_16_3x.setText(str(MatrixX3_16))
self.lineEdit_16_3y.setText(str(MatrixY3_16))
self.lineEdit_16_3z.setText(str(MatrixZ3_16))
try:
MatrixX1_17 = MatrixX1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY1_17 = MatrixY1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ1_17 = MatrixZ1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX2_17 = MatrixX2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY2_17 = MatrixY2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ2_17 = MatrixZ2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX3_17 = MatrixX3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY3_17 = MatrixY3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ3_17 = MatrixZ3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
except Exception:
MatrixX1_17 = MatrixY1_17 = MatrixZ1_17 = 0.0
MatrixX2_17 = MatrixY2_17 = MatrixZ2_17 = 0.0
MatrixX3_17 = MatrixY3_17 = MatrixZ3_17 = 0.0
self.lineEdit_17_1x.setText(str(MatrixX1_17))
self.lineEdit_17_1y.setText(str(MatrixY1_17))
self.lineEdit_17_1z.setText(str(MatrixZ1_17))
self.lineEdit_17_2x.setText(str(MatrixX2_17))
self.lineEdit_17_2y.setText(str(MatrixY2_17))
self.lineEdit_17_2z.setText(str(MatrixZ2_17))
self.lineEdit_17_3x.setText(str(MatrixX3_17))
self.lineEdit_17_3y.setText(str(MatrixY3_17))
self.lineEdit_17_3z.setText(str(MatrixZ3_17))
try:
self.lineEdit_17_M.setText(unitePs+uniteSs)
except Exception:
self.lineEdit_17_M.setText("")
try:
self.LE_007_BB_01_XLength.setText(str(boundBoxLX * uniteM)+" "+uniteMs)
self.LE_007_BB_02_YLength.setText(str(boundBoxLY * uniteM)+" "+uniteMs)
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ * uniteM)+" "+uniteMs)
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag * uniteM)+" "+uniteMs)
boundBox_S = "[X: "+str(boundBoxLX * uniteM)+" "+uniteMs+"] x [Y: "+str(boundBoxLY * uniteM)+" "+uniteMs+"] x [Z: "+str(boundBoxLZ * uniteM)+" "+uniteMs+"] Diagonal: " + str(boundBoxDiag * uniteM)+" "+uniteMs
except Exception:
self.LE_007_BB_01_XLength.setText("")
self.LE_007_BB_02_YLength.setText("")
self.LE_007_BB_03_ZLength.setText("")
self.LE_007_BB_04_Diagonal.setText("")
boundBox_S = ""
if self.GBox_004_SpreadSheet.isChecked():
co = 0
li = 0
for li in range(RowCount): # Zero
for co in range(10):
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]))
chaine = str(Vertx[a]).split(":")
newitem = QtGui.QTableWidgetItem(chaine[0]+":" + str(float(chaine[1]) * float(uniteM))+" "+uniteMs)
self.tableWidget.setItem( li,co, newitem)
except Exception:
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 coordinates
cco+=1
if FacesCoor[jj] == "T":
break
else:
#newitem = QtGui.QTableWidgetItem(FacesCoor[jj])
chaine = str(FacesCoor[jj]).split(":")
newitem = QtGui.QTableWidgetItem(chaine[0]+":" + str(float(chaine[1]) * float(uniteM))+" "+uniteMs)
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
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
densite = densiteSB
poids = ((volume_ * densite) * uniteP) / 1000.0 # base FreeCAD = mm
self.lineEdit_12a.setText(str(poids) +" "+ unitePs)
try:
MatrixX1_17 = MatrixX1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY1_17 = MatrixY1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ1_17 = MatrixZ1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX2_17 = MatrixX2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY2_17 = MatrixY2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ2_17 = MatrixZ2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX3_17 = MatrixX3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY3_17 = MatrixY3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ3_17 = MatrixZ3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
except Exception:
MatrixX1_17 = MatrixY1_17 = MatrixZ1_17 = 0.0
MatrixX2_17 = MatrixY2_17 = MatrixZ2_17 = 0.0
MatrixX3_17 = MatrixY3_17 = MatrixZ3_17 = 0.0
self.lineEdit_17_M.setText("")
self.lineEdit_17_1x.setText(str(MatrixX1_17))
self.lineEdit_17_1y.setText(str(MatrixY1_17))
self.lineEdit_17_1z.setText(str(MatrixZ1_17))
self.lineEdit_17_2x.setText(str(MatrixX2_17))
self.lineEdit_17_2y.setText(str(MatrixY2_17))
self.lineEdit_17_2z.setText(str(MatrixZ2_17))
self.lineEdit_17_3x.setText(str(MatrixX3_17))
self.lineEdit_17_3y.setText(str(MatrixY3_17))
self.lineEdit_17_3z.setText(str(MatrixZ3_17))
def on_pushButton_Raf_clicked(self): # refresh
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 rayonObjet
global perimetre
global typeLongueur
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 CenterOfMassX
global CenterOfMassY
global CenterOfMassZ
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 RowCount
global RowCountTest
global ESCAPE
global directionObj
global direcValueAt
global MatrixX1_16
global MatrixY1_16
global MatrixZ1_16
global MatrixX2_16
global MatrixY2_16
global MatrixZ2_16
global MatrixX3_16
global MatrixY3_16
global MatrixZ3_16
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
global DeterminantM
sel = FreeCADGui.Selection.getSelection()
if len(sel)==0:
App.Console.PrintMessage(u"Select an object"+"\n")
errorDialog(u"Select an object")
else:
if self.GBox_004_SpreadSheet.isChecked():
affect(1)
else:
affect(0)
self.GBox_004_SpreadSheet.setTitle("Disabled module")
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 * uniteM) + " " + uniteMs)
self.lineEdit_4y.setText(str(position1 * uniteM) + " " + uniteMs)
self.lineEdit_4z.setText(str(position2 * uniteM) + " " + uniteMs)
self.lineEdit_9_Direction.setText(str(directionObj))
self.lineEdit_10_ValueAt.setText(str(direcValueAt))
try:
self.LE_007_BB_01_XLength.setText(str(boundBoxLX * uniteM)+" "+uniteMs)
self.LE_007_BB_02_YLength.setText(str(boundBoxLY * uniteM)+" "+uniteMs)
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ * uniteM)+" "+uniteMs)
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag * uniteM)+" "+uniteMs)
boundBox_S = "[X: "+str(boundBoxLX * uniteM)+" "+uniteMs+"] x [Y: "+str(boundBoxLY * uniteM)+" "+uniteMs+"] x [Z: "+str(boundBoxLZ * uniteM)+" "+uniteMs+"] Diagonal: " + str(boundBoxDiag * uniteM)+" "+uniteMs
except Exception:
self.LE_007_BB_01_XLength.setText("")
self.LE_007_BB_02_YLength.setText("")
self.LE_007_BB_03_ZLength.setText("")
self.LE_007_BB_04_Diagonal.setText("")
boundBox_S = ""
if rayonObjet != 0.0:
self.lineEdit_5.setText(str(longueurObjet * uniteM)+" "+uniteMs)
self.label_5b.setVisible(True)
self.lineEdit_5b.setVisible(True)
self.lineEdit_5b.setText(str(rayonObjet * uniteM)+" "+uniteMs)
else:
self.lineEdit_5.setText(str(longueurObjet * uniteM)+" "+uniteMs)
self.label_5b.setVisible(False)
self.lineEdit_5b.setVisible(False)
rayonObjet = 0.0
self.label_5.setText(typeLongueur)
self.comboBox.setCurrentIndex(6)
self.pushButton_Ra.setText("Degree")
# numberEdges = len(select[0].Shape.Edges)
ui.label_6.setText(u"Perim. du shape (" + str(numberEdges) + ")")
try:
self.lineEdit_6.setText(str(float(perimetre) * float(uniteM))+" "+uniteMs)
except Exception:
perimetre = 0.0
self.lineEdit_6.setText(str(perimetre))
if self.GBox_004_SpreadSheet.isChecked():
co = 0
li = 0
for li in range(RowCount): # Zero
for co in range(10):
newitem = QtGui.QTableWidgetItem("")
self.tableWidget.setItem( li,co, newitem)
if RowCountTest > RowCount:
self.GBox_004_SpreadSheet.setTitle("Details ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+") (!+ "+str(RowCount)+") "+str(RowCountTest))
else:
self.GBox_004_SpreadSheet.setTitle("Vertexes and details ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+")")#str(RowCount)
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]))
chaine = str(Vertx[a]).split(":")
newitem = QtGui.QTableWidgetItem(chaine[0]+":" + str(float(chaine[1]) * float(uniteM))+" "+uniteMs)
self.tableWidget.setItem( li,co, newitem)
except Exception:
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 coordinates
cco+=1
if FacesCoor[jj] == "T":
break
else:
# newitem = QtGui.QTableWidgetItem(FacesCoor[jj])
chaine = str(FacesCoor[jj]).split(":")
newitem = QtGui.QTableWidgetItem(chaine[0]+":" + str(float(chaine[1]) * float(uniteM))+" "+uniteMs)
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 * uniteM) + " " + uniteMs)
self.lineEdit_13y.setText(str(boundBoxCenterY * uniteM) + " " + uniteMs)
self.lineEdit_13z.setText(str(boundBoxCenterZ * uniteM) + " " + uniteMs)
self.lineEdit_14x.setText(str(CenterOfMassX * uniteM) + " " + uniteMs)
self.lineEdit_14y.setText(str(CenterOfMassY * uniteM) + " " + uniteMs)
self.lineEdit_14z.setText(str(CenterOfMassZ * uniteM) + " " + uniteMs)
self.LE_007_BB_01_XLength.setText(str(boundBoxLX * uniteM) + " " + uniteMs)
self.LE_007_BB_02_YLength.setText(str(boundBoxLY * uniteM) + " " + uniteMs)
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ * uniteM) + " " + uniteMs)
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag * uniteM) + " " + uniteMs)
try:
MatrixX1_16 = MatrixX1*uniteS**5
MatrixY1_16 = MatrixY1*uniteS**5
MatrixZ1_16 = MatrixZ1*uniteS**5
MatrixX2_16 = MatrixX2*uniteS**5
MatrixY2_16 = MatrixY2*uniteS**5
MatrixZ2_16 = MatrixZ2*uniteS**5
MatrixX3_16 = MatrixX3*uniteS**5
MatrixY3_16 = MatrixY3*uniteS**5
MatrixZ3_16 = MatrixZ3*uniteS**5
except Exception:
MatrixX1_16 = MatrixY1_16 = MatrixZ1_16 = 0.0
MatrixX2_16 = MatrixY2_16 = MatrixZ2_16 = 0.0
MatrixX3_16 = MatrixY3_16 = MatrixZ3_16 = 0.0
self.lineEdit_16_M.setText("")
self.lineEdit_16_1x.setText(str(MatrixX1_16))
self.lineEdit_16_1y.setText(str(MatrixY1_16))
self.lineEdit_16_1z.setText(str(MatrixZ1_16))
self.lineEdit_16_01.setText(str(Matrix_1))
self.lineEdit_16_2x.setText(str(MatrixX2_16))
self.lineEdit_16_2y.setText(str(MatrixY2_16))
self.lineEdit_16_2z.setText(str(MatrixZ2_16))
self.lineEdit_16_02.setText(str(Matrix_2))
self.lineEdit_16_3x.setText(str(MatrixX3_16))
self.lineEdit_16_3y.setText(str(MatrixY3_16))
self.lineEdit_16_3z.setText(str(MatrixZ3_16))
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))
try:
MatrixX1_17 = MatrixX1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY1_17 = MatrixY1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ1_17 = MatrixZ1*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX2_17 = MatrixX2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY2_17 = MatrixY2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ2_17 = MatrixZ2*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixX3_17 = MatrixX3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixY3_17 = MatrixY3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
MatrixZ3_17 = MatrixZ3*uniteM**5*densite*uniteP*(1.0/(uniteV*1000.0))
except Exception:
MatrixX1_17 = MatrixY1_17 = MatrixZ1_17 = 0.0
MatrixX2_17 = MatrixY2_17 = MatrixZ2_17 = 0.0
MatrixX3_17 = MatrixY3_17 = MatrixZ3_17 = 0.0
self.lineEdit_17_M.setText("")
self.lineEdit_17_1x.setText(str(MatrixX1_17))
self.lineEdit_17_1y.setText(str(MatrixY1_17))
self.lineEdit_17_1z.setText(str(MatrixZ1_17))
self.lineEdit_17_2x.setText(str(MatrixX2_17))
self.lineEdit_17_2y.setText(str(MatrixY2_17))
self.lineEdit_17_2z.setText(str(MatrixZ2_17))
self.lineEdit_17_3x.setText(str(MatrixX3_17))
self.lineEdit_17_3y.setText(str(MatrixY3_17))
self.lineEdit_17_3z.setText(str(MatrixZ3_17))
self.lineEdit_18_determinant.setText(str(DeterminantM))
self.lineEdit_18_determinantDecim.setText(str(decimal.Decimal(DeterminantM)))
self.LA_01_Tabulation.setText("")
self.LA_02_Virgule.setText("")
self.LA_03_Point_Virgule.setText("")
self.LA_04_Espace.setText("")
self.RB_01_Tabulation.setChecked(True)
ESCAPE = "\t"
ui.paletteBase()
##################################################################################################################
def on_RB_Separation(self): # option ESCAPE for spreadSheet
global ESCAPE
if self.RB_01_Tabulation.isChecked(): #tabulation #compatible FC
ESCAPE = "\t"
elif self.RB_02_Virgule.isChecked(): #virgule #compatible FCInfo
ESCAPE = ","
elif self.RB_03_Point_Virgule.isChecked(): #point virgule #option
ESCAPE = ";"
elif self.RB_04_Espace.isChecked(): #espace #option
ESCAPE = " "
def on_pushButton_Lec_clicked(self): # lecture
global ESCAPE
OpenName = ""
OpenName, Filter = PySide.QtGui.QFileDialog.getOpenFileName(None, "Read a txt file", path, "*.FCInfo *.csv *.asc *.txt;;FCInfo (*.FCInfo);;Cvs (*.csv);;Ascii (*.asc);;TXT (*.txt)")#PySide
try:
if OpenName != "":
# App.Console.PrintMessage("Reading the file "+OpenName+"\n")
####detection separator###################
# ori 0.18 Py27 file = open(OpenName, "rb") # open file for counter line and colonne
file = open(OpenName, "r") # open file for counter separator
separateur1 = separateur2 = separateur3 = separateur4 = 0
for separator in file:
separateur1 += separator.count("\t")
separateur2 += separator.count(",")
separateur3 += separator.count(";")
separateur4 += separator.count(" ")
self.LA_01_Tabulation.setText(str(separateur1))
self.LA_02_Virgule.setText(str(separateur2))
self.LA_03_Point_Virgule.setText(str(separateur3))
self.LA_04_Espace.setText("(" + str(separateur4) + ")")
file.close()
####detection separator###################
# ori 0.18 Py27 file = open(OpenName, "rb") # open file for read
file = open(OpenName, "r") # open file for counter line and colonne
reader = csv.reader(file, delimiter = ESCAPE) #, quotechar=';'
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) # prepare the tableau
self.table.setWindowTitle("FCInfo Patience reading the file")
# self.table.resize(700, 500)
self.table.resize(390, 500)
self.table.setWindowModality(QtCore.Qt.NonModal)
self.table.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # PySide
self.table.setWindowIcon(QtGui.QIcon(path+'FCInfoSpreadsheet.png'))#
self.table.show()
# ori 0.18 Py27 file = open(OpenName, "rb") # open file for read
file = open(OpenName, "r") # open file for read
reader = csv.reader(file, delimiter = ESCAPE) #, quotechar=';'
lignes = ligne
colonne = 0
ligne = 0
try:
for row in reader:
for field in row:
newitem = QtGui.QTableWidgetItem(str(field))
self.table.setItem(ligne, colonne, newitem)
colonne += 1
ligne += 1
colonne = 0
self.table.setWindowTitle("FCInfo Patience reading the file "+str(ligne)+"/"+str(lignes))
finally:
file.close()
self.table.setWindowTitle("FCInfo Tableau " + OpenName)
except Exception:
App.Console.PrintMessage("Error in reading the file "+OpenName+"\n")
errorDialog(u"Error in reading the file "+OpenName)
##################################################################################################################
def on_pushButton_En_clicked(self): # registration
global document_
global object_Label
global object_Name
global typeObject
global element_
global position0
global position1
global position2
global longueurObjet
global rayonObjet
global perimetre
global Plan_xy_V
global Plan_yz_V
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 unitePs
global boundBoxCenterX
global boundBoxCenterY
global boundBoxCenterZ
global CenterOfMassX
global CenterOfMassY
global CenterOfMassZ
global boundBoxLX
global boundBoxLY
global boundBoxLZ
global Vertx
global Edges
global EdgesLong
global Faces
global FacesSurf
global FacesCoor
global compt_E
global compt_F
global compt_VF
global RowCountTest
global path
global SaveName
global ESCAPE
global directionObj
global direcValueAt
global Matrix_1
global Matrix_2
global Matrix_3
global Matrix12
global Matrix13
global Matrix14
global Matrix15
global DeterminantM
global MatrixX1_16
global MatrixY1_16
global MatrixZ1_16
global MatrixX2_16
global MatrixY2_16
global MatrixZ2_16
global MatrixX3_16
global MatrixY3_16
global MatrixZ3_16
global MatrixX1_17
global MatrixY1_17
global MatrixZ1_17
global MatrixX2_17
global MatrixY2_17
global MatrixZ2_17
global MatrixX3_17
global MatrixY3_17
global MatrixZ3_17
global typeLongueur
SaveName = ""
# SaveName, Filter = PySide.QtGui.QFileDialog.getSaveFileName(None, "Save a file FCInfo", path, "*.FCInfo") # PySide
SaveName, Filter = PySide.QtGui.QFileDialog.getSaveFileName(None, "Save a file FCInfo", path, "*.FCInfo *.csv *.asc *.txt;;FCInfo (*.FCInfo);;Cvs (*.csv);;Ascii (*.asc);;TXT (*.txt)") # PySide
if SaveName == "":
App.Console.PrintMessage("Process aborted"+"\n")
errorDialog("Process aborted")
else:
App.Console.PrintMessage("Registration of "+SaveName+"\n")
try:
f = open(SaveName, 'w') # write
f.write(iso8859("Info on the element\n"))
f.write(iso8859("___________________\n"))
f.write(iso8859(dateUs() + " "+ heure() + "\n\n"))
f.write(iso8859("Name of the document :" + ESCAPE + document_ + "\n"))
f.write(iso8859("Label Name :" + ESCAPE + object_Label + "\n"))
f.write(iso8859("Internal Name :" + ESCAPE + object_Name + "\n"))
f.write(iso8859("Name of the element :" + ESCAPE + str(element_) + "\n"))
f.write(iso8859("Object type :" + ESCAPE + typeObject + "\n"))
f.write(iso8859("Mouse coordinates :" + ESCAPE + " X:" + ESCAPE + str(position0 * uniteM) + ESCAPE + uniteMs + ESCAPE + " Y:" + ESCAPE + str(position1 * uniteM) + ESCAPE + uniteMs + ESCAPE + " Z:" + ESCAPE + str(position2 * uniteM) + ESCAPE + uniteMs + "\n"))
f.write(iso8859(typeLongueur + " :" + ESCAPE + str(longueurObjet * uniteM) + ESCAPE + uniteMs + "\n"))
if rayonObjet != 0.0:
f.write(iso8859("Radius :" + ESCAPE + str(rayonObjet * uniteM) + ESCAPE + uniteMs + "\n") )
f.write(iso8859("Perimeter of the shape :" + ESCAPE + str(perimetre * uniteM) + ESCAPE + uniteMs + "\n\n"))
if self.GBox_004_SpreadSheet.isChecked():
f.write(iso8859("Vertexes and details :" + ESCAPE + " Number Edges :" + ESCAPE + str(compt_E) + ESCAPE + " Number Faces :" + ESCAPE + str(compt_F) + ESCAPE + " Number Vertexes faces :" + ESCAPE + str(compt_VF) + ESCAPE + " Detail Total :" + ESCAPE + str(RowCountTest) + "\n\n"))
co = 0
aa = 0
for j in enumerate(Edges):
f.write(str(j[1]) + ESCAPE +iso8859(str(float(EdgesLong[co]) * float(uniteM)) + ESCAPE + uniteMs + ESCAPE))#"\n"
co+=1
for a in range(aa,aa+6):
try:
chaine = str(Vertx[a]).split(":")
f.write(chaine[0] + ESCAPE + iso8859(str(float(chaine[1]) * float(uniteM))) + ESCAPE + uniteMs + ESCAPE)
except Exception:
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]) + ESCAPE + iso8859(str(float(FacesSurf[co]) * float(uniteS)) + ESCAPE + uniteSs + "\n"))
co += 1
for jj in range(cco,len(FacesCoor)):# Faces coordinates
cco+=1
if FacesCoor[jj] == "T":
f.write("\n")
break
else:
chaine = str(FacesCoor[jj]).split(":")
f.write(iso8859(chaine[0] + ESCAPE + str(float(chaine[1]) * float(uniteM)) + ESCAPE + uniteMs + ESCAPE))
co2 += 1
if co2 == 3:
f.write("\n")
co2 = 0
f.write("\n")
f.write(iso8859("Plan :" + ESCAPE + " XY:" + ESCAPE + self.lineEdit_8xy.text() + ESCAPE + " coordinates:" + ESCAPE + str(Plan_xy_V) + "\n"))
f.write(iso8859("Plan :" + ESCAPE + " YZ:" + ESCAPE + self.lineEdit_8yz.text() + ESCAPE + " coordinates:" + ESCAPE + str(Plan_yz_V) + "\n"))
f.write(iso8859("Plan :" + ESCAPE + " ZX:" + ESCAPE + self.lineEdit_8zx.text() + ESCAPE + " coordinates:" + ESCAPE + str(Plan_zx_V) + "\n\n"))
f.write(iso8859("The form surface :" + ESCAPE + str(surface * uniteS) + ESCAPE + uniteSs + "\n"))
f.write(iso8859("Surface of the face :" + ESCAPE + str(surfaceFace * uniteS) + ESCAPE + uniteSs + "\n\n"))
f.write(iso8859("Volume of the form :" + ESCAPE + str(volume_ * uniteV) + ESCAPE + uniteVs + "\n"))
f.write(iso8859("Weight :" + ESCAPE + str(poids) + ESCAPE + unitePs + ESCAPE + " Density:" + ESCAPE + str(densite) + "\n\n"))
f.write(iso8859("Center of the shape :" + ESCAPE + " X:" + ESCAPE + str(boundBoxCenterX * uniteM) + ESCAPE + uniteMs + ESCAPE + " Y:" + ESCAPE + str(boundBoxCenterY * uniteM) + ESCAPE + uniteMs + ESCAPE + " Z:" + ESCAPE + str(boundBoxCenterZ * uniteM) + ESCAPE + uniteMs + "\n"))
f.write(iso8859("Center of mass :" + ESCAPE + " X:" + ESCAPE + str(CenterOfMassX * uniteM) + ESCAPE + uniteMs + ESCAPE + " Y:" + ESCAPE + str(CenterOfMassY * uniteM) + ESCAPE + uniteMs + ESCAPE + " Z:" + ESCAPE + str(CenterOfMassZ * uniteM) + ESCAPE + uniteMs + "\n"))
f.write(iso8859("BoundBox :" + ESCAPE + " X:" + ESCAPE + str(boundBoxLX * uniteM) + ESCAPE + uniteMs + ESCAPE + " Y:" + ESCAPE + str(boundBoxLY * uniteM) + ESCAPE + uniteMs + ESCAPE + " Z:" + ESCAPE + str(boundBoxLZ * uniteM) + ESCAPE + uniteMs + "\n"))
f.write(iso8859("BoundBox Diagonal :" + ESCAPE + str(boundBoxDiag * uniteM) + ESCAPE + uniteMs + "\n\n"))
f.write(iso8859("Direction :" + ESCAPE + str(directionObj) + "\n"))
f.write(iso8859("ValueAt :" + ESCAPE + str(direcValueAt) + "\n\n"))
f.write(iso8859("Matrix of inertia :" + ESCAPE + uniteMs+"^5") + "\n")
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(MatrixX1_16) + ESCAPE + " Y:" + ESCAPE + str(MatrixY1_16) + ESCAPE + " Z:" + ESCAPE + str(MatrixZ1_16) + ESCAPE + " :" + ESCAPE + str(Matrix_1) + "\n"))
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(MatrixX2_16) + ESCAPE + " Y:" + ESCAPE + str(MatrixY2_16) + ESCAPE + " Z:" + ESCAPE + str(MatrixZ2_16) + ESCAPE + " :" + ESCAPE + str(Matrix_2) + "\n"))
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(MatrixX3_16) + ESCAPE + " Y:" + ESCAPE + str(MatrixY3_16) + ESCAPE + " Z:" + ESCAPE + str(MatrixZ3_16) + ESCAPE + " :" + ESCAPE + str(Matrix_3) + "\n"))
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(Matrix12) + ESCAPE + " Y:" + ESCAPE + str(Matrix13) + ESCAPE + " Z:" + ESCAPE + str(Matrix14) + ESCAPE + " :" + ESCAPE + str(Matrix15) + "\n\n"))
f.write(iso8859("Matrix inertia with mass :" + ESCAPE + unitePs + uniteSs) + "\n")
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(MatrixX1_17) + ESCAPE + " Y:" + ESCAPE + str(MatrixY1_17) + ESCAPE + " Z:" + ESCAPE + str(MatrixZ1_17) + "\n"))
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(MatrixX2_17) + ESCAPE + " Y:" + ESCAPE + str(MatrixY2_17) + ESCAPE + " Z:" + ESCAPE + str(MatrixZ2_17) + "\n"))
f.write(iso8859(" :" + ESCAPE + " X:" + ESCAPE + str(MatrixX3_17) + ESCAPE + " Y:" + ESCAPE + str(MatrixY3_17) + ESCAPE + " Z:" + ESCAPE + str(MatrixZ3_17) + "\n\n"))
f.write(iso8859("Matrix Determinant :" + ESCAPE + str(DeterminantM) + "\n"))
f.write(iso8859("Determinant decimal :" + ESCAPE + str(decimal.Decimal(DeterminantM))+"\n\n"))
f.close()
except Exception:
App.Console.PrintMessage("Error writing file "+SaveName+"\n")
errorDialog("Error writing file "+SaveName)
def on_pushButton_Ra_clicked(self): # clicked() pressed(), released() Bouton radian/degrés
global uniteAs
global Plan_xy
global Plan_yz
global Plan_zx
Plan_xy2 = 0.0
Plan_yz2 = 0.0
Plan_zx2 = 0.0
choice = self.pushButton_Ra.text()
# ori 0.18 Py 27 choice = choice.encode('utf-8') # PySide
if choice == "Degree":
uniteAs = ""
self.pushButton_Ra.setText("DegMinSec")
self.lineEdit_8xy.setText(degMinSec(Plan_xy))
self.lineEdit_8yz.setText(degMinSec(Plan_yz))
self.lineEdit_8zx.setText(degMinSec(Plan_zx))
elif choice == "DegMinSec":
uniteAs = " rad"
self.pushButton_Ra.setText("Radian")
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 choice == "Radian":
uniteAs = " gon"
self.pushButton_Ra.setText("Grade")
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 choice == "Grade":
uniteAs = u"%"
self.pushButton_Ra.setText("Percent")
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 choice == "Percent":
uniteAs = u"°"
try:
self.pushButton_Ra.setText("Degree")
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 Exception:
None
def on_CB_01_ClipBoard(self):
global switchClipBoard
if switchClipBoard == 0:
switchClipBoard = 1
else:
switchClipBoard = 0
def on_CB_02_Point(self):
global switchPoint
if switchPoint == 0:
switchPoint = 1
else:
switchPoint = 0
def on_CB_03_Axis(self):
global switchAxis
if switchAxis == 0:
switchAxis = 1
else:
switchAxis = 0
def on_CB_04_Plane(self):
global switchPlane
if switchPlane == 0:
switchPlane = 1
else:
switchPlane = 0
def on_CB_05_Info(self):
global InfoReportView
if InfoReportView == 0:
InfoReportView = 1
else:
InfoReportView = 0
def on_CB_05_Position(self):
global FCmw
global testing
if testing != 1:
if self.CB_05_Position.isChecked():
FCmw.addDockWidget(QtCore.Qt.LeftDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window Left
else:
FCmw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewFreeCADWidget)# add the widget to the main window Right
def on_pushButton02_clicked(self): # Exit button
global InfoReportView
global testing
if testing == 1: # MainWindow
FreeCADGui.Selection.removeObserver(s) # Uninstalls resident function (desactivated for read after LeftDock RightDock)
App.Console.PrintMessage("End FCInfo\r\n")
self.CB_05_Info.setChecked(False)
InfoReportView = 0
self.window.hide()
#########################################################################################################################
class SelObserver:
def addSelection(self,document, object, element, position): # Selection
global ui
global sel
global document_
global object_Label
global element_
global position0
global position1
global position2
global switchInertia
if switchInertia == 0: # for create plane without refresh
sel = FreeCADGui.Selection.getSelection()
document_ = document
object_Label = object
element_ = element
position0 = (position[0])
position1 = (position[1])
position2 = (position[2])
if len(sel)==0:
App.Console.PrintMessage("Select an object"+"\n")
errorDialog("Select an object")
else:
ui.on_pushButton_Raf_clicked()
#########################################################################################################################
sel = FreeCADGui.Selection.getSelection()
s=SelObserver()
FreeCADGui.Selection.addObserver(s) # install the function resident mode
mw = FreeCADGui.getMainWindow()
dw=mw.findChildren(QtGui.QDockWidget)
for i in dw:
if str(i.objectName()) == __title__:
if i.isVisible():
i.setVisible(False)
else:
if testing == 1: # MainWindow
None
else:
myNewFreeCADWidget = QtGui.QDockWidget() # create (restore) a new dockwidget
myNewFreeCADWidget.setObjectName(__title__)
ui = Ui_MainWindow()
ui.setupUi(myNewFreeCADWidget)
FCmw = FreeCADGui.getMainWindow()
i.setVisible(True)
break
if i.objectName() != __title__: # macro internal Name
#####MainWindow################################################################################
#
if testing == 1: # MainWindow
MainWindow = QtGui.QMainWindow() # create a new window volant
MainWindow.setObjectName(__title__) # macro internal Name
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
#####DockWidget################################################################################
#
else:
myNewFreeCADWidget = QtGui.QDockWidget() # create a new dockwidget
myNewFreeCADWidget.setObjectName(__title__)
ui = Ui_MainWindow()
ui.setupUi(myNewFreeCADWidget)
FCmw = FreeCADGui.getMainWindow()
if testing == 2: # RightDock
FCmw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window Right
else: # LeftDock
FCmw.addDockWidget(QtCore.Qt.LeftDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window Left
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment