-
-
Save mario52a/8d40ab6c018c2bde678f to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
""" | |
*************************************************************************** | |
* Copyright (c) <mario52> 2014 2015 2016 2017 2018 2019 2020 2021 2022 * | |
* 2023 2024 * | |
* 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" | |
# other: Momentof Interia - FCInfo macro: https://forum.freecad.org/viewtopic.php?t=64653 | |
# 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 ver "01.21-rmu" rmu change fixed positions to qt layouts grid.addWidget() by rmu75 see the rmu75 fork "https://gist.github.com/rmu75/b165147bd1c2f2659c014103793ae1d8" | |
# 07/11/2019 ver "01.21-3-rmu" replace character micro = "U", square = "2", cube = "3", degrees = " deg" see "https://forum.freecadweb.org/viewtopic.php?f=3&t=6005&start=70#p345819" | |
# 12/11/2020 ver "01.22-rmu" replace self window(hide) by "self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)" | |
# 18/11/2021 ver "01.23 rmu" ajout icones, RB clipBoard, Decimal, Hauteur texte, compatible Sketcher editeur ouvert | |
# 25/11/2021 ver "01.23cb rmu" delete "import Sketcher * " create conflict with open(OpenName, "r") ?? | |
# 02/12/2021 ver "01.24 rmu" add adjustedGlobalPlacement(,), boundbox tracing | |
# 10/12/2021 ver "01.25 rmu" PySide2 and add comboBox materials | |
# 11/12/2021 ver "01.25b, 12/12/2021 ver "01.25c, 13/12/2021 ver "01.25d, 2021/12/27 ver "1.25e" | |
# 2022/02/06 ver "1.26" Mesh, Points, Couleurs, 2022/02/20 ver 1.26b upgrade BSPline, 2022/04/19 ver 1.26c upgrade BSpline error with Gear Bspline=Line | |
# 2023/06/24 ver "1.27" optimize styleSheet and litle bug | |
# 2023/09/01 ver "1.28" modify variable name, possibility hidden each sector, save data spreadSheet in document, surface radius, add button webWiki and webForum | |
# 2024/05/06 ver "1.29" port to PySide6 by sylvainbx https://gist.github.com/sylvainbx/af09a30be3e1427de56305825331fb29 | |
# 2024/05/10 ver "1.29b" PySide2 modify Inertia " MatrixX1*uniteM to (MatrixX1*uniteM) " and adding spinBox inertia | |
#https://forum.freecad.org/viewtopic.php?p=713935#p713935 # Moment of inertias calculation | |
#https://forum.freecad.org/viewtopic.php?t=64653 # Momentof Interia - FCInfo macro | |
# | |
#OS: Windows 10 build 19045 | |
#Word size of FreeCAD: 64-bit | |
#Version: 0.22.0dev.37100 (Git) | |
#Build type: Release | |
#Branch: main | |
#Hash: ede6c811fd39d68a44949601f2eb7ecc8a67fdb7 | |
#Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2 | |
#Locale: French/Mars (fr_MA) | |
# | |
__Title__ = "FCInfo" | |
__Author__ = "Mario52" | |
__Url__ = "https://gist.github.com/mario52a/8d40ab6c018c2bde678f" | |
__Version__ = "1.29b" | |
__Date__ = "2024/05/10" | |
__Comment__ = "gives different information about the selected object with the possibility of saving information" | |
__Forum1__ = "http://forum.freecadweb.org/viewtopic.php?f=10&t=3185" | |
__Forum2__ = "https://forum.freecadweb.org/viewtopic.php?f=3&t=6005" | |
__Wiki__ = "https://www.freecadweb.org/wiki/Macro_FCInfo" | |
__Gist__ = "https://gist.github.com/mario52a/6afc64081c4eb8be3b93" | |
__IconL__ = "" | |
__IconW__ = "" | |
__Help__ = "Start the macro select an object and read the info displayed" | |
__Status__ = "stable" | |
__Requires__ = "freecad 0.19 and more" | |
__Communication__ = "http://forum.freecadweb.org/viewtopic.php?f=10&t=3185" | |
# | |
import PySide2 | |
from PySide2 import QtGui , QtCore, QtWidgets | |
from PySide2.QtWidgets import QComboBox | |
from PySide2.QtWidgets import QMessageBox | |
from PySide2.QtWidgets import QTableWidget, QApplication | |
from PySide2.QtGui import * | |
from PySide2.QtCore import * | |
from PySide2.QtWidgets import * | |
#import PySide2.QtXml | |
import os | |
import platform | |
import Draft, Part, FreeCAD, PartGui, FreeCADGui | |
import FreeCAD as App | |
import FreeCADGui as Gui | |
from FreeCAD import Base | |
import Sketcher | |
import Points | |
import Mesh | |
import pivy | |
from pivy import coin | |
import Spreadsheet | |
import math | |
import decimal | |
from math import sqrt, pi, sin, cos, asin, acos, atan, atan2, degrees, radians, tan | |
import csv | |
import codecs | |
import sys | |
import copy # pour copier 2 tableaux | |
import re | |
####path######################################################################### | |
global path ; path = "" # | |
#path = FreeCAD.ConfigGet(u"AppHomePath") # path FreeCAD installation | |
#path = FreeCAD.ConfigGet(u"UserAppData") # path FreeCAD User data | |
#path = "your path" # your directory path | |
param = FreeCAD.ParamGet(u"User parameter:BaseApp/Preferences/Macro")# macro path | |
path = param.GetString(u"MacroPath","") + "/" # macro path | |
path = path.replace(u"\\","/") # convert the "\" to "/" | |
#print( u"Path for the icons : " , path ) # | |
################################################################################# | |
try: | |
import webbrowser | |
except Exception: | |
None | |
#### Detect version macro ########################################### #22/03/2021 | |
try: | |
import urllib | |
from urllib import request | |
except Exception: | |
None | |
#### Detect version macro ########################################### #22/03/2021 | |
def versionSearch(): | |
try: | |
contentPage = request.urlopen(u"https://wiki.freecadweb.org/Macro_" + __Title__).readlines() | |
versionDetect = dateDetect = "" | |
effacer = 0 | |
for i in contentPage: | |
if "ctEven macro-version" in str(i): | |
versionDetect = str((str(i).split(">")[1])) | |
versionDetect = versionDetect.split("\\")[0] | |
if "ctEven macro-date" in str(i): | |
dateDetect = str((str(i).split(">")[1])) | |
dateDetect = dateDetect.split("\\")[0] | |
if (versionDetect != "") and (dateDetect != ""): | |
break | |
try: | |
if (versionDetect == __Version__) and (dateDetect == __Date__): | |
None | |
else: | |
msg = (u"New version availlable : " + "\n" + | |
str(versionDetect) + ":" + str(dateDetect) + "\n" + | |
"You can install with AddonManager" + "\n" + | |
"For desactivate this Info window go to " + "\n" + | |
"parameter:BaseApp/Preferences/Macros/FCMmacros/FCInfo " + "\n" + | |
"set the [ switchVersionSearch ] parameter to False") | |
App.Console.PrintMessage(u"your actual version : " + str(__Version__) + " : " + str(__Date__) + "\n") | |
App.Console.PrintMessage(u"new version availlable : " + str(versionDetect) + " : " + str(dateDetect) + "\n") | |
diag = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information, 'New Version', msg) | |
diag.setWindowModality(QtCore.Qt.ApplicationModal) | |
diag.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint) # PySide2 cette fonction met la fenetre en avant | |
diag.exec_() | |
except Exception: | |
None | |
return versionDetect, dateDetect | |
except Exception: | |
App_Console_PrintError(u"Not search version not connected for testing or internal error" + "\n") | |
global FreeCAD_ParamGetSet ; FreeCAD_ParamGetSet = FreeCAD.ParamGet(u"User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__) # FreeCAD_ParamGetSet | |
global switchVersionSearch; switchVersionSearch = 0 # Search version switchable in | |
# Tools/Edit parameter/BaseApp/Preferences/Macros/FCMmacros/FCCircularText | |
switchVersionSearch = FreeCAD_ParamGetSet.GetBool(u"switchVersionSearch") | |
FreeCAD_ParamGetSet.SetBool(u"switchVersionSearch", switchVersionSearch) #*True or False | |
if switchVersionSearch == 1: | |
versionSearch() | |
#### Detect version macro ########################################### | |
try: | |
_fromUtf8 = QtCore.QString.fromUtf8 | |
except AttributeError: | |
def _fromUtf8(s): | |
return s | |
try: | |
_encoding = QtWidgets.QApplication.UnicodeUTF8 | |
def _translate(context, text, disambig): | |
return QtWidgets.QApplication.translate(context, text, disambig, _encoding) | |
except AttributeError: | |
def _translate(context, text, disambig): | |
return QtWidgets.QApplication.translate(context, text, disambig) | |
#################################################################################### | |
def iso8859(encoder): | |
# ori 0.18 Py 27 return unicode(encoder).encode('iso-8859-1') | |
verPython = sys.version_info | |
if int(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 Around(a) : | |
global seTDecimalValue | |
if seTDecimalValue == -1: | |
seTDecimalValue = 1000 | |
ard = round(a, seTDecimalValue) | |
return ard | |
global uniteAs ; uniteAs = " deg" # HTML: ° | |
def degMinSec(angle0): | |
# give the angle in degrees | |
global uniteAs | |
try: | |
deg = int(angle0) | |
min = int((angle0 - deg)*60) | |
sec = Around((((angle0 - deg)*60)-min)*60) | |
angle = str(deg)+" deg"+" "+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) | |
return angle | |
except Exception: | |
return 0 | |
def anglePourcent(angle0): | |
# give the angle in degrees | |
global uniteAs | |
#angle0 = round(abs(angle0)) | |
angle0 = 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)) | |
angle = abs(tan(radians(angle0))*100) | |
uniteAs = u"%" | |
#return round(angle,6) | |
return angle | |
except Exception: | |
return 0.0 | |
def angle2(vecteur_x1, vecteur_y1, vecteur_x2, vecteur_y2, modeTypeAngle): | |
# calculation of the slope of a line using two vectors | |
# If 'modeTypeAngle' = 1 then display in degrees else in radians | |
global uniteAs | |
try: | |
deltaX = vecteur_x2 - vecteur_x1 | |
deltaY = vecteur_y2 - vecteur_y1 | |
if modeTypeAngle == 1: | |
angle = degrees(atan2(float(deltaY),float(deltaX))) # degrees | |
uniteAs = " deg" | |
else: | |
angle = atan2(float(deltaY),float(deltaX)) # radian | |
uniteAs = " rad" | |
#return round(angle,6) | |
return angle | |
except Exception: | |
return 0 | |
#### Configuration begin ################################################ | |
#### NOT MODIFY THE CODE HERE #### | |
#### for modify : go to : FreeCAD >Menu >Tools >Edit parameters... >BaseApp/Preferences/Macros/FCMmacros/FCInfo #### | |
## | |
FreeCAD_ParamGetSet.SetString(u"Version", __Version__ + " (" + __Date__ + ")") | |
## | |
global switchNotInfoOnBeginning # switchNotInfoOnBeginnin = 0 # display or not the inf on beginning run macro False | |
switchNotInfoOnBeginning = FreeCAD_ParamGetSet.GetBool(u"switchNotInfoOnBeginning") | |
FreeCAD_ParamGetSet.SetBool(u"switchNotInfoOnBeginning", switchNotInfoOnBeginning) #*True or False | |
## | |
global switchWarning # display or not the little window "Warning Error Selection" | |
switchWarning = FreeCAD_ParamGetSet.GetBool(u"switchWarning") | |
FreeCAD_ParamGetSet.SetBool(u"switchWarning", switchWarning) #*True or False | |
#Config | |
global switchCreatePoint #; switchCreatePoint = 0 # for point False | |
switchCreatePoint = FreeCAD_ParamGetSet.GetBool(u"switchCreatePoint") | |
## | |
global switchCreateAxis #; switchCreateAxis = 1 # for axis True | |
switchCreateAxis = FreeCAD_ParamGetSet.GetBool(u"switchCreateAxis") | |
## | |
global switchCreatePlane #; switchCreatePlane = 1 # for plane True | |
switchCreatePlane = FreeCAD_ParamGetSet.GetBool(u"switchCreatePlane") | |
## | |
global switchDisplayInfoObject #; switchDisplayInfoObject = 0 # | |
switchDisplayInfoObject = FreeCAD_ParamGetSet.GetBool(u"switchDisplayInfoObject") | |
FreeCAD_ParamGetSet.SetBool(u"switchDisplayInfoObject", switchDisplayInfoObject) #*True or False | |
## | |
global switchDisplayErrorInfo #; switchDisplayErrorInfo = 0 # | |
switchDisplayErrorInfo = FreeCAD_ParamGetSet.GetBool(u"switchDisplayErrorInfo") | |
FreeCAD_ParamGetSet.SetBool(u"switchDisplayErrorInfo", switchDisplayErrorInfo) #*True or False | |
## | |
global switchClearDisplayReportView #; switchClearDisplayReportView = 0 # | |
switchClearDisplayReportView = FreeCAD_ParamGetSet.GetBool(u"switchClearDisplayReportView") | |
FreeCAD_ParamGetSet.SetBool(u"switchClearDisplayReportView", switchClearDisplayReportView) #*True or False | |
## | |
global seTWidgetPosition #; seTWidgetPosition = 0 # position the widget Left or Right | |
seTWidgetPosition = FreeCAD_ParamGetSet.GetBool(u"seTWidgetPosition") # True or False | |
FreeCAD_ParamGetSet.SetBool(u"seTWidgetPosition", seTWidgetPosition) | |
## | |
global switchBoundBoxCreateText #; switchBoundBoxCreateText = 0 # | |
switchBoundBoxCreateText = FreeCAD_ParamGetSet.GetBool(u"switchBoundBoxCreateText") | |
## | |
global seTBoundBoxTextHeigth #; seTBoundBoxTextHeigth = 3.0 # | |
seTBoundBoxTextHeigth = FreeCAD_ParamGetSet.GetFloat(u"seTBoundBoxTextHeigth") | |
if seTBoundBoxTextHeigth == 0: seTBoundBoxTextHeigth = 3.0 | |
## | |
global seTBoundBoxTextArround #; seTBoundBoxTextArround = 3 # | |
seTBoundBoxTextArround = FreeCAD_ParamGetSet.GetInt(u"seTBoundBoxTextArround") | |
if seTBoundBoxTextArround == 0: seTBoundBoxTextArround = 3 | |
FreeCAD_ParamGetSet.SetInt(u"seTBoundBoxTextArround", seTBoundBoxTextArround) # 3 | |
## | |
global seTBoundBoxDisplayModeText #; seTBoundBoxDisplayModeText = str(u"Screen") # available : u"Screen" or u"World" | |
seTBoundBoxDisplayModeText = FreeCAD_ParamGetSet.GetString(u"seTBoundBoxDisplayModeText") | |
if seTBoundBoxDisplayModeText == "": seTBoundBoxDisplayModeText = str(u"Screen") | |
FreeCAD_ParamGetSet.SetString(u"seTBoundBoxDisplayModeText", seTBoundBoxDisplayModeText) | |
## | |
global seTBoundBoxJustificationText #; seTBoundBoxJustificationText = str(u"Center") # available : "Center" or "Left" or "Right" | |
seTBoundBoxJustificationText = FreeCAD_ParamGetSet.GetString(u"seTBoundBoxJustificationText") | |
if seTBoundBoxJustificationText == "": seTBoundBoxJustificationText = str(u"Center") | |
FreeCAD_ParamGetSet.SetString(u"seTBoundBoxJustificationText", seTBoundBoxJustificationText) | |
## | |
global seTMemoClipBoard #; seTMemoClipBoard = 0 # seT format du memo 0=None ou 1=F...CAD(1,1,1) ou 2=1,1,1 ou 3=1 1 1 | |
seTMemoClipBoard = FreeCAD_ParamGetSet.GetInt(u"seTMemoClipBoard") | |
## | |
global seTTextHeigthValue #; seTTextHeigthValue = 11 # heigth Text value | |
seTTextHeigthValue = FreeCAD_ParamGetSet.GetInt(u"seTTextHeigthValue") | |
if seTTextHeigthValue == 0: seTTextHeigthValue = 11 | |
## | |
global seTDecimalValue #; seTDecimalValue = 4 # number of decimal value | |
seTDecimalValue = FreeCAD_ParamGetSet.GetInt(u"seTDecimalValue") | |
if seTDecimalValue == 0: seTDecimalValue = 4 | |
## | |
global seTMaterialCurrentIndex #; seTMaterialCurrentIndex = ? # index materiel | |
seTMaterialCurrentIndex = FreeCAD_ParamGetSet.GetInt(u"seTMaterialCurrentIndex") | |
## | |
global seTMaterialFileName #; seTMaterialFileName = u"FCInfo_material.txt" or other | |
seTMaterialFileName = FreeCAD_ParamGetSet.GetString(u"seTMaterialFileName") | |
if seTMaterialFileName == "": seTMaterialFileName = u"FCInfo_material.txt" | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialFileName", seTMaterialFileName) #*"FCInfo_material.txt" | |
## | |
#### new version since 1.25f separate path and name of file more logic 28/01/2022 the parameter/Preferences is not compatible "you must delete the name file and extension in preferences" | |
global seTMaterialReadPathName #; seTMaterialReadPathName = path | |
global seTMaterialSavePathName #; seTMaterialSavePathName = path | |
seTMaterialSavePathName = FreeCAD_ParamGetSet.GetString(u"seTMaterialSavePathName") | |
if seTMaterialSavePathName == "": seTMaterialSavePathName = path | |
seTMaterialSavePathName = os.path.dirname(seTMaterialSavePathName) + "/" # = C:/Provisoire400/ | |
seTMaterialReadPathName = seTMaterialSavePathName | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialSavePathName", seTMaterialSavePathName) #*"C:\...\Macro\" | |
## | |
global seTMaterialPrice #; seTMaterialPrice = 1.0 # price | |
seTMaterialPrice = FreeCAD_ParamGetSet.GetFloat(u"seTMaterialPrice") | |
if seTMaterialPrice == 0: seTMaterialPrice = 0.0 | |
## | |
global seTMaterialSuffixDevise #; seTMaterialSuffixDevise = " Eu # Suffix Devise | |
seTMaterialSuffixDevise = FreeCAD_ParamGetSet.GetString(u"seTMaterialSuffixDevise") | |
if seTMaterialSuffixDevise == "": seTMaterialSuffixDevise = " Eu (by Kg)" | |
## | |
global seTMaterialSuffixCost #; seTMaterialSuffixCost = " Eu # Suffix Cost | |
seTMaterialSuffixCost = FreeCAD_ParamGetSet.GetString(u"seTMaterialSuffixCost") | |
if seTMaterialSuffixCost == "": seTMaterialSuffixCost = " Eu" | |
## | |
global seTMaterialCost #; seTMaterialCost = 1.0 # (by Kg) | |
seTMaterialCost = FreeCAD_ParamGetSet.GetFloat(u"seTMaterialCost") | |
if seTMaterialCost == 0: seTMaterialCost = 1.0 | |
## | |
global seTDensiteValue #; seTDensiteValue = 1.0 # (steel = 7,32 to 7,86 kg by dm3) | |
seTDensiteValue = FreeCAD_ParamGetSet.GetFloat(u"seTDensiteValue") | |
if seTDensiteValue == 0: seTDensiteValue = 1.0 | |
FreeCAD_ParamGetSet.SetFloat(u"seTDensiteValue", seTDensiteValue) | |
## | |
global seTDensiteDecimalNumber #; seTDensiteDecimalNumber = 4 # number of decimal value | |
seTDensiteDecimalNumber = FreeCAD_ParamGetSet.GetInt(u"seTDensiteDecimalNumber") | |
if seTDensiteDecimalNumber == 0: seTDensiteDecimalNumber = 4 | |
FreeCAD_ParamGetSet.SetInt(u"seTDensiteDecimalNumber", seTDensiteDecimalNumber) #*4 | |
## | |
global seTDensiteSingleStep #; seTDensiteSingleStep = 1.0 # increse step | |
seTDensiteSingleStep = FreeCAD_ParamGetSet.GetFloat(u"seTDensiteSingleStep") | |
if seTDensiteSingleStep == 0: seTDensiteSingleStep = 1.0 | |
FreeCAD_ParamGetSet.SetFloat(u"seTDensiteSingleStep", seTDensiteSingleStep) #*1.0 | |
## | |
global seTIndexUnitWeight ; seTIndexUnitWeight = 0 # item Poids | |
#seTIndexUnitWeight = FreeCAD_ParamGetSet.GetInt(u"seTIndexUnitWeight") | |
## | |
global seTIndexUnitLength ; seTIndexUnitLength = 0 # item Longueur | |
#seTIndexUnitLength = FreeCAD_ParamGetSet.GetInt(u"seTIndexUnitLength") | |
## | |
global seTPositionFlyRightLeft #; seTPositionFlyRightLeft = 2 # 1 = fly, 2 = RightDock other= LeftDock | |
seTPositionFlyRightLeft = FreeCAD_ParamGetSet.GetInt(u"seTPositionFlyRightLeft") | |
if seTPositionFlyRightLeft == 0: seTPositionFlyRightLeft = 2 # 1 , 2, other | |
## | |
global seTUnitSymbolMicro #; seTUnitSymbolMicro = u"U" # micro hex="\xB5", html=<span>µ</span> | |
seTUnitSymbolMicro = FreeCAD_ParamGetSet.GetString(u"seTUnitSymbolMicro") | |
if seTUnitSymbolMicro == "": seTUnitSymbolMicro = "U" | |
FreeCAD_ParamGetSet.SetString(u"seTUnitSymbolMicro", seTUnitSymbolMicro) #*"U" | |
## | |
global seTUnitSymbolCube #; seTUnitSymbolCube = u"3" # cube hex="\xb3", html=<span>³</span> | |
seTUnitSymbolCube = FreeCAD_ParamGetSet.GetString(u"seTUnitSymbolCube") | |
if seTUnitSymbolCube == "": seTUnitSymbolCube = "3" | |
FreeCAD_ParamGetSet.SetString(u"seTUnitSymbolCube", seTUnitSymbolCube) #*"3" | |
## | |
global seTDensiteSuffixChain #; seTDensiteSuffixChain = kg # Suffix (by dm3) | |
seTDensiteSuffixChain = FreeCAD_ParamGetSet.GetString(u"seTDensiteSuffixChain") | |
if seTDensiteSuffixChain == "": seTDensiteSuffixChain = " kg (by dm)" + seTUnitSymbolCube | |
FreeCAD_ParamGetSet.SetString(u"seTDensiteSuffixChain", seTDensiteSuffixChain) #*" kg (by dm3)" | |
## | |
global seTUnitSymbolCarre #; seTUnitSymbolCarre = u"2" # carre hex="\xb2", html=<span>²</span> | |
seTUnitSymbolCarre = FreeCAD_ParamGetSet.GetString(u"seTUnitSymbolCarre") | |
if seTUnitSymbolCarre == "": seTUnitSymbolCarre = "2" | |
FreeCAD_ParamGetSet.SetString(u"seTUnitSymbolCarre", seTUnitSymbolCarre) #*"2" | |
## | |
global switchQFileDialogMint # special LinuxMint | |
switchQFileDialogMint = FreeCAD_ParamGetSet.GetBool("switchQFileDialogMint") | |
if switchQFileDialogMint == 0: | |
FreeCAD_ParamGetSet.SetBool("switchQFileDialogMint", switchQFileDialogMint) | |
try: | |
if platform.node() == "mint": | |
switchQFileDialogMint = 1 | |
FreeCAD_ParamGetSet.SetBool("switchQFileDialogMint", switchQFileDialogMint) #*Special Mint | |
except Exception: | |
None | |
## | |
global setPathLatestDirectory #; setPathLatestDirectory = "C:\ ???" | |
setPathLatestDirectory = FreeCAD_ParamGetSet.GetString(u"setPathLatestDirectory") | |
if setPathLatestDirectory == "": setPathLatestDirectory = path | |
FreeCAD_ParamGetSet.SetString(u"setPathLatestDirectory", setPathLatestDirectory) #*"C:\ ???" | |
## | |
global setBSplineToByArcValue #; setBSplineToByArcValue = 0.00001 | |
setBSplineToByArcValue = FreeCAD_ParamGetSet.GetFloat(u"setBSplineToByArcValue") | |
if setBSplineToByArcValue == 0.0: setBSplineToByArcValue = 0.00001 | |
FreeCAD_ParamGetSet.SetFloat(u"setBSplineToByArcValue", setBSplineToByArcValue) #*0.00001 | |
global BSplinetoByArcValeurS # string pour afficher en "0.00001" pas en 1.e5 | |
BSplinetoByArcValeurS = str("%.12f" % setBSplineToByArcValue) | |
BSplinetoByArcValeurS = str(BSplinetoByArcValeurS.rstrip('0')) | |
## | |
global setMeshTopologyValue #; setMeshTopologyValue = 0.1 | |
setMeshTopologyValue = FreeCAD_ParamGetSet.GetFloat(u"setMeshTopologyValue") | |
if setMeshTopologyValue == 0.0: setMeshTopologyValue = 0.1 | |
FreeCAD_ParamGetSet.SetFloat(u"setMeshTopologyValue", setMeshTopologyValue) #*0.1 | |
## | |
global switchBSplineCreateCircleConstructorAxis#; switchBSplineCreateCircleConstructorAxis = 0 # for create points with toByArcs() | |
switchBSplineCreateCircleConstructorAxis = FreeCAD_ParamGetSet.GetBool(u"switchBSplineCreateCircleConstructorAxis") | |
FreeCAD_ParamGetSet.SetBool(u"switchBSplineCreateCircleConstructorAxis", switchBSplineCreateCircleConstructorAxis)#*True or False | |
## | |
global switchBSplineCreateCircleConstructor #; switchBSplineCreateCircleConstructor = 0 # for create circles with toByArcs() | |
switchBSplineCreateCircleConstructor = FreeCAD_ParamGetSet.GetBool(u"switchBSplineCreateCircleConstructor") | |
FreeCAD_ParamGetSet.SetBool(u"switchBSplineCreateCircleConstructor", switchBSplineCreateCircleConstructor) #*True or False | |
## | |
global switchCreateLineDiVatNatOnClick #; switchCreateLineDiVatNatOnClick = 0 # for position line on click mouse | |
switchCreateLineDiVatNatOnClick = FreeCAD_ParamGetSet.GetBool(u"switchCreateLineDiVatNatOnClick") | |
FreeCAD_ParamGetSet.SetBool(u"switchCreateLineDiVatNatOnClick", switchCreateLineDiVatNatOnClick) #*True or False | |
## | |
global setMomentOfInertia_16 #; setMomentOfInertia_16 = 1 | |
setMomentOfInertia_16 = FreeCAD_ParamGetSet.GetInt(u"setMomentOfInertia_16") | |
if setMomentOfInertia_16 == 0: setMomentOfInertia_16 = 1 | |
FreeCAD_ParamGetSet.SetInt(u"setMomentOfInertia_16", setMomentOfInertia_16) | |
## | |
global setMomentOfInertiaMassique_17 #; setMomentOfInertiaMassique_17 = 1 | |
setMomentOfInertiaMassique_17 = FreeCAD_ParamGetSet.GetInt(u"setMomentOfInertiaMassique_17") | |
if setMomentOfInertiaMassique_17 == 0: setMomentOfInertiaMassique_17 = 1 | |
FreeCAD_ParamGetSet.SetInt(u"setMomentOfInertiaMassique_17", setMomentOfInertiaMassique_17) | |
#### | |
#### section GroupBox begin | |
global switch_setVisible_GBox_001_Document # switch_setVisible_GBox_001_Document = True (1) | |
switch_setVisible_GBox_001_Document = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_001_Document", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_001_Document", switch_setVisible_GBox_001_Document) # *True or False | |
global switch_setVisible_GBox_002_Coordinate_Mouse # switch_setVisible_GBox_002_Coordinate_Mouse = True (1) | |
switch_setVisible_GBox_002_Coordinate_Mouse = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_002_Coordinate_Mouse", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_002_Coordinate_Mouse", switch_setVisible_GBox_002_Coordinate_Mouse) # *True or False | |
global switch_setVisible_GBox_003_Color # switch_setVisible_GBox_003_Color = True (1) | |
switch_setVisible_GBox_003_Color = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_003_Color", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_003_Color", switch_setVisible_GBox_003_Color) # *True or False | |
global switch_setVisible_GBox_004_Object_Mesh # switch_setVisible_GBox_004_Object_Mesh = True (1) | |
switch_setVisible_GBox_004_Object_Mesh = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_004_Object_Mesh", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_004_Object_Mesh", switch_setVisible_GBox_004_Object_Mesh) # *True or False | |
global switch_setVisible_GBox_005_Value_Unit # switch_setVisible_GBox_005_Value_Unit = True (1) | |
switch_setVisible_GBox_005_Value_Unit = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_005_Value_Unit", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_005_Value_Unit", switch_setVisible_GBox_005_Value_Unit) # *True or False | |
global switch_setVisible_GBox_006_Inclination # switch_setVisible_GBox_006_Inclination = True (1) | |
switch_setVisible_GBox_006_Inclination = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_006_Inclination", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_006_Inclination", switch_setVisible_GBox_006_Inclination) # *True or False | |
global switch_setVisible_GBox_007_Surface_and_Volume # switch_setVisible_GBox_007_Surface_and_Volume = True (1) | |
switch_setVisible_GBox_007_Surface_and_Volume = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_007_Surface_and_Volume", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_007_Surface_and_Volume", switch_setVisible_GBox_007_Surface_and_Volume) # *True or False | |
global switch_setVisible_GBox_008_Cost_And_Price # switch_setVisible_GBox_008_Cost_And_Price = True (1) | |
switch_setVisible_GBox_008_Cost_And_Price = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_008_Cost_And_Price", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_008_Cost_And_Price", switch_setVisible_GBox_008_Cost_And_Price) # *True or False | |
global switch_setVisible_GBox_009_BoundBox # switch_setVisible_GBox_009_BoundBox = True (1) | |
switch_setVisible_GBox_009_BoundBox = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_009_BoundBox", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_009_BoundBox", switch_setVisible_GBox_009_BoundBox) # *True or False | |
global switch_setVisible_GBox_010_Center_Mass # switch_setVisible_GBox_010_Center_Mass = True (1) | |
switch_setVisible_GBox_010_Center_Mass = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_010_Center_Mass", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_010_Center_Mass", switch_setVisible_GBox_010_Center_Mass) # *True or False | |
global switch_setVisible_GBox_011_Inertia # switch_setVisible_GBox_011_Inertia = True (1) | |
switch_setVisible_GBox_011_Inertia = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_011_Inertia", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_011_Inertia", switch_setVisible_GBox_011_Inertia) # *True or False | |
global switch_setVisible_GBox_012_SpreadSheet # switch_setVisible_GBox_012_SpreadSheet = True (1) | |
switch_setVisible_GBox_012_SpreadSheet = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_012_SpreadSheet", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_012_SpreadSheet", switch_setVisible_GBox_012_SpreadSheet) # *True or False | |
global switch_setVisible_GBox_013_SpreadSheet_Creation # switch_setVisible_GBox_013_SpreadSheet_Creation = True (1) | |
switch_setVisible_GBox_013_SpreadSheet_Creation = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_013_SpreadSheet_Creation", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_013_SpreadSheet_Creation", switch_setVisible_GBox_013_SpreadSheet_Creation) # *True or False | |
global switch_setVisible_GBox_014_Main_Tools # switch_setVisible_GBox_014_Main_Tools = True (1) | |
switch_setVisible_GBox_014_Main_Tools = FreeCAD_ParamGetSet.GetBool(u"switch_setVisible_GBox_014_Main_Tools", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_setVisible_GBox_014_Main_Tools", switch_setVisible_GBox_014_Main_Tools) # *True or False | |
#### section GroupBox end | |
#### | |
global switch_Set_Placeholder_Text # switch_Set_Placeholder_Text = True (1) | |
switch_Set_Placeholder_Text = FreeCAD_ParamGetSet.GetBool(u"switch_Set_Placeholder_Text", True) | |
FreeCAD_ParamGetSet.SetBool(u"switch_Set_Placeholder_Text", switch_Set_Placeholder_Text) # *True or False | |
#### Configuration end ################################################ | |
## | |
####tools after in FreeCAD.ParamGet########################################################### | |
## | |
global ui ; ui = "" # QtWidgets.QMainWindow() | |
global FCmw ; FCmw = "" # Docked RightDock LeftDock | |
global myNewFreeCADWidget; myNewFreeCADWidget = "" | |
## | |
####tools after in FreeCAD.ParamGet########################################################### | |
# | |
def App_Console_PrintMessage(textInfo): | |
global switchDisplayInfoObject | |
if switchDisplayInfoObject == 1 : | |
App.Console.PrintMessage(textInfo) | |
def App_Console_PrintError(textInfo): | |
global switchDisplayErrorInfo | |
if switchDisplayErrorInfo == 1 : | |
App.Console.PrintMessage(textInfo) | |
def errorDialog(msg): | |
global switchWarning | |
if switchWarning == 0: | |
None | |
else: | |
diag = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical,"Error Message",msg ) | |
diag.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint) # PySide2 #cette fonction met la fenetre en avant | |
#diag.setWindowModality(QtCore.Qt.ApplicationModal) # la fonction a ete desactivee pour favoriser "WindowStaysOnTopHint" | |
diag.exec_() | |
global sel ; sel = u"" | |
global document_ ; document_ = u"FCInfo" | |
global object_Label ; object_Label = u"" | |
global object_Name ; object_Name = u"" | |
global typeObject ; typeObject = u"" # ShapeType : Compound | |
global object_Type ; object_Type = u"" # Part::Feature | |
global subElemName ; subElemName = u"" | |
global RotationToEuler; RotationToEuler = u"" | |
global position0 ; position0 = 0.0 | |
global position1 ; position1 = 0.0 | |
global position2 ; position2 = 0.0 | |
global diffuseColorRF ; diffuseColorRF = 0.0 # color face Red Float 0.0 a 1.0 | |
global diffuseColorVF ; diffuseColorVF = 0.0 # color face Vert/Green Float 0.0 a 1.0 | |
global diffuseColorBF ; diffuseColorBF = 0.0 # color face Blue Float 0.0 a 1.0 | |
global diffuseColorTF ; diffuseColorTF = 0.0 # color face Transparent Float 0.0 a 1.0 | |
global transparenceFace ; transparenceFace = 0 # taux de transparence de fa face 0 a 100 Int | |
global unsignedEncodeColor; unsignedEncodeColor = "" # resultat format 25144423565 unsigned FC | |
global cols ; cols = [] | |
global colorShapeFace ; colorShapeFace = [] | |
global colorShapeLine ; colorShapeLine = [] | |
global colorShapePoint ; colorShapePoint = [] | |
global colorShapeFaceDiffuseColor; colorShapeFaceDiffuseColor = [] | |
global longueurObjet ; longueurObjet = 0.0 | |
global rayonObjet ; rayonObjet = 0.0 | |
global perimetre ; perimetre = 0.0 | |
global numberEdges ; numberEdges = 0 | |
global typeLongueur ; typeLongueur = u"Length of object " | |
global nombreArretesMesh; nombreArretesMesh = 0 | |
global nombreFacesMesh ; nombreFacesMesh = 0 | |
global nombrePointsMesh ; nombrePointsMesh = 0 | |
global Plan_xy ; Plan_xy = 0.0 | |
global Plan_xy_V ; Plan_xy_V = u"" | |
global Plan_yz ; Plan_yz = 0.0 | |
global Plan_yz_V ; Plan_yz_V = u"" | |
global Plan_zx ; Plan_zx = 0.0 | |
global Plan_zx_V ; Plan_zx_V = u"" | |
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" # micro hex="\xB5", html=<span>µ</span> | |
global uniteS ; uniteS = 1.0 # unit of measurement surface | |
global uniteSs ; uniteSs = u"mm"+seTUnitSymbolCarre # carre hex="\xb2", html=<span>²</span> | |
global uniteV ; uniteV = 1.0 # unit of measurement volume | |
global uniteVs ; uniteVs = u"mm"+seTUnitSymbolCube # cube hex="\xb3", html=<span>³</span> | |
global uniteP ; uniteP = 1.0 # unit of measure Mass | |
global unitePs ; unitePs = u"g" | |
#global uniteAs ; uniteAs = " deg" #place plus haut | |
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 = u"" | |
global BDvol ; BDvol = FreeCAD.Placement() | |
global switchBoundBoxCreateVolume ; switchBoundBoxCreateVolume = 0 # 1 = create Volume | |
global massOrGravity ; massOrGravity = " Mass " | |
global adaptWithBody ; adaptWithBody = 1 # 1 = adaptWithBody passe par adjustedGlobalPlacement() / 0 = mode normal | |
## Verify this section by person knowing the inertia position ## | |
## ONLY IF THE OBJECT IS PRESENT IN ONE BODY ## | |
## and post your knowledges in the forum tread if it is not correct ## | |
## http://forum.freecadweb.org/viewtopic.php?f=10&t=3185 ## | |
global boundBoxCenterX ; boundBoxCenterX = 0.0 | |
global boundBoxCenterY ; boundBoxCenterY = 0.0 | |
global boundBoxCenterZ ; boundBoxCenterZ = 0.0 | |
global boundBoxXMin ; boundBoxXMin = 0.0 | |
global boundBoxYMin ; boundBoxYMin = 0.0 | |
global boundBoxZMin ; boundBoxZMin = 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 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 MatrixOfInertiaRaw; MatrixOfInertiaRaw = "" | |
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 = u"" | |
global Edges ; Edges = u"" | |
global ReperEdge ; ReperEdge = 0 | |
global EdgesLong ; EdgesLong = 0.0 | |
global Faces ; Faces = u"" | |
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_ = u"" | |
global RowCount ; RowCount = 200 | |
global RowCountTest ; RowCountTest = 0 | |
global SaveName ; SaveName = u"" | |
global ESCAPE ; ESCAPE = u"\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 = "[]" | |
global direcValueAt ; direcValueAt = "[]" | |
global direcNormalAt ; direcNormalAt = "[]" | |
global typeNormalAt ; | |
if switchCreateLineDiVatNatOnClick == 0: | |
typeNormalAt = u"NormalAt(0,0)" | |
else: | |
typeNormalAt = u"*NormalAt(0,0)" | |
global switchInertia ; switchInertia = 0 # 0 = pass / 1 = stop for create plane without refresh | |
global BsplineDetect ; BsplineDetect = u"" | |
global BsplinePointsCoor ; BsplinePointsCoor = [] | |
global BsplineNombreDeNoeuds ; BsplineNombreDeNoeuds = 0 | |
global BsplineArcsRadius ; BsplineArcsRadius = [] | |
global BsplineArcsLocation ; BsplineArcsLocation = [] | |
global BsplineRayonApproximatif; BsplineRayonApproximatif = u"" | |
global BsplineCercleToolTip ; BsplineCercleToolTip = u"Bspline détecté " | |
global BsplineNumberElement ; BsplineNumberElement = 0 | |
global BsplineCutLength ; BsplineCutLength = 0.0 | |
global detected ; detected = u"" | |
global newSpreadSheetName ; newSpreadSheetName = "FCSpreadSheet" | |
global TextColorText_R ; TextColorText_R = 0.627451 # color red 1 = 255 | |
global TextColorText_G ; TextColorText_G = 0.627451 # color green 1 = 255 | |
global TextColorText_B ; TextColorText_B = 0.643137 # color blue 1 = 255 | |
global TextColorText_L ; TextColorText_L = 1.000000 # transparency 1 = 255 | |
################################################################################## | |
Macro_FCInfo_01 = [ | |
" 24 24 8 1", | |
"` c #a90d0e", | |
". c #a39697", | |
"# c #875e5e", | |
" c None", | |
"b c #e10c0d", | |
"c c #ed5f60", | |
"d c #e1a1a1", | |
"e c #8d3130", | |
" ", | |
" d.ccccdd ", | |
" .ebbccccce#d ", | |
" #bbbcd dcbb`. ", | |
" ebbbbc cbbbb# ", | |
" #bbbbbd ccbbbb. ", | |
" .bbbccbd cddcbbe ", | |
" ebbc cc d dbbb# ", | |
" d`bbd cc cd cbbe ", | |
" .bbbd dbc cc dbb`d ", | |
" cbbc cbc bbd dbbbd ", | |
" ebbc cbbd cbbd dbbbd ", | |
" ebbc cbbbccbbbd dbbbd ", | |
" #bbbd dbbbbbbbbd cbb`d ", | |
" .bbbd cbbbbbbd cbb` ", | |
" d`bbc dcbbbbd dbbb# ", | |
" #bbbc dddd dcbb`. ", | |
" d`bbbcd ddcbbb# ", | |
" .`b`bbcddddcbbbbed ", | |
" #`b```bbbb``bbe. ", | |
" .ebbbbbbbbb`#d ", | |
" d#e`````e#. ", | |
" ddddd ", | |
" "] | |
Macro_FCInfo_02 = [ | |
" 24 23 8 1", | |
"` c #4478b4", | |
". c #a4c0de", | |
"# c #7b9ac1", | |
" c None", | |
"b c #c8d0db", | |
"c c #6391c5", | |
"d c #89aad1", | |
"e c #5b80ad", | |
" bdd##ddb ", | |
" ddbbbbb.d#d b# ", | |
" d.bbbbb...b.#. bcd ", | |
" ..b..dd.bb....dc#.d ", | |
" #bc``dbbd#..ddddddd ", | |
" #e`` dcdd###dd ", | |
" .ecd# ddd##dd ", | |
" b`b.. ddd##dd ", | |
" bd bdddddd. ", | |
" b b`#c###c. ", | |
" cd###ded b ", | |
" .b...bd d ", | |
" d.d..c b# ", | |
" d....c b #c ", | |
" d.dd..cdb . d`. ", | |
" d...d###ee##ce#ee` ", | |
" ...cddccc###cceecce ", | |
" d.#b#cd#ccccccccceb ", | |
" #ebbb.ec##cccccce. ", | |
" bb bbbb.#eeeeee#b b ", | |
" bbbbbbbbb.bb b ", | |
" bbbbb ", | |
" "] | |
Macro_FCInfo_03 = [ | |
" 24 24 8 1", | |
"` c #293444", | |
". c #619ee5", | |
"# c #366ab3", | |
"a c #6f7885", | |
"b c #b7b8b8", | |
"c c #ecedec", | |
"d c #344861", | |
"e c #919aa2", | |
"bccbccbcbbaaecccbccbcbcc", | |
"ecbebbebd#aaaddcbcbebeec", | |
"bcbbbbbd.#.b..aabcbbbbbc", | |
"ebcacbda.a#a...adbbaceec", | |
"ccccce`abce#a..e#bcccccc", | |
"bccbcaacbcced...#ecbcbcc", | |
"aaadaaaadaad`a.#.ddaaecc", | |
"aabbbbeaaaaa`#.#.ddadacc", | |
"aecbbcbaa``#d.##..#d`acc", | |
"beccccb`ead..#####.adbcc", | |
"e```````da#d#ddd`d#`dacc", | |
"aacbbbedabbd##``##deeacc", | |
"aacebbedabba`##d#dabbacc", | |
"aebebbedabbee`#.dabeeabc", | |
"b`ddddd``````d`````d`ecc", | |
"aaeaeea`deeabaadaeeaaacc", | |
"aabbbcedebbecbbbeeebeacc", | |
"aabeebedeebebbbeeeeeeabc", | |
"e````d````d`d`d``````abc", | |
"baeeeea`aeeeeeeeeeeeaecc", | |
"aecbcbbdacbecbbcebbbbacc", | |
"aacbccedacbbbbbbbbcbbacc", | |
"aaaaaaaddaaaaaaaaaaaaabc", | |
"bccbccbcbccbccccbccbcbbc"] | |
Macro_FCInfo_04 = [ | |
" 24 24 8 1", | |
"` c #2e383f", | |
". c #7a9abf", | |
"# c #4870a2", | |
"a c #7a8592", | |
" c None", | |
"c c #adb0b1", | |
"d c #425264", | |
"e c #5b89c3", | |
" ca ", | |
" .dacc ", | |
" cad.c . ", | |
" adac ca` ", | |
" cd`c cddacc ", | |
" adacdc caddac . ", | |
" ccac adddac cadc ", | |
" caac cad`a .ddaca ", | |
" caadddac#. cadd. c ", | |
" caada .`ddac cada ", | |
" .aa#a cad`a c.ddac. ", | |
" c#dd`d`d.ddcca``#.c cc", | |
" cd#.....e..eee...aaac ", | |
" .de.eeee.e.eeeee... ", | |
" ad..eeeeeeeeeeeeeec ", | |
" .d......e.....eeeec ", | |
" ad............eeeec ", | |
" ad.....eeeeeeeeeeec ", | |
" #deeeee#########ee. ", | |
" #d################. ", | |
" dd##############e#c ", | |
" #deeeeeeeeeeeeeeedc ", | |
" d`ddddddddddddddd#c ", | |
" aaaaaaaaaaaaaaaaaac "] | |
Macro_FCInfo_05 = [ | |
" 24 24 8 1", | |
"` c None", | |
". c #280000", | |
"# c #8ae234", | |
"a c #729fcf", | |
"b c #2a1018", | |
"c c #c8a9a7", | |
"d c #ef2929", | |
"e c #000000", | |
" . ", | |
" ... ", | |
" .#. ", | |
" ... .#. ", | |
" .aa. ..#.. ", | |
" .aaa... .###. ", | |
" .aaaa.. .###. ", | |
" .aaaa. ..#.. ", | |
" .aaaa. .#. ", | |
" ..aaaa. .#. ", | |
" ...aaa. .#. ", | |
" .aab....#...", | |
" .bacccc#ccc", | |
" .acccc#ccc", | |
" .caccc#ccc", | |
" .ccacc#ccc", | |
" .ccacc#ccc", | |
" .cccac#ccc", | |
" .... .cccca#ccc", | |
" ....dd........cccca#ccc", | |
"..ddddddddddddddddddaddd", | |
" ....dd........ccccc#acc", | |
" .... .ccccc#acc", | |
" .ccccc#cac"] | |
Macro_FCInfo_06 = [ | |
" 24 24 8 1", | |
"` c #2c0204", | |
". c #749ecc", | |
"# c #ccaaa4", | |
"a c #0dfa0d", | |
"b c #8ce234", | |
"c c #ec2a2c", | |
" c None", | |
"e c #fcfefc", | |
" ` ", | |
" `````` ``` ", | |
" ```aaaa``` `b` ", | |
" ```aaaaaaaa``` `b` ", | |
" `aaaaaaaaaaaa` ``b`` ", | |
" ``aaaaaaaaaaaa```bbb` ", | |
" `aaaaaaaaaaaaea``bbb` ", | |
" ``aaaaaaaaaaaeea```b`` ", | |
" `aaaaaaaaaaaeeeaa``b` ", | |
" `aaaeeaaaaaeeeeaa``b` ", | |
" `aaaeeeaaaeeeeaaa``b` ", | |
" `aaaeeeeaeeeeaaaa``b```", | |
" ``aaaeeeeeeeaaaa``#b###", | |
" `aaaaeeeeeaaaaa`##b###", | |
" ``aaaaeeeaaaaa``##b###", | |
" `aaaaaeaaaaaa`.##b###", | |
" ```aaaaaaaa```.##b###", | |
" ```aaaa```###.#b###", | |
" ````````` `####.b###", | |
" ````cc````````####.b###", | |
"``cccccccccccccccccc.ccc", | |
" ````cc````````#####b.##", | |
" ```` `#####b.##", | |
" `#####b#.#"] | |
Macro_FCInfo_07 = [ | |
" 24 24 8 1", | |
" c None", | |
". c #280000", | |
"# c #ef2929", | |
"a c #8ae234", | |
"b c #ffffff", | |
"c c #c8a9a7", | |
"d c #729fcf", | |
"e c #000000", | |
" . ", | |
" ......... ... ", | |
" ..#######.. .a. ", | |
" ..#########.. .a. ", | |
" ..###########.. ..a.. ", | |
" ..##bb#####bb##...aaa. ", | |
" .###bbb###bbb###..aaa. ", | |
" .####bbb#bbb####...a.. ", | |
" .#####bbbbb#####. .a. ", | |
" .######bbb######. .a. ", | |
" .#####bbbbb#####. .a. ", | |
" .####bbb#bbb####...a...", | |
" .###bbb###bbb###.ccaccc", | |
" ..##bb#####bb##..ccaccc", | |
" ..###########..cccaccc", | |
" ..#########..cdccaccc", | |
" ..#######..ccdccaccc", | |
" ..........cccdcaccc", | |
" .... .ccccdaccc", | |
" ....##........ccccdaccc", | |
"..##################d###", | |
" ....##........cccccadcc", | |
" .... .cccccadcc", | |
" .cccccacdc"] | |
Macro_FCInfo_08 = [ | |
"21 24 8 1", | |
"` c #fc0507", | |
". c #fc9494", | |
"# c #fc4c4b", | |
"a c #fcd1d0", | |
" c None", | |
"c c #fcb9b9", | |
"d c #fc3433", | |
"e c #fc6f6f", | |
" a````e.a ", | |
" c```dd````d.aa ", | |
" e`dd` a.#````d", | |
" d`# e` c```", | |
" a``e e` c```", | |
" .``a e` a`d``", | |
"e``e e` a`` #`", | |
"``````e.#` a`` d`", | |
"`da.ed`````#.a#`a #`", | |
"`# ad`d````c #`", | |
"`# e` a`d #`", | |
"`# e` d` #`", | |
"`# e`c d` #`", | |
"`# e``````` #`", | |
"`# #`#ac#````#c #`", | |
"`# ``e d`d`````", | |
"`# a``c d` ce``", | |
"`#c``a d` a``", | |
"```d d` a`` ", | |
"```c d` a`` ", | |
"c````ea dda`` ", | |
" ce````dc #```a ", | |
" a.d```d.d``a ", | |
" .`````a "] | |
Macro_FCInfo_09 = [ | |
" 24 24 8 1", | |
"` c #b7201c", | |
". c #cba938", | |
"# c #e1cb42", | |
"a c #d6d1bd", | |
"b c #f4e256", | |
"c c #b7752b", | |
"d c #c7b295", | |
" c None", | |
" dda ", | |
" a.c.a ", | |
" dcdcd ", | |
" a.cc. ", | |
" dccca ", | |
" a.ccc a ", | |
" accc## ", | |
" d.bbbca ", | |
" b#bbac`` ", | |
" a#.c`c`.a ", | |
" d```cbbb. ", | |
" d``.bbbb## ", | |
" d#bbbb####a ", | |
" #bbbb####b# ", | |
" ##bbb###.#ab ", | |
" .b#####.####ab ", | |
" a##########.ba ", | |
" a#.#####.####a ", | |
" aaadb.###.b.#daaa ", | |
" a aaa#.#.#b..ddaaaa ", | |
" aaaddb###ddddaaaa ", | |
" aaadadadaaaaa ", | |
" a aa a a ", | |
" "] | |
Macro_FCInfo_10 = [ | |
" 24 24 8 1", | |
"` c #486ea4", | |
". c #b8babd", | |
"# c #868e98", | |
"a c #dfdfe1", | |
"b c #9da5b1", | |
"c c #6687b4", | |
"d c #d0d2d2", | |
" c None", | |
" aaa ", | |
" .bcc#bb ", | |
" .cbbbbbcc ", | |
" accccbbbbcb ", | |
" cc.adccbcbca ", | |
" aca cbcbcb ", | |
" d.b####ccccb`####. ", | |
" aa.a...bcccb`b....a ", | |
" dda#ccbbcccbbc`d.d ", | |
" #aaacccccc``cc.aa# ", | |
" d.aa dcc````cc.aaabd ", | |
" #a aaad`c``c`bddadd# ", | |
" ab daada.`c`ccdddaaa#a ", | |
" .aaaaadddbccc.ddddddd. ", | |
" .aadadaaddb`..dddddddb ", | |
"a.a adaddadaddadddda d.a", | |
"a.aaaaaaadadadadadadddba", | |
"a.d...........b.b.bbb.#a", | |
"a...##bbb.bbbb.b..bb.b#a", | |
"a...##bbbb.b.b.bb.bb.b#a", | |
"a.....bb.bb.bb.bb.bb.b#a", | |
"abddddd.d........bbbbb#a", | |
" .b###################. ", | |
" addddddaddddddddaaa "] | |
Macro_FCInfo_11 = [ | |
" 24 24 8 1", | |
"` c #040204", | |
". c #749ecc", | |
"# c #ec2a2c", | |
"a c #244a84", | |
"b c #fcea4c", | |
" c None", | |
"d c #040234", | |
"e c #040644", | |
" ", | |
" ", | |
" ```````` ", | |
" ```.....```````` ", | |
" ```...........```` ", | |
" ````````.....de`aa` ", | |
" `.....````````aaaa` ", | |
" `............`aaaa` ", | |
" `....bbb.....`aaaa` ", | |
" `...bbbbb....`aaaa` ", | |
" `...b``bb....`aaa`` ", | |
" ``...```bb...``aaa`` ", | |
" ``..``#`b....``aaa` ", | |
" `..``##`.....`aaaa` ", | |
" `.``###`.....`aaaa` ", | |
" ```####`.....`aaaa` ", | |
" ``#####`.....`aaaa` ", | |
" ``######`.....`aaa`` ", | |
" ```#####`.....`a``` ", | |
" `#####````..``` ", | |
" `###`#` ````` ", | |
" `##```` ", | |
" ```` ", | |
" "] | |
Macro_FCInfo_12 = [ | |
" 24 24 8 1", | |
"` c #060407", | |
". c #049a9c", | |
"# c #c5a107", | |
"a c #ec2a2c", | |
" c None", | |
"c c #34e2e4", | |
"d c #342a34", | |
"e c #fcae3c", | |
" `ccccccccccc`...` ", | |
" `cccccccccccc`...` ", | |
" `ccccccccccc`.....` ", | |
" ````cccccccc`.....` ", | |
" `###````ccc`.....` ", | |
" `#######```......` ", | |
" `###`#####`.....` ", | |
" `#`a`####`.....` ", | |
" ``aaa`####`...` ", | |
" `aaaa`#````````d``d```", | |
" `aaa`##`eeeeeeeeeeeee`", | |
" `aaa``#``eeeeeeeeeeee`", | |
" `aaa` ``a`eeeeeeeeeee`", | |
" `aaa` `aa`eeeeeeeeee`", | |
" `aaaa` `aaa`eeeeeeeee`", | |
" `aaaa`aaaaa`eeeeeeee`", | |
" `aaaaaaaaaa`eeeeeee`", | |
" `aaaaaaaaa`eeeeeee`", | |
" ``aaaaaa`eeeeeeee`", | |
" `aaaa`eeeeeeeee`", | |
" `aa`eeeeeeeeee`", | |
" `a`eeeeeeeeeee`", | |
" ``eeeeeeeeeeee`", | |
" ```````````````"] | |
Macro_FCInfo_13J = [ | |
"24 24 4 1", | |
" c None", | |
". c #280000", | |
"+ c #EF2929", | |
"@ c #FBE852", | |
"... ", | |
".++... ++ ", | |
".+++++.. ++++ ", | |
" .+++++.. +++ + ", | |
" .++@@. +++ + ", | |
" .++@@@. ++ + + ", | |
" .+.@@@. + + ", | |
" .. .@@@. +++ + ", | |
" . .@@@. + ", | |
" .@@@. + ++ ", | |
" .@@@. + ++++ ", | |
" .@@@. ++ + ", | |
" .@@@. + ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@. ", | |
" .@@@.", | |
" .@++", | |
" .++"] | |
Macro_FCInfo_13M = [ | |
"24 24 5 1", | |
" c None", | |
". c #280000", | |
"+ c #EE292B", | |
"@ c #EF2929", | |
"# c #FE19FF", | |
"... ", | |
".@@... ++ ", | |
".@@@@@.. ++ ", | |
" .@@@@@.. ++ ", | |
" .@@##. ++ ", | |
" .@@###. ++ +++ ", | |
" .@.###. ++++++ ", | |
" .. .###. ++ +++ ", | |
" . .###. ++++++ ", | |
" .###. ++ + + +", | |
" .###. +++ ++", | |
" .###. + ++ ", | |
" .###. + ++ ", | |
" .###. ++ ", | |
" .###. + ", | |
" .###. + ", | |
" .###. ", | |
" .###. ", | |
" .###. ", | |
" .###. ", | |
" .###. ", | |
" .###.", | |
" .#@@", | |
" .@@" | |
] | |
Macro_FCInfo_13C = [ | |
"24 24 5 1", | |
" c None", | |
". c #280000", | |
"+ c #EE292B", | |
"@ c #EF2929", | |
"# c #19FEFF", | |
"... ", | |
".@@... ++ ", | |
".@@@@@.. +++ ", | |
" .@@@@@.. +++ ", | |
" .@@##. ++ + ++ ", | |
" .@@###. + +++ + ", | |
" .@.###. ++ +++ ", | |
" .. .###. ++ ++ ++ ", | |
" . .###. ++ ++ ", | |
" .###. ++ ++ ++ ", | |
" .###. +++ ++++", | |
" .###. + ++ +", | |
" .###. ++ + +", | |
" .###. + +++", | |
" .###. + ", | |
" .###. + ", | |
" .###. ", | |
" .###. ", | |
" .###. ", | |
" .###. ", | |
" .###. ", | |
" .###.", | |
" .#@@", | |
" .@@" | |
] | |
Macro_FCInfo_Point = [ | |
"24 24 8 1", | |
" c None", | |
". c #000100", | |
"+ c #B0A22C", | |
"@ c #E9D235", | |
"# c #6B6014", | |
"$ c #F7E66C", | |
"% c #FBF4BC", | |
"& c #D5B716", | |
" ", | |
" ", | |
" ", | |
" ", | |
" ...... ", | |
" ..+@@@@+.. ", | |
" .#$$$@@@@@#. ", | |
" .#$%%$@@@@@@#. ", | |
" .$%%%$@@@@@@@. ", | |
" .+$%%$@@@@@@@@+. ", | |
" .@$$$@@@@@&&&&&. ", | |
" .@@@@@@@&&&&&&&. ", | |
" .@@@@@&&&&&&&&&. ", | |
" .@@@@&&&&&&&&&&. ", | |
" .+@@&&&&&&&&&&+. ", | |
" .@&&&&&&&&&&&. ", | |
" .#&&&&&&&&&&#. ", | |
" .#&&&&&&&&#. ", | |
" ..+&&&&+.. ", | |
" ...... ", | |
" ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Plane = [ | |
"24 24 8 1", | |
" c None", | |
". c #A40000", | |
"+ c #204A87", | |
"@ c #208020", | |
"# c #EF2929", | |
"$ c #729FCF", | |
"% c #8AE234", | |
"& c #729ECE", | |
" . ", | |
" .. + @ ", | |
" .#. +$+ @@ ", | |
" .##.+$$$+ @%@ ", | |
" .###.$$$$@%%@ ", | |
" .####.$$@%%%@ ", | |
" ..####.@%%%%@ ", | |
" ++.##.@.%%%@+ ", | |
" +&$+..@@#.%@+$+ ", | |
" +&$&&+@%@##.+$$$+ ", | |
" +&$&&&@%%@###.$$$$+ ", | |
" +&$&&&@%%%@####.$$$$+ ", | |
" +$&&@%%%%@#####.$$$$+ ", | |
" +$&@%%%@+.#####.$$$+ ", | |
" +&@%%@+$+.####.$$+ ", | |
" +@%@+$$$+.###.$+ ", | |
" @@+$$$$$+.##.+ ", | |
" @+$$$$$$$+.#. ", | |
" @%+$$$$$$$+.. ", | |
" @%%+$$$$$$+#. ", | |
" @%@ +$&$$+##. ", | |
" @@ +$$+ .#. ", | |
" @ ++ .. ", | |
" . " | |
] | |
Macro_FCInfo_Axis = [ | |
"24 24 6 1", | |
" c None", | |
". c #204B86", | |
"+ c #247F23", | |
"@ c #A30701", | |
"# c #204A87", | |
"$ c #208023", | |
" ", | |
" ", | |
" .. ", | |
" .. ", | |
" .. ", | |
" . ", | |
" . ", | |
" ++ .. ", | |
" +++ .. @ ", | |
" +++ .. @@@@ ", | |
" +++ .# @@@@ ", | |
" +$#@@@@ ", | |
" @@@@##@ ", | |
" @@@@@ ..+++ ", | |
" @@ .. +++ ", | |
" .. +++ ", | |
" .. ++ ", | |
" .. ", | |
" . ", | |
" . ", | |
" .. ", | |
" .. ", | |
" .. ", | |
" " | |
] | |
Macro_FCInfo_Info = [ | |
"24 24 10 1", | |
" c None", | |
". c #F57900", | |
"+ c #BCBCB3", | |
"@ c #555755", | |
"# c #ECEEEB", | |
"$ c #D8DAD7", | |
"% c #DBDDDA", | |
"& c #E6E9E5", | |
"* c #F2F4F1", | |
"= c #EFF1EE", | |
" ", | |
" ", | |
" . . . . ", | |
" +..+..+..+..++ ", | |
" @@..@..@..@..@+ ", | |
" @#.##.##.##.#@+ ", | |
" @############@+ ", | |
" @#$$$$$$$$$$#@+ ", | |
" @#++++++++++#@+ ", | |
" @#$%%%%%$$$##@+ ", | |
" @#++++++++++#@+ ", | |
" @#$%%%$$$$%#&@+ ", | |
" @#++++++++%##@+ ", | |
" @#$%$$$$$$$%#@+ ", | |
" @#+++++++++%#@+ ", | |
" @#$$$$$$$$$$*@+ ", | |
" @#++++$######@+ ", | |
" @#$$$$$####@@@+ ", | |
" @####&=*##@@@++ ", | |
" @###&#***#@@++ ", | |
" @@@@@@@@@@@++ ", | |
" +++++++++++ ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Radian = [ | |
"24 24 6 1", | |
" c None", | |
". c #0C0000", | |
"+ c #171018", | |
"@ c #EE2C29", | |
"# c #749FCE", | |
"$ c #FFFFFF", | |
" ", | |
" ", | |
" ....... +++ ", | |
" ...#####... + + ", | |
" ..#########@@ ++ ", | |
" ..##########$@@ + + ", | |
" ..##########$##@@ ", | |
" .##########$####@ ", | |
" ..##########$####@@ ", | |
" .##########$######@ ", | |
" .#########$#######@ ", | |
" .########$$$$$$$$$$ ", | |
" .#################. ", | |
" .##########+++####. ", | |
" ..#########+#+###.. ", | |
" .#########++####. ", | |
" ..########+#+##.. ", | |
" ..###########.. ", | |
" ..#########.. ", | |
" ...#####... ", | |
" ....... ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Pourcent = [ | |
"24 24 4 1", | |
" c None", | |
". c #000000", | |
"+ c #A40000", | |
"@ c #FFFFFF", | |
" ", | |
" ", | |
" ", | |
" ", | |
" + ", | |
" +++ ", | |
" +@+ ", | |
" ++@++ ", | |
" ++@@@++ ", | |
" +@@@@@+ ", | |
" ++@.@.@++ ", | |
" ++@@.@..@++ ", | |
" +@@@.@@.@@+ ", | |
" ++@.@@@@@@@++ ", | |
" ++@....@@@@@@++ ", | |
" +@.......@@@@@+ ", | |
" ++@.........@@@++ ", | |
" ++@............@@++ ", | |
" +@...............@+ ", | |
" ++@@@@@@@@@@@@@@@@@++ ", | |
" +++++++++++++++++++++ ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Degrees = [ | |
"24 24 5 1", | |
" c None", | |
". c #000000", | |
"+ c #EE2C29", | |
"@ c #3965A3", | |
"# c #FFFFFF", | |
" ", | |
" ", | |
" ", | |
" ..", | |
" . ... ..", | |
" . . . . ", | |
" ... . . ", | |
" . . . ", | |
" #+ . ... ", | |
" ##++ ", | |
" ##@@++ ", | |
" ##@@@@+ ", | |
" ##@@@@@++ ", | |
" ###@@@@@@@++ ", | |
" ###@@@@@@@@@++ ", | |
" ##@@@@@@@@@@@@+ ", | |
" ##@@@@@@@@@@@@@++ ", | |
" ##@@@@@@@@@@@@@@@+ ", | |
" ##@@@@@@@@@@@@@@@@+ ", | |
" ################### ", | |
" ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_DegreesMinSec = [ | |
"24 24 6 1", | |
" c None", | |
". c #000000", | |
"+ c #A40000", | |
"@ c #204A87", | |
"# c #4E9A06", | |
"$ c #FCAF3E", | |
" ", | |
" ", | |
" +++++++ ", | |
" +++$@$@$+++ ", | |
" ++$$$@.@$$$++ ", | |
" ++$@$$$$$$.@$++ ", | |
" ++$.$@$$$$$$$$$++ ", | |
" +$@..$$$$$$$$$$$+ ", | |
" ++$$@..$$$$$.$$.@++ ", | |
" +$$$$$..$$$..$$$$$+ ", | |
" +$$$$$$..$..$$$$$$+ ", | |
" +@@.$$$$...$$$$.@@+ ", | |
" +$$$$$$$$.$$$$$$$$+ ", | |
" +$$$$$$$$$$$$$$$$$+ ", | |
" ++$$.$$$###$$$$.$++ ", | |
" +$@$$$$$#$$$$$$@+ ", | |
" ++$$$$$$$$$.$$$++ ", | |
" ++$$.$$$$$$@$++ ", | |
" ++@$$$.$$$$++ ", | |
" +++$$@$$+++ ", | |
" +++++++ ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Grade = [ | |
"24 24 5 1", | |
" c None", | |
". c #000000", | |
"+ c #A40000", | |
"@ c #C4A000", | |
"# c #FFFFFF", | |
" ", | |
" ", | |
" # # ", | |
" #...#... # ", | |
" #+++#++..#. ", | |
" #@@@@@@+#+... # ", | |
" #@@@@@@@@@++..# ", | |
" #@@#@@@@@@@@+#. ", | |
" #@@#@@@#@@@@@+.. ", | |
" #@@#@@#@@@@@@@+.. ", | |
" #@@#@@#@@@#@@@@+..# ", | |
" #@#@@#@@@#@@@@@@+# ", | |
" #@#@@#@@#@@@@@@@#. ", | |
" #@#@#@@#@@@@@#@@+.. ", | |
" #@#@#@#@@@@##@@@@+. ", | |
" #@##@#@@@##@@@@@@+. ", | |
" #@###@@##@@@@@@@@+. ", | |
" ####@##@@@@@@@@@@#### ", | |
" #####@@@@######@@+. ", | |
" #########@@@@@@@@+. ", | |
" +#################### ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_ClipBoard_None = [ | |
"24 24 9 1", | |
" c None", | |
". c #A30500", | |
"+ c #555755", | |
"@ c #BCBCB3", | |
"# c #D7DAD6", | |
"$ c #DBDDDA", | |
"% c #E7E9E6", | |
"& c #EBEEEA", | |
"* c #F1F4F0", | |
" ", | |
" @...@@@@@@@@@@@ ... ", | |
" ++....+++++++++@.... ", | |
" +$....$$$$$$$$+..... ", | |
" +$$....$$$$$$$..... ", | |
" +$$.....$$$$......@@@ ", | |
" +$$@....+++......+++@ ", | |
" +$$$$....&......&&&+@ ", | |
" +$$@@.........&&&&&+@ ", | |
" +$$$$$.......&&&&&&+@ ", | |
" +$$@@@+.....@@@@@@&+@ ", | |
" +$$$$$......$$###&&+@ ", | |
" +$$@@........@@@@@&+@ ", | |
" +$$..........###$&%+@ ", | |
" +$......&@....@@$&&+@ ", | |
" +......&&$.....##$&+@ ", | |
" .....$+&&@@....@@$&+@ ", | |
" .....$$+&&&&&....&&*+@ ", | |
" ....++++&&&&&.....&&+@ ", | |
" ... +&&&&&&....+++@ ", | |
" +&&&&%**....+@@ ", | |
" +&&&%&**....@@ ", | |
" +++++++++...@ ", | |
" @@@@@@@@@@@ " | |
] | |
Macro_FCInfo_ClipBoard_FC = [ | |
"24 24 9 1", | |
" c None", | |
". c #A30500", | |
"+ c #154A89", | |
"@ c #555755", | |
"# c #BCBCB3", | |
"$ c #DADDDA", | |
"% c #E7E9E6", | |
"& c #EBEEEA", | |
"* c #F1F4F0", | |
" ", | |
" ############### ", | |
" @@@@@@@@@@@@@@@# ", | |
" @$$$$$$$$$$$$$@# ", | |
" @$$$$$$$$$$$$$@# ", | |
" @$$$$$$$$$$$$$@###### ", | |
" @$$###@@@@@@@@@@+@@@# ", | |
" @$$$.......+&&&++&&@# ", | |
" @$$#.......++&++&&&@# ", | |
" @$$$.......++++&&&&@# ", | |
" @$$#...&+++++++###&@# ", | |
" @$$$.....+$%$++++&&@# ", | |
" @$$#......%%%+++++&@# ", | |
" @$$$.....+$%$++++&%@# ", | |
" @$$$...&+++++++#$&&@# ", | |
" @$$$...++$+++$++$$&@# ", | |
" @$$$..++&#+++##++$&@# ", | |
" @$$$..+&&&&+&&&&+&*@# ", | |
" @@@@@@@&&&&&&&&&&&&@# ", | |
" @&&&&&&&&&&@@@# ", | |
" @&&&&%**&&@@@## ", | |
" @&&&%&***&@@## ", | |
" @@@@@@@@@@@## ", | |
" ########### " | |
] | |
Macro_FCInfo_ClipBoard_Comma = [ | |
"24 24 9 1", | |
" c None", | |
". c #000000", | |
"+ c #A30500", | |
"@ c #2C4A85", | |
"# c #555755", | |
"$ c #52990C", | |
"% c #BCBCB3", | |
"& c #DADDD9", | |
"* c #ECEEEB", | |
" ", | |
" %%%%%%%%%%%%%%% ", | |
" ###############% ", | |
" #&&&&&&&&&&&&&#% ", | |
" #&&&&&&&&&&&&&#% ", | |
" #&&&&&&&&&&&&&#%%%%%% ", | |
" #&&%%%##############% ", | |
" ++&&&&++*$$**$$*@@@@@@ ", | |
" +++&%+++*$$$&$$&@@@@@@ ", | |
" ++&&++#**$$*$$****@@% ", | |
" #++++%#**$$%$$%%%%@@% ", | |
" #&++&&#**&$$$$&&&@@#% ", | |
" #&++%%#**%$$$$%%%@@#% ", | |
" #++++&#**&&$$&&&&@@#% ", | |
" ++&&++#**%%$$%%%@@*#% ", | |
" +&&&&+#**&$$$&&&@@*#% ", | |
" ++&&&&++..%$$..%@@@@@@ ", | |
" +#&&&&&+..*$$..*@@@@@@ ", | |
" #######*.****.*****#% ", | |
" #..***..***###% ", | |
" ..***..***###%% ", | |
" #*********##%% ", | |
" ###########%% ", | |
" %%%%%%%%%%% " | |
] | |
Macro_FCInfo_ClipBoard_Raw = [ | |
"24 24 9 1", | |
" c None", | |
". c #000000", | |
"+ c #A30500", | |
"@ c #2C4A85", | |
"# c #555755", | |
"$ c #52990C", | |
"% c #BCBCB3", | |
"& c #DADDD9", | |
"* c #ECEEEB", | |
" ", | |
" %%%%%%%%%%%%%%% ", | |
" ###############% ", | |
" #&&&&&&&&&&&&&#% ", | |
" #&&&&&&&&&&&&&#% ", | |
" #&&&&&&&&&&&&&#%%%%%% ", | |
" #&&%%%##############% ", | |
" ++&&&&++*$$**$$*@@@@@@ ", | |
" +++&%+++*$$$&$$&@@@@@@ ", | |
" ++&&++#**$$*$$****@@% ", | |
" #++++%#**$$%$$%%%%@@% ", | |
" #&++&&#**&$$$$&&&@@#% ", | |
" #&++%%#**%$$$$%%%@@#% ", | |
" #++++&#**&&$$&&&&@@#% ", | |
" ++&&++#**%%$$%%%@@*#% ", | |
" +&&&&+#**&$$$&&&@@*#% ", | |
" ++&&&&++**%$$%%%@@@@@@ ", | |
" +#&&&&&+***$$***@@@@@@ ", | |
" #######************#% ", | |
" #**********###% ", | |
" #*********###%% ", | |
" #*********##%% ", | |
" ###########%% ", | |
" %%%%%%%%%%% " | |
] | |
Macro_FCInfo_BoundBoxTracing = [ | |
"24 24 8 1", | |
" c None", | |
". c #A30500", | |
"+ c #ED2928", | |
"@ c #69678E", | |
"# c #6B6990", | |
"$ c #6D6B92", | |
"% c #706E95", | |
"& c #746F91", | |
" ", | |
" ", | |
" +++. ", | |
" ++++..++. ", | |
" ++++.... ++. ", | |
" +++.... +.+. ", | |
" ++. +.+. ", | |
" +.+. +++. +. ", | |
" +. +. ++++..+. +. ", | |
" +. ++++... +. +. ", | |
" +. +.. +++. +. ", | |
" +. +. ++++...+.+. ", | |
" +. ++++.... ++. ", | |
" +++.+.. +. ", | |
" +..+. +. ", | |
" +.+. ++. ", | |
" +.+. ++++.. ", | |
" ++. ++++.... ", | |
" +++.... ", | |
" ... ", | |
" ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_BoundBoxVolume = [ | |
"24 24 9 1", | |
" c None", | |
". c #000000", | |
"+ c #140300", | |
"@ c #A40709", | |
"# c #CE000B", | |
"$ c #ED2928", | |
"% c #F02C30", | |
"& c #6A698F", | |
"* c #706E95", | |
" ", | |
" ++++ ", | |
" ++++$$$+ ", | |
" ++++$$$$%%%$+ ", | |
" +++$$$$%%%%%%%$+ ", | |
" ..$$%%%%%%%%%%%%$+ ", | |
" .$.%%%%%%%%%%%%..+ ", | |
" .#$.%%%%%%%%...@@$+ ", | |
" .##$.%%%....@@@@@$+ ", | |
" .###$...@@@@@@@@@$+ ", | |
" .###$.@@@@@@@@@@@$+ ", | |
" .###$.@@@@@@@@@@@$+ ", | |
" .###$.@@@@@@@@@@@$+ ", | |
" .$##$.@@@@@@@@@@@$+ ", | |
" .$#$.@@@@@@@@@@@$+ ", | |
" .$$.@@@@@@@@@@$$+ ", | |
" .$$.@@@@@@$$$$+++ ", | |
" .$.@@$$$$++++ ", | |
" ..$$++++ ", | |
" +++ ", | |
" ", | |
" ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_DeleteLineMaterial = [ | |
"24 24 9 1", | |
" c None", | |
". c #A30500", | |
"+ c #555755", | |
"@ c #F67904", | |
"# c #BCBCB3", | |
"$ c #D8DAD7", | |
"% c #E7E9E6", | |
"& c #EBEEEA", | |
"* c #F1F4F0", | |
" ", | |
" ", | |
" @ @ @ @ ", | |
" #@@#@@#@@#@@## ", | |
". ++@@+@@+@@+@@+# .", | |
"... +&@&&@&&@&&@&+# ...", | |
".....+&&&&&&&&&&&&+.....", | |
".......$$$$$$$$$$.......", | |
" ........######........ ", | |
" ........$$........ ", | |
" ..............# ", | |
" +&..........%+# ", | |
" +&..........&+# ", | |
" ..............# ", | |
" ........##........ ", | |
" ........$$$$$$........ ", | |
".......####$&&&&&.......", | |
".....+&$$$$$&&&&+++.....", | |
"... +&&&&%**&&+++## ...", | |
". +&&&%&***&++## .", | |
" +++++++++++## ", | |
" ########### ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Beer = [ | |
"25 25 7 1", | |
" c None", | |
". c #000000", | |
"+ c #C17D11", | |
"@ c #BABDB6", | |
"# c #BDBDBA", | |
"$ c #D7D9D6", | |
"% c #EEEEEC", | |
" ", | |
" ", | |
" % % ", | |
" %%%% %% % ", | |
" % %% %% %% ", | |
" % %%%% %%% % % ", | |
" %%%@%%@%%%@%@%%% ", | |
" %%%%%@%%@%%%%%%% % ", | |
" %%%%@@%%%@%%@%. ", | |
" %%@%@%%@%%@%@%#... ", | |
" %%%$%%%%%%%%%%####.. ", | |
" %.$$%%@%%@%%%##.##. ", | |
" ..$.%%%%%%@.#. .#. ", | |
" .#%@.@.@.%%#. .#. ", | |
" .#+%%+@%%%+#. .#. ", | |
" .#+++++++++#. .#. ", | |
" .#+++++++++#. .#. ", | |
" .##++++++++#. .#. ", | |
" ..#++++++++#..##. ", | |
" .#++++++++#.##. ", | |
" .###+++++##... ", | |
" ...#####... ", | |
" ....... ", | |
" ", | |
" " | |
] | |
Macro_FCInfo_Save_Material = [ | |
"24 24 9 1", | |
" c None", | |
". c #000000", | |
"+ c #A30500", | |
"@ c #555755", | |
"# c #CD5D01", | |
"$ c #F67904", | |
"% c #BCBCB3", | |
"& c #EBEEEA", | |
"* c #F1F3F0", | |
" ", | |
" ", | |
" $ $ $ $ ", | |
" %$$%$$%$$%$$%% ", | |
" @@$$@$$@$$@$$@% ", | |
" @&$&&$&&$&&$&@% ", | |
" @&&&&&&&&&&&&@% ", | |
" @&&&&&&&&&&&&@% ", | |
" @&&%%%%%%%%&&@% ", | |
" @&&&&&&&&&&&&@% ", | |
" @&&%%..%&&&&&@% ", | |
" @&&&&.@@&&&&&@% ", | |
" @&&%%%@@@&&&&@% ", | |
" @&&&&&&@++&&&@% ", | |
" @&&%%%%++++&&@% ", | |
" @&&&&&&&++++&@% ", | |
" @&&%%%&&&++++@% ", | |
" @&&&&&&&&&++++% ", | |
" @&&&&&**&&@+++# ", | |
" @&&&&&***&@@+##$ ", | |
" @@@@@@@@@@@%%#$$$ ", | |
" %%%%%%%%%%% $$$$ ", | |
" $$ ", | |
" " | |
] | |
Macro_FCInfo_Work = [ | |
"24 24 8 1", | |
" c None", | |
". c #C17D11", | |
"+ c #8F5902", | |
"@ c #BABDB6", | |
"# c #EDD400", | |
"$ c #A40000", | |
"% c #CE5C00", | |
"& c #171018", | |
" ", | |
" ..... ", | |
" ++........ ", | |
" +...++++++... ", | |
" +..@@@@#@@@++.. ", | |
" +..#@@@@#@@@@#+.. ", | |
" +..@@#@@@#@@$#@@+.. ", | |
" +.#@@@%@@%@@$@@@#+. ", | |
" +..@#@@@@@#@$@@@#@+.. ", | |
" +.@@@%@@@@@$$@@%@@@+. ", | |
" +.@@@@@@@@@$$@@@@@@+. ", | |
" +.@@@@@@@@&&@@@@@@@+. ", | |
" +.###%@@@@&&@@@%###+. ", | |
" +.@@@@@@@@$$@@@@@@@+. ", | |
" +.@@@%@@@@@$$@@%@@@+. ", | |
" +..@#@@@@@#$$$@@#@+.. ", | |
" +.#@@@%@@%@$$@@@#+. ", | |
" ..@@#@@@#@@$$@@+.. ", | |
" +..#@@@@#@@@$#+.. ", | |
" +..@@@@#@@@++.. ", | |
" +...++++++... ", | |
" ++........ ", | |
" ...... ", | |
" " | |
] | |
Macro_FCInfo_Color = [ | |
"24 24 9 1", | |
" c None", | |
". c #16D0D2", | |
"+ c #D3D7CF", | |
"@ c #C17D11", | |
"# c #EDD400", | |
"$ c #73D216", | |
"% c #F57900", | |
"& c #3465A4", | |
"* c #CC0000", | |
" .... ", | |
" +++ .... @@@@ ", | |
" ++#### .... $$$ @@@@ ", | |
" ++####%%%...&&$$$ @@@@ ", | |
" ####%%% &&&&$$$ @@@@ ", | |
" ####%%%+&&&&** ", | |
" $$$$ ++&&&&**##%%% ", | |
"@@@@$$$$ ++++ ***##%%% ", | |
"@@@@$$$$ ++++ ####%%% ", | |
"@@@@ &&&$$$$## ", | |
"@@@$$$$ %%&&&$$$$ %%%% ", | |
" $$$$ %%&***$$$ %%%% ", | |
"...$$$$ %%%***$$$ %%%% ", | |
"...$$$$*** ***&&&+%%%% ", | |
"....%%%***### &&&+++@@@@", | |
"....%%%***### &&&+++@@@@", | |
" +++%% ### .... @@@@", | |
" +++ &&& $$$..####@@@@", | |
" +++ &&****$$..#### ", | |
" #### &&****$&&&###**** ", | |
" ####+++**...&&&###**** ", | |
" ####+++**...&&&& **** ", | |
" ####+++ ...&&&& **** ", | |
" .... " | |
] | |
Macro_FCInfo_Face = [ | |
"24 24 9 1", | |
" c None", | |
". c #A30500", | |
"+ c #9C0C04", | |
"@ c #9C0D0C", | |
"# c #EF2B29", | |
"$ c #5468F8", | |
"% c #A9B0CB", | |
"& c #98B5D8", | |
"* c #9EB7D5", | |
" ", | |
" ", | |
" ## ", | |
" ##++## ", | |
" ##++++++## ", | |
" ##++++++++++## ", | |
" ##@+++++++## ", | |
" ## $$*#++++++#**$ ", | |
" ##***##++##***$$ # ", | |
" ##**##***##***$$*$## ", | |
" #.#***##*****$*&*# # ", | |
" #..##***#$*$$**##$ # ", | |
" #....#***%$**##**$ # ", | |
" #.....##%%$*#****$ # ", | |
" #......#%%$#*****$ # ", | |
" #......#%%$#*****$ # ", | |
" #......#%%$#***&*$ # ", | |
" #......#%%$#***$$ # ", | |
" ##.....#%%$#*$$ ## ", | |
" ##...#$%$#$ # ", | |
" ##.# $$# ## ", | |
" ## ### ", | |
" # # ", | |
" " | |
] | |
Macro_FCInfo_WebForum = [ | |
"24 24 4 1", | |
" c None", | |
". c #1E4C89", | |
"+ c #EBF0F3", | |
"@ c #FFFFFF", | |
" ", | |
" .......... ", | |
" ..@@@@@@@@.. ", | |
" ..@@......@@.. ", | |
" ..@@........@+.. ", | |
" ..@@...@@@@...@@.. ", | |
" ..@@...@@@@@@...@@.. ", | |
" ..@@...@@@..@@@...@@.. ", | |
" .@@....@@....@@....@@. ", | |
" .@...........@@.....@. ", | |
" .@..........@@@.....@. ", | |
" .@.........@@@......@. ", | |
" .@........@@@.......@. ", | |
" .@........@@........@. ", | |
" .@........@@........@. ", | |
" .@@.......@@.......@@. ", | |
" ..@@..............@@.. ", | |
" ..@@............@@.. ", | |
" ..@@....@@....@@.. ", | |
" ..@@...@@...@@.. ", | |
" ..@@......@@.. ", | |
" ..@@@@@@@@.. ", | |
" .......... ", | |
" " | |
] | |
Macro_FCInfo_WebWiki = [ | |
"24 24 9 1", | |
" c None", | |
". c #091756", | |
"+ c #194C8B", | |
"@ c #214B97", | |
"# c #50627D", | |
"$ c #BC727C", | |
"% c #9DAAC0", | |
"& c #C7D0DF", | |
"* c #FFFFFF", | |
" ", | |
" ++++++++++ ", | |
" ++********++ ", | |
" ++**++++++**++ ", | |
" ++**++++++++**++ ", | |
" ++**+++****+++**++ ", | |
" ++**+++******+++**++ ", | |
" ++**+++***++***+++**++ ", | |
" +**++++**++++**++++**+ ", | |
" +*+++++++++++**+++++*+ ", | |
" +*+++++++++............", | |
" +*+++++++++.**@@@@****.", | |
" +*++++++++*.*@%&%%@***.", | |
" +*++++++++*.@%%%*%%@**.", | |
" +*++++++++*.@&%**$%@**.", | |
" +**+++++++*.@%**$$%@**.", | |
" ++**+++++++.@%%$$$%@**.", | |
" ++**++++++.*@%%%%@***.", | |
" ++**++++*.**@@@@%#**.", | |
" ++**+++*.******#%#*.", | |
" ++**+++.*....**#%#.", | |
" ++****.**%%%***#%.", | |
" +++++.*********#.", | |
" ............" | |
] | |
Macro_FCInfo_SpreadSheet = [ | |
"27 24 8 1", | |
" c #383C3E", | |
". c #4D5153", | |
"+ c #6C6F70", | |
"@ c #868A8C", | |
"# c #9DA1A1", | |
"$ c #BFC1BE", | |
"% c #D6D9D5", | |
"& c #EFF1EE", | |
"&&&&&&&&&&&&&&&&&&&&&&&&&&&", | |
"&$@@@@@@@@@@@@@@@@@@@@@@@@&", | |
"&$######@ ###############@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%$$$$$@ %&&&&&&&&&&&&&%@&", | |
"&$ @&", | |
"&$######@ ###############@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%$$$$$@ %&&&&&&&&&&&&&%@&", | |
"&$ @&", | |
"&$######@ ###############@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%$$$$$@ %&&&&&&&&&&&&&%@&", | |
"&$ @&", | |
"&$######@ ###############@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%&&&&&@ %&&&&&&&&&&&&&%@&", | |
"&$%$$$$$@ %&&&&&&&&&&&&&%@&", | |
"&$#######################@&", | |
"&$$$$$$$$$$$$$$$$$$$$$$$$$&", | |
"&&&&&&&&&&&&&&&&&&&&&&&&&&&" | |
] | |
#### Material, Gravity By Default Begin | |
global materialAssociated ; materialAssociated = [] # material associate | |
materialAssociated = [ | |
(u"Liquid Water (H2o),1,10.0,adapt Price"), | |
(u"Mater Beton,2.4,10.0,adapt Price"), | |
(u"Metal Aluminium (Al),2.7,10.0,adapt Price"), | |
(u"Metal Copper (Cu),8.96,10.0,adapt Price"), | |
(u"Metal Gold (Au),19.3,10.0,Gratis"), | |
(u"Metal Iron (Fe),7.87,10.0,adapt Price"), | |
(u"Metal Lead (Pb),11.35,10.0,adapt Price"), | |
(u"Metal Magnesium (Mg),1.43,10.0,adapt Price"), | |
(u"Metal Nickel (Ni),8.27,10.0,adapt Price"), | |
(u"Metal Pewter (Sn),7.29,10.0,adapt Price"), | |
(u"Metal Platinum (Pt),21.45,10.0,adapt Price"), | |
(u"Metal Silver (Ag),10.5,10.0,adapt Price"), | |
(u"Metal Sodium (Na),0.97,10.0,adapt Price"), | |
(u"Metal Titanium (Ti),4.4,10.0,adapt Price"), | |
(u"Metal Zinc (Zn),7.1,10.0,adapt Price"), | |
(u"Wood Beechwood,0.8,10.0,adapt Price"), | |
(u"Wood MDF,0.75,10.0,adapt Price"), | |
(u"Wood Mahogany,0.6,10.0,adapt Price"), | |
(u"Wood Oak,0.7,10.0,adapt Price"), | |
(u"Wood White pine,0.4,10.0,adapt Price") | |
] | |
if os.path.exists(path): | |
#App.Console.PrintMessage(str(os.path.exists(path)) + "\n") | |
#App.Console.PrintMessage(str(os.path.isfile(path + "FCInfo_material.txt")) + "\n") | |
# | |
#if not file one file (data default in macro) is created in the Macro location or in the seTMaterialSavePathName path | |
if (os.path.isfile(seTMaterialSavePathName + seTMaterialFileName) == False) or (os.path.getsize(seTMaterialSavePathName + seTMaterialFileName) == 0): # default "FCInfo_material.txt" | |
App.Console.PrintMessage(u"Save " + str(seTMaterialSavePathName) + str(seTMaterialFileName) + "\n") | |
materialAssociated.sort() | |
App_Console_PrintMessage(u"Number material : " + str(len(materialAssociated)) + "\n") | |
try: | |
f = open(seTMaterialSavePathName + seTMaterialFileName, 'w') # write | |
for i in materialAssociated: | |
f.write(i + "\n") | |
f.close() | |
App_Console_PrintMessage(u"Create/Save file : " + seTMaterialFileName + "\n") | |
except Exception: | |
App_Console_PrintError(u"Not file " + seTMaterialFileName + "\n") | |
seTMaterialCurrentIndex = 0 | |
seTDensiteValue = float(materialAssociated[0].split(",")[1]) | |
else: | |
try: | |
App_Console_PrintMessage(u"Read the file " + str(seTMaterialReadPathName) + str(seTMaterialFileName) + "\n") | |
f = open(seTMaterialReadPathName + seTMaterialFileName, 'r') # read # read the file | |
materialAssociated = [] | |
for i in f: | |
i2 = i.rstrip() # .lstrip(), .rstrip(), .split(",") | |
materialAssociated.append(i2) | |
f.close() | |
seTDensiteValue = float(materialAssociated[0].split(",")[1]) | |
App_Console_PrintMessage(u"Load the file : " + seTMaterialFileName + "\n") | |
except Exception: | |
App_Console_PrintError(u"Not read file " + seTMaterialFileName + " saved" + "\n") | |
#### Material, Gravity End | |
global infoFaceMesh; | |
global indexFaceMesh ; indexFaceMesh = 0 | |
global coordPointsMesh; coordPointsMesh = "" | |
import warnings | |
warnings.simplefilter("ignore") | |
def getNormal(cb): | |
#https://wiki.freecadweb.org/Code_snippets#Get_the_normal_vector_of_a_surface_from_a_STL_file | |
global infoFaceMesh; | |
global indexFaceMesh | |
try: | |
pp = cb.getPickedPoint() | |
indexFaceMesh = coin.cast(pp.getDetail(), "SoFaceDetail").getFaceIndex() | |
except Exception: | |
None | |
def Around(a) : | |
global seTDecimalValue | |
if seTDecimalValue == -1: | |
seTDecimalValue = 1000 | |
ard = round(a, seTDecimalValue) | |
return ard | |
#### BoundBox Tracing #### | |
def adjustedGlobalPlacement(obj, locVector): | |
'''find global placement to make locVector the local origin with the correct orientation''' | |
# extract BoundingBox_Tracing | |
#2021/07/10 modified by edwilliams16 to handle objects in nested part containers | |
#https://forum.freecadweb.org/viewtopic.php?f=22&t=59852 | |
# | |
try: | |
objectPlacement = obj.Placement | |
objectGlobalPlacement = obj.getGlobalPlacement() | |
locPlacement = App.Placement(locVector, App.Rotation(App.Vector(1,0,0),0)) | |
return objectGlobalPlacement.multiply(objectPlacement.inverse()).multiply(locPlacement) | |
except Exception: | |
locPlacement = App.Placement(App.Vector(0,0,0), App.Rotation(0,0,0), App.Vector(0,0,0)) | |
App_Console_PrintError(u"Error adjustedGlobalPlacement") | |
return locPlacement | |
def bounBoxTracing(): | |
#import PySide | |
global BDvol | |
global switchBoundBoxCreateVolume # 1 = create Volume | |
global switchBoundBoxCreateText # 1 = create dimension info : 0 = not dimension info | |
global seTBoundBoxTextHeigth # text heigth | |
global seTBoundBoxTextArround # arrondi text dimensions | |
global seTBoundBoxDisplayModeText # u"Screen" or u"World" | |
global seTBoundBoxJustificationText # u"Center" or u"Left" or u"Right" | |
##### Section configuration begin ################## | |
FontSizeText = seTBoundBoxTextHeigth# text info dimension | |
#### | |
TextColorText_R = 0.0 # text color info red 1 = 255 | |
TextColorText_G = 0.0 # text color info green 1 = 255 | |
TextColorText_B = 0.0 # text color info blue 1 = 255 | |
LineColor_red = 1.0 # Line Color rectangle 1 = 255 | |
LineColor_green = 0.0 # Line Color rectangle 1 = 255 | |
LineColor_blue = 0.0 # Line Color rectangle 1 = 255 | |
arrondi = seTBoundBoxTextArround # round the info ex: 3 = 3 decimals | |
##### Section configuration end #################### | |
sel = FreeCADGui.Selection.getSelection() | |
selEx = FreeCADGui.Selection.getSelectionEx() | |
objs = [selobj.Object for selobj in selEx] | |
if len(objs) >= 1: | |
if hasattr(objs[0], "Shape"): | |
s = objs[0].Shape | |
elif hasattr(objs[0], "Mesh"): # upgrade with wmayer thanks #http://forum.freecadweb.org/viewtopic.php?f=13&t=22331 | |
s = objs[0].Mesh | |
elif hasattr(objs[0], "Points"): | |
s = objs[0].Points | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo BBox") # memorise les actions (avec annuler restore) | |
#FreeCAD.ActiveDocument.commitTransaction() # restore les actions (avec annuler restore) | |
#FreeCAD.ActiveDocument.abortTransaction() # abandonne les actions(avec annuler restore) | |
# boundBox | |
if sel[0].isDerivedFrom("Fem::FemPostWarpVectorFilter"): | |
boundBox_ = sel[0].ViewObject.getBoundingBox() | |
else: | |
boundBox_ = s.BoundBox | |
boundBoxLX = boundBox_.XLength | |
boundBoxLY = boundBox_.YLength | |
boundBoxLZ = boundBox_.ZLength | |
boundBoxXMin = boundBox_.XMin | |
boundBoxYMin = boundBox_.YMin | |
boundBoxZMin = boundBox_.ZMin | |
boundBoxLocation = App.Vector(boundBox_.XMin,boundBox_.YMin,boundBox_.ZMin) | |
nameLabel = sel[0].Label | |
try: | |
try: | |
import unicodedata | |
nameLabel = str(unicodedata.normalize('NFKD', nameLabel).encode('ascii','ignore'))[2:] | |
except Exception: | |
None | |
boundBoxLocation = App.Vector(boundBoxXMin,boundBoxYMin,boundBoxZMin) | |
nameLabel = sel[0].Label | |
# create Volume | |
if (switchBoundBoxCreateVolume == 1): | |
if (boundBoxLX > 0) and (boundBoxLY > 0) and (boundBoxLZ > 0): # Create Volume | |
BDvol = App.ActiveDocument.addObject("Part::Box",nameLabel + "_BoundBoxVolume") | |
#BDvol.Label = "BoundBoxVolume" | |
BDvol.Length.Value = boundBoxLX | |
BDvol.Width.Value = boundBoxLY | |
BDvol.Height.Value = boundBoxLZ | |
BDvol.Placement = adjustedGlobalPlacement(objs[0], boundBoxLocation) | |
BDPl = BDvol.Placement | |
oripl_X=BDvol.Placement.Base.x | |
oripl_Y=BDvol.Placement.Base.y | |
oripl_Z=BDvol.Placement.Base.z | |
#if debug: print(f'global {globalObjectPlacement}\n local {localObjectPlacement} BB {BBlocPlacement}') | |
FreeCADGui.ActiveDocument.getObject(BDvol.Name).LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
FreeCADGui.ActiveDocument.getObject(BDvol.Name).PointColor = (LineColor_red, LineColor_green, LineColor_blue) | |
FreeCADGui.ActiveDocument.getObject(BDvol.Name).ShapeColor = (LineColor_red, LineColor_green, LineColor_blue) | |
FreeCADGui.ActiveDocument.getObject(BDvol.Name).Transparency = 80 | |
switchBoundBoxCreateVolume = 0 | |
#App_Console_PrintMessage(nameLabel + "_BoundBoxVolume : " + str(BDvol.Shape.Volume)+"\r\n") | |
# create Text for volume | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
conteneurVol = [] | |
del conteneurVol[:] | |
conteneurVol = App.activeDocument().addObject("App::DocumentObjectGroup",nameLabel + "_BoundBoxVolume_Info") | |
BDtext = FreeCAD.Placement() | |
BDtext = adjustedGlobalPlacement(objs[0], boundBoxLocation) | |
BDPl = BDtext | |
#pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],point=FreeCAD.Vector(oripl_X + (boundBoxLX/2), oripl_Y, oripl_Z)) | |
pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement = BDPl.multVec(App.Vector(boundBoxLX/2,0,0))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Volume_X_" + str(round(boundBoxLX,arrondi)) | |
conteneurVol.addObject(pl_0C1) | |
#pl_0C2 = Draft.make_text([str(round(boundBoxLY,arrondi))],point=FreeCAD.Vector(oripl_X, oripl_Y + (boundBoxLY/2), oripl_Z)) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement = BDPl.multVec(App.Vector(0, boundBoxLY/2, 0))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Volume_Y_" + str(round(boundBoxLY,arrondi)) | |
conteneurVol.addObject(pl_0C2) | |
#pl_0C3 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=FreeCAD.Vector(oripl_X, oripl_Y, oripl_Z + (boundBoxLZ/2))) | |
pl_0C3 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement = BDPl.multVec(App.Vector(0, 0, boundBoxLZ/2))) | |
pl_0C3.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C3.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C3.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C3.ViewObject.FontSize = FontSizeText | |
pl_0C3.Label = nameLabel + "_Volume_Z_" + str(round(boundBoxLZ,arrondi)) | |
conteneurVol.addObject(pl_0C3) | |
App.ActiveDocument.recompute() | |
else: #create rectangles | |
conteneurRectangle = [] | |
del conteneurRectangle[:] | |
conteneurRectangle = App.activeDocument().addObject("App::DocumentObjectGroup",nameLabel + "_BoundBoxRectangle") | |
if switchBoundBoxCreateText == 1: # conteneur dimension info | |
conteneurInfo = [] | |
del conteneurInfo[:] | |
conteneurInfo = App.activeDocument().addObject("App::DocumentObjectGroup",nameLabel + "_BoundBoxRectangle_Info") | |
try: | |
if (boundBoxLX and boundBoxLY) > 0.0: | |
#pl_0 = App.Placement(App.Vector(oripl_X,oripl_Y,oripl_Z), App.Rotation(0.0,0.0,0.0)) | |
pl_0 = adjustedGlobalPlacement(objs[0], boundBoxLocation) | |
double = Draft.makeRectangle(length=boundBoxLX,height=boundBoxLY,placement=pl_0,face=False,support=None) #OK | |
double.Label = nameLabel + "_BoundBoxRectangle_Bo" | |
FreeCADGui.activeDocument().activeObject().LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
conteneurRectangle.addObject(double) | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
#pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=FreeCAD.Vector(pl_0.Base.x + (boundBoxLX/2), pl_0.Base.y, pl_0.Base.z)) | |
# XY -> XY | |
pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=pl_0.multVec(App.Vector(boundBoxLX/2, 0, 0))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Rectangle_Bo_0X_" + str(round(boundBoxLX,arrondi)) | |
conteneurInfo.addObject(pl_0C1) | |
#pl_0C2 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=FreeCAD.Vector(pl_0.Base.x, pl_0.Base.y + (boundBoxLY/2), pl_0.Base.z)) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=pl_0.multVec(App.Vector(0., boundBoxLY/2, 0.))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Rectangle_Bo_0Y_" + str(round(boundBoxLY,arrondi)) | |
conteneurInfo.addObject(pl_0C2) | |
except: | |
App_Console_PrintError(u"not done 0"+"\n") | |
try: | |
if (boundBoxLX and boundBoxLY) > 0.0: | |
#pl_1 = App.Placement(App.Vector(oripl_X,oripl_Y,oripl_Z+boundBoxLZ), App.Rotation(0.0,0.0,0.0)) | |
pl_1 =adjustedGlobalPlacement(objs[0], boundBoxLocation + App.Vector(0,0,boundBoxLZ)) | |
double = Draft.makeRectangle(length=boundBoxLX,height=boundBoxLY,placement=pl_1,face=False,support=None) #Ok | |
double.Label = nameLabel + "_BoundBoxRectangle_To" | |
FreeCADGui.activeDocument().activeObject().LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
conteneurRectangle.addObject(double) | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
#pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=FreeCAD.Vector(pl_1.Base.x + (boundBoxLX/2), pl_1.Base.y, pl_1.Base.z)) | |
#XY -> XY | |
pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=pl_1.multVec(App.Vector(boundBoxLX/2, 0, 0))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Rectangle_To_1X_" + str(round(boundBoxLX,arrondi)) | |
conteneurInfo.addObject(pl_0C1) | |
#pl_0C2 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=FreeCAD.Vector(pl_1.Base.x, pl_1.Base.y + (boundBoxLY/2), pl_1.Base.z)) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=pl_1.multVec(App.Vector(0., boundBoxLY/2, 0))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Rectangle_To_1Y_" + str(round(boundBoxLY,arrondi)) | |
conteneurInfo.addObject(pl_0C2) | |
except: | |
App_Console_PrintError(u"not done 1"+"\n") | |
try: | |
if (boundBoxLX and boundBoxLZ) > 0.0: | |
#pl_2 = App.Placement(App.Vector(oripl_X,oripl_Y,oripl_Z), App.Rotation(0.0,0.0,90)) | |
pl_2 = pl_0.multiply(App.Placement(App.Vector(0.,0.,0.),App.Rotation(0.0,0.0,90))) | |
double = Draft.makeRectangle(length=boundBoxLX,height=boundBoxLZ,placement=pl_2,face=False,support=None) #Ok | |
double.Label = nameLabel + "_BoundBoxRectangle_Fr" | |
FreeCADGui.activeDocument().activeObject().LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
conteneurRectangle.addObject(double) | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
#pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=FreeCAD.Vector(pl_2.Base.x + (boundBoxLX/2), pl_2.Base.y, pl_2.Base.z)) | |
#XZ -> XY | |
pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=pl_2.multVec(App.Vector(boundBoxLX/2, 0, 0))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Rectangle_Fr_2X_" + str(round(boundBoxLX,arrondi)) | |
conteneurInfo.addObject(pl_0C1) | |
#pl_0C2 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=FreeCAD.Vector(pl_2.Base.x, pl_2.Base.y, pl_2.Base.z + (boundBoxLZ/2))) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=pl_2.multVec(App.Vector(0, boundBoxLZ/2, 0))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Rectangle_Fr_2Z_" + str(round(boundBoxLZ,arrondi)) | |
conteneurInfo.addObject(pl_0C2) | |
except: | |
App_Console_PrintError(u"not done 2"+"\n") | |
try: | |
if (boundBoxLX and boundBoxLZ) > 0.0: | |
#pl_3 = App.Placement(App.Vector(oripl_X,oripl_Y+boundBoxLY,oripl_Z), App.Rotation(0.0,0.0,90)) | |
pl_3 = adjustedGlobalPlacement(objs[0], boundBoxLocation+App.Vector(0, boundBoxLY, 0)).multiply(App.Placement(App.Vector(0.,0.,0.),App.Rotation(0.0,0.0,90))) | |
double = Draft.makeRectangle(length=boundBoxLX,height=boundBoxLZ,placement=pl_3,face=False,support=None) #Ok | |
double.Label = nameLabel + "_BoundBoxRectangle_Re" | |
FreeCADGui.activeDocument().activeObject().LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
conteneurRectangle.addObject(double) | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
#XZ -> XY | |
pl_0C1 = Draft.make_text([str(round(boundBoxLX,arrondi))],placement=pl_3.multVec(App.Vector(boundBoxLX/2, 0, 0))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Rectangle_Re_3X_" + str(round(boundBoxLX,arrondi)) | |
conteneurInfo.addObject(pl_0C1) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=pl_3.multVec(App.Vector(0, boundBoxLZ/2, 0))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Rectangle_Re_3Z_" + str(round(boundBoxLZ,arrondi)) | |
conteneurInfo.addObject(pl_0C2) | |
except: | |
App_Console_PrintError(u"not done 3"+"\n") | |
try: | |
if (boundBoxLY and boundBoxLZ) > 0.0: | |
#pl_4 = App.Placement(App.Vector(oripl_X,oripl_Y,oripl_Z), App.Rotation(90,0.0,90)) | |
pl_4 = pl_0.multiply(App.Placement(App.Vector(0.,0.,0.),App.Rotation(90,0,90))) | |
double = Draft.makeRectangle(length=boundBoxLY,height=boundBoxLZ,placement=pl_4,face=False,support=None) #Ok | |
double.Label = nameLabel + "_BoundBoxRectangle_Le" | |
FreeCADGui.activeDocument().activeObject().LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
conteneurRectangle.addObject(double) | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
#pl_0C1 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=FreeCAD.Vector(pl_4.Base.x, pl_4.Base.y + (boundBoxLY/2), pl_4.Base.z)) | |
#YZ ->XY | |
pl_0C1 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=pl_4.multVec(App.Vector(boundBoxLY/2, 0., 0.))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Rectangle_Le_4Y_" + str(round(boundBoxLY,arrondi)) | |
conteneurInfo.addObject(pl_0C1) | |
#pl_0C2 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=FreeCAD.Vector(pl_4.Base.x, pl_4.Base.y, pl_4.Base.z + (boundBoxLZ/2))) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=pl_4.multVec(App.Vector(0., boundBoxLZ/2, 0))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Rectangle_Le_4Z_" + str(round(boundBoxLZ,arrondi)) | |
conteneurInfo.addObject(pl_0C2) | |
except: | |
App_Console_PrintError(u"not done 4"+"\n") | |
try: | |
if (boundBoxLY and boundBoxLZ) > 0.0: | |
#pl_5 = App.Placement(App.Vector(oripl_X+boundBoxLX,oripl_Y,oripl_Z), App.Rotation(90,0.0,90)) | |
pl_5 = adjustedGlobalPlacement(objs[0], boundBoxLocation+App.Vector(boundBoxLX,0,0)).multiply(App.Placement(App.Vector(0.,0.,0.),App.Rotation(90,0.0,90))) | |
double = Draft.makeRectangle(length=boundBoxLY,height=boundBoxLZ,placement=pl_5,face=False,support=None) #Ok | |
double.Label = nameLabel + "_BoundBoxRectangle_Ri" | |
FreeCADGui.activeDocument().activeObject().LineColor = (LineColor_red, LineColor_green, LineColor_blue) | |
conteneurRectangle.addObject(double) | |
if switchBoundBoxCreateText == 1: # section create dimension info | |
#YZ-> XY | |
pl_0C1 = Draft.make_text([str(round(boundBoxLY,arrondi))],placement=pl_5.multVec(App.Vector(boundBoxLY/2, 0, 0))) | |
pl_0C1.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C1.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C1.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C1.ViewObject.FontSize = FontSizeText | |
pl_0C1.Label = nameLabel + "_Rectangle_Ri_5Y_" + str(round(boundBoxLY,arrondi)) | |
conteneurInfo.addObject(pl_0C1) | |
pl_0C2 = Draft.make_text([str(round(boundBoxLZ,arrondi))],placement=pl_5.multVec(App.Vector(0, boundBoxLZ/2, 0 ))) | |
pl_0C2.ViewObject.DisplayMode = seTBoundBoxDisplayModeText | |
pl_0C2.ViewObject.Justification = seTBoundBoxJustificationText | |
pl_0C2.ViewObject.TextColor = (TextColorText_R, TextColorText_G, TextColorText_B) | |
pl_0C2.ViewObject.FontSize = FontSizeText | |
pl_0C2.Label = nameLabel + "_Rectangle_Ri_5Z_" + str(round(boundBoxLZ,arrondi)) | |
conteneurInfo.addObject(pl_0C2) | |
except: | |
App_Console_PrintError(u"not done 5"+"\n") | |
##### | |
App.ActiveDocument.recompute() | |
except Exception: | |
App_Console_PrintError(u"Bad selection"+"\n") | |
else: | |
App_Console_PrintMessage(u"Select an object !"+"\n") | |
############################################################################################################## | |
def axisPlane( posX = 0.0, posY = 0.0, posZ = 0.0, namePlane = "FCPlane"): # plane creation | |
global sel | |
global document_ | |
global object_Name | |
global boundBoxDiag | |
global switchInertia | |
global seTMemoClipBoard | |
global switchCreatePoint | |
global switchCreateAxis | |
global switchCreatePlane | |
global directionObj | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Plane") # memorise les actions (avec annuler restore) | |
#FreeCAD.ActiveDocument.commitTransaction() # restore les actions (avec annuler restore) | |
#FreeCAD.ActiveDocument.abortTransaction() # abandonne les actions(avec annuler restore) | |
sel = FreeCADGui.Selection.getSelection() | |
retour = Macro_FCInfo_05 # icone dans une variable (ok / ko) | |
switchInertia = 1 | |
if seTMemoClipBoard >= 1: # memo clipBoard | |
memo = QtWidgets.QApplication.clipboard() | |
memo.clear(mode=memo.Clipboard ) | |
if seTMemoClipBoard == 1: | |
memo.setText(u"FreeCAD.Vector("+str(Around(posX))+", "+str(Around(posY))+", "+str(Around(posZ))+")", mode = memo.Clipboard) # format : FreeCAD.Vector(x, y, z) | |
elif seTMemoClipBoard == 2: | |
memo.setText(str(Around(posX))+", "+str(Around(posY))+", "+str(Around(posZ)), mode = memo.Clipboard) # format : x, y, z | |
elif seTMemoClipBoard == 3: | |
memo.setText(str(Around(posX))+" "+str(Around(posY))+" "+str(Around(posZ)), mode = memo.Clipboard) # format : x y z | |
if switchCreatePoint == 1: | |
try: # create point | |
point = Draft.makePoint( posX, posY, posZ) | |
point.ViewObject.PointColor = (1.0,0.0,0.0) | |
point.Label = u"FCPoint" + namePlane | |
retour = Macro_FCInfo_06 | |
FreeCADGui.updateGui() # updateGui | |
App.ActiveDocument.recompute() | |
except Exception: | |
retour = Macro_FCInfo_07 | |
if switchCreatePlane == 1: | |
try: # create plane | |
doc = App.activeDocument() | |
if boundBoxDiag == 0.0: | |
boundBoxDiag = 10.0 | |
boundBoxLX = boundBoxLY = boundBoxLZ = boundBoxDiag | |
FCSpring = doc.addObject(u"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 = Macro_FCInfo_06 | |
except Exception: | |
retour = Macro_FCInfo_07 | |
if switchCreateAxis == 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(u"Dashdot") | |
centerX.Label = str(u"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(u"Dashdot") | |
centerY.Label = str(u"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(u"Dashdot") | |
centerZ.Label = str(u"Axis White PlaneZ") | |
FCSpring.addObject(centerZ) | |
FreeCADGui.updateGui() # updateGui | |
App.ActiveDocument.recompute() | |
retour = Macro_FCInfo_06 | |
except Exception: | |
retour = Macro_FCInfo_07 | |
try: | |
Gui.Selection.addSelection(App.ActiveDocument.getObject(object_Name)) | |
except Exception: | |
None | |
#FreeCAD.ActiveDocument.commitTransaction() # restore les actions (avec annuler restore) | |
#FreeCAD.ActiveDocument.abortTransaction() # abandonne les actions(avec annuler restore) | |
FreeCADGui.updateGui() # updateGui | |
switchInertia = 0 | |
return retour | |
def tableau(): | |
global sel | |
global subElemName | |
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(u"X1: "+str(a.Point.x)) | |
Vertx.append(u"Y1: "+str(a.Point.y)) | |
Vertx.append(u"Z1: "+str(a.Point.z)) | |
try: | |
a = sel[0].Shape.Edges[compt_E-1].Vertexes[1] # search Vertexes Edges | |
Vertx.append(u"X2: "+str(a.Point.x)) | |
Vertx.append(u"Y2: "+str(a.Point.y)) | |
Vertx.append(u"Z2: "+str(a.Point.z)) | |
except Exception: | |
Vertx.append(u"-") | |
Vertx.append(u"-") | |
Vertx.append(u"-") | |
FacesSurf = [] | |
FacesCoor = [] | |
for j in enumerate(sel[0].Shape.Faces): # search Faces | |
compt_F+=1 | |
Faces.append(u"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(u"X"+str(fco)+": "+str(f0.Point.x)) | |
FacesCoor.append(u"Y"+str(fco)+": "+str(f0.Point.y)) | |
FacesCoor.append(u"Z"+str(fco)+": "+str(f0.Point.z)) | |
compt_VF += 1 | |
FacesCoor += (u"T",) | |
RowCountTest = compt_E + compt_F + compt_VF | |
# encoder 3 couleurs et transparence renvoye la valeur (unsigned pour Preferences FC) | |
def unsignedEncode(red = 0, green = 0, blue = 0, transparent = 1): # | |
#(255 *256*256*256 ) + (85 *256*256) + (51 *256) +(1*255) = 4283773951 | |
red = int(red*255) | |
green = int(green*255) | |
blue = int(blue*255) | |
transparent = int(transparent*255) | |
value = int((red*pow(256,3)) + (green*pow(256,2)) + (blue*pow(256,1)) + (transparent*pow(256,0))) | |
return value | |
# converti decimal en hexadecimal | |
def decimalTohexa(decimal = 0): | |
# 5 = "05" | |
hexa = str(hex(int(decimal)))[2:4] | |
if len(hexa) == 1: | |
hexa = "0" + hexa | |
return hexa | |
def affect(passTableau): | |
global ui | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global object_Type | |
global subElemName | |
global RotationToEuler | |
global position0 | |
global position1 | |
global position2 | |
global diffuseColorRF | |
global diffuseColorVF | |
global diffuseColorBF | |
global diffuseColorTF | |
global transparenceFace | |
global unsignedEncodeColor | |
global cols | |
global colorShapeFace | |
global colorShapeLine | |
global colorShapePoint | |
global BsplineRayonApproximatif | |
global longueurObjet | |
global rayonObjet | |
global perimetre | |
global numberEdges | |
global nombreArretesMesh | |
global nombreFacesMesh | |
global nombrePointsMesh | |
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 seTDensiteValue | |
global poids | |
global uniteM | |
global uniteMs | |
global uniteS | |
global uniteSs | |
global uniteV | |
global uniteVs | |
global uniteP | |
global unitePs | |
global uniteAs | |
global boundBox_ | |
global boundBoxLX | |
global boundBoxLY | |
global boundBoxLZ | |
global boundBox_S | |
global BDvol | |
global adaptWithBody | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global boundBoxDiag | |
global boundBoxXMin | |
global boundBoxYMin | |
global boundBoxZMin | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global massOrGravity | |
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 direcNormalAt | |
global typeNormalAt | |
global switchDisplayInfoObject | |
global MatrixOfInertiaRaw | |
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 | |
global BsplineDetect | |
global BsplineNombreDeNoeuds | |
global BsplinePointsCoor | |
global BsplineArcsRadius | |
global BsplineArcsLocation | |
global switchBSplineCreateCircleConstructorAxis | |
global switchBSplineCreateCircleConstructor | |
global setBSplineToByArcValue | |
global BsplineCercleToolTip | |
global BsplineNumberElement | |
global BsplineCutLength | |
global BSplinetoByArcValeurS | |
global colorShapeFaceDiffuseColor | |
global detected | |
global indexFaceMesh | |
global coordPointsMesh | |
detected = "" | |
try: | |
atest = sel[0].Shape.Vertexes | |
except Exception: | |
#################### | |
selEx = FreeCADGui.Selection.getSelectionEx() | |
objs = [selobj.Object for selobj in selEx] | |
if len(objs) >= 1: | |
ui.on_ZeroInfo() # zero 25-07-2023 | |
if hasattr(objs[0], "Shape"): | |
colorShapeFace = colorShapeLine = colorShapePoint = colorShapeFaceDiffuseColor = [] | |
s = objs[0].Shape | |
elif hasattr(objs[0], "Mesh"): | |
##https://wiki.freecadweb.org/Mesh_API | |
originalObject = objs[0] | |
s = objs[0].Mesh # object mesh | |
sel = Gui.Selection.getSelection() # object | |
originalObject = sel[0] # object | |
colorShapeFace = colorShapeLine = colorShapePoint = colorShapeFaceDiffuseColor = [] | |
colorShapeFace = sel[0].ViewObject.ShapeColor | |
colorShapeLine = sel[0].ViewObject.LineColor | |
##colorShapePoint = sel[0].ViewObject.PointColor | |
detected = str(s) | |
cols = colors = [] | |
cols = sel[0].ViewObject.ShapeColor | |
diffuseColorRF = cols[0] | |
diffuseColorVF = cols[1] | |
diffuseColorBF = cols[2] | |
diffuseColorTF = float(transparenceFace) / 100.0 | |
transparenceFace = FreeCAD.ActiveDocument.getObject(sel[0].Name).ViewObject.Transparency | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((diffuseColorRF), (diffuseColorVF), (diffuseColorBF), 0.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(diffuseColorRF*255.0)) + "," + str(int(diffuseColorVF*255.0)) + "," + str(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorFloat = '"' + "(" + str(Around(diffuseColorRF)) + "," + str(Around(diffuseColorVF)) + "," + str(Around(diffuseColorBF)) + ")" + '"' | |
# | |
unsignedEncodeColor = unsignedEncodeColor + " , " + diffuseColorHexa + " , " + diffuseColorHexaPy + " , " + diffuseColorRVB + " , " + diffuseColorFloat | |
object_Label = sel[0].Label | |
object_Name = sel[0].Name | |
object_Type = sel[0].TypeId | |
typeObject = sel[0].Module | |
boundBox_ = s.BoundBox | |
boundBoxLX = boundBox_.XLength | |
boundBoxLY = boundBox_.YLength | |
boundBoxLZ = boundBox_.ZLength | |
boundBoxDiag = boundBox_.DiagonalLength | |
boundBox_S = "[X: "+str(Around(boundBoxLX * uniteM))+" "+uniteMs+"] x [Y: "+str(Around(boundBoxLY * uniteM))+" "+uniteMs+"] x [Z: "+str(Around(boundBoxLZ * uniteM))+" "+uniteMs+"] Diagonal: " + str(Around(boundBoxDiag * uniteM))+" "+uniteMs | |
#### | |
boundBoxLocation = App.Vector(boundBox_.Center[0], boundBox_.Center[1], boundBox_.Center[2]) | |
BDvol = adjustedGlobalPlacement(sel[0], boundBoxLocation) | |
boundBoxCenterX = BDvol.Base[0] | |
boundBoxCenterY = BDvol.Base[1] | |
boundBoxCenterZ = BDvol.Base[2] | |
#### | |
surface = s.Area | |
surfaceFace = s.Facets[indexFaceMesh].Area | |
coordPointsMesh = s.Facets[indexFaceMesh].Points | |
###################################### mesh later | |
# x=0 | |
# for i in s.Facets: | |
# print(str(Around(i.Area * uniteM )) + uniteMs) | |
# print(str((i.getEdge(0) ))) | |
# print(str((i.getEdge(0).Points))) | |
# print(str(i.Points)) | |
# print("____________________________________________") | |
# x += 1 | |
# if x >= 10 : break | |
###################################### | |
try: # no in version 018 | |
length0 = s.Facets[indexFaceMesh].getEdge(0).Length | |
length1 = s.Facets[indexFaceMesh].getEdge(1).Length | |
length2 = s.Facets[indexFaceMesh].getEdge(2).Length | |
except Exception: | |
length0 = length1 = length2 = 0.0 | |
longueurObjet = length0 + length1 + length2 | |
typeLongueur = u"Perimeter of face" | |
if switchCreateLineDiVatNatOnClick == 0: | |
typeNormalAt = u"Normal_____" | |
else: | |
typeNormalAt = u"*Normal_____" | |
direcNormalAt = s.Facets[indexFaceMesh].Normal | |
volume_ = s.Volume | |
# poids | |
poids = ((volume_ * seTDensiteValue) * uniteP) / 1000.0 # mm3 (mm base FreeCAD) | |
CenterOfMassX = s.CenterOfGravity[0] | |
CenterOfMassY = s.CenterOfGravity[1] | |
CenterOfMassZ = s.CenterOfGravity[2] | |
subElemName = "Face" + str(indexFaceMesh) | |
DeterminantM = 0.0 | |
nombreFacesMesh = s.CountFacets | |
nombrePointsMesh = s.CountPoints | |
try: # no in version 018 | |
nombreArretesMesh = s.CountEdges | |
except Exception: | |
nombreArretesMesh = 0 | |
#print(s.Topology) | |
elif hasattr(objs[0], "Points"): | |
s = objs[0].Points | |
#sel = Gui.Selection.getSelection() | |
detected = str(s) | |
sel = Gui.Selection.getSelection() | |
cols = colors = [] | |
colorShapeFace = colorShapeLine = colorShapePoint = colorShapeFaceDiffuseColor = [] | |
cols = FreeCAD.ActiveDocument.getObject(sel[0].Name).ViewObject.ShapeColor | |
diffuseColorRF = cols[0] | |
diffuseColorVF = cols[1] | |
diffuseColorBF = cols[2] | |
diffuseColorTF = float(transparenceFace) / 100.0 | |
transparenceFace = FreeCAD.ActiveDocument.getObject(sel[0].Name).ViewObject.Transparency | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((diffuseColorRF), (diffuseColorVF), (diffuseColorBF), 0.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(diffuseColorRF*255.0)) + "," + str(int(diffuseColorVF*255.0)) + "," + str(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorFloat = '"' + "(" + str(Around(diffuseColorRF)) + "," + str(Around(diffuseColorVF)) + "," + str(Around(diffuseColorBF)) + ")" + '"' | |
# | |
unsignedEncodeColor = unsignedEncodeColor + " , " + diffuseColorHexa + " , " + diffuseColorHexaPy + " , " + diffuseColorRVB + " , " + diffuseColorFloat | |
object_Label = sel[0].Label | |
object_Name = sel[0].Name | |
object_Type = sel[0].TypeId | |
typeObject = sel[0].Module | |
nombrePointsMesh = s.CountPoints | |
boundBox_ = s.BoundBox | |
boundBoxLX = boundBox_.XLength | |
boundBoxLY = boundBox_.YLength | |
boundBoxLZ = boundBox_.ZLength | |
try: | |
boundBoxDiag = boundBox_.DiagonalLength | |
except Exception: | |
boundBoxDiag = 0.0 | |
boundBox_S = "[X: "+str(Around(boundBoxLX * uniteM))+" "+uniteMs+"] x [Y: "+str(Around(boundBoxLY * uniteM))+" "+uniteMs+"] x [Z: "+str(Around(boundBoxLZ * uniteM))+" "+uniteMs+"] Diagonal: " + str(Around(boundBoxDiag * uniteM))+" "+uniteMs | |
#### correction | |
boundBoxLocation = App.Vector(boundBox_.Center[0], boundBox_.Center[1], boundBox_.Center[2]) | |
BDvol = adjustedGlobalPlacement(sel[0], boundBoxLocation) | |
#### | |
boundBoxCenterX = BDvol.Base[0] | |
boundBoxCenterY = BDvol.Base[1] | |
boundBoxCenterZ = BDvol.Base[2] | |
CenterOfMassX = CenterOfMassY = CenterOfMassZ = 0.0 | |
#### Fem debut | |
elif sel[0].isDerivedFrom("Fem::FemPostWarpVectorFilter"): # same sel[0].TypeId | |
detected = "FemPostWarpVectorFilter" | |
object_Label = sel[0].Label | |
object_Name = sel[0].Name | |
object_Type = sel[0].TypeId | |
typeObject = sel[0].Module | |
boundBox_ = sel[0].ViewObject.getBoundingBox() | |
boundBoxLX = boundBox_.XLength | |
boundBoxLY = boundBox_.YLength | |
boundBoxLZ = boundBox_.ZLength | |
try: | |
boundBoxDiag = boundBox_.DiagonalLength | |
except Exception: | |
boundBoxDiag = 0.0 | |
boundBox_S = "[X: "+str(Around(boundBoxLX * uniteM))+" "+uniteMs+"] x [Y: "+str(Around(boundBoxLY * uniteM))+" "+uniteMs+"] x [Z: "+str(Around(boundBoxLZ * uniteM))+" "+uniteMs+"] Diagonal: " + str(Around(boundBoxDiag * uniteM))+" "+uniteMs | |
#### correction | |
boundBoxLocation = App.Vector(boundBox_.Center[0], boundBox_.Center[1], boundBox_.Center[2]) | |
BDvol = adjustedGlobalPlacement(sel[0], boundBoxLocation) | |
#### | |
boundBoxCenterX = BDvol.Base[0] | |
boundBoxCenterY = BDvol.Base[1] | |
boundBoxCenterZ = BDvol.Base[2] | |
CenterOfMassX = CenterOfMassY = CenterOfMassZ = 0.0 | |
#### Fem fin ################## | |
else: | |
App_Console_PrintMessage(u"Invalid selection " + "\n") | |
errorDialog(u"Invalid selection " + "\n" + detected ) | |
sel = selEx = "" | |
else: | |
sel = FreeCADGui.Selection.getSelection() | |
mydoc = FreeCAD.activeDocument().Name | |
document_ = mydoc | |
try: | |
object_Type += " / " + sel[0].TypeId | |
object_Type = sel[0].Shape.TypeId | |
except Exception: | |
object_Type = "?" | |
try: | |
object_Label = sel[0].Label | |
object_Name = sel[0].Name | |
except Exception: | |
object_Label = "" | |
object_Name = "" | |
try: | |
SubElement = FreeCADGui.Selection.getSelectionEx() | |
subElemName = SubElement[0].SubElementNames[0] | |
except Exception: | |
subElemName = "" | |
#### sketcher begin #### | |
## | |
##https://forum.freecadweb.org/viewtopic.php?f=22&t=53127 | |
##How to select edges inside of Sketcher? | |
## | |
sketch = Gui.Selection.getSelection()[0] | |
App.ActiveDocument.recompute() | |
if (Gui.ActiveDocument.getInEdit() and (sketch.TypeId == "Sketcher::SketchObject")) and ("Constraint" not in subElemName): # sketcher open | |
try: | |
longueurObjet = rayonObjet = points1 = points2 = 0.0 | |
directionObj = direcValueAt = direcNormalAt = "" | |
typeLongueur = RotationToEuler = "" | |
nameSketch = sketch.Name | |
sketch0 = Gui.Selection.getSelectionEx()[0] | |
subElemName = sketch0.SubElementNames[0] | |
RotationToEuler = sketch.Placement.Rotation.toEuler() # Plan (Direction) | |
indexSubObject = int(subElemName[4:]) - 1 # index | |
sObject = App.ActiveDocument.getObject(nameSketch).Geometry[indexSubObject] | |
typeObject = sketch.TypeId | |
if isinstance(sObject,(Part.LineSegment)): | |
#print("Part.LineSegment") | |
points1 = sObject.StartPoint | |
points2 = sObject.EndPoint | |
longueurObjet = sObject.length() | |
typeLongueur = u"Length (Sk) " | |
directionObj = points2.sub(points1) | |
elif isinstance(sObject,(Part.BSplineCurve)): | |
#print("Part.BSplineCurve") | |
points1 = sObject.StartPoint | |
points2 = sObject.EndPoint | |
longueurObjet = sObject.length() | |
typeLongueur = u"Length (Sk) " | |
directionObj = points2.sub(points1) | |
elif isinstance(sObject,(Part.Circle)): | |
#print("Part.Circle") | |
longueurObjet = sObject.length() | |
typeLongueur = u"Length (Sk) " | |
rayonObjet = sObject.Radius | |
elif isinstance(sObject,(Part.ArcOfCircle)): | |
#print("Part.ArcOfCircle") | |
points1 = sObject.StartPoint | |
points2 = sObject.EndPoint | |
longueurObjet = sObject.length() | |
typeLongueur = u"Length (Sk) " | |
rayonObjet = sObject.Radius | |
directionObj = points2.sub(points1) | |
else: | |
None | |
#### | |
# angles | |
if isinstance(sObject,(Part.Circle)) == False: | |
try: | |
angleX1 = points1.x; angleY1 = points1.y; angleZ1 = points1.z | |
angleX2 = points2.x; angleY2 = points2.y; angleZ2 = points2.z | |
except Exception: | |
angleX1 = angleY1 = angleZ1 = 0.0 | |
angleX2 = angleY2 = angleZ2 = 0.0 | |
modeTypeAngle = 1 # 1 = degrees other = radians | |
try: | |
Plan_xy = Around(angle2(angleX1, angleY1, angleX2, angleY2, modeTypeAngle)) | |
Plan_xy_V = "[,"+str(Around(angleX1))+" , "+str(Around(angleY1))+",] [,"+str(Around(angleX2))+" , "+str(Around(angleY2))+",]" | |
except Exception: | |
Plan_xy = 0.0; Plan_xy_V = "" | |
try: | |
Plan_yz = Around(angle2(angleY1, angleZ1, angleY2, angleZ2, modeTypeAngle)) | |
Plan_yz_V = "[,"+str(Around(angleY1))+" , "+str(Around(angleZ1))+",] [,"+str(Around(angleY2))+" , "+str(Around(angleZ2))+",]" | |
except Exception: | |
Plan_yz = 0.0; Plan_yz_V = "" | |
try: | |
Plan_zx = Around(angle2(angleZ1, angleX1, angleZ2, angleX2, modeTypeAngle)) | |
Plan_zx_V = "[,"+str(Around(angleZ1))+" , "+str(Around(angleX1))+",] [,"+str(Around(angleZ2))+" , "+str(Around(angleX2))+",]" | |
except Exception: | |
Plan_zx = 0.0; Plan_zx_V = "" | |
except Exception: | |
None | |
## | |
#### sketcher end #### | |
else: | |
# colors (DiffuseColor) | |
try: | |
#### search color face selected | |
a = FreeCADGui.Selection.getSelectionEx() # selection sous objet | |
aa = FreeCADGui.Selection.getSelection() # selection objet | |
colorShapeFace = colorShapeLine = colorShapePoint = colorShapeFaceDiffuseColor = [] | |
colorShapeFace = aa[0].ViewObject.ShapeColor | |
colorShapeLine = aa[0].ViewObject.LineColor | |
colorShapePoint = aa[0].ViewObject.PointColor | |
diffuseColorRF = diffuseColorVF = diffuseColorBF = diffuseColorTF = 0.0 | |
transparenceFace = 0 | |
cols = colors = [] | |
if str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:5] == "Face": | |
cols = colors = [] | |
cols = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.DiffuseColor | |
if len(cols) == 1: | |
for i in aa[0].Shape.Faces: | |
colors += [(cols[0])] | |
cols = colors | |
else: | |
colors = cols | |
fce = int(a[0].SubElementNames[0][4:])-1 | |
indexFaceMesh = fce | |
colorShapeFaceDiffuseColor = colors #[fce] | |
diffuseColorRF = colors[fce][0] | |
diffuseColorVF = colors[fce][1] | |
diffuseColorBF = colors[fce][2] | |
diffuseColorTF = colors[fce][3] | |
transparenceFace = math.ceil(round(cols[fce][3]*100, 12)) | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((diffuseColorRF), (diffuseColorVF), (diffuseColorBF), 1.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(diffuseColorRF*255.0)) + "," + str(int(diffuseColorVF*255.0)) + "," + str(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorFloat = '"' + "(" + str(Around(diffuseColorRF)) + "," + str(Around(diffuseColorVF)) + "," + str(Around(diffuseColorBF)) + ")" + '"' | |
# | |
unsignedEncodeColor = unsignedEncodeColor + " , " + diffuseColorHexa + " , " + diffuseColorHexaPy + " , " + diffuseColorRVB + " , " + diffuseColorFloat | |
elif str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:5] == "Edge": | |
cols = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.LineColor | |
diffuseColorRF = cols[0] | |
diffuseColorVF = cols[1] | |
diffuseColorBF = cols[2] | |
diffuseColorTF = 0.0 | |
transparenceFace = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.Transparency | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((diffuseColorRF), (diffuseColorVF), (diffuseColorBF), 0.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(diffuseColorRF*255.0)) + "," + str(int(diffuseColorVF*255.0)) + "," + str(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorFloat = '"' + "(" + str(Around(diffuseColorRF)) + "," + str(Around(diffuseColorVF)) + "," + str(Around(diffuseColorBF)) + ")" + '"' | |
# | |
unsignedEncodeColor = unsignedEncodeColor + " , " + diffuseColorHexa + " , " + diffuseColorHexaPy + " , " + diffuseColorRVB + " , " + diffuseColorFloat | |
elif str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:7] == "Vertex": | |
cols = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.PointColor | |
diffuseColorRF = cols[0] | |
diffuseColorVF = cols[1] | |
diffuseColorBF = cols[2] | |
diffuseColorTF = 0.0 | |
transparenceFace = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.Transparency | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((diffuseColorRF), (diffuseColorVF), (diffuseColorBF), 0.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(diffuseColorRF*255.0)) + "," + str(int(diffuseColorVF*255.0)) + "," + str(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorFloat = '"' + "(" + str(Around(diffuseColorRF)) + "," + str(Around(diffuseColorVF)) + "," + str(Around(diffuseColorBF)) + ")" + '"' | |
# | |
unsignedEncodeColor = unsignedEncodeColor + " , " + diffuseColorHexa + " , " + diffuseColorHexaPy + " , " + diffuseColorRVB + " , " + diffuseColorFloat | |
else: | |
unsignedEncodeColor = unsignedEncodeColor = diffuseColorHexa = diffuseColorHexaPy = diffuseColorRVB = "" | |
diffuseColorRF = 0.0; diffuseColorVF = 0.0; diffuseColorBF = 0.0; diffuseColorTF = 0.0; unsignedEncodeColor = "" | |
except Exception: | |
if str(aa) == "[<Part::Part2DObject>]": # (triangle) une Face du Mesh | |
colorShapeFace = colorShapeLine = colorShapePoint = colorShapeFaceDiffuseColor = [] | |
colorShapeFace = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.ShapeColor | |
cols = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.LineColor | |
diffuseColorRF = cols[0] | |
diffuseColorVF = cols[1] | |
diffuseColorBF = cols[2] | |
diffuseColorTF = 0.0 | |
transparenceFace = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.Transparency | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((diffuseColorRF), (diffuseColorVF), (diffuseColorBF), 0.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(diffuseColorRF*255.0)) + decimalTohexa(int(diffuseColorVF*255.0)) + decimalTohexa(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(diffuseColorRF*255.0)) + "," + str(int(diffuseColorVF*255.0)) + "," + str(int(diffuseColorBF*255.0)) + '"' | |
diffuseColorFloat = '"' + "(" + str(Around(diffuseColorRF)) + "," + str(Around(diffuseColorVF)) + "," + str(Around(diffuseColorBF)) + ")" + '"' | |
# | |
unsignedEncodeColor = unsignedEncodeColor + " , " + diffuseColorHexa + " , " + diffuseColorHexaPy + " , " + diffuseColorRVB + " , " + diffuseColorFloat | |
else: | |
unsignedEncodeColor = unsignedEncodeColor = diffuseColorHexa = diffuseColorHexaPy = diffuseColorRVB = "" | |
diffuseColorRF = 0.0; diffuseColorVF = 0.0; diffuseColorBF = 0.0; diffuseColorTF = 0.0; unsignedEncodeColor = "" | |
# Shape | |
# longueur Objet | |
try: | |
longueurObjet = Gui.Selection.getSelectionEx()[0].SubObjects[0].Length | |
if str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:5] == "Face": | |
typeLongueur = u"Perimeter of the face" | |
else: | |
typeLongueur = u"Length of the object" | |
except Exception: | |
longueurObjet = 0.0 | |
typeLongueur = u"Length of the object" | |
######################## | |
# | |
# if (str(s.Curve)[1:5]) == "Line" : | |
# FreeCAD.Console.PrintMessage( "4The Object is a Line!\n") | |
# | |
############################ | |
# rayon Objet cas cercle et Bspline Begin | |
BsplineDetect = "" | |
BsplinePointsCoor = [] | |
rayonObjet = 0.0 | |
try: | |
BsplineDetect = str(Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve) #"<BSplineCurve object>" | |
except Exception: BsplineDetect = "" | |
# surface Face Radius (surveiller la position !!) | |
try: | |
rayonObjet = Gui.Selection.getSelectionEx()[0].SubObjects[0].Surface.Radius | |
except Exception: | |
rayonObjet = 0.0 | |
try: | |
rayonObjet = Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.Radius | |
BsplineDetect = "" | |
BsplineArcsRadius = [] | |
except Exception: | |
# try: | |
if str(BsplineDetect) == "<BSplineCurve object>" : | |
BsplineDetect = Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve | |
BsplineNombreDeNoeuds = BsplineDetect.NbKnots | |
#### toBiArcs | |
BsplineArcsToBiArcs = BsplineDetect.toBiArcs(setBSplineToByArcValue) | |
BsplineNumberElement = len(BsplineArcsToBiArcs) | |
BsplineArcsRadius = [] | |
for i in BsplineArcsToBiArcs: # radius on point "toBiArcs(0.00001)" | |
try: | |
BsplineArcsRadius.append(i.Radius) # .Axis , Vector (-0.7265381966759821, 0.49597386656536946, -0.4755545946103446) | |
# .Location (center) , Vector (47.192438328074296, -12.532928959782193, -85.17027221104478) | |
# .Circle , Circle (Radius : 390.516, Position : (47.1924, -12.5329, -85.1703), Direction : (-0.726538, 0.495974, -0.475555)) | |
# .Radius , 390.51645180669107 | |
#ArcOfCircle (Radius : 90.2998, Position : (-123.212, -33.0236, 153.798), Direction : (-0.726538, 0.495974, -0.475555), Parameter : (3.37639, 3.38484)) | |
rayonObjet = BsplineArcsRadius[0] | |
except Exception: | |
BsplineArcsRadius = [] | |
rayonObjet = 0.0 | |
#### for create points and circle creators of the BSpline | |
if (switchBSplineCreateCircleConstructorAxis == 1) or ( switchBSplineCreateCircleConstructor == 1): | |
try: | |
BsplineArcsLocation = [] | |
for i in BsplineArcsToBiArcs: | |
BsplineArcsLocation.append(i) # .Location (center), Vector (47.192438328074296, -12.532928959782193, -85.17027221104478) | |
except Exception: | |
BsplineArcsLocation = [] | |
None | |
#### | |
BsplineNumberToBiArcs = len(BsplineArcsToBiArcs) | |
#### toBiArcs | |
try: | |
BsplineRayonApproximatif = str(Around(BsplineArcsRadius[0] * float(uniteM))) + " " + uniteMs | |
except Exception : | |
BsplineRayonApproximatif = u"" | |
try: | |
#### distance between 2 points Shape | |
bsplineL = Gui.Selection.getSelection()[0] | |
BsplineLength = float(bsplineL.Shape.Length) | |
BsplineCutLength = BsplineLength / float(BsplineNumberElement) | |
#### points noeuds | |
for i in bsplineL.Points: # nombre de points (noeuds) | |
BsplinePointsCoor.append(i) | |
#### points Shape | |
except Exception: # None | |
#### distance between 2 points Curve.getPoles() | |
bsplineL = Gui.Selection.getSelectionEx()[0].SubObjects[0] #.Curve | |
BsplineLength = float(bsplineL.Length) | |
BsplineCutLength = BsplineLength / float(BsplineNumberElement) | |
#### points a.Curve.NbKnots | |
for i in Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.getPoles(): # nombre de poles (noeuds) | |
BsplinePointsCoor.append(i) | |
#### points a.Curve.NbKnots | |
typeLongueur = "Length BSpline" | |
# except Exception: | |
# rayonObjet = 0.0 | |
# rayon Objet cas cercle et Bspline End | |
# tableau | |
if passTableau == 1: | |
tableau() | |
# surface | |
try: # object | |
surface = sel[0].Shape.Area | |
except Exception: | |
surface = 0.0 | |
try: # face | |
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_ * seTDensiteValue) * 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(Around(boundBoxLX * uniteM))+" "+uniteMs+"] x [Y: "+str(Around(boundBoxLY * uniteM))+" "+uniteMs+"] x [Z: "+str(Around(boundBoxLZ * uniteM))+" "+uniteMs+"] Diagonal: " + str(Around(boundBoxDiag * uniteM))+" "+uniteMs | |
boundBoxXMin = boundBox_.XMin # BB tracing | |
boundBoxYMin = boundBox_.YMin | |
boundBoxZMin = boundBox_.ZMin | |
except Exception: | |
boundBox_ = boundBoxLX = boundBoxLY = boundBoxLZ = boundBoxDiag = 0.0 | |
boundBox_S = "" | |
if adaptWithBody == 0: | |
# centre de la forme (boundBox) mode sans Body (normal) | |
try: | |
boundBoxCenterX = boundBox_.Center[0] | |
boundBoxCenterY = boundBox_.Center[1] | |
boundBoxCenterZ = boundBox_.Center[2] | |
except Exception: | |
boundBoxCenterX = boundBoxCenterY = boundBoxCenterZ = 0.0 | |
else: | |
# centre de la forme (boundBox) mode avec correction Body GetGlobalPlacement | |
try: | |
#### correction | |
boundBoxLocation = App.Vector(boundBox_.Center[0], boundBox_.Center[1], boundBox_.Center[2]) | |
BDvol = adjustedGlobalPlacement(sel[0], boundBoxLocation) | |
#### | |
boundBoxCenterX = BDvol.Base[0] | |
boundBoxCenterY = BDvol.Base[1] | |
boundBoxCenterZ = BDvol.Base[2] | |
except Exception: | |
boundBoxCenterX = boundBoxCenterY = boundBoxCenterZ = 0.0 | |
# 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 | |
modeTypeAngle = 1 | |
try: | |
Plan_xy = Around(angle2(angleX1,angleY1,angleX2,angleY2,modeTypeAngle)) | |
Plan_xy_V = "[,"+str(Around(angleX1))+" , "+str(Around(angleY1))+",] [,"+str(Around(angleX2))+" , "+str(Around(angleY2))+",]" | |
except Exception: | |
Plan_xy = 0.0 | |
Plan_xy_V = "" | |
try: | |
Plan_yz = Around(angle2(angleY1,angleZ1,angleY2,angleZ2,modeTypeAngle)) | |
Plan_yz_V = "[,"+str(Around(angleY1))+" , "+str(Around(angleZ1))+",] [,"+str(Around(angleY2))+" , "+str(Around(angleZ2))+",]" | |
except Exception: | |
Plan_yz = 0.0 | |
Plan_yz_V = "" | |
try: | |
Plan_zx = Around(angle2(angleZ1,angleX1,angleZ2,angleX2,modeTypeAngle)) | |
Plan_zx_V = "[,"+str(Around(angleZ1))+" , "+str(Around(angleX1))+",] [,"+str(Around(angleZ2))+" , "+str(Around(angleX2))+",]" | |
except Exception: | |
Plan_zx = 0.0 | |
Plan_zx_V = "" | |
# angle Placement | |
try: | |
typeObject = sel[0].Shape.ShapeType | |
except Exception: | |
typeObject = "" | |
# center of mass or gravity | |
try: | |
c = FreeCADGui.Selection.getSelection()[0].Shape.CenterOfMass | |
massOrGravity = " Mass " | |
except Exception: | |
try: | |
c = FreeCADGui.Selection.getSelection()[0].Shape.CenterOfGravity | |
massOrGravity = " Gravity " | |
except Exception: | |
try: | |
###https://forum.freecad.org/viewtopic.php?p=664655#p664655 | |
##shp = App.ActiveDocument.Shape059.Shape | |
##cog = (shp.Face1.CenterOfGravity + shp.Face2.CenterOfGravity) / 2 | |
##Part.show(Part.Vertex(cog)) | |
selEx = FreeCADGui.Selection.getSelectionEx() | |
objs = [selobj.Object for selobj in selEx] | |
s = objs[0].Shape | |
c = s.Solids[0].CenterOfMass | |
massOrGravity = " Mass " | |
except Exception: | |
c = "" | |
massOrGravity = " Mass " | |
if adaptWithBody == 0: | |
# centre de la forme (CenterOfMass) mode sans Body (normal) | |
try: | |
CenterOfMassX = c.x | |
CenterOfMassY = c.y | |
CenterOfMassZ = c.z | |
massOrGravity = " Mass " | |
except Exception: | |
try: | |
c = FreeCADGui.Selection.getSelection()[0].Shape.CenterOfGravity | |
CenterOfMassX = c.x | |
CenterOfMassY = c.y | |
CenterOfMassZ = c.z | |
massOrGravity = " Gravity " | |
except: | |
CenterOfMassX = CenterOfMassY = CenterOfMassZ = 0.0 | |
massOrGravity = " Mass " | |
else: | |
# centre de la forme (CenterOfMass) mode avec correction Body GetGlobalPlacement | |
try: | |
#### correction | |
boundBoxLocation = App.Vector(c[0], c[1], c[2]) | |
BDvol = adjustedGlobalPlacement(sel[0], boundBoxLocation) | |
#### | |
CenterOfMassX = BDvol.Base[0] | |
CenterOfMassY = BDvol.Base[1] | |
CenterOfMassZ = BDvol.Base[2] | |
except Exception: | |
CenterOfMassX = CenterOfMassY = CenterOfMassZ = 0.0 | |
# inertia DeterminantM | |
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 | |
matrixOfInertia = FreeCADGui.Selection.getSelection()[0].Shape.MatrixOfInertia | |
except Exception: | |
try: | |
selEx = FreeCADGui.Selection.getSelectionEx() | |
objs = [selobj.Object for selobj in selEx] | |
s = objs[0].Shape | |
matrixOfInertia = s.Solids[0].MatrixOfInertia | |
except Exception: | |
matrixOfInertia = "" | |
MatrixOfInertiaRaw = str(matrixOfInertia) | |
# Matrix of inertia | |
## Verify this section by person knowing the inertia position ## | |
## ONLY IF THE OBJECT IS PRESENT IN ONE BODY ## | |
## and post your knowledges in the forum tread if it is not correct ## | |
## http://forum.freecadweb.org/viewtopic.php?f=10&t=3185 ## | |
try: # Matrix of inertia | |
MatrixX1_16 = MatrixX1 = (matrixOfInertia.A[0]) | |
MatrixY1_16 = MatrixY1 = (matrixOfInertia.A[1]) | |
MatrixZ1_16 = MatrixZ1 = (matrixOfInertia.A[2]) | |
Matrix_1 = (matrixOfInertia.A[3]) | |
MatrixX2_16 = MatrixX2 = (matrixOfInertia.A[4]) | |
MatrixY2_16 = MatrixY2 = (matrixOfInertia.A[5]) | |
MatrixZ2_16 = MatrixZ2 = (matrixOfInertia.A[6]) | |
Matrix_2 = (matrixOfInertia.A[7]) | |
MatrixX3_16 = MatrixX3 = (matrixOfInertia.A[8]) | |
MatrixY3_16 = MatrixY3 = (matrixOfInertia.A[9]) | |
MatrixZ3_16 = MatrixZ3 = (matrixOfInertia.A[10]) | |
Matrix_3 = (matrixOfInertia.A[11]) | |
Matrix12 = (matrixOfInertia.A[12]) | |
Matrix13 = (matrixOfInertia.A[13]) | |
Matrix14 = (matrixOfInertia.A[14]) | |
Matrix15 = (matrixOfInertia.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 verifier choix objet ou sub objet | |
# edgeObject = Gui.Selection.getSelection()[0].Shape.Edges[0] # first edge of Shape | |
edgeObject = Gui.Selection.getSelectionEx()[0].SubObjects[0].Edges[0] # sub object selcted | |
directionObj = edgeObject.Vertexes[1].Point.sub(edgeObject.Vertexes[0].Point) | |
except Exception: | |
directionObj = "[]" | |
try: # valueAt(0) | |
direcValueAt = Gui.Selection.getSelectionEx()[0].SubObjects[0].Edges[0].valueAt(0) | |
except Exception: | |
direcValueAt = "[]" | |
try: # normalAt(0,0) | |
if switchCreateLineDiVatNatOnClick == 0: | |
typeNormalAt = u"NormalAt(0,0)" | |
else: | |
typeNormalAt = u"*NormalAt(0,0)" | |
direcNormalAt = Gui.Selection.getSelectionEx()[0].SubObjects[0].Faces[0].normalAt(0,0) | |
except Exception: | |
direcNormalAt = "[]" | |
#### Display info | |
if switchDisplayInfoObject == 1 : | |
if switchClearDisplayReportView == 1: | |
##################### effacer la vue rapport ############################ | |
try: #### | |
mw=Gui.getMainWindow() #### | |
r=mw.findChild(QtWidgets.QTextEdit, "Report view") #### | |
r.clear() #### | |
except Exception: #### | |
None #### | |
######################################################################### | |
App_Console_PrintMessage(u"\n") | |
App_Console_PrintMessage(u"FCInfo_Beginning_"+str(subElemName) +"______________________________________________________"+"\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(subElemName)+"\n") | |
App_Console_PrintMessage(u"Object type : "+typeObject+"\n") | |
App_Console_PrintMessage(u"Object type : "+object_Type+"\n") | |
App_Console_PrintMessage(u"Mouse coordinates : X: "+str(Around(position0 * uniteM)) + " " + uniteMs + " Y:" + str(Around(position1 * uniteM)) + " " + uniteMs + " Z:" + str(Around(position2 * uniteM)) + " " + uniteMs + "\n") | |
App_Console_PrintMessage(typeLongueur + " : "+str(Around(longueurObjet * uniteM))+", "+uniteMs+"\n\n") | |
App_Console_PrintMessage(u"Color on selection" + "\n") | |
App_Console_PrintMessage(u"Red" + ", " + str(int(diffuseColorRF*255.0)) + ", " + | |
u"Green" + ", " + str(int(diffuseColorVF*255.0)) + ", " + | |
u"Blue" + ", " + str(int(diffuseColorBF*255.0)) + ", " + | |
u"Transparency" + ", " + str(int(diffuseColorTF*255.0)) + "\n\n") | |
#### couleurs | |
if len(colorShapeFace) != 0: | |
App_Console_PrintMessage(u"Color Object (float) " + str(colorShapeFace[0])+", "+str(colorShapeFace[1])+", "+str(colorShapeFace[2])+", "+str(colorShapeFace[3])+")" + "\n") | |
App_Console_PrintMessage(u"Color Object (int )(" + str(int(colorShapeFace[0]*255.0))+", "+str(int(colorShapeFace[1]*255.0))+", "+str(int(colorShapeFace[2]*255.0))+", "+str(int(colorShapeFace[3]*255.0))+")" + "\n\n") | |
if len(colorShapeLine) != 0: | |
App_Console_PrintMessage(u"Color Line(s) (float) " + str(colorShapeLine[0])+", "+str(colorShapeLine[1])+", "+str(colorShapeLine[2])+", "+str(colorShapeLine[3])+")" + "\n") | |
App_Console_PrintMessage(u"Color Line(s) (int )(" + str(int(colorShapeLine[0]*255.0))+", "+str(int(colorShapeLine[1]*255.0))+", "+str(int(colorShapeLine[2]*255.0))+", "+str(int(colorShapeLine[3]*255.0))+")" + "\n\n") | |
if len(colorShapePoint) != 0: | |
try: | |
App_Console_PrintMessage(u"Color Point(s) (float) " + str(colorShapePoint[0])+", "+str(colorShapePoint[1])+", "+str(colorShapePoint[2])+", "+str(colorShapePoint[3])+")" + "\n") | |
App_Console_PrintMessage(u"Color Point(s) (int )(" + str(int(colorShapePoint[0]*255.0))+", "+str(int(colorShapePoint[1]*255.0))+", "+str(int(colorShapePoint[2]*255.0))+", "+str(int(colorShapePoint[3]*255.0))+")" + "\n\n") | |
except Exception: | |
None | |
if detected[0:4] == "Mesh": | |
App_Console_PrintMessage(u"Number of Edges : "+str(nombreArretesMesh)+"\n") | |
App_Console_PrintMessage(u"Number of Faces : "+str(nombreFacesMesh)+"\n") | |
App_Console_PrintMessage(u"Number of Points : "+str(nombrePointsMesh)+"\n\n") | |
if detected == "<PointKernel object>": | |
App_Console_PrintMessage(u"Number of Points : "+str(nombrePointsMesh)+"\n\n") | |
############### detail of Cercle BSpline begin | |
if (rayonObjet != 0.0) or (str(BsplineDetect) == "<BSplineCurve object>"): | |
if (str(BsplineDetect) == "<BSplineCurve object>"): | |
App_Console_PrintMessage(u"Number of nodes : "+str(BsplineNombreDeNoeuds) +"\n") | |
for i in enumerate(BsplinePointsCoor): # nombre de points | |
App_Console_PrintMessage("\t" + u"X" + str(i[0]+1) + ": " + str(Around(float(BsplinePointsCoor[i[0]][0]))) + " " + "\t" + | |
u"Y" + str(i[0]+1) + ": " + str(Around(float(BsplinePointsCoor[i[0]][1]))) + " " + "\t" + | |
u"Z" + str(i[0]+1) + ": " + str(Around(float(BsplinePointsCoor[i[0]][2]))) + "\n") | |
App_Console_PrintMessage(u"\n") | |
else: | |
App_Console_PrintMessage(u"Radius of the object : "+str(Around(rayonObjet * uniteM))+", "+uniteMs +"\n") | |
App_Console_PrintMessage(u"Diameter of the object : "+str(Around((rayonObjet * uniteM) * 2.0))+", "+uniteMs +"\n") | |
############### detail of Cercle BSpline end | |
App_Console_PrintMessage(u"Perimeter of the shape : "+str(Around(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(Around(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(Around(float(chaine[1]) * float(uniteM)))+" "+uniteMs+"\n") | |
except Exception: | |
None | |
co += 1 | |
aa += 6 | |
App_Console_PrintMessage(u"\n") | |
co=0 | |
cco=0 | |
for j in enumerate(Faces): | |
App_Console_PrintMessage(u"Area "+str(j[1])+" = "+str(Around(float(FacesSurf[co]) * float(uniteS)))+" "+uniteSs+"\n") | |
if len(colorShapeFaceDiffuseColor) != 0: | |
App_Console_PrintMessage(u"Color float Face" + str(j[0]+1) + " " + | |
u"R: " + str(colorShapeFaceDiffuseColor[j[0]][0]) + ", "+ | |
u"G: " + str(colorShapeFaceDiffuseColor[j[0]][1]) + ", "+ | |
u"B: " + str(colorShapeFaceDiffuseColor[j[0]][2]) + ", "+ | |
u"T: " + str(colorShapeFaceDiffuseColor[j[0]][3]) + "\n") | |
App_Console_PrintMessage(u"Color integer Face" + str(j[0]+1) + " " + | |
u"R: " + str(int(colorShapeFaceDiffuseColor[j[0]][0]*255.0))+", "+ | |
u"G: " + str(int(colorShapeFaceDiffuseColor[j[0]][1]*255.0))+", "+ | |
u"B: " + str(int(colorShapeFaceDiffuseColor[j[0]][2]*255.0))+", "+ | |
u"T: " + str(int(colorShapeFaceDiffuseColor[j[0]][3]*255.0))+ "\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(Around(float(chaine[1]) * float(uniteM)))+" "+uniteMs+"\n") | |
App_Console_PrintMessage(u"\n") | |
co += 1 | |
cco=0 | |
else: | |
App_Console_PrintMessage(u"\n") | |
############### detail of object end | |
#### Display info Begin | |
App_Console_PrintMessage(u"Plane : XY: " + str(Around(Plan_xy))+uniteAs+" coordinates: " + str(Plan_xy_V)+"\n") | |
App_Console_PrintMessage(u"Plane : YZ: " + str(Around(Plan_yz))+uniteAs+" coordinates: " + str(Plan_yz_V)+"\n") | |
App_Console_PrintMessage(u"Plane : ZX: " + str(Around(Plan_zx))+uniteAs+" coordinates: " + str(Plan_zx_V)+"\n\n") | |
App_Console_PrintMessage(u"The form surface : "+str(Around(surface * uniteS))+" "+uniteSs+"\n") | |
App_Console_PrintMessage(u"The face surface : "+str(Around(surfaceFace * uniteS))+" "+uniteSs+"\n\n") | |
App_Console_PrintMessage(u"Volume of the form : "+str(Around(volume_ * uniteV))+" "+uniteVs+"\n") | |
App_Console_PrintMessage(u"Mass : "+str(Around(poids))+ " " +unitePs+u" (Densité : "+str(seTDensiteValue)+")\n\n") | |
App_Console_PrintMessage(u"Center of the shape : X: "+str(Around(boundBoxCenterX * uniteM))+ " " +uniteMs+" Y: "+str(Around(boundBoxCenterY * uniteM))+ " " +uniteMs+" Z: "+str(Around(boundBoxCenterZ * uniteM))+ " " +uniteMs+"\n") | |
App_Console_PrintMessage(u"Center of mass : X: "+str(Around(CenterOfMassX * uniteM))+ " " +uniteMs +" Y: "+str(Around(CenterOfMassY * uniteM))+ " " +uniteMs +" Z: "+str(Around(CenterOfMassZ * uniteM))+ " " +uniteMs+"\n") | |
App_Console_PrintMessage(u"Overall dimensions : "+boundBox_S+"\n\n") | |
if directionObj != "[]": | |
App_Console_PrintMessage(u"Direction : "+str(directionObj)+"\n") | |
if direcValueAt != "[]": | |
App_Console_PrintMessage(u"ValueAt : "+str(direcValueAt)+"\n") | |
if direcNormalAt != "[]": | |
App_Console_PrintMessage(u"NormalAt : "+str(direcNormalAt)+"\n") | |
App_Console_PrintMessage(u"\n") | |
if detected[0:4] == "Mesh": | |
None | |
else: | |
App_Console_PrintMessage(u"Matrix of inertia : Raw: "+str(MatrixOfInertiaRaw)+"\n") | |
App_Console_PrintMessage(u" : " + uniteMs + "^" + str(setMomentOfInertia_16) + "\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(MatrixX1_16))+" Y: "+str(Around(MatrixY1_16))+" Z: "+str(Around(MatrixZ1_16))+" : "+str(Around(Matrix_1))+"\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(MatrixX2_16))+" Y: "+str(Around(MatrixY2_16))+" Z: "+str(Around(MatrixZ2_16))+" : "+str(Around(Matrix_2))+"\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(MatrixX3_16))+" Y: "+str(Around(MatrixY3_16))+" Z: "+str(Around(MatrixZ3_16))+" : "+str(Around(Matrix_3))+"\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(Matrix12))+" Y: "+str(Around(Matrix13))+" Z: "+str(Around(Matrix14))+" : "+str(Around(Matrix15))+"\n\n") | |
App_Console_PrintMessage(u"Matrix inertia with mass : " +unitePs + uniteSs + "^" + str(setMomentOfInertiaMassique_17) + "\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(MatrixX1_17))+" Y: "+str(Around(MatrixY1_17))+" Z: "+str(Around(MatrixZ1_17))+"\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(MatrixX2_17))+" Y: "+str(Around(MatrixY2_17))+" Z: "+str(Around(MatrixZ2_17))+"\n") | |
App_Console_PrintMessage(u" : X: "+str(Around(MatrixX3_17))+" Y: "+str(Around(MatrixY3_17))+" Z: "+str(Around(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"FCInfo_End_"+str(subElemName)+ "____________________________________________________________"+"\n\n") | |
#### Display info end | |
class Ui_MainWindow(object): | |
def setupUi(self, MainWindow): | |
global ui | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global object_Type | |
global subElemName | |
global position0 | |
global position1 | |
global position2 | |
global diffuseColorRF | |
global diffuseColorVF | |
global diffuseColorBF | |
global diffuseColorTF | |
global transparenceFace | |
global unsignedEncodeColor | |
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 poids | |
global materialAssociated | |
global seTMaterialCurrentIndex | |
global uniteM | |
global uniteMs | |
global uniteS | |
global uniteSs | |
global uniteV | |
global uniteVs | |
global uniteP | |
global unitePs | |
global directionObj | |
global direcValueAt | |
global direcNormalAt | |
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 seTMemoClipBoard | |
global switchCreatePoint | |
global switchCreateAxis | |
global switchCreatePlane | |
global switchDisplayInfoObject | |
global seTWidgetPosition | |
global switchBoundBoxCreateText | |
global seTBoundBoxTextHeigth | |
global seTDecimalValue | |
global seTTextHeigthValue | |
global seTDensiteDecimalNumber | |
global seTDensiteValue | |
global seTDensiteSingleStep | |
global seTDensiteSuffixChain | |
global seTPositionFlyRightLeft | |
global seTMaterialPrice | |
global seTMaterialSuffixDevise | |
global seTMaterialSuffixCost | |
global seTIndexUnitLength | |
global seTIndexUnitWeight | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global BsplineDetect | |
global BsplineRayonApproximatif | |
global BsplineArcsRadius | |
global switch_setVisible_GBox_001_Document | |
global switch_setVisible_GBox_002_Coordinate_Mouse | |
global switch_setVisible_GBox_003_Color | |
global switch_setVisible_GBox_004_Object_Mesh | |
global switch_setVisible_GBox_005_Value_Unit | |
global switch_setVisible_GBox_006_Inclination | |
global switch_setVisible_GBox_007_Surface_and_Volume | |
global switch_setVisible_GBox_008_Cost_And_Price | |
global switch_setVisible_GBox_009_BoundBox | |
global switch_setVisible_GBox_010_Center_Mass | |
global switch_setVisible_GBox_011_Inertia | |
global switch_setVisible_GBox_012_SpreadSheet | |
global switch_setVisible_GBox_013_SpreadSheet_Creation | |
global switch_setVisible_GBox_014_Main_Tools | |
self.window = MainWindow | |
#### | |
if seTPositionFlyRightLeft == 1: | |
MainWindow.setObjectName(_fromUtf8(u"MainWindow")) # volant | |
MainWindow.resize(500, 590) | |
MainWindow.setMinimumSize(QtCore.QSize(500, 590)) | |
#MainWindow.setMaximumSize(QtCore.QSize(380, 590)) | |
#MainWindow.move(1300, 120) # deplace la fenetre | |
#### | |
self.fontGlobal_08 = QtGui.QFont() | |
self.fontGlobal_08.setFamily(u"Arial") | |
# self.fontGlobal_08.setPointSize(seTTextHeigthValue) | |
self.fontGlobal_08.setPixelSize(seTTextHeigthValue) | |
#self.xxxx.setFont(self.fontGlobal_08) | |
#self.xxxx.setStyleSheet(u"color : #ff0000; font: bold") # couleur du texte et gras# | |
#### | |
self.centralWidget = QtWidgets.QWidget(MainWindow) | |
#self.centralWidget.setMinimumSize(QtCore.QSize(500, 500)) | |
#### | |
grid = QtWidgets.QGridLayout() | |
self.centralWidget.setLayout(grid) | |
#### | |
self.scrollArea = QtWidgets.QScrollArea(self.centralWidget) # cadre scrollarea contenant le widget GUI | |
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) | |
self.scrollArea.setWidgetResizable(True) | |
grid.addWidget(self.scrollArea, 0, 0) | |
vbox = QtWidgets.QVBoxLayout() | |
self.scrollArea.setLayout(vbox) | |
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget() #widget contenant le GUI | |
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) | |
vbox = QtWidgets.QVBoxLayout() | |
self.scrollAreaWidgetContents_2.setLayout(vbox) | |
#### Document | |
grid = QtWidgets.QGridLayout() | |
self.GBox_001_Document = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_001_Document == False: | |
self.GBox_001_Document.setVisible(switch_setVisible_GBox_001_Document) # visibility | |
self.GBox_001_Document.setLayout(grid) | |
vbox.addWidget(self.GBox_001_Document) | |
self.LA_1 = QtWidgets.QLabel() | |
self.LE_1 = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_1, 0, 0) | |
grid.addWidget(self.LE_1, 0, 1, 1, 2) | |
self.LA_2 = QtWidgets.QLabel() | |
self.LE_2 = QtWidgets.QLineEdit() | |
self.LE_2a = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_2, 1, 0) | |
grid.addWidget(self.LE_2, 1, 1) | |
grid.addWidget(self.LE_2a, 1, 2) | |
self.LA_3 = QtWidgets.QLabel() | |
self.LA_4 = QtWidgets.QLabel() | |
self.LE_3 = QtWidgets.QLineEdit() | |
self.LE_3a = QtWidgets.QLineEdit() | |
self.LE_4 = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_3, 2, 0) | |
grid.addWidget(self.LE_3, 2, 1) | |
grid.addWidget(self.LE_3a, 2, 2) | |
grid.addWidget(self.LA_4, 3, 0) | |
grid.addWidget(self.LE_4, 3, 1, 1, 2) | |
#### Coordinate click mouse | |
grid = QtWidgets.QGridLayout() | |
self.GBox_002_Coordinate_Mouse = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_002_Coordinate_Mouse == False: | |
self.GBox_002_Coordinate_Mouse.setVisible(switch_setVisible_GBox_002_Coordinate_Mouse) # visibility | |
self.GBox_002_Coordinate_Mouse.setLayout(grid) | |
vbox.addWidget(self.GBox_002_Coordinate_Mouse) | |
self.LA_4x = QtWidgets.QLabel() | |
self.LA_4x.setStyleSheet(u"QLabel {color : #ff0000; font: bold}") # couleur du texte et gras | |
self.LE_4x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_4x, 0, 0) | |
grid.addWidget(self.LE_4x, 1, 0) | |
self.LA_4y = QtWidgets.QLabel() | |
self.LA_4y.setStyleSheet(u"QLabel {color : #008500; font: bold}") # couleur du texte et gras | |
self.LE_4y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_4y, 0, 1) | |
grid.addWidget(self.LE_4y, 1, 1) | |
self.LA_4z = QtWidgets.QLabel() | |
self.LA_4z.setStyleSheet(u"QLabel {color : #0000ff; font: bold}") # couleur du texte et gras | |
self.LE_4z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_4z, 0, 2) | |
grid.addWidget(self.LE_4z, 1, 2) | |
self.PB_Axis_01 = QtWidgets.QPushButton() | |
self.PB_Axis_01.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_01.clicked.connect(self.on_PB_Axis_Mouse) | |
grid.addWidget(self.PB_Axis_01, 1, 3) | |
#### couleur point clique | |
grid = QtWidgets.QGridLayout() | |
self.GBox_003_Color = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_003_Color == False: | |
self.GBox_003_Color.setVisible(switch_setVisible_GBox_003_Color) # visibility | |
self.GBox_003_Color.setLayout(grid) | |
vbox.addWidget(self.GBox_003_Color) | |
self.LA_1_Red = QtWidgets.QLabel() | |
self.LA_1_Red.setStyleSheet(u"QLabel {color : #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_1_Red, 0, 0) | |
self.LA_2_Green = QtWidgets.QLabel() | |
self.LA_2_Green.setStyleSheet(u"QLabel {color : #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_2_Green, 0, 1) | |
self.LA_3_Blue = QtWidgets.QLabel() | |
self.LA_3_Blue.setStyleSheet(u"QLabel {color : #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_3_Blue, 0, 2) | |
self.LA_4_Transparent = QtWidgets.QLabel() | |
self.LA_4_Transparent.setStyleSheet(u"QLabel {color : #000000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_4_Transparent, 0, 3) | |
self.LE_CRed = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_CRed, 1, 0) | |
self.LE_CGreen = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_CGreen, 1, 1) | |
self.LE_CBlue = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_CBlue, 1, 2) | |
self.LE_Transparent = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_Transparent, 1, 3) | |
self.LE_ConversionUnsigned = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_ConversionUnsigned, 2, 0, 1, 4) | |
self.CBox_Color_FaceObject = QtWidgets.QCheckBox() | |
#self.CBox_Color_FaceObject.setChecked(False) | |
self.CBox_Color_FaceObject.clicked.connect(self.SIGNAL_CBox_Color_FaceObject) | |
grid.addWidget(self.CBox_Color_FaceObject, 3, 0) | |
self.PB_ChangeColor = QtWidgets.QPushButton() | |
self.PB_ChangeColor.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Color))) # icone dans une variable | |
self.PB_ChangeColor.clicked.connect(self.on_PB_ChangeColor) | |
grid.addWidget(self.PB_ChangeColor, 3, 1) | |
self.PB_CreateFace = QtWidgets.QPushButton() | |
self.PB_CreateFace.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Face))) # icone dans une variable | |
self.PB_CreateFace.clicked.connect(self.on_PB_CreateFace) | |
grid.addWidget(self.PB_CreateFace, 3, 2) | |
self.SBox_Transparence = QtWidgets.QSpinBox() | |
#self.SBox_Transparence.setEnabled(False) | |
self.SBox_Transparence.setMinimum(0) | |
self.SBox_Transparence.setMaximum(100) | |
self.SBox_Transparence.setValue(transparenceFace) | |
self.SBox_Transparence.valueChanged.connect(self.on_SBox_Transparence_valueChanged) | |
grid.addWidget(self.SBox_Transparence, 3, 3) | |
#### Composantes Object Mesh | |
grid = QtWidgets.QGridLayout() | |
self.GBox_004_Object_Mesh = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_004_Object_Mesh == False: | |
self.GBox_004_Object_Mesh.setVisible(switch_setVisible_GBox_004_Object_Mesh) # visibility | |
self.GBox_004_Object_Mesh.setVisible(False) | |
self.GBox_004_Object_Mesh.setLayout(grid) | |
vbox.addWidget(self.GBox_004_Object_Mesh) | |
self.LA_N_Edges = QtWidgets.QLabel() | |
self.LE_N_Edges = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_N_Edges, 0, 0) | |
grid.addWidget(self.LE_N_Edges, 1, 0) | |
self.LA_N_Facets = QtWidgets.QLabel() | |
self.LE_N_Facets = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_N_Facets, 0, 1) | |
grid.addWidget(self.LE_N_Facets, 1, 1) | |
self.LA_N_Points = QtWidgets.QLabel() | |
self.LE_N_Points = QtWidgets.QLineEdit() | |
grid.addWidget(self.LA_N_Points, 0, 2) | |
grid.addWidget(self.LE_N_Points, 1, 2) | |
#### Unit | |
grid = QtWidgets.QGridLayout() | |
self.GBox_005_Value_Unit = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_005_Value_Unit == False: | |
self.GBox_005_Value_Unit.setVisible(switch_setVisible_GBox_005_Value_Unit) # visibility | |
self.GBox_005_Value_Unit.setLayout(grid) | |
vbox.addWidget(self.GBox_005_Value_Unit) | |
self.LA_5a = QtWidgets.QLabel() | |
grid.addWidget(self.LA_5a, 0, 0) | |
self.comboBox = QtWidgets.QComboBox() | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
self.comboBox.addItem(_fromUtf8(u"")) | |
#self.comboBox.setCurrentIndex(seTIndexUnitLength) | |
QtCore.QObject.connect(self.comboBox, QtCore.SIGNAL(u"currentIndexChanged(QString)"), self.SIGNAL_comboBox_Changed) | |
grid.addWidget(self.comboBox, 0, 1)#, 1, 2 | |
#### Line Cercle et BSpline | |
self.LA_5 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_5, 1, 0)#, 1, 2 | |
self.LE_5 = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_5, 1, 1)#, 1, 2 | |
self.LA_5b = QtWidgets.QLabel() | |
grid.addWidget(self.LA_5b, 2, 0)#, 1, 2 | |
self.LE_5b = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_5b, 2, 1)#, 1, 2 | |
self.SB_Arc_ToByArcs = QtWidgets.QSpinBox() | |
self.SB_Arc_ToByArcs.setMinimum(1) | |
self.SB_Arc_ToByArcs.setMaximum(99999999) | |
self.SB_Arc_ToByArcs.setPrefix(u"arc ") | |
# try: | |
# self.SB_Arc_ToByArcs.setSuffix(u" / " + str(len(BsplineArcsRadius))) | |
# BsplineRayonApproximatif = str(Around(BsplineArcsRadius[0] * float(uniteM))) + " " + uniteMs | |
# except Exception: | |
# BsplineRayonApproximatif = u"" | |
self.SB_Arc_ToByArcs.valueChanged.connect(self.on_SB_Arc_ToByArcs_valueChanged) | |
grid.addWidget(self.SB_Arc_ToByArcs, 2, 2) | |
self.LA_6 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_6, 3, 0)#, 1, 1 | |
self.LE_6 = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_6, 3, 1) | |
self.PB_BSplineCreateNodes = QtWidgets.QPushButton() | |
self.PB_BSplineCreateNodes.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Point))) # icone dans une variable | |
self.PB_BSplineCreateNodes.clicked.connect(self.on_PB_BSplineCreateNodes) | |
grid.addWidget(self.PB_BSplineCreateNodes, 3, 2) | |
# if (rayonObjet != 0) or (str(BsplineDetect) == "<BSplineCurve object>"):: | |
# if (str(BsplineDetect) == "<BSplineCurve object>"): | |
# self.SB_Arc_ToByArcs.setVisible(True) | |
# self.PB_BSplineCreateNodes.setVisible(True) | |
# self.LA_5b.setVisible(True) | |
# self.LE_5b.setVisible(True) | |
# else: | |
# self.SB_Arc_ToByArcs.setVisible(False) | |
# self.PB_BSplineCreateNodes.setVisible(False) | |
# self.LA_5b.setVisible(False) | |
# self.LE_5b.setVisible(False) | |
# rayonObjet = 0.0 | |
#### Inclination | |
grid = QtWidgets.QGridLayout() | |
self.GBox_006_Inclination = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_006_Inclination == False: | |
self.GBox_006_Inclination.setVisible(switch_setVisible_GBox_006_Inclination) # visibility | |
self.GBox_006_Inclination.setLayout(grid) | |
vbox.addWidget(self.GBox_006_Inclination) | |
self.LA_8a = QtWidgets.QLabel(self.GBox_006_Inclination) | |
grid.addWidget(self.LA_8a, 0, 0) | |
self.PB_Ra = QtWidgets.QPushButton() | |
self.PB_Ra.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Degrees))) # icone dans une variable | |
self.PB_Ra.clicked.connect(self.on_PB_Ra_clicked) # "Radian" | |
grid.addWidget(self.PB_Ra, 0, 1) | |
self.LA_8a_2 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_8a_2, 0, 2, 1, 3) | |
self.LA_8xy = QtWidgets.QLabel() | |
self.LA_8xy.setStyleSheet(u"QLabel {color : #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_8xy, 1, 0) | |
self.LE_8xy = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_8xy, 1, 1) | |
self.LE_8xya = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_8xya, 1, 2) | |
self.LA_8yz = QtWidgets.QLabel() | |
self.LA_8yz.setStyleSheet(u"QLabel {color : #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_8yz, 2, 0) | |
self.LE_8yz = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_8yz, 2, 1) | |
self.LE_8yza = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_8yza, 2, 2) | |
self.LA_8zx = QtWidgets.QLabel() | |
self.LA_8zx.setStyleSheet(u"QLabel {color : #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_8zx, 3, 0) | |
self.LE_8zx = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_8zx, 3, 1) | |
self.LE_8zxa = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_8zxa, 3, 2) | |
self.PB_Line_Direction = QtWidgets.QPushButton() | |
self.PB_Line_Direction.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_13J))) # icone dans une variable | |
self.PB_Line_Direction.clicked.connect(self.on_PB_Line_Direction) | |
grid.addWidget(self.PB_Line_Direction, 4, 0) | |
self.LE_9_Direction = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_9_Direction, 4, 1, 1, 2) | |
self.PB_Line_ValueAT = QtWidgets.QPushButton() | |
self.PB_Line_ValueAT.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_13M))) # icone dans une variable | |
self.PB_Line_ValueAT.clicked.connect(self.on_PB_Line_ValueAT) | |
grid.addWidget(self.PB_Line_ValueAT, 5, 0) | |
self.LE_10_ValueAt = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_10_ValueAt, 5, 1, 1, 2) | |
self.PB_Line_NormalAT = QtWidgets.QPushButton() | |
self.PB_Line_NormalAT.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_13C))) # icone dans une variable | |
self.PB_Line_NormalAT.clicked.connect(self.on_PB_Line_NormalAT) | |
grid.addWidget(self.PB_Line_NormalAT, 6, 0) | |
self.LE_10b_NormalAt = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_10b_NormalAt, 6, 1, 1, 2) | |
##### Surface and Volume | |
grid = QtWidgets.QGridLayout() | |
self.GBox_007_Surface_and_Volume = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_007_Surface_and_Volume == False: | |
self.GBox_007_Surface_and_Volume.setVisible(switch_setVisible_GBox_007_Surface_and_Volume) # visibility | |
self.GBox_007_Surface_and_Volume.setLayout(grid) | |
vbox.addWidget(self.GBox_007_Surface_and_Volume) | |
self.LA_9 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_9, 0, 0) | |
self.LE_9a = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_9a, 0, 1) | |
self.LA_10 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_10, 1, 0) | |
self.LE_10a = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_10a, 1, 1) | |
self.LA_11 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_11, 2, 0) | |
self.LE_11a = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_11a, 2, 1) | |
self.LA_Unit = QtWidgets.QLabel() | |
grid.addWidget(self.LA_Unit, 3, 0) | |
self.comboBox_Unit = QtWidgets.QComboBox() | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
self.comboBox_Unit.addItem(_fromUtf8(u"")) | |
#self.comboBox_Unit.setCurrentIndex(seTIndexUnitWeight) | |
QtCore.QObject.connect(self.comboBox_Unit, QtCore.SIGNAL(u"currentIndexChanged(QString)"), self.SIGNAL_comboPoids_Changed) | |
grid.addWidget(self.comboBox_Unit, 3, 1) | |
self.LA_Weight = QtWidgets.QLabel() | |
grid.addWidget(self.LA_Weight, 4, 0) | |
self.LA_Density = QtWidgets.QLabel() | |
grid.addWidget(self.LA_Density, 4, 1) | |
self.LE_12a = QtWidgets.QLineEdit() | |
self.LE_12a.setText(str(Around(poids))+" "+unitePs) | |
grid.addWidget(self.LE_12a, 5, 0) | |
self.DS_Density = QtWidgets.QDoubleSpinBox() | |
seTDensiteValue = float(materialAssociated[seTMaterialCurrentIndex].split(",")[1]) | |
self.DS_Density.setDecimals(seTDensiteDecimalNumber) | |
self.DS_Density.setMinimum(-0.00000001) | |
self.DS_Density.setMaximum(99999999.0) | |
#self.DS_Density.setProperty(u"value", seTDensiteValue) | |
self.DS_Density.setValue(seTDensiteValue) | |
self.DS_Density.setSuffix(seTDensiteSuffixChain) | |
self.DS_Density.setSingleStep(seTDensiteSingleStep) | |
self.DS_Density.valueChanged.connect(self.on_DS_Density_valueChanged) | |
grid.addWidget(self.DS_Density, 5, 1) | |
self.LA_Material = QtWidgets.QLabel() | |
grid.addWidget(self.LA_Material, 6, 0) | |
self.CBox_Materiel = QtWidgets.QComboBox() | |
for ligneMat in materialAssociated: | |
self.CBox_Materiel.addItem(_fromUtf8(ligneMat)) | |
self.CBox_Materiel.setCurrentIndex(seTMaterialCurrentIndex) | |
QtCore.QObject.connect(self.CBox_Materiel, QtCore.SIGNAL(u"currentIndexChanged(QString)"), self.SIGNAL_CBox_Materiel_Changed) | |
grid.addWidget(self.CBox_Materiel,7, 0, 1, 2) | |
self.LA_NewMaterial = QtWidgets.QLabel() | |
grid.addWidget(self.LA_NewMaterial, 8, 0) | |
self.LE_Materiel = QtWidgets.QLineEdit() | |
self.LE_Materiel.setText(materialAssociated[seTMaterialCurrentIndex]) | |
self.LE_Materiel.returnPressed.connect(self.on_LE_Materiel_Pressed) # connect "on_LE_Materiel_Pressed" # for validate the data with press on return touch | |
#self.LE_Materiel.textChanged.connect(self.on_LE_Materiel_Pressed) # connect "on_LE_Materiel_Pressed" # with tips key char by char | |
grid.addWidget(self.LE_Materiel, 9, 0, 1, 2) | |
self.PB_Del_Material = QtWidgets.QPushButton() | |
self.PB_Del_Material.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_DeleteLineMaterial))) # icone dans une variable | |
self.PB_Del_Material.clicked.connect(self.on_PB_Del_Material_clicked) | |
grid.addWidget(self.PB_Del_Material, 10, 0) | |
self.PB_Save_Material = QtWidgets.QPushButton() | |
self.PB_Save_Material.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Save_Material))) # icone dans une variable | |
self.PB_Save_Material.clicked.connect(self.on_PB_Save_Material_clicked) | |
grid.addWidget(self.PB_Save_Material, 10, 1) | |
#### Cost | |
grid = QtWidgets.QGridLayout() | |
self.GBox_008_Cost_And_Price = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_008_Cost_And_Price == False: | |
self.GBox_008_Cost_And_Price.setVisible(switch_setVisible_GBox_008_Cost_And_Price) # visibility | |
self.GBox_008_Cost_And_Price.setLayout(grid) | |
vbox.addWidget(self.GBox_008_Cost_And_Price) | |
self.LA_Cost = QtWidgets.QLabel() | |
grid.addWidget(self.LA_Cost, 0, 0) | |
self.LA_Price = QtWidgets.QLabel() | |
grid.addWidget(self.LA_Price, 0, 1) | |
self.LE_Cost = QtWidgets.QLineEdit() | |
seTMaterialCost = ((volume_ * seTDensiteValue * seTMaterialPrice) / 1000000.0) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
grid.addWidget(self.LE_Cost, 1, 0) | |
self.DS_Price = QtWidgets.QDoubleSpinBox() | |
self.DS_Price.setDecimals(seTDensiteDecimalNumber) | |
self.DS_Price.setMinimum(-0.00000001) | |
self.DS_Price.setMaximum(99999999.0) | |
#self.DS_Price.setProperty(u"value", seTMaterialPrice) | |
self.DS_Price.setValue(seTMaterialPrice) | |
self.DS_Price.setSuffix(seTMaterialSuffixDevise) | |
self.DS_Price.setSingleStep(1) | |
self.DS_Price.valueChanged.connect(self.on_DS_Price_valueChanged) | |
grid.addWidget(self.DS_Price, 1, 1) | |
##### BoundBox | |
grid = QtWidgets.QGridLayout() | |
self.GBox_009_BoundBox = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_009_BoundBox == False: | |
self.GBox_009_BoundBox.setVisible(switch_setVisible_GBox_009_BoundBox) # visibility | |
self.GBox_009_BoundBox.setLayout(grid) | |
vbox.addWidget(self.GBox_009_BoundBox) | |
self.LA_007_01_Xlength = QtWidgets.QLabel() | |
self.LA_007_01_Xlength.setStyleSheet(u"QLabel {color : #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_007_01_Xlength, 0, 0) | |
self.LA_007_02_Ylength = QtWidgets.QLabel() | |
self.LA_007_02_Ylength.setStyleSheet(u"QLabel {color : #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_007_02_Ylength, 0, 1) | |
self.LA_007_03_Zlength = QtWidgets.QLabel() | |
self.LA_007_03_Zlength.setStyleSheet(u"QLabel {color : #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_007_03_Zlength, 0, 2) | |
self.LA_007_04_Diagonallength = QtWidgets.QLabel() | |
grid.addWidget(self.LA_007_04_Diagonallength, 0, 3) | |
self.LE_007_BB_01_XLength = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_007_BB_01_XLength, 1, 0) | |
self.LE_007_BB_02_YLength = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_007_BB_02_YLength, 1, 1) | |
self.LE_007_BB_03_ZLength = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_007_BB_03_ZLength, 1, 2) | |
self.LE_007_BB_04_Diagonal = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_007_BB_04_Diagonal, 1, 3) | |
self.PB_BoundBox_Tracing = QtWidgets.QPushButton() | |
self.PB_BoundBox_Tracing.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_BoundBoxTracing))) # icone dans une variable | |
self.PB_BoundBox_Tracing.clicked.connect(self.on_PB_BoundBox_Tracing) | |
grid.addWidget(self.PB_BoundBox_Tracing, 2, 0) | |
self.PB_00_BoundBox_Volume = QtWidgets.QPushButton() | |
self.PB_00_BoundBox_Volume.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_BoundBoxVolume))) # icone dans une variable | |
self.PB_00_BoundBox_Volume.clicked.connect(self.On_PB_00_BoundBox_Volume) | |
grid.addWidget(self.PB_00_BoundBox_Volume, 2, 1) | |
self.CB_01_BoundBox_Text = QtWidgets.QCheckBox() | |
self.CB_01_BoundBox_Text.setChecked(switchBoundBoxCreateText) | |
self.CB_01_BoundBox_Text.clicked.connect(self.On_CB_01_BoundBox_Text) | |
grid.addWidget(self.CB_01_BoundBox_Text, 2, 2) | |
self.DS_BoundBoxTextHeigth = QtWidgets.QDoubleSpinBox() | |
self.DS_BoundBoxTextHeigth.setMinimum(-0.00000001) | |
self.DS_BoundBoxTextHeigth.setMaximum(99999999.0) | |
#self.DS_BoundBoxTextHeigth.setProperty(u"value", seTBoundBoxTextHeigth) | |
self.DS_BoundBoxTextHeigth.setValue(seTBoundBoxTextHeigth) | |
self.DS_BoundBoxTextHeigth.setDecimals(seTDensiteDecimalNumber) | |
self.DS_BoundBoxTextHeigth.setSingleStep(1) | |
self.DS_BoundBoxTextHeigth.setEnabled(switchBoundBoxCreateText) | |
self.DS_BoundBoxTextHeigth.valueChanged.connect(self.on_DS_BoundBoxTextHeigth_valueChanged) | |
grid.addWidget(self.DS_BoundBoxTextHeigth, 2, 3) | |
##### Center of: | |
grid = QtWidgets.QGridLayout() | |
self.GBox_010_Center_Mass = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_010_Center_Mass == False: | |
self.GBox_010_Center_Mass.setVisible(switch_setVisible_GBox_010_Center_Mass) # visibility | |
self.GBox_010_Center_Mass.setLayout(grid) | |
vbox.addWidget(self.GBox_010_Center_Mass) | |
self.LA_13x = QtWidgets.QLabel() | |
self.LA_13x.setStyleSheet(u"QLabel {color : #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_13x, 1, 0) | |
self.LA_13y = QtWidgets.QLabel() | |
self.LA_13y.setStyleSheet(u"QLabel {color : #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_13y, 1, 1) | |
self.LA_13z = QtWidgets.QLabel() | |
self.LA_13z.setStyleSheet(u"QLabel {color : #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_13z, 1, 2) | |
self.LE_13x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_13x, 2, 0) | |
self.LE_13y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_13y, 2, 1) | |
self.LE_13z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_13z, 2, 2) | |
self.PB_Axis_02 = QtWidgets.QPushButton() | |
self.PB_Axis_02.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_02.clicked.connect(self.on_PB_Axis_Center_Shape) | |
grid.addWidget(self.PB_Axis_02, 2, 3) | |
self.LA_14x = QtWidgets.QLabel() | |
self.LA_14x.setStyleSheet(u"QLabel {color : #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_14x, 4, 0) | |
self.LA_14y = QtWidgets.QLabel() | |
self.LA_14y.setStyleSheet(u"QLabel {color : #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_14y, 4, 1) | |
self.LA_14z = QtWidgets.QLabel() | |
self.LA_14z.setStyleSheet(u"QLabel {color : #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_14z, 4, 2) | |
self.LE_14x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_14x, 5, 0) | |
self.LE_14y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_14y, 5, 1) | |
self.LE_14z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_14z, 5, 2) | |
self.PB_Axis_03 = QtWidgets.QPushButton() | |
self.PB_Axis_03.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_03.clicked.connect(self.on_PB_Axis_Center_Mass) | |
grid.addWidget(self.PB_Axis_03, 5, 3) | |
##### Inertia | |
grid = QtWidgets.QGridLayout() | |
self.GBox_011_Inertia = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_011_Inertia == False: | |
self.GBox_011_Inertia.setVisible(switch_setVisible_GBox_011_Inertia) # visibility | |
self.GBox_011_Inertia.setLayout(grid) | |
vbox.addWidget(self.GBox_011_Inertia) | |
self.LA_16 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_16, 0, 0, 1, 3) | |
self.LE_16_Raw = QtWidgets.QLineEdit() # mode RAW | |
grid.addWidget(self.LE_16_Raw, 1, 0, 1, 5) | |
##oriself.LE_16_M = QtWidgets.QLineEdit() # change en spinBox | |
self.SB_16_M = QtWidgets.QSpinBox() | |
#self.SB_16_M.setEnabled(False) | |
self.SB_16_M.setMinimum(0) | |
self.SB_16_M.setMaximum(999999) | |
self.SB_16_M.setPrefix(u"mm^") | |
self.SB_16_M.setAlignment(QtCore.Qt.AlignCenter) | |
self.SB_16_M.setValue(setMomentOfInertia_16) | |
self.SB_16_M.valueChanged.connect(self.on_SB_16_M_valueChanged) | |
self.SB_16_M.setStyleSheet(u"QLineEdit {color: #000000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.SB_16_M, 2, 3, 1, 2) | |
self.LA_16x = QtWidgets.QLabel() | |
self.LA_16x.setStyleSheet(u"QLabel {color: #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_16x, 2, 0) | |
self.LA_16y = QtWidgets.QLabel() | |
self.LA_16y.setStyleSheet(u"QLabel {color: #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_16y, 2, 1) | |
self.LA_16z = QtWidgets.QLabel() | |
self.LA_16z.setStyleSheet(u"QLabel {color: #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_16z, 2, 2) | |
self.LE_16_1x = QtWidgets.QLineEdit() | |
self.LE_16_1x.setAlignment(QtCore.Qt.AlignLeft) | |
self.LE_16_1x.cursorPosition() | |
self.LE_16_1x.setCursorPosition(1) | |
grid.addWidget(self.LE_16_1x, 3, 0) | |
self.LE_16_1y = QtWidgets.QLineEdit() | |
self.LE_16_1y.setAlignment(QtCore.Qt.AlignLeft) | |
self.LE_16_1y.cursorPosition() | |
self.LE_16_1y.setCursorPosition(1) | |
grid.addWidget(self.LE_16_1y, 3, 1) | |
self.LE_16_1z = QtWidgets.QLineEdit() | |
self.LE_16_1z.setAlignment(QtCore.Qt.AlignLeft) | |
self.LE_16_1z.cursorPosition() | |
self.LE_16_1z.setCursorPosition(1) | |
grid.addWidget(self.LE_16_1z, 3, 2) | |
self.LE_16_01 = QtWidgets.QLineEdit() | |
self.LE_16_01.setEnabled(False) | |
grid.addWidget(self.LE_16_01, 3, 3) | |
self.PB_Axis_04_16_1 = QtWidgets.QPushButton() | |
self.PB_Axis_04_16_1.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_04_16_1.clicked.connect(self.on_PB_Axis_04_16_1) | |
grid.addWidget(self.PB_Axis_04_16_1, 3, 4) | |
self.LE_16_2x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_16_2x, 4, 0) | |
self.LE_16_2y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_16_2y, 4, 1) | |
self.LE_16_2z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_16_2z, 4, 2) | |
self.LE_16_02 = QtWidgets.QLineEdit() | |
self.LE_16_02.setEnabled(False) | |
grid.addWidget(self.LE_16_02, 4, 3) | |
self.PB_Axis_05_16_2 = QtWidgets.QPushButton() | |
self.PB_Axis_05_16_2.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_05_16_2.clicked.connect(self.on_PB_Axis_05_16_2) | |
grid.addWidget(self.PB_Axis_05_16_2, 4, 4) | |
self.LE_16_3x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_16_3x, 5, 0) | |
self.LE_16_3y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_16_3y, 5, 1) | |
self.LE_16_3z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_16_3z, 5, 2) | |
self.LE_16_03 = QtWidgets.QLineEdit() | |
self.LE_16_03.setEnabled(False) | |
grid.addWidget(self.LE_16_03, 5, 3) | |
self.PB_Axis_06_16_3 = QtWidgets.QPushButton() | |
self.PB_Axis_06_16_3.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_06_16_3.clicked.connect(self.on_PB_Axis_06_16_3) | |
grid.addWidget(self.PB_Axis_06_16_3, 5, 4) | |
self.LE_16_4x = QtWidgets.QLineEdit() | |
self.LE_16_4x.setEnabled(False) | |
grid.addWidget(self.LE_16_4x, 6, 0) | |
self.LE_16_4y = QtWidgets.QLineEdit() | |
self.LE_16_4y.setEnabled(False) | |
grid.addWidget(self.LE_16_4y, 6, 1) | |
self.LE_16_4z = QtWidgets.QLineEdit() | |
self.LE_16_4z.setEnabled(False) | |
grid.addWidget(self.LE_16_4z, 6, 2) | |
self.LE_16_04 = QtWidgets.QLineEdit() | |
self.LE_16_04.setEnabled(False) | |
grid.addWidget(self.LE_16_04, 6, 3) | |
self.PB_Axis_07_16_4 = QtWidgets.QPushButton() | |
self.PB_Axis_07_16_4.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_07_16_4.clicked.connect(self.on_PB_Axis_07_16_4) | |
grid.addWidget(self.PB_Axis_07_16_4, 6, 4) | |
self.LA_17 = QtWidgets.QLabel() | |
grid.addWidget(self.LA_17, 7, 0, 1, 3) | |
##self.LE_17_M = QtWidgets.QLineEdit() # change en spinBox | |
self.SB_17_M = QtWidgets.QSpinBox() | |
#self.SB_17_M.setEnabled(False) | |
self.SB_17_M.setMinimum(0) | |
self.SB_17_M.setMaximum(999999) | |
self.SB_17_M.setPrefix(u"mm2^") | |
self.SB_17_M.setAlignment(QtCore.Qt.AlignCenter) | |
self.SB_17_M.setValue(setMomentOfInertiaMassique_17) | |
self.SB_17_M.valueChanged.connect(self.on_SB_17_M_valueChanged) | |
self.SB_17_M.setAlignment(QtCore.Qt.AlignCenter) | |
self.SB_17_M.setStyleSheet(u"QLineEdit {color: #000000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.SB_17_M, 8, 3, 1, 2) | |
self.LA_17x = QtWidgets.QLabel() | |
self.LA_17x.setStyleSheet(u"QLabel {color: #ff0000; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_17x, 8, 0) | |
self.LA_17y = QtWidgets.QLabel() | |
self.LA_17y.setStyleSheet(u"QLabel {color: #008500; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_17y, 8, 1) | |
self.LA_17z = QtWidgets.QLabel() | |
self.LA_17z.setStyleSheet(u"QLabel {color: #0000ff; font: bold}") # couleur du texte et gras | |
grid.addWidget(self.LA_17z, 8, 2) | |
self.LE_17_1x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_1x, 9, 0) | |
self.LE_17_1y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_1y, 9, 1) | |
self.LE_17_1z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_1z, 9, 2) | |
self.PB_Axis_08_17_1 = QtWidgets.QPushButton() | |
self.PB_Axis_08_17_1.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_08_17_1.clicked.connect(self.on_PB_Axis_08_17_1) | |
grid.addWidget(self.PB_Axis_08_17_1, 9, 4) | |
self.LE_17_2x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_2x, 10, 0) | |
self.LE_17_2y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_2y, 10, 1) | |
self.LE_17_2z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_2z, 10, 2) | |
self.PB_Axis_09_17_2 = QtWidgets.QPushButton() | |
self.PB_Axis_09_17_2.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_09_17_2.clicked.connect(self.on_PB_Axis_09_17_2) | |
grid.addWidget(self.PB_Axis_09_17_2, 10, 4) | |
self.LE_17_3x = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_3x, 11, 0) | |
self.LE_17_3y = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_3y, 11, 1) | |
self.LE_17_3z = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_17_3z, 11, 2) | |
self.PB_Axis_10_17_3 = QtWidgets.QPushButton() | |
self.PB_Axis_10_17_3.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_10_17_3.clicked.connect(self.on_PB_Axis_10_17_3) | |
grid.addWidget(self.PB_Axis_10_17_3, 11, 4) | |
self.PB_Axis_11_17_4 = QtWidgets.QPushButton() | |
self.PB_Axis_11_17_4.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05))) # icone dans une variable | |
self.PB_Axis_11_17_4.clicked.connect(self.on_PB_Axis_11_17_4) | |
grid.addWidget(self.PB_Axis_11_17_4, 12, 4) | |
self.LA_determinant = QtWidgets.QLabel() | |
grid.addWidget(self.LA_determinant, 13, 0, 1, 1) | |
self.LE_18_determinant = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_18_determinant, 13, 1, 1, 4) | |
self.LA_determinantDecimal = QtWidgets.QLabel() | |
grid.addWidget(self.LA_determinantDecimal, 14, 0, 1, 1) | |
self.LE_18_determinantDecim = QtWidgets.QLineEdit() | |
grid.addWidget(self.LE_18_determinantDecim, 14, 1, 1, 4) | |
#### Disabled Module (SpreadSheet) | |
grid = QtWidgets.QGridLayout() | |
self.GBox_012_SpreadSheet = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_012_SpreadSheet == False: | |
self.GBox_012_SpreadSheet.setVisible(switch_setVisible_GBox_012_SpreadSheet) # visibility | |
self.GBox_012_SpreadSheet.setCheckable(True) | |
self.GBox_012_SpreadSheet.setChecked(False) | |
self.GBox_012_SpreadSheet.setStyleSheet(u"QGroupBox {color : #ff0000}") | |
self.GBox_012_SpreadSheet.clicked.connect(self.on_GBox_012_SpreadSheet) | |
self.GBox_012_SpreadSheet.setLayout(grid) | |
vbox.addWidget(self.GBox_012_SpreadSheet) | |
self.tableWidget = QtWidgets.QTableWidget() # self.GBox_012_SpreadSheet | |
self.tableWidget.setIconSize(QtCore.QSize(15, 15)) | |
self.tableWidget.setRowCount(RowCount) | |
self.tableWidget.setColumnCount(8) # number of columns | |
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) | |
grid.addWidget(self.tableWidget, 0, 0, 4, 4) | |
#### SpreadSheet (options CSV debut) | |
grid = QtWidgets.QGridLayout() | |
self.GBox_013_SpreadSheet_Creation = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_013_SpreadSheet_Creation == False: | |
self.GBox_013_SpreadSheet_Creation.setVisible(switch_setVisible_GBox_013_SpreadSheet_Creation) # visibility | |
self.GBox_013_SpreadSheet_Creation.setLayout(grid) | |
vbox.addWidget(self.GBox_013_SpreadSheet_Creation) | |
#### SpreadSheet dans le document | |
self.PB_03_Create_SpreadSheet = QtWidgets.QPushButton() | |
self.PB_03_Create_SpreadSheet.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_SpreadSheet))) # icone dans une variable | |
self.PB_03_Create_SpreadSheet.clicked.connect(self.on_PB_03_Create_SpreadSheet_clicked) | |
grid.addWidget(self.PB_03_Create_SpreadSheet, 0, 0, 1, 2) | |
self.LE_SpreadSheet = QtWidgets.QLineEdit() | |
self.LE_SpreadSheet.setText(newSpreadSheetName) | |
self.LE_SpreadSheet.textChanged.connect(self.on_LE_SpreadSheet_Pressed) | |
grid.addWidget(self.LE_SpreadSheet, 0, 2, 1, 2) | |
self.PB_SpreadSheet_Refresh = QtWidgets.QPushButton() | |
self.PB_SpreadSheet_Refresh.clicked.connect(self.on_PB_SpreadSheet_clicked) | |
grid.addWidget(self.PB_SpreadSheet_Refresh, 1, 0, 1, 2) | |
self.ComboB_SpreadSheet = QtWidgets.QComboBox() | |
self.ComboB_SpreadSheet.currentIndexChanged[str].connect(self.On_ComboB_SpreadSheet)# [str] or [int] | |
grid.addWidget(self.ComboB_SpreadSheet, 1, 2, 1, 2) | |
#### SpreadSheet sur disque | |
self.PB_01_Read_SpreadSheet = QtWidgets.QPushButton() | |
self.PB_01_Read_SpreadSheet.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_04))) # icone dans une variable | |
self.PB_01_Read_SpreadSheet.clicked.connect(self.on_PB_01_Read_SpreadSheet_clicked) | |
grid.addWidget(self.PB_01_Read_SpreadSheet, 2, 0, 1, 1) | |
self.PB_02_Save_SreadSheet = QtWidgets.QPushButton() | |
self.PB_02_Save_SreadSheet.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_03))) # icone dans une variable | |
self.PB_02_Save_SreadSheet.clicked.connect(self.on_PB_02_Save_SreadSheet_clicked) | |
grid.addWidget(self.PB_02_Save_SreadSheet, 2, 1, 1, 1) | |
self.RB_01_Tabulation = QtWidgets.QRadioButton() | |
self.RB_01_Tabulation.setChecked(True) | |
self.RB_01_Tabulation.clicked.connect(self.on_RB_Separation) | |
grid.addWidget(self.RB_01_Tabulation, 3, 0) | |
self.RB_02_Virgule = QtWidgets.QRadioButton() | |
self.RB_02_Virgule.clicked.connect(self.on_RB_Separation) | |
grid.addWidget(self.RB_02_Virgule, 3, 1) | |
self.RB_03_Point_Virgule = QtWidgets.QRadioButton() | |
self.RB_03_Point_Virgule.clicked.connect(self.on_RB_Separation) | |
grid.addWidget(self.RB_03_Point_Virgule, 3, 2) | |
self.RB_04_Espace = QtWidgets.QRadioButton() | |
self.RB_04_Espace.clicked.connect(self.on_RB_Separation) | |
grid.addWidget(self.RB_04_Espace, 3, 3) | |
#options CSV fin | |
#### Main | |
grid = QtWidgets.QGridLayout() | |
self.GBox_014_Main_Tools = QtWidgets.QGroupBox() | |
if switch_setVisible_GBox_014_Main_Tools == False: | |
self.GBox_014_Main_Tools.setVisible(switch_setVisible_GBox_014_Main_Tools) # visibility | |
self.GBox_014_Main_Tools.setLayout(grid) | |
vbox.addWidget(self.GBox_014_Main_Tools) | |
self.CB_01_Info = QtWidgets.QCheckBox() | |
self.CB_01_Info.setChecked(switchDisplayInfoObject) | |
self.CB_01_Info.clicked.connect(self.on_CB_01_Info) | |
grid.addWidget(self.CB_01_Info, 0, 0, 1, 2) | |
self.CB_02_Point = QtWidgets.QCheckBox() | |
self.CB_02_Point.setChecked(switchCreatePoint) | |
self.CB_02_Point.clicked.connect(self.on_CB_02_Point) | |
grid.addWidget(self.CB_02_Point, 0, 1) | |
self.CB_03_Axis = QtWidgets.QCheckBox() | |
self.CB_03_Axis.setChecked(switchCreateAxis) #False | |
self.CB_03_Axis.clicked.connect(self.on_CB_03_Axis) | |
grid.addWidget(self.CB_03_Axis, 0, 2) | |
self.CB_04_Plane = QtWidgets.QCheckBox() | |
self.CB_04_Plane.setChecked(switchCreatePlane) #False | |
self.CB_04_Plane.clicked.connect(self.on_CB_04_Plane) | |
grid.addWidget(self.CB_04_Plane, 0, 3) | |
self.RB_00_ClipBoard = QtWidgets.QRadioButton() | |
if seTMemoClipBoard == 0: | |
self.RB_00_ClipBoard.setChecked(True) | |
self.RB_00_ClipBoard.clicked.connect(self.on_RB_00_ClipBoard) | |
grid.addWidget(self.RB_00_ClipBoard, 1, 0) | |
self.RB_01_ClipBoard = QtWidgets.QRadioButton() | |
if seTMemoClipBoard == 1: | |
self.RB_01_ClipBoard.setChecked(True) | |
self.RB_01_ClipBoard.clicked.connect(self.on_RB_01_ClipBoard) | |
grid.addWidget(self.RB_01_ClipBoard, 1, 1) | |
self.RB_02_ClipBoard = QtWidgets.QRadioButton() | |
if seTMemoClipBoard == 2: | |
self.RB_02_ClipBoard.setChecked(True) | |
self.RB_02_ClipBoard.clicked.connect(self.on_RB_02_ClipBoard) | |
grid.addWidget(self.RB_02_ClipBoard, 1, 2) | |
self.RB_03_ClipBoard = QtWidgets.QRadioButton() | |
if seTMemoClipBoard == 3: | |
self.RB_03_ClipBoard.setChecked(True) | |
self.RB_03_ClipBoard.clicked.connect(self.on_RB_03_ClipBoard) | |
grid.addWidget(self.RB_03_ClipBoard, 1, 3) | |
self.CB_05_Position = QtWidgets.QCheckBox() | |
self.CB_05_Position.setChecked(False) | |
if seTPositionFlyRightLeft == 1: | |
self.CB_05_Position.setVisible(False) | |
elif seTPositionFlyRightLeft == 2: | |
self.CB_05_Position.setChecked(False) | |
else: | |
self.CB_05_Position.setChecked(True) | |
self.CB_05_Position.clicked.connect(self.on_CB_05_Position) | |
grid.addWidget(self.CB_05_Position, 2, 0) | |
self.SPBox_arrondi = QtWidgets.QSpinBox() | |
self.SPBox_arrondi.setMinimum(-1) | |
self.SPBox_arrondi.setMaximum(1000) | |
#self.SPBox_arrondi.setProperty(u"value", seTDecimalValue) | |
self.SPBox_arrondi.setValue(seTDecimalValue) | |
self.SPBox_arrondi.setSuffix(u" (Decimals)") | |
self.SPBox_arrondi.valueChanged.connect(self.on_SPBox_arrondi_valueChanged) | |
grid.addWidget(self.SPBox_arrondi, 3, 0, 1, 2) | |
self.SP_012_01_Text = QtWidgets.QSpinBox() | |
self.SP_012_01_Text.setMinimum(0) | |
self.SP_012_01_Text.setMaximum(99999999) | |
self.SP_012_01_Text.setValue(seTTextHeigthValue) | |
self.SP_012_01_Text.setSuffix(u" (Text Height)") | |
self.SP_012_01_Text.valueChanged.connect(self.on_SP_012_01_Text_valueChanged) | |
grid.addWidget(self.SP_012_01_Text, 3, 2, 1, 2) | |
self.PB_05_Help_Forum = QtWidgets.QPushButton() | |
self.PB_05_Help_Forum.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_WebForum))) # icone dans une variable | |
self.PB_05_Help_Forum.clicked.connect(self.on_PB_05_Help_Forum_clicked) | |
grid.addWidget(self.PB_05_Help_Forum, 4, 0, 1, 2) | |
self.PB_06_Help_Wiki = QtWidgets.QPushButton() | |
self.PB_06_Help_Wiki.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_WebWiki))) # icone dans une variable | |
self.PB_06_Help_Wiki.clicked.connect(self.on_PB_06_Help_Wiki) | |
grid.addWidget(self.PB_06_Help_Wiki, 4, 2, 1, 2) | |
self.PB_01_Refrech = QtWidgets.QPushButton() | |
self.PB_01_Refrech.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_02))) # icone dans une variable | |
self.PB_01_Refrech.clicked.connect(self.on_PB_01_Refrech_clicked) | |
grid.addWidget(self.PB_01_Refrech, 5, 0, 1, 2) | |
self.PB_04_Quit = QtWidgets.QPushButton() | |
self.PB_04_Quit.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_01))) # icone dans une variable | |
self.PB_04_Quit.clicked.connect(self.on_PB_04_Quit) | |
grid.addWidget(self.PB_04_Quit, 5, 2, 1, 2) | |
###########################################################scrollArea | |
self.scrollArea.setWidget(self.scrollAreaWidgetContents_2) | |
###########################################################scrollArea | |
self.retranslateUi(MainWindow) | |
QtCore.QMetaObject.connectSlotsByName(MainWindow) | |
if seTPositionFlyRightLeft == 1: # 1=MainWindow separate | |
MainWindow.setWindowTitle(__Title__ + u" rmu (" + __Version__ + ") (" + __Date__ + ")") | |
MainWindow.setCentralWidget(self.centralWidget) | |
MainWindow.move(1000, 120) # deplace la fenetre | |
else: | |
MainWindow.setWindowTitle(__Title__ + u" rmu (" + __Version__ + ") (" + __Date__ + ")") | |
MainWindow.setWidget(self.centralWidget) | |
self.retranslateUi(MainWindow) | |
QtCore.QMetaObject.connectSlotsByName(MainWindow) | |
def retranslateUi(self, MainWindow): | |
global diffuseColorRF | |
global diffuseColorVF | |
global diffuseColorBF | |
global diffuseColorTF | |
global unsignedEncodeColor | |
global typeLongueur | |
global path | |
global volume_ | |
global longueurObjet | |
global rayonObjet | |
global perimetre | |
global seTDensiteValue | |
global seTIndexUnitWeight | |
global seTIndexUnitLength | |
global ui | |
global materialAssociated | |
global seTMaterialFileName | |
global seTMaterialSavePathName | |
global seTMaterialSuffixCost | |
global seTMaterialPrice | |
global seTMaterialCost | |
global seTTextHeigthValue | |
global directionObj | |
global direcValueAt | |
global direcNormalAt | |
global poids | |
global unitePs | |
global numberEdges | |
global nombreArretesMesh | |
global nombreFacesMesh | |
global nombrePointsMesh | |
global seTUnitSymbolMicro | |
global BsplineDetect | |
global BsplineNombreDeNoeuds | |
global BsplineRayonApproximatif | |
global BsplineCercleToolTip | |
global BsplineNumberElement | |
global BsplineCutLength | |
global BsplinePointsCoor | |
global setBSplineToByArcValue | |
global BSplinetoByArcValeurS | |
global switchCreateLineDiVatNatOnClick | |
global switchSetPlaceholderText | |
global typeNormalAt | |
#self.LA_determinantDecimal = QtWidgets.QLabel() | |
#grid.addWidget(self.LA_determinantDecimal, 14, 0, 1, 1) | |
ui.on_SP_012_01_Text_valueChanged(seTTextHeigthValue) # actualise text | |
MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint) # PySide2 cette fonction met la fenetre en avant | |
##https://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html | |
#MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowTitleHint) # 2 absents X grise (fonctionne pas dans ComboView et desactive WindowStaysOnTopHint) | |
#MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowContextHelpButtonHint)# WindowCloseButtonHint , setCancelButton(None) | |
MainWindow.setWindowIcon(QtGui.QIcon(path+'FCInfo.png')) # icone dans fichier | |
pointPlanAxesTexte = ( | |
u"Create Point or Axis or Plane or Clipboard" + "\n" + | |
u"Mouse coordinates" + "\n\n" + | |
u"The coordinates are cliped to this form" + "\n" + | |
u"FreeCAD.Vector(-24.0, 240.0, 7.0)" + "\n" + | |
u"X, Y, Z (separated by comma)" + "\n" + | |
u"X Y Z (separated by space)" + "\n" + | |
u"depend option on choice" + "\n" | |
) | |
#### | |
self.GBox_001_Document.setTitle(u"Document") | |
self.LE_1.setText(document_) | |
self.LE_1.setToolTip(u"Name of the active document.") | |
self.LE_2.setText(object_Label) | |
self.LE_2.setToolTip(u"Label of the selected object.") | |
self.LE_2a.setText(object_Name) | |
self.LE_2a.setToolTip(u"Internal name of the element.") | |
self.LE_3.setText(str(subElemName)) | |
self.LE_3.setToolTip(u"Name of the selected SubObject.") | |
self.LE_3a.setText(str(typeObject)) | |
self.LE_3a.setToolTip(u"Type of the selected (Shape) object.") | |
self.LE_4.setText(str(object_Type)) | |
self.LE_4.setToolTip(u"TypeID of the selected Object.") | |
# self.LE_Curve.setText(str(curveObject)) | |
# self.LE_Curve.setToolTip(u"Curve.") | |
self.LA_1.setText(u"Document name") | |
self.LA_2.setText(u"Label / Internal-Name") | |
self.LA_3.setText(u"Sub.Shape / Type") | |
self.LA_4.setText(u"Shape.TypeID / TypeID") | |
# self.LA_Curve.setText(u"Curve") | |
#### | |
self.GBox_002_Coordinate_Mouse.setTitle(u"Coordinate click mouse") | |
self.LA_4x.setText(u"X") | |
self.LA_4y.setText(u"Y") | |
self.LA_4z.setText(u"Z") | |
self.LE_4x.setText(str(Around(position0))) | |
self.LE_4x.setToolTip(u"X coordinate of the click of the mouse.") | |
self.LE_4y.setText(str(Around(position1))) | |
self.LE_4y.setToolTip(u"Y coordinate of the click of the mouse.") | |
self.LE_4z.setText(str(Around(position2))) | |
self.LE_4z.setToolTip(u"Z coordinate of the click of the mouse.") | |
self.PB_Axis_01.setToolTip(pointPlanAxesTexte) | |
#### | |
self.GBox_003_Color.setTitle(u"Color on point") | |
self.LA_1_Red.setText(u"Red") | |
self.LA_2_Green.setText(u"Green") | |
self.LA_3_Blue.setText(u"Blue") | |
self.LA_4_Transparent.setText(u"Transparency") | |
self.LE_CRed.setText(str(Around(diffuseColorRF))) | |
self.LE_CRed.setToolTip(u"Color Red on clicked point (format FreeCAD)" + "\n" + | |
u"The frame is colored with the percent of red displayed") | |
self.LE_CRed.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb("+str(int(diffuseColorRF*255.0))+", 0, 0)}") # white and red | |
self.LE_CGreen.setText(str(Around(diffuseColorVF))) | |
self.LE_CGreen.setToolTip(u"Color Green on clicked point (format FreeCAD)" + "\n" + | |
u"The frame is colored with the percent of green displayed") | |
self.LE_CGreen.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb(0, "+str(int(diffuseColorVF*255.0))+", 0)}") # white and green | |
self.LE_CBlue.setText(str(Around(diffuseColorBF))) | |
self.LE_CBlue.setToolTip(u"Color Blue on clicked point (format FreeCAD)" + "\n" + | |
u"The frame is colored with the percent of blue displayed") | |
self.LE_CBlue.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb(0, 0, "+str(int(diffuseColorBF*255.0))+")}") # white and blue | |
self.LE_Transparent.setText(str(Around(diffuseColorTF))) | |
self.LE_Transparent.setToolTip(u"Transparency on clicked point (format FreeCAD)") | |
self.LE_ConversionUnsigned.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb("+str(int(diffuseColorRF*255.0))+","+str(int(diffuseColorVF*255.0))+","+str(int(diffuseColorBF*255.0))+")}") # white | |
self.LE_ConversionUnsigned.setText(str(unsignedEncodeColor)) | |
self.LE_ConversionUnsigned.setToolTip(u'Give different mode codification of colors' + '\n' | |
u'The frame is colored with the same color on point clicked' + '\n\n' + | |
u'Example displayed :' + '\n\n' | |
u'1:\t\t2:\t\t3:\t\t4:\t\t5:' + '\n' | |
u'"86057986"\t, "#052123"\t, "0x52123"\t, "5,33,35"\t, "0.0196,0.1294,0.1373"' + '\n\n' | |
u'1: 86057986\t: Mode RVBA Int unsigned (format in FreeCAD preferences) Alpha = 255' + '\n' | |
u'2: #052123\t: Mode RVB Hexadecimal (Qt setStyleSheet("color : #052123")' + '\n' | |
u'3: 0x052123\t: Mode RVB Hexadecimal (Python: hex(336163)' + '\n' | |
u'4: RVB decim\t: Mode RVB (Qt setStyleSheet("background-color: rgb(5, 33, 36)"))' + '\n' | |
u'5: RVB float\t: Mode RVB format float de 0.0 to 1.0' + '\n' | |
u'\t\t(The number of decimals depend of the option "x (Decimals)") (seTDecimalValue)' + '\n\n') | |
self.CBox_Color_FaceObject.setText(u"Sub.Objet") | |
self.CBox_Color_FaceObject.setToolTip(u"Change the color of the selected object or subobject" + "\n" + | |
u"If this box is activated the face or sub Object selected is modified or duplicated" + "\n" + | |
u"If it is not activated (default) the object is modified (color) or duplicated") | |
self.PB_ChangeColor.setText(u"Coul. Obj") | |
self.PB_ChangeColor.setToolTip(u"Change the color of the shape or the face depend of the choice" + "\n" | |
u"In case object Mesh or Points the complete object is colored" + "\n\n") | |
#u"If a point or an edge is selected, the complete object is colored") | |
self.PB_CreateFace.setText(u"Dupl. Obj") | |
self.PB_CreateFace.setToolTip(u"Duplicates the face or the object depend to the chosen option" + "\n" + | |
u"In the case of a Mesh object or Points the complete object is colored" + "\n" + | |
u"Duplicate a Mesh object keeps the original and creates a solid shape" + "\n" + | |
u"Duplicate a Points object keeps the original and creates a copy") | |
self.SBox_Transparence.setToolTip(u"Degree of transparency of the selected face or object" + "\n" + | |
u"depend on the option chosen" + "\n" + | |
u"0 = opaque / 100 = transparent") | |
#### | |
self.GBox_004_Object_Mesh.setTitle(u"Components") # Mesh or Points | |
self.LA_N_Edges.setText(u"Edges") | |
self.LE_N_Edges.setText(str(nombreArretesMesh)) | |
self.LE_N_Edges.setToolTip(u"Number of Edges in object Mesh") | |
#self.PB_Axis_01.setText(u"Axis") | |
self.LA_N_Facets.setText(u"Faces") | |
self.LE_N_Facets.setText(str(nombreFacesMesh)) | |
self.LE_N_Facets.setToolTip(u"Number of Faces in object objet Mesh") | |
self.LA_N_Points.setText(u"Points") | |
self.LE_N_Points.setText(str(nombrePointsMesh)) | |
self.LE_N_Points.setToolTip(u"Number of Points in object") # mesh and Points | |
#### | |
self.GBox_005_Value_Unit.setTitle(u"Units") | |
self.LA_5a.setText(u"Units") | |
#http://fr.wikipedia.org/wiki/Unit%C3%A9s_de_mesure_anglo-saxonnes | |
self.comboBox.setToolTip(u"Selects a unit of length.") | |
# self.comboBox.setCurrentIndex(seTIndexUnitLength) | |
self.comboBox.setCurrentIndex(6) | |
self.comboBox.setItemText(0, u"km") #km # = 1000000 | |
self.comboBox.setItemText(1, u"hm") #hm # = 100000 | |
self.comboBox.setItemText(2, u"dam") #dam# = 10000 | |
self.comboBox.setItemText(3, u"m") #m # = 1000 | |
self.comboBox.setItemText(4, u"dm") #dm # = 100 | |
self.comboBox.setItemText(5, u"cm") #cm # = 10 | |
self.comboBox.setItemText(6, u"mm") #mm # = 1 | |
self.comboBox.setItemText(7, seTUnitSymbolMicro + u"m")#Um#= 0.001 micro hex="\xB5", html=<span>µ</span> | |
self.comboBox.setItemText(8, u"nm") #nm # * = 0.000001 nano | |
self.comboBox.setItemText(9, u"pm") #pm # = 0.000000001 pico | |
self.comboBox.setItemText(10, u"fm") #fm # = 0.000000000001 femto | |
self.comboBox.setItemText(11, u"inch") #in # inch pouce = 25.400 | |
self.comboBox.setItemText(12, u"link") #lk # link chainon = 201.168 | |
self.comboBox.setItemText(13, u"foot") #ft # foot pied = 304.800 | |
self.comboBox.setItemText(14, u"yard") #yd # yard verge = 914.400 | |
self.comboBox.setItemText(15, u"perch") #rd # rod ou perch perche = 5029.200 | |
self.comboBox.setItemText(16, u"chain") #ch # chain chaine = 20116.800 | |
self.comboBox.setItemText(17, u"furlong") #fur# furlong = 201168 | |
self.comboBox.setItemText(18, u"mile") #mi # mile = 1609344 | |
self.comboBox.setItemText(19, u"league") #lea# league lieue = 4828032 | |
self.comboBox.setItemText(20, u"nautique") #nmi# mile nautique = 1852000 | |
# self.LA_6.setText(u"Perim. shape") | |
self.LA_5.setText(typeLongueur) | |
try: | |
self.LE_5.setText(str(Around(float(longueurObjet) * float(uniteM)))+ " " +uniteMs) | |
except Exception: | |
self.LE_5.setText(u"") | |
self.LE_5.setToolTip(u"Length of the object." + "\n" | |
u"If the face is selected, the perimeter of the face is displayed.") | |
if (rayonObjet != 0.0) or (str(BsplineDetect) == "<BSplineCurve object>"): | |
self.LE_5b.setVisible(True) | |
self.LA_5b.setVisible(True) | |
if (str(BsplineDetect) == "<BSplineCurve object>"): | |
self.SB_Arc_ToByArcs.setVisible(True) | |
self.SB_Arc_ToByArcs.setToolTip(u"Bspline detected " + "\n" | |
u"Number of element = " + str(BsplineNumberElement) + "\n" + | |
u"Calcul with distance between points " + str(Around(BsplineCutLength * uniteM)) + " " + uniteMs + "\n\n" + | |
u"toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n" | |
u"This value can be modified in the preferences variable : setBSplineToByArcValue" + "\n") | |
self.PB_BSplineCreateNodes.setText(u"Points(" + str(len(BsplinePointsCoor)) + ")") # Node | |
self.PB_BSplineCreateNodes.setToolTip(u"Create on point on Poles (" + str(len(BsplinePointsCoor)) + ") of the BSpline" + "\n\n" | |
u"Command for Shape : Gui.Selection.getSelection()[0].Points" + "\n" | |
u"Command for SubObj : Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.getPoles()" + "\n\n" | |
u"Hidden Options : " + "\n\n" | |
u"The variables " + "\n\n" | |
u"switchBSplineCreateCircleConstructorAxis" + "\n" | |
u"switchBSplineCreateCircleConstructor" + "\n\n" | |
u"accessible in : User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__ + "\n" | |
u"allow to create the circles and the point axes construction of the BSpline" + "\n" | |
u"their number (precision) depends on the value toBiArcs(BSplinetoByArcValeurS)" + "\n" | |
u"actual toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n") | |
self.PB_BSplineCreateNodes.setVisible(True) | |
self.LA_5b.setText(u"Radius BSpline.") | |
self.LE_5b.setText(BsplineRayonApproximatif) | |
self.LE_5b.setToolTip(u"BSpline Radius on point : " + self.SB_Arc_ToByArcs.text()) | |
self.LA_6.setText(u"BSpline Nodes") | |
self.LE_6.setText(str(BsplineNombreDeNoeuds)) | |
self.LE_6.setToolTip(u"Number of nodes of the BSpline.") | |
else: | |
self.SB_Arc_ToByArcs.setVisible(False) | |
self.PB_BSplineCreateNodes.setVisible(False) | |
self.LA_5b.setText(u"Radius") | |
self.LE_5b.setText(str(Around(rayonObjet * float(uniteM))) + " " + uniteMs + (" (dia. " + str(Around(rayonObjet * float(uniteM) * 2.0)) + " " + uniteMs + ")")) | |
self.LE_5b.setToolTip(u"Radius detected and displayed in radius and diameter." | |
u"If one radius of face is detected, it is also displayed") | |
if numberEdges == 1: | |
self.LA_6.setText(u"Circumference (" + str(numberEdges) + ")") | |
else: | |
self.LA_6.setText(u"Perimetre of shape (" + str(numberEdges) + ")") | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
else: | |
self.LA_6.setText(u"Perimetre of shape (" + str(numberEdges) + ")") | |
self.SB_Arc_ToByArcs.setVisible(False) | |
self.PB_BSplineCreateNodes.setVisible(False) | |
self.LE_5b.setVisible(False) | |
self.LA_5b.setVisible(False) | |
rayonObjet = 0.0 | |
try: | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
except Exception: | |
perimetre = 0.0 | |
self.LE_6.setText(str(Around(perimetre))) | |
self.LE_6.setToolTip(u"Perimeter total of the form." + "\n" | |
u"Display the total result of the edges") | |
self.PB_BSplineCreateNodes.setText(u"Points(" + str(len(BsplinePointsCoor)) + ")") # Node | |
self.PB_BSplineCreateNodes.setToolTip(u"Create on point on Poles (" + str(len(BsplinePointsCoor)) + ") of the BSpline" + "\n\n" | |
u"Hidden feature : " + "\n\n" | |
u"Command for Shape : Gui.Selection.getSelection()[0].Points" + "\n" | |
u"Command for SubObj : Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.getPoles()" + "\n\n" | |
u"Hidden Options : " + "\n\n" | |
u"The variables " + "\n\n" | |
u"switchBSplineCreateCircleConstructorAxis" + "\n" | |
u"switchBSplineCreateCircleConstructor" + "\n\n" | |
u"accessible in : User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__ + "\n" | |
u"allow to create the circles and the point axes construction of the BSpline" + "\n" | |
u"their number (precision) depends on the value toBiArcs(BSplinetoByArcValeurS)" + "\n" | |
u"actual toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n") | |
#### | |
self.GBox_006_Inclination.setTitle(u"Inclination") | |
self.GBox_006_Inclination.setToolTip(u"Inclination compared XY, YZ, XZ") | |
self.LA_8a.setText(u"Plane") | |
self.PB_Ra.setText(u"Degrees") | |
self.PB_Ra.setToolTip(u"Toggles between decimal degrees, degrees minutes second" + "\n" | |
u"Radian, Grade, Percent.") | |
self.LA_8a_2.setText(u"Coordinates") | |
self.LA_8xy.setText(u"XY") | |
self.LE_8xy.setText(str(Plan_xy) + " " + uniteAs) | |
self.LE_8xy.setToolTip(u"Angle in the XY plane.") | |
self.LE_8xya.setText(str(Plan_xy_V)) | |
self.LA_8yz.setText(u"YZ") | |
self.LE_8yz.setText(str(Plan_yz) + " " + uniteAs) | |
self.LE_8yz.setToolTip(u"Angle in the YZ plane.") | |
self.LE_8yza.setText(str(Plan_yz_V)) | |
self.LA_8zx.setText(u"ZX") | |
self.LE_8zx.setText(str(Plan_zx) + " " + uniteAs) | |
self.LE_8zx.setToolTip(u"Angle in the ZX plane.") | |
self.LE_8zxa.setText(str(Plan_zx_V)) | |
## | |
if switchCreateLineDiVatNatOnClick == 0: | |
self.PB_Line_Direction.setText(u"Direction") | |
self.PB_Line_ValueAT.setText(u"ValueAt(0)") | |
self.PB_Line_NormalAT.setText(typeNormalAt) | |
else: | |
self.PB_Line_Direction.setText(u"*Direction") | |
self.PB_Line_ValueAT.setText(u"*ValueAt(0)") | |
self.PB_Line_NormalAT.setText(typeNormalAt) | |
self.PB_Line_Direction.setToolTip(u"Create a line (Yellow) in the displayed direction" + "\n" | |
u"Line is created at point 0,0,0 to Direction (switchCreateLineDiVatNatOnClick = FALSE)" + "\n" | |
u"If switchCreateLineDiVatNatOnClick = True, the line starts at the point clicked by the mouse" + "\n" | |
u"The button is displayed with an asterisk *Direction" + "\n") | |
self.LE_9_Direction.setText(str(directionObj)) | |
self.LE_9_Direction.setToolTip(u"Direction of object" + "\n" | |
u"Direction du point(x1,y1,z1) à point(x2,y2,z2)" + "\n" | |
u"Commande :" + "\n\n" | |
u"edgeObject = Gui.Selection.getSelection()[0].Shape.Edges[0]" + "\n" | |
u"directionObj = edgeObject.Vertexes[1].Point.sub(edgeObject.Vertexes[0].Point)" + "\n\n") | |
self.PB_Line_ValueAT.setToolTip(u"Create a line (Magenta) in the direction ValueAt(0)" + "\n" | |
u"The line is created at point 0,0,0 in the direction ValueAt(0) (switchCreateLineDiVatNatOnClick = FALSE)" + "\n" | |
u"If switchCreateLineDiVatNatOnClick = True, the line starts at the point clicked by the mouse" + "\n" | |
u"The button is displayed with an asterisk *ValueAt(0)" + "\n") | |
self.LE_10_ValueAt.setText(str(direcValueAt)) | |
self.LE_10_ValueAt.setToolTip(u"Returns the value of the vector corresponding to the 3D parameter. " + "\n" | |
u"Command :" + "\n\n" | |
u"Gui.Selection.getSelectionEx()[0].SubObjects[0].Edges[0].valueAt(0)" + "\n\n") | |
self.PB_Line_NormalAT.setToolTip(u"Create a line (Cyan) in the direction NormalAt(0,0)" + "\n" | |
u"The line is created at point 0,0,0 in the NormalAt(0,0) direction (switchCreateLineDiVatNatOnClick = FALSE)" + "\n" | |
u"If switchCreateLineDiVatNatOnClick = True, the line starts at the point clicked by the mouse" + "\n" | |
u"The button is displayed with an asterisk *NormalAt(0,0)" + "\n") | |
self.LE_10b_NormalAt.setText(str(direcNormalAt)) | |
self.LE_10b_NormalAt.setToolTip(u"Returns the value of the parameters of the normal of the selected face" + "\n" | |
u"Command :" + "\n\n" | |
u"Gui.Selection.getSelectionEx()[0].SubObjects[0].Faces[0].normalAt(0,0)" + "\n\n") | |
## | |
#### | |
self.GBox_012_SpreadSheet.setTitle(u"Details of the form") | |
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.") | |
#### | |
self.GBox_007_Surface_and_Volume.setTitle(u"Area and Volume") | |
self.LA_9.setText(u"Area of the form") | |
self.LE_9a.setText(str(Around(surface)) + " " + uniteSs) | |
self.LE_9a.setToolTip(u"Total area of the form.") | |
self.LA_10.setText(u"Area of the face") | |
self.LE_10a.setText(str(Around(surfaceFace)) + " " + uniteSs) | |
self.LE_10a.setToolTip(u"Area of the face.") | |
self.LA_11.setText(u"Volume of the form") | |
self.LE_11a.setText(str(Around(volume_)) + " " + uniteVs) | |
self.LE_11a.setToolTip(u"Total volume of the form.") | |
self.LA_Unit.setText(u"Unit") | |
self.comboBox_Unit.setCurrentIndex(5) | |
self.comboBox_Unit.setItemText(0, u"tonne") #t # = 1000000 | |
self.comboBox_Unit.setItemText(1, u"quintal") #q # = 100000 | |
self.comboBox_Unit.setItemText(2, u"kilo gram") #kg # = 1000 | |
self.comboBox_Unit.setItemText(3, u"hecto gram") #hg # = 100 | |
self.comboBox_Unit.setItemText(4, u"decagram") #dag # = 10 | |
self.comboBox_Unit.setItemText(5, u"gram") #g # = 1 | |
self.comboBox_Unit.setItemText(6, u"decigram") #dg # = 0.1 | |
self.comboBox_Unit.setItemText(7, u"centigram") #cg # = 0.01 | |
self.comboBox_Unit.setItemText(8, u"milligram") #mg # = 0.001 | |
self.comboBox_Unit.setItemText(9, u"microgram") #Ug # = 0.000001 micro hex="\xB5", html=<span>µ</span> | |
self.comboBox_Unit.setItemText(10, u"nanogram") #ng # = 0.000000001 | |
self.comboBox_Unit.setItemText(11, u"picogram") #pg # = 0.000000000001 | |
self.comboBox_Unit.setItemText(12, u"femtogram") #fg # = 0.000000000000001 femtogram | |
self.comboBox_Unit.setItemText(13, u"grain") #gr # = 0.06479891 g | |
self.comboBox_Unit.setItemText(14, u"drachm") #dr # = 1.7718451953125 g | |
self.comboBox_Unit.setItemText(15, u"once") #oz # = 28.3495231250 g | |
self.comboBox_Unit.setItemText(16, u"once troy") #oz t # = 31.1034768 g once troy | |
self.comboBox_Unit.setItemText(17, u"livre troy") #lb t # = 373.2417216 g livre de troy | |
self.comboBox_Unit.setItemText(18, u"livre av") #lb # = 453.59237 g livre avoirdupois pound | |
self.comboBox_Unit.setItemText(19, u"stone") #st # = 6350.29318 g | |
self.comboBox_Unit.setItemText(20, u"quarter") #qtr # = 12700.58636 g | |
self.comboBox_Unit.setItemText(21, u"hundredweight") #cwt # = 50802.34544 g | |
self.comboBox_Unit.setItemText(22, u"tonneau fr") # # = 0.00000102145045965 g | |
self.comboBox_Unit.setItemText(23, u"carat") #ct # = 0.2 g | |
self.comboBox_Unit.setToolTip(u"Select a unit of mass.") | |
self.LA_Weight.setText(u"Mass") | |
self.LA_Density.setText(u"Density") | |
self.LE_12a.setText(str(Around(poids)) + " " + unitePs) | |
self.LE_12a.setToolTip(u"Mass of the form in the selected unit.") | |
seTMaterialCost = ((volume_ * seTDensiteValue * seTMaterialPrice) / 1000000.0) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
self.DS_Density.setToolTip(u"Give the volume density in Kg by dm3.") | |
self.GBox_008_Cost_And_Price.setTitle(u"Cost") | |
self.LA_Cost.setText(u"Cost total") | |
self.LA_Price.setText(u"Price (kg/dm3)") | |
self.PB_Del_Material.setText(u"Delete (" + str(self.CBox_Materiel.currentIndex() + 1) + "/" + str(len(materialAssociated)) + ")") | |
self.PB_Del_Material.setToolTip(u"Delete the curent material ") | |
self.PB_Save_Material.setText(u"Save") | |
self.PB_Save_Material.setToolTip(u"Save the curent material" + "\n" | |
u"The material is also saved with the Exit button") | |
self.LA_Material.setText(u"Material") | |
self.CBox_Materiel.setToolTip(u"The material data is saved in the macro location (by default)" + "\n\n" | |
u"First run one Material file is created with 20 components" + "\n" | |
u"(You can adding all components material you want)" + "\n" | |
u"Location : " + seTMaterialSavePathName + " file name : " + seTMaterialFileName + "\n" | |
u"Actual : " + str(len(materialAssociated)) + " materials listed" + "\n" | |
u"If the file is deleted or empity one new file of material is created" + "\n" | |
u"with the basic material include in the macro") | |
self.LA_NewMaterial.setText(u"New material or editing") | |
self.LE_Materiel.setToolTip(u"Enter your new material and press enter for validate" + "\n\n" | |
u"Format : newNameMaterial, Density, Price (by kg), Info" + "\n\n" | |
u"newNameMaterial : the material name" + "\n" | |
u"Density \t : density of the material in Kg by dm3" + "\n" | |
u"Price \t : price of the material" + "\n" | |
u"Info \t : info of the material of other" + "\n\n" | |
u"Each field is separated by a comma" + "\n\n" | |
u"Other format is not accepted and the background is coloured in red" + "\n" | |
u"The current material is displayed you can change or complete the data material" + "\n" | |
u"If the name is changed, on new material is created" + "\n") | |
#### | |
self.GBox_009_BoundBox.setTitle(u"BoundBox") | |
self.LA_007_01_Xlength.setText(u"X Length") | |
self.LA_007_02_Ylength.setText(u"Y Length") | |
self.LA_007_03_Zlength.setText(u"Z Length") | |
self.LA_007_04_Diagonallength.setText(u"Diagonal Length") | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_01_XLength.setToolTip(u"Dimensions of the form:" + "\n" | |
u"Direction X") | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setToolTip(u"Dimensions of the form:" + "\n" | |
u"Direction Y") | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setToolTip(u"Dimensions of the form:" + "\n" | |
u"Direction Z") | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setToolTip(u"Dimensions diagonal boundBox of the form.") | |
self.PB_BoundBox_Tracing.setText(u"Tracing") | |
self.PB_BoundBox_Tracing.setToolTip(u"Trace the boundBox edge of the shape.") | |
self.PB_00_BoundBox_Volume.setText(u"Volume") | |
self.PB_00_BoundBox_Volume.setToolTip(u"Create BoundBox Volume of the shape.") | |
self.CB_01_BoundBox_Text.setText(u"Text Dim.") | |
self.CB_01_BoundBox_Text.setToolTip(u"Create Dimension on BoundBox") | |
#### | |
self.GBox_010_Center_Mass.setTitle(u"Centre of :") | |
self.LA_13x.setText(u"BoundBox X") | |
self.LA_13y.setText(u"BoundBox Y") | |
self.LA_13z.setText(u"BoundBox Z") | |
self.LE_13x.setText(str(Around(boundBoxCenterX * uniteM)) + " " + uniteMs) | |
self.LE_13x.setToolTip(u"X coordinate of the center of the shape.") | |
self.LE_13y.setText(str(Around(boundBoxCenterY * uniteM)) + " " + uniteMs) | |
self.LE_13y.setToolTip(u"Y coordinate of the center of the shape.") | |
self.LE_13z.setText(str(Around(boundBoxCenterZ * uniteM)) + " " + uniteMs) | |
self.LE_13z.setToolTip(u"Z coordinate of the center of the shape.") | |
#self.PB_Axis_02.setText(u"Axis") | |
self.PB_Axis_02.setToolTip(pointPlanAxesTexte) | |
self.LA_14x.setText(massOrGravity + u" X") | |
self.LA_14y.setText(massOrGravity + u" Y") | |
self.LA_14z.setText(massOrGravity + u" Z") | |
self.LE_14x.setText(str(Around(CenterOfMassX * uniteM)) + " " + uniteMs) | |
self.LE_14x.setToolTip(u"X coordinate of the center of " + massOrGravity) | |
self.LE_14y.setText(str(Around(CenterOfMassY * uniteM)) + " " + uniteMs) | |
self.LE_14y.setToolTip(u"Y coordinate of the center of " + massOrGravity) | |
self.LE_14z.setText(str(Around(CenterOfMassZ * uniteM)) + " " + uniteMs) | |
self.LE_14z.setToolTip(u"Z coordinate of the center of " + massOrGravity) | |
#self.PB_Axis_03.setText(u"Axis") | |
self.PB_Axis_03.setToolTip(pointPlanAxesTexte) | |
#### | |
self.GBox_011_Inertia.setTitle(u"Inertia") | |
self.GBox_011_Inertia.setStyleSheet(u"QToolTip { color: #ffffff; font: bold 14px; background-color: #ff0000; border: 2px solid white; }") | |
self.GBox_011_Inertia.setToolTip(u"<html> <body>" | |
u"############################################################################################################" + "<br/>" | |
u" INFORMATION" + "<br/>" | |
u" VERIFY THIS SECTION BY PERSON KNOWING THE INERTIA" + "<br/>" | |
u" and thanks post your knowledges in the forum tread if it is not correct" + "<br/>" | |
u" http://forum.freecadweb.org/viewtopic.php?f=10&t=3185 " + "<br/>" | |
u" ###########" | |
u"<p style=color:Yellow >" | |
u" * Use at your own risk. The author assumes no liability for data loss. *" | |
u"</p>" | |
u" ###########" + "<br/>" | |
u"The exposant value 1 (Raw) correspond mode base of FreeCAD" + "<br/>" | |
u"Code used :" | |
u"<p style=color:DarkBlue >" | |
u"####" + "<br/>" | |
u"Matrix = Gui.Selection.getSelection()[0].Shape.MatrixOfInertia # (complete data .A[0] to .A[11])" + "<br/>" | |
u"MatrixX1 = Gui.Selection.getSelection()[0].Shape.MatrixOfInertia.A[0] # (first field, first data)" + "<br/>" | |
u"#volume = Gui.Selection.getSelection()[0].Shape.Volume" + "<br/>" | |
u"uniteV = 1.0 # mm3 base FreeCAD ## (kilo = 0.000000000000000001)" + "<br/>" | |
u"uniteS = 1.0 # mm2 base FreeCAD ## (kilo = 0.000000000001)" + "<br/>" | |
u"uniteM = 1.0 # mm base FreeCAD ## (kilo = 0.000001)" + "<br/>" | |
u"uniteP = 1.0 # gram base FreeCAD## (kilo = 0.001)" + "<br/>" | |
u"setMomentOfInertia_16 = 2 # exposant Moment of inertia value " + "<br/>" | |
u"setMomentOfInertiaMassique_17 = 2 # exposant Moment of inertia massique value" + "<br/>" | |
u"seTDensiteValue = 7.8700 # kg by dm3 (iron)" + "<br/>" | |
u"MatrixX1_16 = (MatrixX1*uniteS)**setMomentOfInertia_16" + "<br/>" | |
u"MatrixX1_17 = (MatrixX1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0))" + "<br/>" | |
u"####" | |
u"</p>" | |
u" ###########" + "<br/>" | |
u"The moment of inertia, otherwise known as the angular mass or" + "<br/>" | |
u"rotational inertia, of a rigid body is a tensor that determines" + "<br/>" | |
u"the torque needed for a desired angular acceleration about a rotational axis." + "<br/>" | |
u"It depends on the body's mass distribution and the axis chosen," + "<br/>" | |
u"with larger moments requiring more torque to change the body's rotation." + "<br/>" | |
u"see https://en.wikipedia.org/wiki/Moment_of_inertia " + "<br/>" | |
u"############################################################################################################" | |
u"</html> </body>") | |
self.LA_16.setText(u"Moment of inertia") | |
self.LE_16_Raw.setText("Raw : " + MatrixOfInertiaRaw) | |
self.LE_16_Raw.setCursorPosition(0) | |
self.LA_16x.setText(u"X") | |
self.LA_16y.setText(u"Y") | |
self.LA_16z.setText(u"Z") | |
#self.SB_16_M.setText(uniteMs + "^5") | |
self.SB_16_M.setPrefix(uniteMs + "^") | |
self.SB_16_M.setValue(setMomentOfInertia_16) | |
self.LE_16_1x.setText(str(Around(MatrixX1))) | |
self.LE_16_1y.setText(str(Around(MatrixY1))) | |
self.LE_16_1z.setText(str(Around(MatrixZ1))) | |
self.LE_16_01.setText(str(Around(Matrix_1))) | |
self.PB_Axis_04_16_1.setToolTip(pointPlanAxesTexte) | |
self.LE_16_2x.setText(str(Around(MatrixX2))) | |
self.LE_16_2y.setText(str(Around(MatrixY2))) | |
self.LE_16_2z.setText(str(Around(MatrixZ2))) | |
self.LE_16_02.setText(str(Around(Matrix_2))) | |
self.LE_16_3x.setText(str(Around(MatrixX3))) | |
self.LE_16_3y.setText(str(Around(MatrixY3))) | |
self.LE_16_3z.setText(str(Around(MatrixZ3))) | |
self.LE_16_03.setText(str(Around(Matrix_3))) | |
self.PB_Axis_05_16_2.setToolTip(pointPlanAxesTexte) | |
self.PB_Axis_06_16_3.setToolTip(pointPlanAxesTexte) | |
self.LE_16_4x.setText(str(Around(Matrix12))) | |
self.LE_16_4y.setText(str(Around(Matrix13))) | |
self.LE_16_4z.setText(str(Around(Matrix14))) | |
self.LE_16_04.setText(str(Around(Matrix15))) | |
self.PB_Axis_07_16_4.setToolTip(pointPlanAxesTexte) | |
## | |
self.LA_17.setText(u"Moment of inertia massique") | |
self.LA_17x.setText(u"X") | |
self.LA_17y.setText(u"Y") | |
self.LA_17z.setText(u"Z") | |
self.LA_determinant.setText(u"Determinant") | |
self.LA_determinantDecimal.setText(u"Determinant Dec.") | |
#self.LE_17_M.setText(unitePs+uniteSs) | |
self.SB_17_M.setPrefix(unitePs + uniteSs + "^") | |
self.SB_17_M.setValue(setMomentOfInertiaMassique_17) | |
self.LE_17_1x.setText(str(Around(MatrixX1*seTDensiteValue))) | |
self.LE_17_1y.setText(str(Around(MatrixY1*seTDensiteValue*uniteP))) | |
self.LE_17_1z.setText(str(Around(MatrixZ1*seTDensiteValue))) | |
self.PB_Axis_08_17_1.setToolTip(pointPlanAxesTexte) | |
self.LE_17_2x.setText(str(Around(MatrixX2*seTDensiteValue))) | |
self.LE_17_2y.setText(str(Around(MatrixY2*seTDensiteValue))) | |
self.LE_17_2z.setText(str(Around(MatrixZ2*seTDensiteValue))) | |
self.PB_Axis_09_17_2.setToolTip(pointPlanAxesTexte) | |
self.LE_17_3x.setText(str(Around(MatrixX3*seTDensiteValue))) | |
self.LE_17_3y.setText(str(Around(MatrixY3*seTDensiteValue))) | |
self.LE_17_3z.setText(str(Around(MatrixZ3*seTDensiteValue))) | |
self.PB_Axis_10_17_3.setToolTip(pointPlanAxesTexte) | |
self.PB_Axis_11_17_4.setToolTip(pointPlanAxesTexte) | |
self.LE_18_determinant.setText(str(DeterminantM)) | |
self.LE_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") | |
self.LE_18_determinantDecim.setText(str(decimal.Decimal(DeterminantM))) | |
self.LE_18_determinantDecim.setToolTip(u"Determinant Decimal.") | |
if switch_Set_Placeholder_Text == True: | |
self.LE_1.setPlaceholderText(u"Document name") | |
self.LE_2.setPlaceholderText(u"Label") | |
self.LE_2a.setPlaceholderText(u"Internal name") | |
self.LE_3.setPlaceholderText(u"Sub objet") | |
self.LE_3a.setPlaceholderText(u"Type") | |
self.LE_4.setPlaceholderText(u"TypeID") | |
self.LE_4x.setPlaceholderText(u"X Mouse") | |
self.LE_4y.setPlaceholderText(u"Y Mouse") | |
self.LE_4z.setPlaceholderText(u"Z Mouse") | |
self.LE_N_Edges.setPlaceholderText(u"Number of Edge(s)") | |
self.LE_N_Facets.setPlaceholderText(u"Number of Face(s)") | |
self.LE_N_Points.setPlaceholderText(u"Number of Points") | |
self.LE_CRed.setPlaceholderText(u"Red") | |
self.LE_CGreen.setPlaceholderText(u"Green") | |
self.LE_CBlue.setPlaceholderText(u"Blue") | |
self.LE_Transparent.setPlaceholderText(u"Transparency") | |
self.LE_ConversionUnsigned.setPlaceholderText(u"Codage of colors") | |
self.LE_5.setPlaceholderText(u"Length") | |
self.LE_5b.setPlaceholderText(u"Radius") | |
self.LE_6.setPlaceholderText(u"Perimeter") | |
self.LE_8xy.setPlaceholderText(u"Degrees") | |
self.LE_8yz.setPlaceholderText(u"Degrees") | |
self.LE_8zx.setPlaceholderText(u"Degrees") | |
self.LE_8xya.setPlaceholderText(u"XY Angle") | |
self.LE_8yza.setPlaceholderText(u"YZ Angle") | |
self.LE_8zxa.setPlaceholderText(u"ZX Angle") | |
self.LE_9_Direction.setPlaceholderText(u"Direction") | |
self.LE_10_ValueAt.setPlaceholderText(u"Vector") | |
self.LE_10b_NormalAt.setPlaceholderText(u"NormalAt") | |
self.LE_9a.setPlaceholderText(u"Total Area") | |
self.LE_10a.setPlaceholderText(u"Face Area") | |
self.LE_11a.setPlaceholderText(u"Volume") | |
self.LE_12a.setPlaceholderText(u"Mass") | |
self.LE_Cost.setPlaceholderText(u"Price") | |
self.LE_Materiel.setPlaceholderText(u"Material") | |
self.LE_007_BB_01_XLength.setPlaceholderText(u"X Length") | |
self.LE_007_BB_02_YLength.setPlaceholderText(u"Y Length") | |
self.LE_007_BB_03_ZLength.setPlaceholderText(u"Z Length") | |
self.LE_007_BB_04_Diagonal.setPlaceholderText(u"Diagonal Length") | |
self.LE_13x.setPlaceholderText(u"X Coordinate") | |
self.LE_13y.setPlaceholderText(u"Y Coordinate") | |
self.LE_13z.setPlaceholderText(u"Z Coordinate") | |
self.LE_14x.setPlaceholderText(u"X Coordinate") | |
self.LE_14y.setPlaceholderText(u"Y Coordinate") | |
self.LE_14z.setPlaceholderText(u"Z Coordinate") | |
self.LE_18_determinant.setPlaceholderText(u"Determinant") | |
self.LE_18_determinantDecim.setPlaceholderText(u"Decimal Determinant") | |
#### | |
self.GBox_013_SpreadSheet_Creation.setTitle(u"SpreadSheet") | |
self.GBox_013_SpreadSheet_Creation.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.PB_01_Read_SpreadSheet.setText(u"Read") | |
self.PB_01_Read_SpreadSheet.setToolTip(u"Read the file from disk.") | |
self.PB_02_Save_SreadSheet.setText(u"Save") | |
self.PB_02_Save_SreadSheet.setToolTip(u"Save the file to disk.") | |
self.RB_01_Tabulation.setText(u"Tabulation") | |
self.RB_02_Virgule.setText(u"Comma") | |
self.RB_03_Point_Virgule.setText(u"Semicolon") | |
self.RB_04_Espace.setText(u"Space") | |
self.ComboB_SpreadSheet.setToolTip(u"List of spreadSeet available") | |
self.PB_SpreadSheet_Refresh.setText(u"Refresh") | |
self.PB_SpreadSheet_Refresh.setToolTip(u"Refresh and Search Spreadsheet") | |
self.LE_SpreadSheet.setToolTip(u"Current worksheet (first displayed)" + "\n" + | |
u"If there is no worksheet in the document," + "\n" + | |
u"a spreadsheet named FCSpreadSheet is created" + "\n" + | |
u"or the displayed spreadsheet is updated" + "\n" + | |
u"or type the name of your spreadsheet") | |
self.PB_03_Create_SpreadSheet.setText(u"SpreadSheet") | |
self.PB_03_Create_SpreadSheet.setToolTip(u"Creates a spreadsheet with all the information in the current document.") | |
#### | |
self.GBox_014_Main_Tools.setTitle(u"Main menu") | |
self.CB_01_Info.setText(u"Info") | |
self.CB_01_Info.setToolTip(u"If checked Display Infos in Rapport View") | |
self.CB_01_Info.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Info))) # icone dans une variable | |
self.CB_02_Point.setText(u"Point") | |
self.CB_02_Point.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Point))) # icone dans une variable | |
self.CB_02_Point.setToolTip(u"<img src= />" + "\n" + | |
u"If checked Create point") | |
self.CB_03_Axis.setText(u"Axis") | |
self.CB_03_Axis.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Axis))) # icone dans une variable | |
self.CB_03_Axis.setToolTip(u"<img src= />" + "\n" + | |
u"If checked Create 3 axis in XYZ direction") | |
self.CB_04_Plane.setText(u"Plane") | |
self.CB_04_Plane.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Plane))) # icone dans une variable | |
self.CB_04_Plane.setToolTip(u"<img src= />" + "\n" + | |
u"If checked Create 3 Plane in XYZ direction") | |
#### | |
self.RB_00_ClipBoard.setText(u"Clip-B0") #Board | |
self.RB_00_ClipBoard.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_ClipBoard_None))) # icone dans une variable | |
self.RB_00_ClipBoard.setToolTip(u"<img src= />" + "\n" + | |
u"None clipBoard") | |
self.RB_01_ClipBoard.setText(u"Clip-B1") | |
self.RB_01_ClipBoard.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_ClipBoard_FC))) # icone dans une variable | |
self.RB_01_ClipBoard.setToolTip(u"<img src= />" + "\n" | |
u"If checked the coordinate are copy in the clipBoard" + "\n" + | |
u"Form : FreeCAD.Vector(X.0, Y.0, Z.0)" + "\n" + | |
u"FreeCAD model") | |
self.RB_02_ClipBoard.setText(u"Clip-B2") | |
self.RB_02_ClipBoard.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_ClipBoard_Comma))) # icone dans une variable | |
self.RB_02_ClipBoard.setToolTip(u"<img src= />" + "\n" + | |
u"If checked the coordinate are copy in the clipBoard" + "\n" + | |
u"Form : X, Y, Z" + "\n" + | |
u"with Comma separator") | |
self.RB_03_ClipBoard.setText(u"Clip-B3") | |
self.RB_03_ClipBoard.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_ClipBoard_Raw))) # icone dans une variable | |
self.RB_03_ClipBoard.setToolTip(u"<img src= />" + "\n" + | |
u"If checked the coordinate are copy in the clipBoard" + "\n" + | |
u"Form : X Y Z" + "\n" + | |
u"As is with Space separator") | |
## | |
self.CB_05_Position.setText(u"Left/Right") | |
self.CB_05_Position.setToolTip(u"Change the window macro position Right of Left") | |
## | |
self.SPBox_arrondi.setSuffix(u" (Decimals)") | |
self.SPBox_arrondi.setToolTip(u"Select the number of decimal places behind the comma." + "\n" | |
u"If the value is -1, the rounding is set to 1000" + "\n" | |
u"(infinity)") | |
self.SP_012_01_Text.setSuffix(u" (Text Height)") | |
## | |
self.PB_05_Help_Forum.setText(u"Forum") | |
self.PB_05_Help_Forum.setToolTip(u"Open your explorer in the FCInfo Forum page ") | |
self.PB_06_Help_Wiki.setText(u"Wiki") | |
self.PB_06_Help_Wiki.setToolTip(u"Open your explorer in the FCInfo Wiki page") | |
## | |
self.PB_01_Refrech.setText(u"Ref") | |
self.PB_01_Refrech.setToolTip(u"Refrech the rapport view.") | |
self.PB_04_Quit.setText(u"Exit") | |
self.PB_04_Quit.setToolTip(u"Exit FCInfo." + "\n" | |
u"The material is saved also on quit the macro" + "\n" | |
u"All parameters are saved with this action") | |
self.SPBox_arrondi.setToolTip(u"seTDecimalValue the value displayed in the window." + "\n" | |
u"If the value is -1 the arrond is called to 1000" + "\n" | |
u"(infini)") | |
## | |
def displayMatrixMomentOfInertia(self): | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixOfInertiaRaw | |
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 | |
self.LE_16_Raw.setText("Raw : " + MatrixOfInertiaRaw) | |
self.LE_16_Raw.setCursorPosition(0) | |
self.SB_16_M.setValue(setMomentOfInertia_16) | |
self.SB_16_M.setPrefix(uniteMs + "^") | |
## | |
self.LE_16_1x.setText(str(Around(MatrixX1_16))) | |
self.LE_16_1x.setCursorPosition(0) | |
self.LE_16_1y.setText(str(Around(MatrixY1_16))) | |
self.LE_16_1y.setCursorPosition(0) | |
self.LE_16_1z.setText(str(Around(MatrixZ1_16))) | |
self.LE_16_1z.setCursorPosition(0) | |
self.LE_16_01.setText(str(Around(Matrix_1))) | |
self.LE_16_01.setCursorPosition(0) | |
## | |
self.LE_16_2x.setText(str(Around(MatrixX2_16))) | |
self.LE_16_2x.setCursorPosition(0) | |
self.LE_16_2y.setText(str(Around(MatrixY2_16))) | |
self.LE_16_2y.setCursorPosition(0) | |
self.LE_16_2z.setText(str(Around(MatrixZ2_16))) | |
self.LE_16_2z.setCursorPosition(0) | |
self.LE_16_02.setText(str(Around(Matrix_2))) | |
self.LE_16_02.setCursorPosition(0) | |
## | |
self.LE_16_3x.setText(str(Around(MatrixX3_16))) | |
self.LE_16_3x.setCursorPosition(0) | |
self.LE_16_3y.setText(str(Around(MatrixY3_16))) | |
self.LE_16_3y.setCursorPosition(0) | |
self.LE_16_3z.setText(str(Around(MatrixZ3_16))) | |
self.LE_16_3z.setCursorPosition(0) | |
self.LE_16_03.setText(str(Around(Matrix_3))) | |
self.LE_16_03.setCursorPosition(0) | |
## | |
self.LE_16_4x.setText(str(Around(Matrix12))) | |
self.LE_16_4x.setCursorPosition(0) | |
self.LE_16_4y.setText(str(Around(Matrix13))) | |
self.LE_16_4y.setCursorPosition(0) | |
self.LE_16_4z.setText(str(Around(Matrix14))) | |
self.LE_16_4z.setCursorPosition(0) | |
self.LE_16_04.setText(str(Around(Matrix15))) | |
self.LE_16_04.setCursorPosition(0) | |
## | |
#### | |
self.SB_17_M.setValue(setMomentOfInertiaMassique_17) | |
self.SB_17_M.setPrefix(unitePs + uniteSs + "^") | |
self.LE_17_1x.setText(str(Around(MatrixX1_17))) | |
self.LE_17_1x.setCursorPosition(0) | |
self.LE_17_1y.setText(str(Around(MatrixY1_17))) | |
self.LE_17_1y.setCursorPosition(0) | |
self.LE_17_1z.setText(str(Around(MatrixZ1_17))) | |
self.LE_17_1z.setCursorPosition(0) | |
self.LE_17_2x.setText(str(Around(MatrixX2_17))) | |
self.LE_17_2x.setCursorPosition(0) | |
self.LE_17_2y.setText(str(Around(MatrixY2_17))) | |
self.LE_17_2y.setCursorPosition(0) | |
self.LE_17_2z.setText(str(Around(MatrixZ2_17))) | |
self.LE_17_2z.setCursorPosition(0) | |
self.LE_17_3x.setText(str(Around(MatrixX3_17))) | |
self.LE_17_3x.setCursorPosition(0) | |
self.LE_17_3y.setText(str(Around(MatrixY3_17))) | |
self.LE_17_3y.setCursorPosition(0) | |
self.LE_17_3z.setText(str(Around(MatrixZ3_17))) | |
self.LE_17_3z.setCursorPosition(0) | |
self.LE_18_determinant.setText(str(DeterminantM)) | |
self.LE_18_determinantDecim.setText(str(decimal.Decimal(DeterminantM))) | |
def on_SP_012_01_Text_valueChanged(self, value): | |
global ui | |
global seTTextHeigthValue | |
global FreeCAD_ParamGetSet | |
seTTextHeigthValue = value | |
FreeCAD_ParamGetSet.SetInt(u"seTTextHeigthValue", seTTextHeigthValue) # 11 | |
self.fontGlobal_08.setPixelSize(seTTextHeigthValue) # pour compatibilite Windows Linux pour tous les textes | |
self.scrollArea.setFont(self.fontGlobal_08) | |
######GBox_001_Document | |
self.GBox_001_Document.setFont(self.fontGlobal_08) | |
self.LA_1.setFont(self.fontGlobal_08) | |
self.LE_1.setFont(self.fontGlobal_08) | |
self.LA_2.setFont(self.fontGlobal_08) | |
self.LE_2.setFont(self.fontGlobal_08) | |
self.LE_2a.setFont(self.fontGlobal_08) | |
self.LA_3.setFont(self.fontGlobal_08) | |
self.LA_4.setFont(self.fontGlobal_08) | |
self.LE_3.setFont(self.fontGlobal_08) | |
self.LE_3a.setFont(self.fontGlobal_08) | |
######GBox_002_Coordinate_Mouse | |
self.GBox_002_Coordinate_Mouse.setFont(self.fontGlobal_08) | |
self.LA_4x.setFont(self.fontGlobal_08) | |
self.LA_4y.setFont(self.fontGlobal_08) | |
self.LA_4z.setFont(self.fontGlobal_08) | |
self.LE_4x.setFont(self.fontGlobal_08) | |
self.LE_4y.setFont(self.fontGlobal_08) | |
self.LE_4z.setFont(self.fontGlobal_08) | |
self.PB_Axis_01.setFont(self.fontGlobal_08) | |
######GBox_003_Color | |
self.GBox_003_Color.setFont(self.fontGlobal_08) | |
self.LA_1_Red.setFont(self.fontGlobal_08) | |
self.LA_2_Green.setFont(self.fontGlobal_08) | |
self.LA_3_Blue.setFont(self.fontGlobal_08) | |
self.LA_4_Transparent.setFont(self.fontGlobal_08) | |
self.LE_CRed.setFont(self.fontGlobal_08) | |
self.LE_CGreen.setFont(self.fontGlobal_08) | |
self.LE_CBlue.setFont(self.fontGlobal_08) | |
self.LE_Transparent.setFont(self.fontGlobal_08) | |
self.LE_ConversionUnsigned.setFont(self.fontGlobal_08) | |
self.PB_ChangeColor.setFont(self.fontGlobal_08) | |
self.CBox_Color_FaceObject.setFont(self.fontGlobal_08) | |
self.PB_CreateFace.setFont(self.fontGlobal_08) | |
self.SBox_Transparence.setFont(self.fontGlobal_08) | |
######GBox_004_Object_Mesh | |
self.GBox_004_Object_Mesh.setFont(self.fontGlobal_08) | |
self.LA_N_Edges.setFont(self.fontGlobal_08) | |
self.LE_N_Edges.setFont(self.fontGlobal_08) | |
self.LA_N_Facets.setFont(self.fontGlobal_08) | |
self.LE_N_Facets.setFont(self.fontGlobal_08) | |
self.LA_N_Points.setFont(self.fontGlobal_08) | |
self.LE_N_Points.setFont(self.fontGlobal_08) | |
######GBox_005_Value_Unit | |
self.GBox_005_Value_Unit.setFont(self.fontGlobal_08) | |
#self.ComboB_Grandeur.setFont(self.fontGlobal_08) | |
self.LA_5.setFont(self.fontGlobal_08) | |
self.LA_5b.setFont(self.fontGlobal_08) | |
self.LE_5.setFont(self.fontGlobal_08) | |
self.LE_5b.setFont(self.fontGlobal_08) | |
self.SB_Arc_ToByArcs.setFont(self.fontGlobal_08) | |
self.PB_BSplineCreateNodes.setFont(self.fontGlobal_08) | |
self.LA_6.setFont(self.fontGlobal_08) | |
self.LE_6.setFont(self.fontGlobal_08) | |
######GBox_012_SpreadSheet | |
self.GBox_012_SpreadSheet.setFont(self.fontGlobal_08) | |
self.tableWidget.setFont(self.fontGlobal_08) | |
######GBox_006_Inclination | |
self.GBox_006_Inclination.setFont(self.fontGlobal_08) | |
self.LA_8a.setFont(self.fontGlobal_08) | |
self.PB_Ra.setFont(self.fontGlobal_08) | |
self.LA_8a_2.setFont(self.fontGlobal_08) | |
self.LE_8xy.setFont(self.fontGlobal_08) | |
self.LA_8xy.setFont(self.fontGlobal_08) | |
self.LE_8xya.setFont(self.fontGlobal_08) | |
self.LA_8yz.setFont(self.fontGlobal_08) | |
self.LE_8yz.setFont(self.fontGlobal_08) | |
self.LE_8yza.setFont(self.fontGlobal_08) | |
self.LA_8zx.setFont(self.fontGlobal_08) | |
self.LE_8zx.setFont(self.fontGlobal_08) | |
self.LE_8zxa.setFont(self.fontGlobal_08) | |
self.PB_Line_Direction.setFont(self.fontGlobal_08) | |
self.PB_Line_ValueAT.setFont(self.fontGlobal_08) | |
self.PB_Line_NormalAT.setFont(self.fontGlobal_08) | |
self.LE_9_Direction.setFont(self.fontGlobal_08) | |
self.LE_10_ValueAt.setFont(self.fontGlobal_08) | |
self.LE_10b_NormalAt.setFont(self.fontGlobal_08) | |
######GBox_007_Surface_and_Volume | |
self.GBox_007_Surface_and_Volume.setFont(self.fontGlobal_08) | |
self.LA_9.setFont(self.fontGlobal_08) | |
self.LE_9a.setFont(self.fontGlobal_08) | |
self.LA_10.setFont(self.fontGlobal_08) | |
self.LE_10a.setFont(self.fontGlobal_08) | |
self.LA_11.setFont(self.fontGlobal_08) | |
self.LE_11a.setFont(self.fontGlobal_08) | |
self.LA_Unit.setFont(self.fontGlobal_08) | |
self.comboBox_Unit.setFont(self.fontGlobal_08) | |
self.LA_Weight.setFont(self.fontGlobal_08) | |
self.LE_12a.setFont(self.fontGlobal_08) | |
self.LA_Density.setFont(self.fontGlobal_08) | |
self.DS_Density.setFont(self.fontGlobal_08) | |
self.LA_Cost.setFont(self.fontGlobal_08) | |
self.LA_Price.setFont(self.fontGlobal_08) | |
self.LE_Cost.setFont(self.fontGlobal_08) | |
self.DS_Price.setFont(self.fontGlobal_08) | |
self.PB_Del_Material.setFont(self.fontGlobal_08) | |
self.CBox_Materiel.setFont(self.fontGlobal_08) | |
self.LE_Materiel.setFont(self.fontGlobal_08) | |
######GBox_009_BoundBox | |
self.GBox_009_BoundBox.setFont(self.fontGlobal_08) | |
self.LA_007_01_Xlength.setFont(self.fontGlobal_08) | |
self.LA_007_02_Ylength.setFont(self.fontGlobal_08) | |
self.LA_007_03_Zlength.setFont(self.fontGlobal_08) | |
self.LA_007_04_Diagonallength.setFont(self.fontGlobal_08) | |
self.LE_007_BB_01_XLength.setFont(self.fontGlobal_08) | |
self.LE_007_BB_02_YLength.setFont(self.fontGlobal_08) | |
self.LE_007_BB_03_ZLength.setFont(self.fontGlobal_08) | |
self.LE_007_BB_04_Diagonal.setFont(self.fontGlobal_08) | |
self.PB_BoundBox_Tracing.setFont(self.fontGlobal_08) | |
self.PB_00_BoundBox_Volume.setFont(self.fontGlobal_08) | |
self.CB_01_BoundBox_Text.setFont(self.fontGlobal_08) | |
self.DS_BoundBoxTextHeigth.setFont(self.fontGlobal_08) | |
######GBox_010_Center_Mass | |
self.GBox_010_Center_Mass.setFont(self.fontGlobal_08) | |
self.PB_BoundBox_Tracing.setFont(self.fontGlobal_08) | |
self.LA_13x.setFont(self.fontGlobal_08) | |
self.LA_13y.setFont(self.fontGlobal_08) | |
self.LA_13z.setFont(self.fontGlobal_08) | |
self.LE_13x.setFont(self.fontGlobal_08) | |
self.LE_13y.setFont(self.fontGlobal_08) | |
self.LE_13z.setFont(self.fontGlobal_08) | |
self.PB_Axis_02.setFont(self.fontGlobal_08) | |
self.LA_14x.setFont(self.fontGlobal_08) | |
self.LA_14y.setFont(self.fontGlobal_08) | |
self.LA_14z.setFont(self.fontGlobal_08) | |
self.LE_14x.setFont(self.fontGlobal_08) | |
self.LE_14y.setFont(self.fontGlobal_08) | |
self.LE_14z.setFont(self.fontGlobal_08) | |
self.PB_Axis_03.setFont(self.fontGlobal_08) | |
######GBox_011_Inertia | |
self.GBox_011_Inertia.setFont(self.fontGlobal_08) | |
self.LE_16_Raw.setFont(self.fontGlobal_08) | |
self.LA_16.setFont(self.fontGlobal_08) | |
self.SB_16_M.setFont(self.fontGlobal_08) | |
self.LA_16x.setFont(self.fontGlobal_08) | |
self.LA_16y.setFont(self.fontGlobal_08) | |
self.LA_16z.setFont(self.fontGlobal_08) | |
self.LE_16_1x.setFont(self.fontGlobal_08) | |
self.LE_16_1y.setFont(self.fontGlobal_08) | |
self.LE_16_1z.setFont(self.fontGlobal_08) | |
self.LE_16_01.setFont(self.fontGlobal_08) | |
self.PB_Axis_04_16_1.setFont(self.fontGlobal_08) | |
self.LE_16_2x.setFont(self.fontGlobal_08) | |
self.LE_16_2y.setFont(self.fontGlobal_08) | |
self.LE_16_2z.setFont(self.fontGlobal_08) | |
self.LE_16_02.setFont(self.fontGlobal_08) | |
self.PB_Axis_05_16_2.setFont(self.fontGlobal_08) | |
self.LE_16_3x.setFont(self.fontGlobal_08) | |
self.LE_16_3y.setFont(self.fontGlobal_08) | |
self.LE_16_3z.setFont(self.fontGlobal_08) | |
self.LE_16_03.setFont(self.fontGlobal_08) | |
self.PB_Axis_06_16_3.setFont(self.fontGlobal_08) | |
self.LE_16_4x.setFont(self.fontGlobal_08) | |
self.LE_16_4y.setFont(self.fontGlobal_08) | |
self.LE_16_4z.setFont(self.fontGlobal_08) | |
self.LE_16_04.setFont(self.fontGlobal_08) | |
self.PB_Axis_07_16_4.setFont(self.fontGlobal_08) | |
self.LA_17.setFont(self.fontGlobal_08) | |
self.SB_17_M.setFont(self.fontGlobal_08) | |
self.LA_17x.setFont(self.fontGlobal_08) | |
self.LA_17y.setFont(self.fontGlobal_08) | |
self.LA_17z.setFont(self.fontGlobal_08) | |
self.LE_17_1x.setFont(self.fontGlobal_08) | |
self.LE_17_1y.setFont(self.fontGlobal_08) | |
self.LE_17_1z.setFont(self.fontGlobal_08) | |
self.PB_Axis_08_17_1.setFont(self.fontGlobal_08) | |
self.LE_17_2x.setFont(self.fontGlobal_08) | |
self.LE_17_2y.setFont(self.fontGlobal_08) | |
self.LE_17_2z.setFont(self.fontGlobal_08) | |
self.PB_Axis_09_17_2.setFont(self.fontGlobal_08) | |
self.LE_17_3x.setFont(self.fontGlobal_08) | |
self.LE_17_3y.setFont(self.fontGlobal_08) | |
self.LE_17_3z.setFont(self.fontGlobal_08) | |
self.PB_Axis_10_17_3.setFont(self.fontGlobal_08) | |
self.PB_Axis_11_17_4.setFont(self.fontGlobal_08) | |
self.LA_determinant.setFont(self.fontGlobal_08) | |
self.LA_determinantDecimal.setFont(self.fontGlobal_08) | |
self.LE_18_determinant.setFont(self.fontGlobal_08) | |
self.LE_18_determinantDecim.setFont(self.fontGlobal_08) | |
######GBox_013_SpreadSheet_Creation | |
self.GBox_013_SpreadSheet_Creation.setFont(self.fontGlobal_08) | |
self.PB_01_Read_SpreadSheet.setFont(self.fontGlobal_08) | |
self.PB_02_Save_SreadSheet.setFont(self.fontGlobal_08) | |
self.PB_03_Create_SpreadSheet.setFont(self.fontGlobal_08) | |
self.RB_01_Tabulation.setFont(self.fontGlobal_08) | |
self.RB_02_Virgule.setFont(self.fontGlobal_08) | |
self.RB_03_Point_Virgule.setFont(self.fontGlobal_08) | |
self.RB_04_Espace.setFont(self.fontGlobal_08) | |
######GBox_014_Main_Tools | |
self.GBox_014_Main_Tools.setFont(self.fontGlobal_08) | |
self.RB_01_ClipBoard.setFont(self.fontGlobal_08) | |
self.CB_02_Point.setFont(self.fontGlobal_08) | |
self.CB_03_Axis.setFont(self.fontGlobal_08) | |
self.CB_04_Plane.setFont(self.fontGlobal_08) | |
self.CB_01_Info.setFont(self.fontGlobal_08) | |
self.CB_05_Position.setFont(self.fontGlobal_08) | |
self.SPBox_arrondi.setFont(self.fontGlobal_08) | |
self.SPBox_arrondi.setFont(self.fontGlobal_08) | |
self.SP_012_01_Text.setFont(self.fontGlobal_08) | |
self.PB_05_Help_Forum.setFont(self.fontGlobal_08) | |
self.PB_06_Help_Wiki.setFont(self.fontGlobal_08) | |
self.PB_01_Refrech.setFont(self.fontGlobal_08) | |
self.PB_04_Quit.setFont(self.fontGlobal_08) | |
def on_SPBox_arrondi_valueChanged(self, value): | |
global ui | |
global seTDecimalValue | |
global FreeCAD_ParamGetSet | |
seTDecimalValue = value | |
FreeCAD_ParamGetSet.SetInt(u"seTDecimalValue", seTDecimalValue) # *4 | |
ui.on_PB_01_Refrech_clicked() | |
def on_PB_Line_Direction(self): | |
global object_Label | |
global directionObj | |
global direcValueAt | |
global direcNormalAt | |
global switchInertia | |
global RotationToEuler | |
global switchCreateLineDiVatNatOnClick | |
global position0 | |
global position1 | |
global position2 | |
if (directionObj != "[]"): | |
switchInertia = 1 | |
try: | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Direction") # memorise les actions (avec annuler restore) | |
if switchCreateLineDiVatNatOnClick == 0: | |
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(directionObj)] | |
else: | |
points=[FreeCAD.Vector(position0,position1,position2),FreeCAD.Vector(directionObj[0]+position0,directionObj[1]+position1,directionObj[2]+position2)] | |
line0 = Draft.makeWire(points,closed=False,face=False,support=None) | |
App.ActiveDocument.ActiveObject.recompute() | |
line0.Label = u"Direction_(Yellow)_" + object_Label | |
line0.ViewObject.LineColor = (1.0,1.0,0.0) | |
line0.Length = 100.0 | |
if RotationToEuler != "": | |
line0.Placement.Rotation = FreeCAD.Rotation(RotationToEuler[0] ,RotationToEuler[1], RotationToEuler[2]) | |
RotationToEuler = "" | |
App.ActiveDocument.recompute() | |
except Exception: | |
None | |
switchInertia = 0 | |
def on_PB_Line_ValueAT(self): | |
global object_Label | |
global direcValueAt | |
global switchInertia | |
global RotationToEuler | |
global switchCreateLineDiVatNatOnClick | |
global position0 | |
global position1 | |
global position2 | |
if (direcValueAt != "[]"): | |
switchInertia = 1 | |
try: | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo ValueAt") # memorise les actions (avec annuler restore) | |
if switchCreateLineDiVatNatOnClick == 0: | |
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(direcValueAt)] | |
else: | |
points=[FreeCAD.Vector(position0,position1,position2),FreeCAD.Vector(direcValueAt[0]+position0,direcValueAt[1]+position1,direcValueAt[2]+position2)] | |
line0 = Draft.makeWire(points,closed=False,face=False,support=None) | |
App.ActiveDocument.ActiveObject.recompute() | |
line0.Label = u"ValueAt_(Magenta)_" + object_Label | |
line0.ViewObject.LineColor = (1.0,0.0,1.0) | |
line0.Length = 100.0 | |
if RotationToEuler != "": | |
line0.Placement.Rotation = FreeCAD.Rotation(RotationToEuler[0] ,RotationToEuler[1], RotationToEuler[2]) | |
RotationToEuler = "" | |
App.activeDocument().recompute() | |
except Exception: | |
None | |
switchInertia = 0 | |
def on_PB_Line_NormalAT(self): | |
global object_Label | |
global direcNormalAt | |
global switchInertia | |
global RotationToEuler | |
global switchCreateLineDiVatNatOnClick | |
global position0 | |
global position1 | |
global position2 | |
if (direcNormalAt != "[]"): | |
switchInertia = 1 | |
try: | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo NormalAt") # memorise les actions (avec annuler restore) | |
if switchCreateLineDiVatNatOnClick == 0: | |
points=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(direcNormalAt)] | |
else: | |
points=[FreeCAD.Vector(position0,position1,position2),FreeCAD.Vector(direcNormalAt[0]+position0,direcNormalAt[1]+position1,direcNormalAt[2]+position2)] | |
line0 = Draft.makeWire(points,closed=False,face=False,support=None) | |
App.ActiveDocument.ActiveObject.recompute() | |
line0.Label = u"NormalAt_(Cyan)_" + object_Label | |
line0.ViewObject.LineColor = (0.0,1.0,1.0) | |
line0.Length = 100.0 | |
if RotationToEuler != "": | |
line0.Placement.Rotation = FreeCAD.Rotation(RotationToEuler[0] ,RotationToEuler[1], RotationToEuler[2]) | |
RotationToEuler = "" | |
App.ActiveDocument.recompute() | |
except Exception: | |
None | |
switchInertia = 0 | |
def paletteBase(self): | |
qpBase = "QLineEdit {background-color: QPalette.Base}" | |
qpIcon = QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_05)) # icone dans une variable | |
self.LE_4x.setStyleSheet(qpBase) | |
self.LE_4y.setStyleSheet(qpBase) | |
self.LE_4z.setStyleSheet(qpBase) | |
self.PB_Axis_01.setIcon(qpIcon) # icon dans une variable | |
self.LE_13x.setStyleSheet(qpBase) | |
self.LE_13y.setStyleSheet(qpBase) | |
self.LE_13z.setStyleSheet(qpBase) | |
self.PB_Axis_02.setIcon(qpIcon) # icon dans une variable | |
self.LE_14x.setStyleSheet(qpBase) | |
self.LE_14y.setStyleSheet(qpBase) | |
self.LE_14z.setStyleSheet(qpBase) | |
self.PB_Axis_03.setIcon(qpIcon) # icon dans une variable | |
self.LE_16_1x.setStyleSheet(qpBase) | |
self.LE_16_1y.setStyleSheet(qpBase) | |
self.LE_16_1z.setStyleSheet(qpBase) | |
self.PB_Axis_04_16_1.setIcon(qpIcon) # icone dans une variable | |
self.LE_16_2x.setStyleSheet(qpBase) | |
self.LE_16_2y.setStyleSheet(qpBase) | |
self.LE_16_2z.setStyleSheet(qpBase) | |
self.PB_Axis_05_16_2.setIcon(qpIcon) # icone dans une variable | |
self.LE_16_3x.setStyleSheet(qpBase) | |
self.LE_16_3y.setStyleSheet(qpBase) | |
self.LE_16_3z.setStyleSheet(qpBase) | |
self.PB_Axis_06_16_3.setIcon(qpIcon) # icone dans une variable | |
self.PB_Axis_07_16_4.setIcon(qpIcon) # icone dans une variable | |
self.LE_17_1x.setStyleSheet(qpBase) | |
self.LE_17_1y.setStyleSheet(qpBase) | |
self.LE_17_1z.setStyleSheet(qpBase) | |
self.PB_Axis_08_17_1.setIcon(qpIcon) # icone dans une variable | |
self.LE_17_2x.setStyleSheet(qpBase) | |
self.LE_17_2y.setStyleSheet(qpBase) | |
self.LE_17_2z.setStyleSheet(qpBase) | |
self.PB_Axis_09_17_2.setIcon(qpIcon) # icone dans une variable | |
self.LE_17_3x.setStyleSheet(qpBase) | |
self.LE_17_3y.setStyleSheet(qpBase) | |
self.LE_17_3z.setStyleSheet(qpBase) | |
self.PB_Axis_10_17_3.setIcon(qpIcon) # icone dans une variable | |
self.PB_Axis_11_17_4.setIcon(qpIcon) # icone dans une variable | |
self.PB_05_Help_Forum.setStyleSheet(qpBase) | |
self.PB_06_Help_Wiki.setStyleSheet(qpBase) | |
def on_GBox_012_SpreadSheet(self): | |
global ui | |
if self.GBox_012_SpreadSheet.isChecked(): | |
self.GBox_012_SpreadSheet.setStyleSheet(u"QGroupBox {color : QPalette.Base;}") # origin system | |
ui.on_PB_01_Refrech_clicked() | |
else: | |
self.GBox_012_SpreadSheet.setStyleSheet(u"QGroupBox {color : #ff0000;}") | |
self.GBox_012_SpreadSheet.setTitle(u"Details of the form") | |
self.GBox_012_SpreadSheet.setToolTip(u"The module is Disabled by default for rapidity") | |
self.tableWidget.clear() | |
def on_PB_Axis_Mouse(self): | |
global position0 | |
global position1 | |
global position2 | |
global ui | |
ui.paletteBase() | |
self.LE_4x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_4y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_4z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_01.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(position0, position1, position2, "Mouse")))) | |
def on_PB_ChangeColor(self): | |
global seTPositionFlyRightLeft | |
global transparenceFace | |
global ui | |
if len(FreeCADGui.Selection.getSelection()) != 0: | |
if seTPositionFlyRightLeft == 1: self.window.hide() # 1=MainWindow separate | |
couleur = PySide2.QtWidgets.QColorDialog.getColor() | |
if couleur.isValid(): | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Color") # memorise les actions (avec annuler restore) | |
r = int(str(couleur.name()[1:3]),16) | |
v = int(str(couleur.name()[3:5]),16) | |
b = int(str(couleur.name()[5:7]),16) | |
t = transparenceFace # transparence de 0 a 100 | |
a = FreeCADGui.Selection.getSelectionEx() # selection sous objet | |
aa = FreeCADGui.Selection.getSelection() # selection objet | |
try: | |
if str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:5] == "Face": | |
if self.CBox_Color_FaceObject.isChecked(): # checked = face if not = object | |
try: | |
cols = colors = [] | |
cols = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.DiffuseColor | |
if len(cols) == 1: | |
for i in aa[0].Shape.Faces: | |
colors += [(cols[0])] | |
else: | |
colors = cols | |
for i in range(len(aa)): | |
fce = int(a[0].SubElementNames[i][4:])-1 | |
colors[fce] = (float(r)/255.0, float(v)/255.0, float(b)/255.0, float(t)/100.0) | |
aa[i].ViewObject.DiffuseColor = colors | |
except Exception: | |
None | |
else: | |
try: | |
aa = FreeCADGui.Selection.getSelection() # selection objet | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.ShapeColor = (float(r)/255.0, float(v)/255.0, float(b)/255.0) | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.Transparency = transparenceFace | |
except Exception: | |
None | |
elif str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:5] == "Edge": | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.LineColor = (float(r)/255.0, float(v)/255.0, float(b)/255.0) | |
elif str(Gui.Selection.getSelectionEx()[0].SubObjects[0])[1:7] == "Vertex": | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.PointColor = (float(r)/255.0, float(v)/255.0, float(b)/255.0) | |
except Exception: | |
aa = FreeCADGui.Selection.getSelection() # selection objet | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.ShapeColor = (float(r)/255.0, float(v)/255.0, float(b)/255.0) | |
try: | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.LineColor = (float(r)/255.0, float(v)/255.0, float(b)/255.0) | |
except Exception: None | |
try: | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.PointColor = (float(r)/255.0, float(v)/255.0, float(b)/255.0) | |
except Exception: None | |
FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.Transparency = transparenceFace | |
#### | |
transparenceFace = FreeCAD.ActiveDocument.getObject(aa[0].Name).ViewObject.Transparency | |
# unsignedEncodeColor decimal pour FC | |
unsignedEncodeColor = '"' + str(unsignedEncode((r), (v), (b), 0.0)) + '"' | |
diffuseColorHexa = '"' + "#" + decimalTohexa(int(r/255.0)) + decimalTohexa(int(v/255.0)) + decimalTohexa(int(b/255.0)) + '"' | |
diffuseColorHexaPy = '"' + "0x" + decimalTohexa(int(r/255.0)) + decimalTohexa(int(v/255.0)) + decimalTohexa(int(b/255.0)) + '"' | |
diffuseColorRVB = '"' + str(int(r/255.0)) + "," + str(int(v/255.0)) + "," + str(int(b/255.0)) + '"' | |
# | |
ui.on_PB_01_Refrech_clicked() | |
#### | |
if seTPositionFlyRightLeft == 1: self.window.show() # 1=MainWindow separate | |
def SIGNAL_CBox_Color_FaceObject(self): | |
if self.CBox_Color_FaceObject.isChecked(): # checked = face if not = object | |
self.PB_ChangeColor.setText(u"Color.S.Obj") | |
self.PB_CreateFace.setText(u"Dupl.S.Obj") | |
self.CBox_Color_FaceObject.setText(u"Object") | |
else: | |
self.PB_ChangeColor.setText(u"Color.Objet") | |
self.PB_CreateFace.setText(u"Dupl.Objet") | |
self.CBox_Color_FaceObject.setText(u"Sub.Objet") | |
def on_PB_CreateFace(self): | |
global sel | |
global indexFaceMesh | |
global coordPointsMesh | |
global detected | |
global cols | |
global colorShapeFace | |
global colorShapeLine | |
global colorShapePoint | |
global setMeshTopologyValue | |
if self.CBox_Color_FaceObject.isChecked(): # repro face / subOject | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Copy Element") # memorise les actions (avec annuler restore) | |
if detected[0:4] == "Mesh": | |
labelObject = sel[0].Label | |
points = [FreeCAD.Vector(coordPointsMesh[0][0], coordPointsMesh[0][1], coordPointsMesh[0][2]), | |
FreeCAD.Vector(coordPointsMesh[1][0], coordPointsMesh[1][1], coordPointsMesh[1][2]), | |
FreeCAD.Vector(coordPointsMesh[2][0], coordPointsMesh[2][1], coordPointsMesh[2][2])] | |
dummy = cols # save cols before changing [] | |
lineTriangle = Draft.makeWire(points, closed=True, face=True, support=None) | |
cols = dummy # restitue the cols deleted | |
actifObjet = App.ActiveDocument.ActiveObject | |
FreeCAD.ActiveDocument.getObject(lineTriangle.Name).Label = "Face_" + str(indexFaceMesh) + "_" + labelObject | |
Gui.Selection.clearSelection(sel[0].Name) | |
elif detected == "<PointKernel object>": | |
Gui.runCommand(u'Std_Copy',0) | |
Gui.runCommand(u'Std_Paste',0) | |
actifObjet = App.ActiveDocument.ActiveObject | |
else: | |
try: | |
try: | |
placementOrigine = sel[0].getGlobalPlacement() | |
except Exception: | |
placementOrigine = sel[0].Placement() | |
Part.show(FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0].copy()) # create repro shape subObject | |
actifObjet = App.ActiveDocument.ActiveObject | |
actifObjet.Placement = placementOrigine | |
except Exception: | |
None | |
else: # repro object | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Copy Object") # memorise les actions (avec annuler restore) | |
if detected[0:4] == u"Mesh": | |
### Begin command Part_ShapeFromMesh | |
_Shape = App.ActiveDocument.addObject('Part::Feature', str(sel[0].Name) + "_Shape") | |
__shape__ = Part.Shape() | |
__shape__.makeShapeFromMesh(App.ActiveDocument.getObject(sel[0].Name).Mesh.Topology, setMeshTopologyValue, False) # 0.10000 | |
App.ActiveDocument.ActiveObject.Shape = __shape__ | |
App.ActiveDocument.ActiveObject.purgeTouched() | |
### End command Part_ShapeFromMesh | |
### Begin command Part_MakeSolid | |
__s__=App.ActiveDocument.getObject(_Shape.Name).Shape.Faces | |
__s__=Part.Solid(Part.Shell(__s__)) | |
__o__=App.ActiveDocument.addObject("Part::Feature",str(sel[0].Name + "_solid")) | |
__o__.Label=sel[0].Name + u"_(Solid)" | |
__o__.Shape=__s__ | |
App.ActiveDocument.removeObject(_Shape.Name) | |
### End command Part_MakeSolid | |
actifObjet = App.ActiveDocument.ActiveObject | |
App.ActiveDocument.getObject(sel[0].Name).Visibility = False | |
elif detected == "<PointKernel object>": | |
Gui.runCommand('Std_Copy',0) | |
Gui.runCommand('Std_Paste',0) | |
actifObjet = App.ActiveDocument.ActiveObject | |
actifObjet.Label = App.ActiveDocument.getObject(sel[0].Name).Label + "_Points" | |
App.ActiveDocument.getObject(sel[0].Name).Visibility = False | |
else: | |
try: | |
placementOrigine = sel[0].getGlobalPlacement() | |
except Exception: | |
placementOrigine = sel[0].Placement() | |
try: | |
Part.show(sel[0].Shape) | |
except Exception: | |
None | |
actifObjet = App.ActiveDocument.ActiveObject | |
actifObjet.Placement = placementOrigine | |
try: | |
actifObjet.ViewObject.ShapeColor = colorShapeFace | |
except Exception: | |
None | |
try: | |
actifObjet.ViewObject.LineColor = colorShapeLine | |
except Exception: | |
None | |
try: | |
actifObjet.ViewObject.PointColor = colorShapePoint | |
except Exception: | |
None | |
try: | |
transPar = math.ceil(round(cols[indexFaceMesh][3]*100, 12)) # face | |
except Exception: | |
try: | |
transPar = math.ceil(round(cols[indexFaceMesh]*100, 12)) # edge | |
except Exception: | |
try: | |
transPar = math.ceil(round(cols[0]*100, 12)) # if indexFaceMesh-1 = -1 | |
except Exception: | |
transPar = 0 | |
try: | |
if self.CBox_Color_FaceObject.isChecked(): | |
actifObjet.ViewObject.Transparency = transPar | |
if (self.SBox_Transparence.value()) != transPar: | |
actifObjet.ViewObject.Transparency = self.SBox_Transparence.value() | |
else: | |
try: | |
actifObjet.ViewObject.DiffuseColor = cols | |
except Exception: None | |
if (self.CBox_Color_FaceObject.isChecked()) or (len(cols) == 1): | |
actifObjet.ViewObject.Transparency = transPar | |
if (self.SBox_Transparence.value()) != transPar: | |
actifObjet.ViewObject.Transparency = self.SBox_Transparence.value() | |
except Exception: | |
None | |
App.activeDocument().recompute(None,True,True) | |
def on_SBox_Transparence_valueChanged(self, value): | |
global transparenceFace | |
transparenceFace = value | |
def on_SB_16_M_valueChanged(self, value): | |
global FreeCAD_ParamGetSet | |
global setMomentOfInertia_16 | |
setMomentOfInertia_16 = value | |
FreeCAD_ParamGetSet.SetInt(u"setMomentOfInertia_16", setMomentOfInertia_16) | |
self.on_PB_01_Refrech_clicked() | |
def on_SB_17_M_valueChanged(self, value): | |
global FreeCAD_ParamGetSet | |
global setMomentOfInertiaMassique_17 | |
setMomentOfInertiaMassique_17 = value | |
FreeCAD_ParamGetSet.SetInt(u"setMomentOfInertiaMassique_17", setMomentOfInertiaMassique_17) | |
self.on_PB_01_Refrech_clicked() | |
def on_PB_Axis_Center_Shape(self): | |
global boundBoxCenterX | |
global boundBoxCenterY | |
global boundBoxCenterZ | |
global ui | |
ui.paletteBase() | |
self.LE_13x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_13y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_13z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_02.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(boundBoxCenterX, boundBoxCenterY, boundBoxCenterZ, "BBCenter")))) # icone dans une variable | |
def on_PB_Axis_Center_Mass(self): | |
global CenterOfMassX | |
global CenterOfMassY | |
global CenterOfMassZ | |
global ui | |
ui.paletteBase() | |
self.LE_14x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_14y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_14z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_03.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(CenterOfMassX, CenterOfMassY, CenterOfMassZ, "CenterOfMass")))) # icone dans une variable | |
def on_PB_Axis_04_16_1(self): | |
global MatrixX1_16 | |
global MatrixY1_16 | |
global MatrixZ1_16 | |
global ui | |
ui.paletteBase() | |
self.LE_16_1x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_16_1y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_16_1z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_04_16_1.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX1_16, MatrixY1_16, MatrixZ1_16, "Matrix1")))) # icone dans une variable | |
def on_PB_Axis_05_16_2(self): | |
global MatrixX2_16 | |
global MatrixY2_16 | |
global MatrixZ2_16 | |
global ui | |
ui.paletteBase() | |
self.LE_16_2x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_16_2y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_16_2z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_05_16_2.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX2_16, MatrixY2_16, MatrixZ2_16, "Matrix2")))) # icone dans une variable | |
def on_PB_Axis_06_16_3(self): | |
global MatrixX3_16 | |
global MatrixY3_16 | |
global MatrixZ3_16 | |
global ui | |
ui.paletteBase() | |
self.LE_16_3x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_16_3y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_16_3z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_06_16_3.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX3_16, MatrixY3_16, MatrixZ3_16, "Matrix3")))) # icone dans une variable | |
def on_PB_Axis_07_16_4(self): | |
global MatrixX1_16 | |
global MatrixY2_16 | |
global MatrixZ3_16 | |
global ui | |
ui.paletteBase() | |
self.LE_16_1x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_16_2y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_16_3z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_07_16_4.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX1_16, MatrixY2_16, MatrixZ3_16, "Matrix123")))) # icone dans une variable | |
def on_PB_Axis_08_17_1(self): | |
global MatrixX1_17 | |
global MatrixY1_17 | |
global MatrixZ1_17 | |
global ui | |
ui.paletteBase() | |
self.LE_17_1x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_17_1y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_17_1z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_08_17_1.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX1_17, MatrixY1_17, MatrixZ1_17, "MatrixW1")))) # icone dans une variable | |
def on_PB_Axis_09_17_2(self): | |
global MatrixX2_17 | |
global MatrixY2_17 | |
global MatrixZ2_17 | |
global ui | |
ui.paletteBase() | |
self.LE_17_2x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_17_2y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_17_2z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_09_17_2.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX2_17, MatrixY2_17, MatrixZ2_17, "MatrixW2")))) # icone dans une variable | |
def on_PB_Axis_10_17_3(self): | |
global MatrixX3_17 | |
global MatrixY3_17 | |
global MatrixZ3_17 | |
global ui | |
ui.paletteBase() | |
self.LE_17_3x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_17_3y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_17_3z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_10_17_3.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX3_17, MatrixY3_17, MatrixZ3_17, "MatrixW3")))) # icone dans une variable | |
def on_PB_Axis_11_17_4(self): | |
global MatrixX1_17 | |
global MatrixY2_17 | |
global MatrixZ3_17 | |
global ui | |
ui.paletteBase() | |
self.LE_17_1x.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.LE_17_2y.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: green}") | |
self.LE_17_3z.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") | |
self.PB_Axis_11_17_4.setIcon(QtGui.QIcon(QtGui.QPixmap(axisPlane(MatrixX1_17, MatrixY2_17, MatrixZ3_17, "MatrixW123")))) # icone dans une variable | |
def on_PB_BoundBox_Tracing(self): | |
bounBoxTracing() | |
def On_PB_00_BoundBox_Volume(self): | |
global switchBoundBoxCreateVolume | |
switchBoundBoxCreateVolume = 1 | |
bounBoxTracing() | |
def On_CB_01_BoundBox_Text(self): | |
global switchBoundBoxCreateText | |
global FreeCAD_ParamGetSet | |
if self.CB_01_BoundBox_Text.isChecked(): | |
switchBoundBoxCreateText = 1 | |
self.DS_BoundBoxTextHeigth.setEnabled(True) | |
FreeCAD_ParamGetSet.SetBool(u"switchBoundBoxCreateText", True) # True or False | |
else: | |
switchBoundBoxCreateText = 0 | |
self.DS_BoundBoxTextHeigth.setEnabled(False) | |
FreeCAD_ParamGetSet.SetBool(u"switchBoundBoxCreateText", False) # True or False | |
def on_DS_BoundBoxTextHeigth_valueChanged(self, value): | |
global seTBoundBoxTextHeigth | |
global FreeCAD_ParamGetSet | |
seTBoundBoxTextHeigth = value | |
FreeCAD_ParamGetSet.SetFloat(u"seTBoundBoxTextHeigth", seTBoundBoxTextHeigth) # 3.0 | |
def SIGNAL_comboPoids_Changed(self,text): | |
global volume_ | |
global seTDensiteValue | |
global poids | |
global uniteM | |
global uniteS | |
global uniteSs | |
global uniteV | |
global uniteP | |
global unitePs | |
global massOrGravity | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
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 seTMaterialPrice | |
global seTMaterialCost | |
global seTMaterialSuffixCost | |
global seTIndexUnitWeight | |
global seTUnitSymbolMicro | |
if text == u"tonne": #t #0.00001 = 1000000 | |
uniteP = 0.000001 | |
unitePs= u"t" | |
elif text == u"quintal": #q #0.00001 = 100000 | |
uniteP = 0.00001 | |
unitePs= u"q" | |
elif text == u"kilo gram": #kg # 0.001 = 1000 | |
uniteP = 0.001 | |
unitePs= u"kg" | |
elif text == u"hecto gram": #hg # 0.01 = 100 | |
uniteP = 0.01 | |
unitePs= u"hg" | |
elif text == u"decagram": #dag # 0.1 = 10 | |
uniteP = 0.1 | |
unitePs= u"dag" | |
elif text == u"gram": #g # = 1 Base | |
uniteP = 1.00 | |
unitePs= u"g" | |
elif text == u"decigram": #dg # = 0.1 | |
uniteP = 10.0 | |
unitePs= u"dg" | |
elif text == u"centigram": #cg # = 0.01 | |
uniteP = 100.0 | |
unitePs= u"cg" | |
elif text == u"milligram": #mg # = 0.001 | |
uniteP = 1000.0 | |
unitePs= u"mg" | |
elif text == u"microgram": #Ug # = 0.000001 # micro hex="\xB5", html=<span>µ</span> | |
uniteP = 1000000.0 | |
unitePs= seTUnitSymbolMicro+"g" | |
elif text == u"nanogram": #ng # = 0.000000001 | |
uniteP = 1000000000.0 | |
unitePs= u"ng" | |
elif text == u"picogram": #pg # = 0.000000000001 | |
uniteP = 1000000000000.0 | |
unitePs= u"pg" | |
elif text == u"femtogram": #fg # = 0.000000000000001 | |
uniteP = 1000000000000000.0 | |
unitePs= u"fg" | |
elif text == u"grain": #gr # = 0.06479891 | |
uniteP = 0.06479891 | |
unitePs= u"gr" | |
elif text == u"drachm": #dr # = 1.7718451953125 | |
uniteP = 0.56438339189006794681850148894339 | |
unitePs= u"dr" | |
elif text == u"once": #oz # = 28.3495231250 | |
uniteP = 0.035273961949580412915675808215204 | |
unitePs= u"oz" | |
elif text == u"once troy": #oz t # = once troy = 31.1034768 | |
uniteP = 0.032150746568627980522100346029483 | |
unitePs= u"oz t" | |
elif text == u"livre troy": #lb t # = 373.2417216 livre de troy (pound) | |
uniteP = 0.0026792288807189983768416955024569 | |
unitePs= u"lb t" | |
elif text == u"livre av": #lb # = 453.59237 livre avoirdupois (pound) | |
uniteP = 0.0022046226218487758072297380134503 | |
unitePs= u"lb" | |
elif text == u"stone": #st # = 6350.29318 1 stone = 14 livres | |
uniteP = 0.00015747304441776970051640985810359 | |
unitePs= u"st" | |
elif text == u"quarter": #qtr # = 12700.58636 | |
uniteP = 0.000078736522208884850258204929051795 | |
unitePs= u"qtr" | |
elif text == u"hundredweight":#cwt # = 50802.34544 | |
uniteP = 0.000019684130552221212564551232262949 | |
unitePs= u"cwt" | |
elif text == u"tonneau fr": # # tonneau fr = 0.00000102145045965 | |
uniteP = 0.00000102145045965 | |
unitePs= u"tonneau fr" | |
elif text == u"carat": #ct # = 0.2 | |
uniteP = 5.0 | |
unitePs= u"ct" | |
seTIndexUnitWeight = self.comboBox_Unit.currentIndex() | |
self.LA_14x.setText(massOrGravity + u" X") | |
self.LA_14y.setText(massOrGravity + u" Y") | |
self.LA_14z.setText(massOrGravity + u" Z") | |
try: | |
poids = ((volume_ * seTDensiteValue) * uniteP) / 1000.0 | |
self.LE_12a.setText(str(Around(poids))+ " " +unitePs) | |
seTMaterialCost = ((volume_ * seTDensiteValue * seTMaterialPrice) / 1000000.0) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
except Exception: | |
self.LE_12a.setText(u"") | |
self.LE_Cost.setText(u"-" + seTMaterialSuffixCost) #CostMaterial | |
self.SB_17_M.setPrefix(unitePs + uniteSs + "^") | |
self.SB_17_M.setValue(setMomentOfInertiaMassique_17) | |
try: | |
## MatrixX1_17 = MatrixX1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) ## original without parenthesis and modified 17/03/2024 | |
MatrixX1_17 = (MatrixX1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY1_17 = (MatrixY1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ1_17 = (MatrixZ1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX2_17 = (MatrixX2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY2_17 = (MatrixY2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ2_17 = (MatrixZ2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX3_17 = (MatrixX3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY3_17 = (MatrixY3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ3_17 = (MatrixZ3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*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.displayMatrixMomentOfInertia() | |
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 seTDensiteValue | |
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 massOrGravity | |
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 setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixOfInertiaRaw | |
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 | |
global seTIndexUnitLength | |
global seTUnitSymbolMicro | |
global seTUnitSymbolCube | |
global seTUnitSymbolCarre | |
global BsplineDetect | |
global BsplineNombreDeNoeuds | |
global BsplineRayonApproximatif | |
global BsplineNumberElement | |
global BsplineCutLength | |
global setBSplineToByArcValue | |
global BSplinetoByArcValeurS | |
if text == u"km": # = 1000000 | |
uniteM = 0.000001 | |
uniteMs= u"km" | |
uniteS = 0.000000000001 | |
uniteSs= u"km"+seTUnitSymbolCarre | |
uniteV = 0.000000000000000001 | |
uniteVs= u"km"+seTUnitSymbolCube | |
elif text == u"hm": # = 100000 | |
uniteM = 0.00001 | |
uniteMs= u"hm" | |
uniteS = 0.0000000001 | |
uniteSs= u"hm"+seTUnitSymbolCarre | |
uniteV = 0.000000000000001 | |
uniteVs= u"hm"+seTUnitSymbolCube | |
elif text == u"dam": # = 10000 | |
uniteM = 0.0001 | |
uniteMs= u"dam" | |
uniteS = 0.00000001 | |
uniteSs= u"dam"+seTUnitSymbolCarre | |
uniteV = 0.000000000001 | |
uniteVs= u"dam"+seTUnitSymbolCube | |
elif text == u"m": # = 1000 | |
uniteM = 0.001 | |
uniteMs= u"m" | |
uniteS = 0.000001 | |
uniteSs= u"m"+seTUnitSymbolCarre | |
uniteV = 0.000000001 | |
uniteVs= u"m"+seTUnitSymbolCube | |
elif text == u"dm": # = 100 | |
uniteM = 0.01 | |
uniteMs= u"dm" | |
uniteS = 0.0001 | |
uniteSs= u"dm"+seTUnitSymbolCarre | |
uniteV = 0.000001 | |
uniteVs= u"dm"+seTUnitSymbolCube | |
elif text == u"cm": # = 10 | |
uniteM = 0.1 | |
uniteMs= u"cm" | |
uniteS = 0.01 | |
uniteSs= u"cm"+seTUnitSymbolCarre | |
uniteV = 0.001 | |
uniteVs= u"cm"+seTUnitSymbolCube | |
elif text == u"mm": # = 1 ############################### | |
uniteM = 1.0 | |
uniteMs= u"mm" | |
uniteS = 1.0 | |
uniteSs= u"mm"+seTUnitSymbolCarre | |
uniteV = 1.0 | |
uniteVs= u"mm"+seTUnitSymbolCube | |
elif text == seTUnitSymbolMicro+"m": # = 1000 #http://fr.wiktionary.org/wiki/%CE%BCm#conv | |
uniteM = 1000.0 | |
uniteMs= seTUnitSymbolMicro+"m" | |
uniteS = 1000.0**2 | |
uniteSs= seTUnitSymbolMicro+"m"+seTUnitSymbolCarre | |
uniteV = 1000.0**3 | |
uniteVs= seTUnitSymbolMicro+"m"+seTUnitSymbolCube | |
elif text == u"nm": # = 1000000 | |
uniteM = 1000000.0 | |
uniteMs= u"nm" | |
uniteS = 1000000.0**2 | |
uniteSs= u"nm"+seTUnitSymbolCarre | |
uniteV = 1000000.0**3 | |
uniteVs= u"nm"+seTUnitSymbolCube | |
elif text == u"pm": # = 1000000000 | |
uniteM = 1000000000.0 | |
uniteMs= u"pm" | |
uniteS = 1000000000.0**2 | |
uniteSs= u"pm"+seTUnitSymbolCarre | |
uniteV = 1000000000.0**3 | |
uniteVs= u"pm"+seTUnitSymbolCube | |
elif text == u"fm": # = 1000000000000 | |
uniteM = 1000000000000.0 | |
uniteMs= u"fm" | |
uniteS = 1000000000000.0**2 | |
uniteSs= u"fm"+seTUnitSymbolCarre | |
uniteV = 1000000000000.0**3 | |
uniteVs= u"fm"+seTUnitSymbolCube | |
elif text == u"inch": # inch = 25.400 | |
uniteM = 1.0/25.400 | |
uniteMs= u"in" | |
uniteS = uniteM**2 | |
uniteSs= u"in"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"in"+seTUnitSymbolCube | |
elif text == u"link": # link = 201.168 | |
uniteM = 1.0/201.168 | |
uniteMs= u"lk" | |
uniteS = uniteM**2 | |
uniteSs= u"lk"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"lk"+seTUnitSymbolCube | |
elif text == u"foot": # foot = 304.800 | |
uniteM = 1.0/304.800 | |
uniteMs= u"ft" | |
uniteS = uniteM**2 | |
uniteSs= u"ft"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"ft"+seTUnitSymbolCube | |
elif text == u"yard": # yard = 914.400 | |
uniteM = 1.0/914.400 | |
uniteMs= u"yd" | |
uniteS = uniteM**2 | |
uniteSs= u"yd"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"yd"+seTUnitSymbolCube | |
elif text == u"perch": #rd # rod perche = 5029.200 | |
uniteM = 1.0/5029.200 | |
uniteMs= u"rd" | |
uniteS = uniteM**2 | |
uniteSs= u"rd"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"rd"+seTUnitSymbolCube | |
elif text == u"chain": # chain = 20116.800 | |
uniteM = 1.0/20116.800 | |
uniteMs= u"ch" | |
uniteS = uniteM**2 | |
uniteSs= u"ch"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"ch"+seTUnitSymbolCube | |
elif text == u"furlong": # furlong= 201168 | |
uniteM = 1.0/201168 | |
uniteMs= u"fur" | |
uniteS = uniteM**2 | |
uniteSs= u"fur"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"fur"+seTUnitSymbolCube | |
elif text == u"mile": # mile = 1609344 | |
uniteM = 1.0/1609344 | |
uniteMs= u"mi" | |
uniteS = uniteM**2 | |
uniteSs= u"mi"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"mi"+seTUnitSymbolCube | |
elif text == u"league": # league = 4828032 | |
uniteM = 1.0/4828032 | |
uniteMs= u"lea" | |
uniteS = uniteM**2 | |
uniteSs= u"lea"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"lea"+seTUnitSymbolCube | |
elif text == u"nautique": # nautique = 1852000 | |
uniteM = 1.0/1852000 | |
uniteMs= u"nmi" | |
uniteS = uniteM**2 | |
uniteSs= u"nmi"+seTUnitSymbolCarre | |
uniteV = uniteM**3 | |
uniteVs= u"nmi"+seTUnitSymbolCube | |
seTIndexUnitLength = self.comboBox.currentIndex() | |
self.LA_14x.setText(massOrGravity + u" X") | |
self.LA_14y.setText(massOrGravity + u" Y") | |
self.LA_14z.setText(massOrGravity + u" Z") | |
try: | |
self.LE_4x.setText(str(Around(position0 * uniteM)) + " " + uniteMs) | |
self.LE_4y.setText(str(Around(position1 * uniteM)) + " " + uniteMs) | |
self.LE_4z.setText(str(Around(position2 * uniteM)) + " " + uniteMs) | |
except Exception: | |
position0 = position1 = position2 = 0.0 | |
self.LE_4x.setText(str(position0) + " " + uniteMs) | |
self.LE_4y.setText(str(position1) + " " + uniteMs) | |
self.LE_4z.setText(str(position2) + " " + uniteMs) | |
try: | |
self.LE_13x.setText(str(Around(boundBoxCenterX * uniteM)) + " " + uniteMs) | |
self.LE_13y.setText(str(Around(boundBoxCenterY * uniteM)) + " " + uniteMs) | |
self.LE_13z.setText(str(Around(boundBoxCenterZ * uniteM)) + " " + uniteMs) | |
except Exception: | |
boundBoxCenterX = boundBoxCenterY = boundBoxCenterZ = 0.0 | |
self.LE_13x.setText(str(boundBoxCenterX) + " " + uniteMs) | |
self.LE_13y.setText(str(boundBoxCenterY) + " " + uniteMs) | |
self.LE_13z.setText(str(boundBoxCenterZ) + " " + uniteMs) | |
try: | |
self.LE_14x.setText(str(Around(CenterOfMassX * uniteM)) + " " + uniteMs) | |
self.LE_14y.setText(str(Around(CenterOfMassY * uniteM)) + " " + uniteMs) | |
self.LE_14z.setText(str(Around(CenterOfMassZ * uniteM)) + " " + uniteMs) | |
except Exception: | |
CenterOfMassX = CenterOfMassY = CenterOfMassZ = 0.0 | |
self.LE_14x.setText(str(CenterOfMassX) + " " + uniteMs) | |
self.LE_14y.setText(str(CenterOfMassY) + " " + uniteMs) | |
self.LE_14z.setText(str(CenterOfMassZ) + " " + uniteMs) | |
try: | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
except Exception: | |
boundBoxLX = boundBoxLY = boundBoxLZ = 0.0 | |
self.LE_007_BB_01_XLength.setText(str(boundBoxLX) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(boundBoxLY) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(boundBoxLZ) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(boundBoxDiag) + " " + uniteMs) | |
try: | |
self.LE_5.setText(str(Around(float(longueurObjet) * float(uniteM)))+ " " +uniteMs) | |
except Exception: | |
self.LE_5.setText(u"") | |
if (rayonObjet != 0.0) or (str(BsplineDetect) == "<BSplineCurve object>"): | |
self.LE_5b.setVisible(True) | |
self.LA_5b.setVisible(True) | |
if (str(BsplineDetect) == "<BSplineCurve object>"): | |
self.SB_Arc_ToByArcs.setVisible(True) | |
ui.on_SB_Arc_ToByArcs_valueChanged(1) | |
self.SB_Arc_ToByArcs.setToolTip(u"Bspline detected " + "\n" | |
u"Number of element = " + str(BsplineNumberElement) + "\n" + | |
u"Calcul with distance between points " + str(Around((BsplineCutLength) * uniteM)) + " " + uniteMs + "\n\n" + | |
u"toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n" | |
u"This value can be modified in the preferences variable : setBSplineToByArcValue" + "\n") | |
self.PB_BSplineCreateNodes.setText(u"Points (" + str(len(BsplinePointsCoor)) + ")") # Node | |
self.PB_BSplineCreateNodes.setToolTip(u"Create on point on Poles (" + str(len(BsplinePointsCoor)) + ") of the BSpline" + "\n\n" | |
u"Command for Shape : Gui.Selection.getSelection()[0].Points" + "\n" | |
u"Command for SubObj : Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.getPoles()" + "\n\n" | |
u"Hidden Options : " + "\n\n" | |
u"The variables " + "\n\n" | |
u"switchBSplineCreateCircleConstructorAxis" + "\n" | |
u"switchBSplineCreateCircleConstructor" + "\n\n" | |
u"accessible in : User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__ + "\n" | |
u"allow to create the circles and the point axes construction of the BSpline" + "\n" | |
u"their number (precision) depends on the value toBiArcs(BSplinetoByArcValeurS)" + "\n" | |
u"actual toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n") | |
self.PB_BSplineCreateNodes.setVisible(True) | |
self.LA_5b.setText(u"Radius Appr.") | |
try: | |
BsplineRayonApproximatif = str(Around(BsplineArcsRadius[0] * float(uniteM))) + " " + uniteMs # calcul | |
except Exception: | |
BsplineRayonApproximatif = u"" | |
self.LE_5b.setText(BsplineRayonApproximatif) | |
self.LE_5b.setToolTip(u"BSpline Radius on point : " + self.SB_Arc_ToByArcs.text()) | |
self.LA_6.setText(u"BSpline nodes") | |
self.LE_6.setText(str(BsplineNombreDeNoeuds)) | |
self.LE_6.setToolTip(u"Number of nodes of the BSpline.") | |
else: | |
self.SB_Arc_ToByArcs.setVisible(False) | |
self.PB_BSplineCreateNodes.setVisible(False) | |
self.LA_5b.setText(u"Radius") | |
#self.LE_5b.setText(str(Around(rayonObjet * float(uniteM))) + " " + uniteMs) | |
self.LE_5b.setText(str(Around(rayonObjet * float(uniteM))) + " " + uniteMs + (" (dia. " + str(Around(rayonObjet * float(uniteM) * 2.0)) + " " + uniteMs + ")")) | |
self.LE_5b.setToolTip(u"Radius detected.") | |
if numberEdges == 1: | |
self.LA_6.setText(u"Circonference (" + str(numberEdges) + ")") | |
else: | |
self.LA_6.setText(u"Perimetre of shape (" + str(numberEdges) + ")") | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
else: | |
self.LA_6.setText(u"Perimetre of shape (" + str(numberEdges) + ")") | |
self.SB_Arc_ToByArcs.setVisible(False) | |
self.PB_BSplineCreateNodes.setVisible(False) | |
self.LE_5b.setVisible(False) | |
self.LA_5b.setVisible(False) | |
rayonObjet = 0.0 | |
try: | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
except Exception: | |
perimetre = 0.0 | |
self.LE_6.setText(str(Around(perimetre))) | |
self.LE_6.setToolTip(u"Perimeter total of the form." + "\n" | |
u"Display the total result of the edges") | |
try: | |
self.LE_9a.setText(str(Around(float(surface) * float(uniteS))) + " " + uniteSs) | |
except Exception: | |
self.LE_9a.setText(u"") | |
try: | |
self.LE_10a.setText(str(Around(float(surfaceFace) * float(uniteS))) + " " + uniteSs) | |
except Exception: | |
self.LE_10a.setText(u"") | |
try: | |
self.LE_11a.setText(str(Around(float(volume_) * float(uniteV))) + " " + uniteVs) | |
except Exception: | |
self.LE_11a.setText(u"") | |
self.SB_16_M.setPrefix(uniteMs + "^") | |
self.SB_16_M.setValue(setMomentOfInertia_16) | |
self.LE_16_Raw.setText("Raw : " + MatrixOfInertiaRaw) | |
self.LE_16_Raw.setCursorPosition(0) | |
try: | |
## MatrixX1_16 = MatrixX1*uniteM**setMomentOfInertia_16 ## original without parenthesis and modified 17/03/2024 | |
MatrixX1_16 = (MatrixX1*uniteM)**setMomentOfInertia_16 | |
MatrixY1_16 = (MatrixY1*uniteM)**setMomentOfInertia_16 | |
MatrixZ1_16 = (MatrixZ1*uniteM)**setMomentOfInertia_16 | |
MatrixX2_16 = (MatrixX2*uniteM)**setMomentOfInertia_16 | |
MatrixY2_16 = (MatrixY2*uniteM)**setMomentOfInertia_16 | |
MatrixZ2_16 = (MatrixZ2*uniteM)**setMomentOfInertia_16 | |
MatrixX3_16 = (MatrixX3*uniteM)**setMomentOfInertia_16 | |
MatrixY3_16 = (MatrixY3*uniteM)**setMomentOfInertia_16 | |
MatrixZ3_16 = (MatrixZ3*uniteM)**setMomentOfInertia_16 | |
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.SB_16_M.setText(u"") | |
try: | |
## MatrixX1_17 = MatrixX1*uniteM**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) ## original without parenthesis and modified 17/03/2024 | |
MatrixX1_17 = (MatrixX1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY1_17 = (MatrixY1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ1_17 = (MatrixZ1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX2_17 = (MatrixX2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY2_17 = (MatrixY2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ2_17 = (MatrixZ2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX3_17 = (MatrixX3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY3_17 = (MatrixY3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ3_17 = (MatrixZ3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*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.displayMatrixMomentOfInertia() | |
try: | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
boundBox_S = (u"[X: " + str(Around(boundBoxLX * uniteM)) + " " + uniteMs + | |
u"] x [Y: " + str(Around(boundBoxLY * uniteM)) + " " + uniteMs + | |
u"] x [Z: " + str(Around(boundBoxLZ * uniteM)) + " " + uniteMs + | |
u"] Diagonal: " + str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
except Exception: | |
self.LE_007_BB_01_XLength.setText(u"") | |
self.LE_007_BB_02_YLength.setText(u"") | |
self.LE_007_BB_03_ZLength.setText(u"") | |
self.LE_007_BB_04_Diagonal.setText(u"") | |
boundBox_S = "" | |
if self.GBox_012_SpreadSheet.isChecked(): | |
co = 0 | |
li = 0 | |
for li in range(RowCount): # Zero | |
for co in range(10): | |
newitem = QtWidgets.QTableWidgetItem(u"") | |
self.tableWidget.setItem( li,co, newitem) | |
co = 0 | |
li = 0 | |
aa = 0 | |
for j in enumerate(Edges): # Edges | |
newitem = QtWidgets.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtWidgets.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 = QtWidgets.QTableWidgetItem(str(Vertx[a])) | |
chaine = str(Vertx[a]).split(u":") | |
newitem = QtWidgets.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 = QtWidgets.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtWidgets.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 = QtWidgets.QTableWidgetItem(FacesCoor[jj]) | |
chaine = str(FacesCoor[jj]).split(":") | |
newitem = QtWidgets.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 | |
def on_SB_Arc_ToByArcs_valueChanged(self, val): | |
global uniteM | |
global uniteMs | |
global BsplineArcsRadius | |
global BsplineRayonApproximatif | |
global BsplineNumberElement | |
if (val >=1) and (val <= BsplineNumberElement): | |
self.SB_Arc_ToByArcs.setSuffix(u" / " + str(BsplineNumberElement)) | |
self.SB_Arc_ToByArcs.setPrefix(u"arc ") | |
try: | |
BsplineRayonApproximatif = str(Around(BsplineArcsRadius[val - 1] * float(uniteM))) + " " + uniteMs | |
except Exception: | |
BsplineRayonApproximatif = str(Around(0 * float(uniteM))) + " " + uniteMs | |
self.LE_5b.setText(BsplineRayonApproximatif) | |
else: | |
self.SB_Arc_ToByArcs.setValue(0) | |
def on_PB_BSplineCreateNodes(self): | |
global subElemName | |
global BsplinePointsCoor | |
global switchInertia | |
global switchBSplineCreateCircleConstructorAxis | |
global switchBSplineCreateCircleConstructor | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Points BS") # memorise les actions (avec annuler restore) | |
switchInertia = 1 # for create points without refresh | |
self.PB_BSplineCreateNodes.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Work))) # icone dans une variable | |
try: # create point on node | |
conteneurBSpline = App.activeDocument().addObject(u"App::DocumentObjectGroup", "BSpline_Points(" + str(len(BsplinePointsCoor)) + ")") | |
for i in BsplinePointsCoor: | |
point = Draft.makePoint( i[0], i[1], i[2]) | |
conteneurBSpline.addObject(point) | |
point.ViewObject.PointColor = (1.0,0.0,0.0) | |
point.Label = u"FCPoint_BSPline_" + subElemName | |
FreeCADGui.updateGui() # updateGui | |
App.ActiveDocument.recompute() | |
except Exception: | |
None | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Axis BS") # memorise les actions (avec annuler restore) | |
if (switchBSplineCreateCircleConstructorAxis == 1) and (len(BsplineArcsLocation) != 0): | |
try: # create point axis toByArcs() | |
conteneurBSplineP = App.activeDocument().addObject(u"App::DocumentObjectGroup", "BSpline_Center(" + str(len(BsplineArcsLocation)) + ")") | |
for i in BsplineArcsLocation: | |
point = Draft.makePoint(i.Location.x, i.Location.y, i.Location.z) | |
point.ViewObject.PointColor = (0.0,1.0,0.0) | |
point.Label = u"FCPoint_BSPline_toByArcs_" + subElemName | |
conteneurBSplineP.addObject(point) | |
App.ActiveDocument.recompute() | |
except Exception: | |
None | |
FreeCAD.ActiveDocument.openTransaction(u"FCInfo Circles BS") # memorise les actions (avec annuler restore) | |
if (switchBSplineCreateCircleConstructor == 1) and (len(BsplineArcsLocation) != 0): | |
try: # create circle toByArcs() | |
conteneurBSplineC = App.activeDocument().addObject(u"App::DocumentObjectGroup", "BSpline_Circles(" + str(len(BsplineArcsLocation)) + ")") | |
pl=FreeCAD.Placement() | |
for i in BsplineArcsLocation: | |
## | |
pl.Base = FreeCAD.Vector(i.Location.x, i.Location.y, i.Location.z) | |
pl.Rotation.Q = i.Circle.Rotation.Q | |
circle = Draft.makeCircle(radius = i.Radius, placement = pl, face = False, support = None) | |
circle.ViewObject.LineColor = (0.0,0.0,1.0) | |
circle.Label = u"FCCircle_BSPline_toByArcs" + subElemName | |
conteneurBSplineC.addObject(circle) | |
App.ActiveDocument.recompute() | |
except Exception: | |
None | |
self.PB_BSplineCreateNodes.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Point))) # icone dans une variable | |
switchInertia = 0 | |
def SIGNAL_CBox_Materiel_Changed(self,text): | |
global seTDensiteValue | |
global seTMaterialCurrentIndex | |
global seTMaterialPrice | |
global materialAssociated | |
global FreeCAD_ParamGetSet | |
self.PB_Del_Material.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_DeleteLineMaterial))) # icone dans une variable | |
self.LE_Materiel.setStyleSheet(u"QLineEdit {background-color: QPalette.Base}") # origin system | |
if text != "": | |
self.LE_Materiel.setText(materialAssociated[self.CBox_Materiel.currentIndex()]) # affiche la chaine pour completion ou info | |
self.PB_Del_Material.setText(u"Delete (" + str(self.CBox_Materiel.currentIndex() + 1) + "/" + str(len(materialAssociated)) + ")") | |
chaineMat = text.rstrip().split(",") | |
seTDensiteValue = float(chaineMat[1]) | |
FreeCAD_ParamGetSet.SetFloat(u"seTDensiteValue", seTDensiteValue) #*1.0 | |
try: | |
seTMaterialPrice = float(chaineMat[2]) | |
except Exception: | |
seTMaterialPrice = 0.0 | |
#self.DS_Density.setProperty(u"value", seTDensiteValue) | |
self.DS_Density.setValue(seTDensiteValue) | |
self.DS_Price.setValue(seTMaterialPrice) | |
seTMaterialCurrentIndex = self.CBox_Materiel.currentIndex() | |
if self.CBox_Materiel.currentIndex() == -1: | |
self.PB_Del_Material.setText(u"Delete (0\0)") | |
self.PB_Del_Material.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Beer))) # icone dans une variable | |
FreeCAD_ParamGetSet.SetInt(u"seTMaterialCurrentIndex", seTMaterialCurrentIndex) #*0 | |
def on_PB_Del_Material_clicked(self): # efface le materiel en cours | |
global materialAssociated | |
index = self.CBox_Materiel.currentIndex() | |
if self.CBox_Materiel.currentIndex() != -1: | |
try: | |
materialAssociated.remove(materialAssociated[index]) | |
self.CBox_Materiel.clear() | |
for ligneMat in materialAssociated: | |
self.CBox_Materiel.addItem(_fromUtf8(ligneMat)) | |
self.CBox_Materiel.setCurrentIndex(0) | |
self.LE_Materiel.setText(materialAssociated[0]) | |
ui.PB_Save_Material.setText(u"Save (*)") | |
except Exception: | |
self.LE_Materiel.clear() | |
None | |
def on_PB_Save_Material_clicked(self): # sauve le materiel en cours | |
global materialAssociated | |
global seTMaterialSavePathName | |
global seTMaterialFileName | |
global FreeCAD_ParamGetSet | |
#### save the material begin #### | |
materialAssociated.sort() | |
App_Console_PrintMessage(u"Number material : " + str(len(materialAssociated)) + "\n") | |
try: | |
seTMaterialSavePathName = path #+ seTMaterialFileName # u"FCInfo_material.txt" | |
f = open(seTMaterialSavePathName + seTMaterialFileName, 'w') # write | |
for i in materialAssociated: | |
f.write(i + "\n") | |
f.close() | |
self.PB_Save_Material.setText(u"Save") | |
App_Console_PrintMessage(u"Create file : " + seTMaterialFileName + "\n") | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialFileName", seTMaterialFileName) #*"FCInfo_material.txt" | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialSavePathName", seTMaterialSavePathName) #*"C:\...\Macro\ #FCInfo_material.txt" | |
except Exception: | |
App_Console_PrintError(u"Not file " + seTMaterialFileName + " saved" + "\n") | |
#### save the material end #### | |
def on_LE_Materiel_Pressed(self): # LEdit Materiel , tableau des materiaux : [ materiel, poids, prix, info ] | |
global materialAssociated | |
global ui | |
newMateriel = self.LE_Materiel.text() # extract the string in the LE_Materiel | |
self.LE_Materiel.setStyleSheet(u"QLineEdit {background-color: QPalette.Base}") # origin system | |
if (len(newMateriel.split(",")) >= 2): | |
try: | |
if (newMateriel.split(",")[1].isdecimal()) or ((float(newMateriel.split(",")[1])!= 0.0)): # test si alphaNumerique | |
##nomMat = newMateriel.split(",")[0].capitalize() # Metal copper (cu),8.96,10.0 | |
##nomMat = newMateriel.split(",")[0].title() # Metal Copper (Cu),8.96,10.0 | |
##nomMat = newMateriel.split(",")[0].upper() # METAL COPPER (CU),8.96,10.0 | |
nomMat = newMateriel.split(",")[0][0].upper() + newMateriel.split(",")[0][1:] # Metal Copper (Cu),8.96,10.0 | |
try: | |
poidsMat = str(float(newMateriel.split(",")[1])) # teste si float | |
except Exception: | |
poidsMat = "0.0" | |
try: | |
coutMat = str(float(newMateriel.split(",")[2])) # teste si float (facultatif) | |
except Exception: | |
coutMat = "0.0" | |
try: | |
infoMat = newMateriel.split(",")[3] # info (facultatif) | |
except Exception: | |
infoMat = " !" | |
newMateriel = nomMat + "," + poidsMat + "," + coutMat + "," + infoMat | |
self.LE_Materiel.setStyleSheet(u"QLineEdit {color : QPalette.Base}") # origin system | |
index = self.CBox_Materiel.currentIndex() | |
if index == -1: | |
index = 0 | |
try: | |
if nomMat.upper() == materialAssociated[index].split(",")[0].upper(): # remplace (efface)si c'est le meme nom | |
materialAssociated.remove(materialAssociated[index]) | |
except Exception: | |
None | |
#materialAssociated.append(newMateriel.capitalize()) # ajout la nouvelle entree | |
materialAssociated.append(newMateriel) # ajout la nouvelle entree | |
materialAssociated.sort() | |
self.CBox_Materiel.clear() | |
comptIndex = 0 | |
for ligneMat in materialAssociated: | |
self.CBox_Materiel.addItem(_fromUtf8(ligneMat)) | |
#if ligneMat.rstrip().split(",")[0] == newMateriel.capitalize().split(",")[0]: | |
if ligneMat.rstrip().split(",")[0] == newMateriel.split(",")[0][0].upper() + newMateriel.split(",")[0][1:]: | |
index = comptIndex | |
comptIndex += 1 | |
self.CBox_Materiel.setCurrentIndex(index) | |
self.LE_Materiel.clear() | |
ui.PB_Save_Material.setText(u"Save (*)") | |
else: | |
self.LE_Materiel.setStyleSheet(u"QLineEdit {background-color: #efef29}") | |
except Exception: | |
self.LE_Materiel.setStyleSheet(u"QLineEdit {background-color: #ef2929}") | |
else: | |
self.LE_Materiel.setStyleSheet(u"QLineEdit {background-color: #ef2929}") | |
def on_DS_Density_valueChanged(self,densiteSB): # SpinBox # DS_Density_1 poids | |
global ui | |
global volume_ | |
global uniteM | |
global uniteP | |
global unitePs | |
global uniteV # uniteV not in Global ?, add it 05/12/21 | |
global seTDensiteValue | |
global poids | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixX1 | |
global MatrixY1 | |
global MatrixZ1 | |
global MatrixX2 | |
global MatrixY2 | |
global MatrixZ2 | |
global MatrixX3 | |
global MatrixY3 | |
global MatrixZ3 | |
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 seTMaterialPrice | |
global seTMaterialCost | |
global seTMaterialSuffixCost | |
global FreeCAD_ParamGetSet | |
seTDensiteValue = densiteSB | |
FreeCAD_ParamGetSet.SetFloat(u"seTDensiteValue", seTDensiteValue) | |
poids = ((volume_ * seTDensiteValue) * uniteP) / 1000.0 # base FreeCAD = mm | |
self.LE_12a.setText(str(Around(poids)) + " " + unitePs) | |
seTMaterialCost = ((volume_ * seTDensiteValue * seTMaterialPrice) / 1000000.0) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
self.SB_17_M.setPrefix(unitePs + uniteSs + "^") | |
self.SB_17_M.setValue(setMomentOfInertiaMassique_17) | |
try: | |
## MatrixX1_17 = MatrixX1*uniteM**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) ## original without parenthesis and modified 17/03/2024 | |
MatrixX1_17 = (MatrixX1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY1_17 = (MatrixY1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ1_17 = (MatrixZ1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX2_17 = (MatrixX2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY2_17 = (MatrixY2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ2_17 = (MatrixZ2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX3_17 = (MatrixX3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY3_17 = (MatrixY3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ3_17 = (MatrixZ3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*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.displayMatrixMomentOfInertia() | |
def on_DS_Price_valueChanged(self, price): # DSpinBox | |
global volume_ | |
global seTDensiteValue | |
global seTMaterialPrice | |
global seTMaterialCost | |
global seTMaterialSuffixCost | |
seTMaterialPrice = price | |
seTMaterialCost = ((volume_ * seTDensiteValue * seTMaterialPrice) / 1000000.0) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
FreeCAD_ParamGetSet.SetFloat(u"seTMaterialPrice", seTMaterialPrice) # *x | |
FreeCAD_ParamGetSet.SetFloat(u"seTMaterialCost", seTMaterialCost) # *x | |
def on_PB_01_Refrech_clicked(self): # refresh | |
global ui | |
global sel | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global object_Type | |
global subElemName | |
global position0 | |
global position1 | |
global position2 | |
global diffuseColorRF | |
global diffuseColorVF | |
global diffuseColorBF | |
global diffuseColorTF | |
global unsignedEncodeColor | |
global longueurObjet | |
global rayonObjet | |
global perimetre | |
global typeLongueur | |
global numberEdges | |
global nombreArretesMesh | |
global nombreFacesMesh | |
global nombrePointsMesh | |
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 seTDensiteValue | |
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 massOrGravity | |
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 direcNormalAt | |
global typeNormalAt | |
global switchCreateLineDiVatNatOnClick | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixOfInertiaRaw | |
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 | |
global seTMaterialPrice | |
global seTMaterialCost | |
global seTMaterialSuffixCost | |
global seTIndexUnitLength | |
global BsplineDetect | |
global BsplineNombreDeNoeuds | |
global BsplinePointsCoor | |
global BsplineRayonApproximatif | |
global BsplineNumberElement | |
global BsplineCutLength | |
global setBSplineToByArcValue | |
global BSplinetoByArcValeurS | |
global BsplineArcsRadius | |
global FreeCAD_ParamGetSet | |
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_012_SpreadSheet.isChecked(): | |
affect(1) | |
else: | |
affect(0) | |
self.GBox_012_SpreadSheet.setTitle(u"Details of the form") | |
self.LE_1.setText(document_) | |
self.LE_2.setText(object_Label) | |
self.LE_2a.setText(object_Name) | |
self.LE_3.setText(str(subElemName)) | |
self.LE_3a.setText(str(typeObject)) | |
self.LE_4.setText(str(object_Type)) | |
self.LA_14x.setText(massOrGravity + u" X") | |
self.LA_14y.setText(massOrGravity + u" Y") | |
self.LA_14z.setText(massOrGravity + u" Z") | |
self.LE_4x.setText(str(Around(position0 * uniteM)) + " " + uniteMs) | |
self.LE_4y.setText(str(Around(position1 * uniteM)) + " " + uniteMs) | |
self.LE_4z.setText(str(Around(position2 * uniteM)) + " " + uniteMs) | |
self.LE_N_Edges.setText(str(nombreArretesMesh)) | |
self.LE_N_Facets.setText(str(nombreFacesMesh)) | |
self.LE_N_Points.setText(str(nombrePointsMesh)) | |
self.LE_CRed.setText(str(Around(diffuseColorRF))) | |
self.LE_CRed.setToolTip(u"Red color at clicked point (format FreeCAD)") | |
self.LE_CRed.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb("+str(int(diffuseColorRF*255.0))+", 0, 0)}") # white and red | |
self.LE_CGreen.setText(str(Around(diffuseColorVF))) | |
self.LE_CGreen.setToolTip(u"Green color at the clicked point (format FreeCAD)") | |
self.LE_CGreen.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb(0, "+str(int(diffuseColorVF*255.0))+", 0)}") # white and green | |
self.LE_CBlue.setText(str(Around(diffuseColorBF))) | |
self.LE_CBlue.setToolTip(u"Blue color at the clicked point (format FreeCAD)") | |
self.LE_CBlue.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb(0, 0, "+str(int(diffuseColorBF*255.0))+")}") # white and blue | |
self.LE_Transparent.setText(str(Around(diffuseColorTF))) | |
self.LE_Transparent.setToolTip(u"Transparency at the clicked point") | |
self.LE_ConversionUnsigned.setText(str(unsignedEncodeColor)) | |
self.LE_ConversionUnsigned.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: rgb("+str(int(diffuseColorRF*255.0))+","+str(int(diffuseColorVF*255.0))+","+str(int(diffuseColorBF*255.0))+")}") # white | |
switchCreateLineDiVatNatOnClick = FreeCAD_ParamGetSet.GetBool(u"switchCreateLineDiVatNatOnClick") | |
if switchCreateLineDiVatNatOnClick == 0: | |
self.PB_Line_Direction.setText(u"Direction") | |
self.PB_Line_ValueAT.setText(u"ValueAt(0)") | |
self.PB_Line_NormalAT.setText(typeNormalAt) | |
else: | |
self.PB_Line_Direction.setText(u"*Direction") | |
self.PB_Line_ValueAT.setText(u"*ValueAt(0)") | |
self.PB_Line_NormalAT.setText(typeNormalAt) | |
self.LE_9_Direction.setText(str(directionObj)) | |
self.LE_10_ValueAt.setText(str(direcValueAt)) | |
self.LE_10b_NormalAt.setText(str(direcNormalAt)) | |
self.PB_Line_NormalAT.setText(typeNormalAt) | |
self.SBox_Transparence.setValue(transparenceFace) | |
try: | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
boundBox_S = "[X: "+str(Around(boundBoxLX * uniteM)) + " " + uniteMs+"] x [Y: "+str(Around(boundBoxLY * uniteM)) + " " + uniteMs+"] x [Z: "+str(Around(boundBoxLZ * uniteM)) + " " + uniteMs+"] Diagonal: " + str(Around(boundBoxDiag * uniteM)) + " " + uniteMs | |
except Exception: | |
self.LE_007_BB_01_XLength.setText(u"") | |
self.LE_007_BB_02_YLength.setText(u"") | |
self.LE_007_BB_03_ZLength.setText(u"") | |
self.LE_007_BB_04_Diagonal.setText(u"") | |
boundBox_S = u"" | |
self.LA_5.setText(typeLongueur) | |
try: | |
self.LE_5.setText(str(Around(float(longueurObjet) * float(uniteM)))+ " " +uniteMs) | |
except Exception: | |
self.LE_5.setText(u"") | |
# Circle Bspline | |
if (rayonObjet != 0.0) or (str(BsplineDetect) == "<BSplineCurve object>"): | |
self.LE_5b.setVisible(True) | |
self.LA_5b.setVisible(True) | |
if str(BsplineDetect) == "<BSplineCurve object>": | |
# BsplineArcsRadius = [] | |
ui.on_SB_Arc_ToByArcs_valueChanged(1) | |
self.SB_Arc_ToByArcs.setVisible(True) | |
self.SB_Arc_ToByArcs.setToolTip(u"Bspline detected " + "\n" | |
u"Number of element = " + str(BsplineNumberElement) + "\n" + | |
u"Calcul with difference between points " + str(Around(BsplineCutLength * uniteM)) + " " + uniteMs + "\n\n" + | |
u"toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n" | |
u"This value can be changed in the variable preferences : setBSplineToByArcValue" + "\n") | |
self.PB_BSplineCreateNodes.setText(u"Points(" + str(len(BsplinePointsCoor)) + ")") # Node | |
self.PB_BSplineCreateNodes.setToolTip(u"Create on point on Poles (" + str(len(BsplinePointsCoor)) + ") of the BSpline" + "\n\n" | |
u"Command for Shape : Gui.Selection.getSelection()[0].Points" + "\n" | |
u"Command for SubObj : Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.getPoles()" + "\n\n" | |
u"Hidden Options : " + "\n\n" | |
u"The variables " + "\n\n" | |
u"switchBSplineCreateCircleConstructorAxis" + "\n" | |
u"switchBSplineCreateCircleConstructor" + "\n\n" | |
u"accessible in : User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__ + "\n" | |
u"allow to create the circles and the point axes construction of the BSpline" + "\n" | |
u"their number (precision) depends on the value toBiArcs(BSplinetoByArcValeurS)" + "\n" | |
u"actual toBiArcs(" + BSplinetoByArcValeurS + ")" + "\n") | |
self.PB_BSplineCreateNodes.setVisible(True) | |
self.LA_5b.setText(u"Radius Appr.") | |
self.LE_5b.setText(BsplineRayonApproximatif) | |
self.LE_5b.setToolTip(u"BSpline Radius on point : ")# + self.SB_Arc_ToByArcs.text() | |
self.LA_6.setText(u"BSpline Nodes") | |
self.LE_6.setText(str(BsplineNombreDeNoeuds)) | |
self.LE_6.setToolTip(u"Number of nodes of the BSpline.") | |
else: | |
self.SB_Arc_ToByArcs.setVisible(False) | |
self.PB_BSplineCreateNodes.setVisible(False) | |
self.LA_5b.setText(u"Radius") | |
#self.LE_5b.setText(str(Around(rayonObjet * float(uniteM))) + " " + uniteMs) | |
self.LE_5b.setText(str(Around(rayonObjet * float(uniteM))) + " " + uniteMs + (u" (dia. " + str(Around(rayonObjet * float(uniteM) * 2.0)) + " " + uniteMs + ")")) | |
self.LE_5b.setToolTip(u"Radius detected.") | |
if numberEdges == 1: | |
self.LA_6.setText(u"Circumference (" + str(numberEdges) + ")") | |
else: | |
self.LA_6.setText(u"Perimeter of shape (" + str(numberEdges) + ")") | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
else: | |
self.LA_6.setText(u"Perimeter of shape (" + str(numberEdges) + ")") | |
self.SB_Arc_ToByArcs.setVisible(False) | |
self.PB_BSplineCreateNodes.setVisible(False) | |
self.LE_5b.setVisible(False) | |
self.LA_5b.setVisible(False) | |
rayonObjet = 0.0 | |
try: | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
except Exception: | |
perimetre = 0.0 | |
self.LE_6.setText(str(Around(perimetre))) | |
self.LE_6.setToolTip(u"Perimeter total of the form." + "\n" | |
u"Display the total edges of theform") | |
if self.GBox_012_SpreadSheet.isChecked(): | |
self.tableWidget.clear() # Zero | |
co = 0 | |
li = 1 | |
aa = 0 | |
#### detail of Cercle BSpline begin | |
if (str(BsplineDetect) == "<BSplineCurve object>"): | |
newitem = QtWidgets.QTableWidgetItem(u"Number of nodes") | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtWidgets.QTableWidgetItem(str(len(BsplinePointsCoor))) | |
self.tableWidget.setItem( li,1, newitem) | |
li += 1 | |
for i in enumerate(BsplinePointsCoor): # Edges | |
newitem = QtWidgets.QTableWidgetItem(u"Node" + str(i[0]+1)) | |
self.tableWidget.setItem( li,0, newitem) | |
for a in range(3): # Vertexes | |
co += 1 | |
chaine = str(Around(BsplinePointsCoor[i[0]][a])) | |
newitem = QtWidgets.QTableWidgetItem(chaine) | |
self.tableWidget.setItem( li,co, newitem) | |
aa += 6 | |
co = 0 | |
li += 1 | |
#### detail of Cercle BSpline end | |
if RowCountTest > RowCount: | |
self.GBox_012_SpreadSheet.setTitle(u"Details ("+ str(compt_E) +") ("+ str(compt_F)+") ("+ str(compt_VF)+") (!+ "+str(RowCount)+") "+str(RowCountTest)) | |
else: | |
self.GBox_012_SpreadSheet.setTitle(u"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 = QtWidgets.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtWidgets.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 = QtWidgets.QTableWidgetItem(str(Vertx[a])) | |
chaine = str(Vertx[a]).split(":") | |
newitem = QtWidgets.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 = QtWidgets.QTableWidgetItem(str(j[1])) | |
self.tableWidget.setItem( li,0, newitem) | |
newitem = QtWidgets.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 = QtWidgets.QTableWidgetItem(FacesCoor[jj]) | |
chaine = str(FacesCoor[jj]).split(":") | |
newitem = QtWidgets.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.LE_8xy.setText(str(Around(Plan_xy))+uniteAs) | |
self.LE_8xya.setText(str(Plan_xy_V)) | |
self.LE_8yz.setText(str(Around(Plan_yz))+uniteAs) | |
self.LE_8yza.setText(str(Plan_yz_V)) | |
self.LE_8zx.setText(str(Around(Plan_zx))+uniteAs) | |
self.LE_8zxa.setText(str(Plan_zx_V)) | |
self.LE_9a.setText(str(Around(surface * uniteS)) + " " + uniteSs) | |
self.LE_10a.setText(str(Around(surfaceFace * uniteS)) + " " + uniteSs) | |
self.LE_11a.setText(str(Around(volume_ * uniteV)) + " " + uniteVs) | |
self.LE_12a.setText(str(Around(poids)) + " " + unitePs) | |
seTMaterialCost = ((volume_ * seTDensiteValue * seTMaterialPrice) / 1000000.0) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
self.LE_13x.setText(str(Around(boundBoxCenterX * uniteM)) + " " + uniteMs) | |
self.LE_13y.setText(str(Around(boundBoxCenterY * uniteM)) + " " + uniteMs) | |
self.LE_13z.setText(str(Around(boundBoxCenterZ * uniteM)) + " " + uniteMs) | |
self.LE_14x.setText(str(Around(CenterOfMassX * uniteM)) + " " + uniteMs) | |
self.LE_14y.setText(str(Around(CenterOfMassY * uniteM)) + " " + uniteMs) | |
self.LE_14z.setText(str(Around(CenterOfMassZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
self.SB_16_M.setPrefix(uniteMs + "^") | |
self.SB_16_M.setValue(setMomentOfInertia_16) | |
self.LE_16_Raw.setText("Raw : " + MatrixOfInertiaRaw) | |
self.LE_16_Raw.setCursorPosition(0) | |
try: | |
## MatrixX1_16 = MatrixX1*uniteM**setMomentOfInertia_16 ## original without parenthesis and modified 17/03/2024 | |
MatrixX1_16 = (MatrixX1*uniteS)**setMomentOfInertia_16 | |
MatrixY1_16 = (MatrixY1*uniteS)**setMomentOfInertia_16 | |
MatrixZ1_16 = (MatrixZ1*uniteS)**setMomentOfInertia_16 | |
MatrixX2_16 = (MatrixX2*uniteS)**setMomentOfInertia_16 | |
MatrixY2_16 = (MatrixY2*uniteS)**setMomentOfInertia_16 | |
MatrixZ2_16 = (MatrixZ2*uniteS)**setMomentOfInertia_16 | |
MatrixX3_16 = (MatrixX3*uniteS)**setMomentOfInertia_16 | |
MatrixY3_16 = (MatrixY3*uniteS)**setMomentOfInertia_16 | |
MatrixZ3_16 = (MatrixZ3*uniteS)**setMomentOfInertia_16 | |
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.SB_16_M.setText(u"") | |
try: | |
## MatrixX1_17 = MatrixX1*uniteM**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) ## original without parenthesis and modified 17/03/2024 | |
MatrixX1_17 = (MatrixX1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY1_17 = (MatrixY1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ1_17 = (MatrixZ1*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX2_17 = (MatrixX2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY2_17 = (MatrixY2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ2_17 = (MatrixZ2*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixX3_17 = (MatrixX3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixY3_17 = (MatrixY3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*uniteP*(1.0/(uniteV*1000.0)) | |
MatrixZ3_17 = (MatrixZ3*uniteM)**setMomentOfInertiaMassique_17*seTDensiteValue*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.displayMatrixMomentOfInertia() | |
self.RB_01_Tabulation.setText(u"Tabulation") | |
self.RB_02_Virgule.setText(u"Comma") | |
self.RB_03_Point_Virgule.setText(u"Semicolon") | |
self.RB_04_Espace.setText(u"Space") | |
# 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_PB_01_Read_SpreadSheet_clicked(self): # lecture | |
global ESCAPE | |
global setPathLatestDirectory | |
global FreeCAD_ParamGetSet | |
OpenName = "" | |
#### mint | |
if switchQFileDialogMint == True: # Mint | |
OpenName, Filter = PySide2.QtWidgets.QFileDialog.getOpenFileName(None, u"Read a txt file", setPathLatestDirectory, "(FCInfo *.FCInfo);;(Cvs *.csv);;(Ascii *.asc);;(TXT *.txt);;(*.*);;(*)")#PySide2 Mint | |
#### mint | |
else: | |
OpenName, Filter = PySide2.QtWidgets.QFileDialog.getOpenFileName(None, u"Read a txt file", setPathLatestDirectory, "*.FCInfo *.csv *.asc *.txt;;FCInfo (*.FCInfo);;Cvs (*.csv);;Ascii (*.asc);;TXT (*.txt);;(*.*);;(*)")#PySide2 | |
try: | |
if OpenName != "": | |
####new2 | |
pathFile = os.path.dirname(OpenName) + "/" #1# = C:/Provisoire400/ | |
setPathLatestDirectory = pathFile | |
FreeCAD_ParamGetSet.SetString(u"setPathLatestDirectory", setPathLatestDirectory) #*"C:\ ???" | |
#racineDrive = os.path.splitdrive(OpenName)[0] #2# = C: | |
#formatFichier = os.path.splitext(OpenName)[1] #4# = .png | |
#OpenName = os.path.splitext(OpenName)[0] #5# = /home/kubuntu/.FreeCAD/Macro/Texture_007_H #= C:/Provisoire400/image3D | |
#nomFichier = os.path.basename(OpenName) #3# = image3D | |
#SaveNameformatFichier = OpenName + formatFichier #6# = C:/Provisoire400/image3D.png | |
#pathFileSaveNameformatFichier = pathFile + nomFichier + formatFichier #7# = C:/Provisoire400/image3D.png | |
####new2 | |
####detection separator################### | |
file = open(OpenName, "r") # open file for counter separator | |
separateur1 = separateur2 = separateur3 = separateur4 = 0 | |
for separator in file: | |
separateur1 += separator.count(u"\t") | |
separateur2 += separator.count(u",") | |
separateur3 += separator.count(u";") | |
separateur4 += separator.count(u" ") | |
self.RB_01_Tabulation.setText(u"Tabulation "+str(separateur1)) | |
self.RB_02_Virgule.setText(u"Comma "+str(separateur2)) | |
self.RB_03_Point_Virgule.setText(u"Semicolon "+str(separateur3)) | |
self.RB_04_Espace.setText(u"Space "+"(" + str(separateur4) + ")") | |
file.close() | |
####detection separator################### | |
####counter line and colonne################### | |
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 = QtWidgets.QTableWidget( ligne , colonne) # prepare le tableau | |
self.table.setWindowTitle(u"FCInfo Patience reading the file") | |
# self.table.resize(700, 500) | |
self.table.resize(500, 700) | |
self.table.setWindowModality(QtCore.Qt.NonModal) | |
self.table.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint) # PySide2 | |
self.table.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_04))) # icone dans une variable | |
self.table.show() | |
####counter line and colonne################### | |
####csv.reader################### | |
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 = QtWidgets.QTableWidgetItem(str(field)) | |
self.table.setItem(ligne, colonne, newitem) | |
colonne += 1 | |
ligne += 1 | |
colonne = 0 | |
self.table.setWindowTitle(u"FCInfo Patience reading the file "+str(ligne)+"/"+str(lignes)) | |
finally: | |
file.close() | |
self.table.setWindowTitle(u"FCInfo Tableau " + OpenName) | |
####csv.reader################### | |
except Exception: | |
App_Console_PrintMessage(u"Error in reading the file " + OpenName + "\n") | |
errorDialog(u"Error in reading the file " + OpenName) | |
def on_PB_02_Save_SreadSheet_clicked(self): # registration | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global object_Type | |
global subElemName | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global rayonObjet | |
global detected | |
global perimetre | |
global massOrGravity | |
global diffuseColorRF | |
global diffuseColorVF | |
global diffuseColorBF | |
global diffuseColorTF | |
global Plan_xy_V | |
global Plan_yz_V | |
global Plan_zx_V | |
global surface | |
global surfaceFace | |
global volume_ | |
global seTDensiteValue | |
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 direcNormalAt | |
global Matrix_1 | |
global Matrix_2 | |
global Matrix_3 | |
global Matrix12 | |
global Matrix13 | |
global Matrix14 | |
global Matrix15 | |
global DeterminantM | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixOfInertiaRaw | |
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 | |
global nombreArretesMesh | |
global nombreFacesMesh | |
global nombrePointsMesh | |
global colorShapeFaceDiffuseColor | |
global BsplineDetect | |
global BsplineNombreDeNoeuds | |
global BsplinePointsCoor | |
global seTMaterialCost | |
global seTMaterialPrice | |
global seTMaterialSuffixCost | |
global materialAssociated | |
global seTMaterialCurrentIndex | |
global setPathLatestDirectory | |
global FreeCAD_ParamGetSet | |
SaveName = "" | |
#### mint | |
if switchQFileDialogMint == True: # Mint | |
SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a txt file", setPathLatestDirectory, " (FCInfo *.FCInfo);; (Cvs *.csv);; (Ascii *.asc);; (TXT *.txt);;(*.*);;(*)")#PySide2 Mint | |
Filter = Filter[Filter.find("."):Filter.find(")")] | |
if Filter[-2:] == ".*": | |
Filter = Filter[:-2] | |
SaveName = SaveName + Filter | |
#### mint | |
else: | |
SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a txt file", setPathLatestDirectory, "*.FCInfo *.csv *.asc *.txt;;FCInfo (*.FCInfo);;Cvs (*.csv);;Ascii (*.asc);;TXT (*.txt);;(*.*);;(*)")#PySide2 | |
if SaveName == "": | |
App_Console_PrintMessage(u"Process aborted" + "\n") | |
errorDialog(u"Process aborted") | |
else: | |
App_Console_PrintMessage(u"Registration of " + SaveName + "\n") | |
####new2 | |
pathFile = os.path.dirname(SaveName) + "/" #1# = C:/Provisoire400/ | |
setPathLatestDirectory = pathFile | |
FreeCAD_ParamGetSet.SetString(u"setPathLatestDirectory", setPathLatestDirectory) #*"C:\ ???" | |
#racineDrive = os.path.splitdrive(SaveName)[0] #2# = C: | |
#formatFichier = os.path.splitext(SaveName)[1] #4# = .png | |
#SaveName = os.path.splitext(SaveName)[0] #5# = /home/kubuntu/.FreeCAD/Macro/Texture_007_H #= C:/Provisoire400/image3D | |
#nomFichier = os.path.basename(SaveName) #3# = image3D | |
#SaveNameformatFichier = SaveName + formatFichier #6# = C:/Provisoire400/image3D.png | |
#pathFileSaveNameformatFichier = pathFile + nomFichier + formatFichier #7# = C:/Provisoire400/image3D.png | |
####new2 | |
try: | |
f = open(SaveName, 'w') # write | |
f.write(iso8859(u"Info of the element\n")) | |
f.write(iso8859(u"___________________\n")) | |
f.write(iso8859(dateUs() + " "+ heure() + "\n\n")) | |
f.write(iso8859(u"Name of the document" + ESCAPE + document_ + "\n")) | |
f.write(iso8859(u"Label Name" + ESCAPE + object_Label + "\n")) | |
f.write(iso8859(u"Internal Name" + ESCAPE + object_Name + "\n")) | |
f.write(iso8859(u"Name of the element" + ESCAPE + str(subElemName) + "\n")) | |
f.write(iso8859(u"Object type (Shape)" + ESCAPE + typeObject + "\n")) | |
f.write(iso8859(u"Object type" + ESCAPE + object_Type + "\n\n")) | |
f.write(iso8859(u"Mouse coordinates" + ESCAPE + "X" + ESCAPE + str(Around(position0 * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
"Y" + ESCAPE + str(Around(position1 * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
"Z" + ESCAPE + str(Around(position2 * uniteM)) + ESCAPE + uniteMs + "\n\n")) | |
#### couleurs | |
f.write(iso8859(u"Color of the selection" + "\n")) | |
f.write(iso8859(u"Red" + ESCAPE + str(int(diffuseColorRF*255.0)) + ESCAPE + | |
u"Green" + ESCAPE + str(int(diffuseColorVF*255.0)) + ESCAPE + | |
u"Blue" + ESCAPE + str(int(diffuseColorBF*255.0)) + ESCAPE + | |
u"Transparency" + ESCAPE + str(int(diffuseColorTF*255.0)) + "\n\n")) | |
if len(colorShapeFace) != 0: | |
f.write(iso8859(u"Color Objet (float) " + ESCAPE + u"Red" + ESCAPE + str(colorShapeFace[0]) + ESCAPE + | |
u"Green" + ESCAPE + str(colorShapeFace[1]) + ESCAPE + | |
u"Blue" + ESCAPE + str(colorShapeFace[2]) + ESCAPE + | |
u"Transparency" + ESCAPE + str(colorShapeFace[3]) + "\n")) | |
f.write(iso8859(u"Color Objet (int ) " + ESCAPE + u"Red" + ESCAPE + str(int(colorShapeFace[0]*255.0)) + ESCAPE + | |
u"Green" + ESCAPE + str(int(colorShapeFace[1]*255.0)) + ESCAPE + | |
u"Blue" + ESCAPE + str(int(colorShapeFace[2]*255.0)) + ESCAPE + | |
u"Transparency" + ESCAPE + str(int(colorShapeFace[3]*255.0)) + "\n\n")) | |
if len(colorShapeLine) != 0: | |
f.write(iso8859(u"Color Line(s) (float) " + ESCAPE + u"Red" + ESCAPE + str(colorShapeLine[0]) + ESCAPE + | |
u"Green" + ESCAPE + str(colorShapeLine[1]) + ESCAPE + | |
u"Blue" + ESCAPE + str(colorShapeLine[2]) + ESCAPE + | |
u"Transparency" + ESCAPE + str(colorShapeLine[3]) + "\n")) | |
f.write(iso8859(u"Color Line(s) (int ) " + ESCAPE + u"Red" + ESCAPE + str(int(colorShapeLine[0]*255.0)) + ESCAPE + | |
u"Green" + ESCAPE + str(int(colorShapeLine[1]*255.0)) + ESCAPE + | |
u"Blue" + ESCAPE + str(int(colorShapeLine[2]*255.0)) + ESCAPE + | |
u"Transparency" + ESCAPE + str(int(colorShapeLine[3]*255.0)) + "\n\n")) | |
if len(colorShapePoint) != 0: | |
try: | |
f.write(iso8859(u"Color Point(s) (float) " + ESCAPE + u"Red" + ESCAPE + str(colorShapePoint[0]) + ESCAPE + | |
u"Green" + ESCAPE + str(colorShapePoint[1]) + ESCAPE + | |
u"Blue" + ESCAPE + str(colorShapePoint[2]) + ESCAPE + | |
u"Transparency" + ESCAPE + str(colorShapePoint[3]) + "\n")) | |
f.write(iso8859(u"Color Point(s) (int ) " + ESCAPE + u"Red" + ESCAPE + str(int(colorShapePoint[0]*255.0)) + ESCAPE + | |
u"Green" + ESCAPE + str(int(colorShapePoint[1]*255.0)) + ESCAPE + | |
u"Blue" + ESCAPE + str(int(colorShapePoint[2]*255.0)) + ESCAPE + | |
u"Transparency" + ESCAPE + str(int(colorShapePoint[3]*255.0)) + "\n\n")) | |
except Exception: | |
None | |
f.write(iso8859(typeLongueur + ESCAPE + str(Around(longueurObjet * uniteM)) + ESCAPE + uniteMs + "\n")) | |
if detected[0:4] == "Mesh": | |
f.write(iso8859(u"Components Mesh" + "\n")) | |
f.write(iso8859(u"_______________\n")) | |
f.write(iso8859(u"Number Edges" + ESCAPE + str(nombreArretesMesh) + "\n")) | |
f.write(iso8859(u"Number Faces" + ESCAPE + str(nombreFacesMesh) + "\n")) | |
f.write(iso8859(u"Number Points" + ESCAPE + str(nombrePointsMesh) + "\n\n")) | |
if detected == "<PointKernel object>": | |
f.write(iso8859(u"Components Points" + "\n")) | |
f.write(iso8859(u"_________________\n")) | |
f.write(iso8859(u"Number Points" + ESCAPE + str(nombrePointsMesh) + "\n\n")) | |
#### detail of Cercle | |
if rayonObjet != 0.0: | |
f.write(iso8859(u"Radius" + ESCAPE + str(Around(rayonObjet * uniteM)) + ESCAPE + uniteMs + "\n\n")) | |
f.write(iso8859(u"Perimeter of the shape" + ESCAPE + str(Around(perimetre * uniteM)) + ESCAPE + uniteMs + "\n\n")) | |
if self.GBox_012_SpreadSheet.isChecked(): | |
#### detail of Cercle BSpline begin | |
if (str(BsplineDetect) == "<BSplineCurve object>"): | |
f.write(iso8859(u"Number of nodes" + ESCAPE + str(BsplineNombreDeNoeuds) + "\n")) | |
for i in enumerate(BsplinePointsCoor): # nombre de points noeuds | |
f.write(iso8859(u"Nodes" + str(i[0]) + ESCAPE + u"X" + str(i[0] + 1) + ESCAPE + str(Around(i[1][0])) + ESCAPE + | |
u"Y" + str(i[0] + 1) + ESCAPE + str(Around(i[1][1])) + ESCAPE + | |
u"Z" + str(i[0] + 1) + ESCAPE + str(Around(i[1][2])) + ESCAPE + "\n")) | |
f.write(iso8859("\n")) | |
#### detail of Cercle BSpline end | |
f.write(iso8859(u"Vertexes and details" + ESCAPE + u" Number Edges" + ESCAPE + str(compt_E) + ESCAPE + u" Number Faces" + ESCAPE + str(compt_F) + ESCAPE + u" Number Vertexes faces" + ESCAPE + str(compt_VF) + ESCAPE + u" Detail Total" + ESCAPE + str(RowCountTest) + "\n\n")) | |
co = 0 | |
aa = 0 | |
for j in enumerate(Edges): | |
f.write(str(j[1]) + ESCAPE +iso8859(str(Around(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(Around(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(Around(float(FacesSurf[co]) * float(uniteS))) + ESCAPE + uniteSs + "\n")) | |
co += 1 | |
if len(colorShapeFaceDiffuseColor) != 0: | |
f.write(iso8859(u"Color float Face" + str(j[0]+1) + ESCAPE + | |
u"Red" + ESCAPE + str(colorShapeFaceDiffuseColor[j[0]][0]) + ESCAPE + | |
u"Green " + ESCAPE + str(colorShapeFaceDiffuseColor[j[0]][1]) + ESCAPE + | |
u"Blue " + ESCAPE + str(colorShapeFaceDiffuseColor[j[0]][2]) + ESCAPE + | |
u"Transparency" + ESCAPE + str(colorShapeFaceDiffuseColor[j[0]][3]) + ESCAPE + "\n")) | |
f.write(iso8859(u"Couleur integer Face" + str(j[0]+1) + ESCAPE + | |
u"Red" + ESCAPE + str(int(colorShapeFaceDiffuseColor[j[0]][0]*255.0)) + ESCAPE + | |
u"Green " + ESCAPE + str(int(colorShapeFaceDiffuseColor[j[0]][1]*255.0)) + ESCAPE + | |
u"Blue " + ESCAPE + str(int(colorShapeFaceDiffuseColor[j[0]][2]*255.0)) + ESCAPE + | |
u"Transparency" + ESCAPE + str(int(colorShapeFaceDiffuseColor[j[0]][3]*255.0)) + ESCAPE + "\n")) | |
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(Around(float(chaine[1]) * float(uniteM))) + ESCAPE + uniteMs + ESCAPE)) | |
co2 += 1 | |
if co2 == 3: | |
f.write("\n") | |
co2 = 0 | |
f.write(u"\n") | |
f.write(iso8859(u"Plane" + ESCAPE + u" XY:" + ESCAPE + self.LE_8xy.text() + ESCAPE + u" coordinates:" + ESCAPE + str(Plan_xy_V) + "\n")) | |
f.write(iso8859(u"Plane" + ESCAPE + u" YZ:" + ESCAPE + self.LE_8yz.text() + ESCAPE + u" coordinates:" + ESCAPE + str(Plan_yz_V) + "\n")) | |
f.write(iso8859(u"Plane" + ESCAPE + u" ZX:" + ESCAPE + self.LE_8zx.text() + ESCAPE + u" coordinates:" + ESCAPE + str(Plan_zx_V) + "\n\n")) | |
f.write(iso8859(u"The form area" + ESCAPE + str(Around(surface * uniteS)) + ESCAPE + uniteSs + "\n")) | |
f.write(iso8859(u"Area of the face" + ESCAPE + str(Around(surfaceFace * uniteS)) + ESCAPE + uniteSs + "\n\n")) | |
f.write(iso8859(u"Volume of the form" + ESCAPE + str(Around(volume_ * uniteV)) + ESCAPE + uniteVs + "\n")) | |
f.write(iso8859(u"Mass" + ESCAPE + str(Around(poids)) + ESCAPE + unitePs + ESCAPE + u" Density:" + ESCAPE + str(Around(seTDensiteValue)) + "\n\n")) | |
f.write(iso8859(u"Center of the shape" + ESCAPE + u" X:" + ESCAPE + str(Around(boundBoxCenterX * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(boundBoxCenterY * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(boundBoxCenterZ * uniteM)) + ESCAPE + uniteMs + "\n")) | |
f.write(iso8859(u"Center of " + massOrGravity + ESCAPE + u" X:" + ESCAPE + str(Around(CenterOfMassX * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(CenterOfMassY * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(CenterOfMassZ * uniteM)) + ESCAPE + uniteMs + "\n")) | |
f.write(iso8859(u"BoundBox" + ESCAPE + u" X:" + ESCAPE + str(Around(boundBoxLX * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(boundBoxLY * uniteM)) + ESCAPE + uniteMs + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(boundBoxLZ * uniteM)) + ESCAPE + uniteMs + "\n")) | |
f.write(iso8859(u"BoundBox Diagonal" + ESCAPE + str(Around(boundBoxDiag * uniteM)) + ESCAPE + uniteMs + "\n\n")) | |
if directionObj != "[]": | |
f.write(iso8859(u"Direction" + ESCAPE + u" X:" + ESCAPE + str(Around(directionObj[0])) + ESCAPE + u" Y:" + ESCAPE + str(Around(directionObj[1])) + ESCAPE + u" Z:" + ESCAPE + str(Around(directionObj[2])) + "\n")) | |
if direcValueAt != "[]": | |
f.write(iso8859(u"ValueAt" + ESCAPE + u" X:" + ESCAPE + str(Around(direcValueAt[0])) + ESCAPE + u" Y:" + ESCAPE + str(Around(direcValueAt[1])) + ESCAPE + u" Z:" + ESCAPE + str(Around(direcValueAt[2])) + "\n")) | |
if direcNormalAt != "[]": | |
f.write(iso8859(u"NormalAt" + ESCAPE + u" X:" + ESCAPE + str(Around(direcNormalAt[0])) + ESCAPE + u" Y:" + ESCAPE + str(Around(direcNormalAt[1])) + ESCAPE + u" Z:" + ESCAPE + str(Around(direcNormalAt[2])) + "\n")) | |
f.write(iso8859(u"\n")) | |
if detected[0:4] == "Mesh": | |
None | |
else: | |
f.write(iso8859(u"Matrix of inertia Raw" + ESCAPE + str(MatrixOfInertiaRaw)) + "\n") | |
f.write(iso8859(u"Matrix of inertia" + ESCAPE + uniteMs + "^" + str(setMomentOfInertia_16)) + "\n") | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(MatrixX1_16)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(MatrixY1_16)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(MatrixZ1_16)) + ESCAPE + | |
u" :" + ESCAPE + str(Around(Matrix_1)) + "\n")) | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(MatrixX2_16)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(MatrixY2_16)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(MatrixZ2_16)) + ESCAPE + | |
u" :" + ESCAPE + str(Around(Matrix_2)) + "\n")) | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(MatrixX3_16)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(MatrixY3_16)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(MatrixZ3_16)) + ESCAPE + | |
u" :" + ESCAPE + str(Around(Matrix_3)) + "\n")) | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(Matrix12)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(Matrix13)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(Matrix14)) + ESCAPE + | |
u" :" + ESCAPE + str(Around(Matrix15)) + "\n\n")) | |
f.write(iso8859(u"Matrix inertia with mass" + ESCAPE + unitePs + uniteSs + "^" + str(setMomentOfInertiaMassique_17)) + "\n") | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(MatrixX1_17)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(MatrixY1_17)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(MatrixZ1_17)) + "\n")) | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(MatrixX2_17)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(MatrixY2_17)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(MatrixZ2_17)) + "\n")) | |
f.write(iso8859(ESCAPE + u" X:" + ESCAPE + str(Around(MatrixX3_17)) + ESCAPE + | |
u" Y:" + ESCAPE + str(Around(MatrixY3_17)) + ESCAPE + | |
u" Z:" + ESCAPE + str(Around(MatrixZ3_17)) + "\n\n")) | |
f.write(iso8859(u"Matrix Determinant" + ESCAPE + str(DeterminantM) + "\n")) | |
f.write(iso8859(u"Determinant decimal" + ESCAPE + str(decimal.Decimal(DeterminantM)) + "\n\n")) | |
materiel = materialAssociated[seTMaterialCurrentIndex].rstrip().split(",") | |
nomMateriel = materiel[0] | |
densitexMateriel= str(Around(float(materiel[1]))) | |
prixMateriel = str(Around(float(materiel[2]))) | |
infoMateriel = materiel[3] | |
f.write(iso8859(u"Material" + ESCAPE + "\n")) | |
f.write(iso8859(u"Name" + ESCAPE + u"Density" + ESCAPE + u"Volume" + ESCAPE + u"Unit" + ESCAPE + u"Price (kg/dm3)"+ ESCAPE + | |
u"Cost total" + ESCAPE + u"Devise" + ESCAPE + u"Info" + "\n")) | |
f.write(iso8859(nomMateriel + ESCAPE + densitexMateriel + ESCAPE + str(Around(volume_ * uniteV)) + ESCAPE + uniteVs + ESCAPE + | |
prixMateriel + ESCAPE + str(Around(seTMaterialCost)) + ESCAPE + seTMaterialSuffixCost + ESCAPE + infoMateriel + "\n\n")) | |
f.write(iso8859(u"End " + ESCAPE + document_ + "\n")) | |
f.close() | |
except Exception: | |
App_Console_PrintMessage(u"Error writing file " + SaveName + "\n") | |
errorDialog(u"Error writing file " + SaveName) | |
def on_PB_Ra_clicked(self): # clicked() pressed(), released() Bouton radian/degrees | |
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.PB_Ra.text() | |
if choice == "Degrees": # ne pas traduire | |
uniteAs = "" | |
self.PB_Ra.setText(u"DegMinSec") # ne pas traduire | |
self.PB_Ra.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_DegreesMinSec))) # icone dans une variable | |
self.LE_8xy.setText(str(degMinSec(Plan_xy))) #angle degesMinutesSecondes | |
self.LE_8yz.setText(str(degMinSec(Plan_yz))) | |
self.LE_8zx.setText(str(degMinSec(Plan_zx))) | |
elif choice == "DegMinSec":# ne pas traduire | |
uniteAs = " rad" | |
self.PB_Ra.setText(u"Radian") # ne pas traduire | |
self.PB_Ra.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Radian))) # icone dans une variable | |
Plan_xy2 = radians(Plan_xy) | |
self.LE_8xy.setText(str(Around(Plan_xy2))+uniteAs) # angleRadian | |
Plan_yz2 = radians(Plan_yz) | |
self.LE_8yz.setText(str(Around(Plan_yz2))+uniteAs) | |
Plan_zx2 = radians(Plan_zx) | |
self.LE_8zx.setText(str(Around(Plan_zx2))+uniteAs) | |
elif choice == "Radian": # ne pas traduire | |
uniteAs = " gon" | |
self.PB_Ra.setText(u"Grade") # ne pas traduire | |
self.PB_Ra.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Grade))) # icone dans une variable | |
Plan_xy2 = angleGrade(Plan_xy) | |
self.LE_8xy.setText(str(Around(Plan_xy2))+uniteAs) #angleGrade | |
Plan_yz2 = angleGrade(Plan_yz) | |
self.LE_8yz.setText(str(Around(Plan_yz2))+uniteAs) | |
Plan_zx2 = angleGrade(Plan_zx) | |
self.LE_8zx.setText(str(Around(Plan_zx2))+uniteAs) | |
elif choice == "Grade": # ne pas traduire | |
uniteAs = u"%" | |
self.PB_Ra.setText(u"Percent") # ne pas traduire | |
self.PB_Ra.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Pourcent))) # icone dans une variable | |
Plan_xy2 = anglePourcent(Plan_xy) | |
self.LE_8xy.setText(str(Around(Plan_xy2))+uniteAs) #anglePourcent | |
Plan_yz2 = anglePourcent(Plan_yz) | |
self.LE_8yz.setText(str(Around(Plan_yz2))+uniteAs) | |
Plan_zx2 = anglePourcent(Plan_zx) | |
self.LE_8zx.setText(str(Around(Plan_zx2))+uniteAs) | |
elif choice == "Percent": # ne pas traduire | |
uniteAs = " deg" | |
try: | |
self.PB_Ra.setText(u"Degrees") # ne pas traduire | |
self.PB_Ra.setIcon(QtGui.QIcon(QtGui.QPixmap(Macro_FCInfo_Degrees))) # icone dans une variable | |
self.LE_8xy.setText(str(Around(Plan_xy))+uniteAs) # angleDegree | |
self.LE_8yz.setText(str(Around(Plan_yz))+uniteAs) | |
self.LE_8zx.setText(str(Around(Plan_zx))+uniteAs) | |
except Exception: | |
None | |
def on_CB_01_Info(self): | |
global switchDisplayInfoObject | |
global FreeCAD_ParamGetSet | |
if self.CB_01_Info.isChecked(): | |
switchDisplayInfoObject = 1 | |
else: | |
switchDisplayInfoObject = 0 | |
FreeCAD_ParamGetSet.SetBool(u"switchDisplayInfoObject", switchDisplayInfoObject) # True or False | |
def on_CB_02_Point(self): | |
global switchCreatePoint | |
global FreeCAD_ParamGetSet | |
if switchCreatePoint == 0: | |
switchCreatePoint = 1 | |
else: | |
switchCreatePoint = 0 | |
FreeCAD_ParamGetSet.SetBool(u"switchCreatePoint", switchCreatePoint) # True or False | |
def on_CB_03_Axis(self): | |
global switchCreateAxis | |
global FreeCAD_ParamGetSet | |
if switchCreateAxis == 0: | |
switchCreateAxis = 1 | |
else: | |
switchCreateAxis = 0 | |
FreeCAD_ParamGetSet.SetBool(u"switchCreateAxis", switchCreateAxis) #*True or False | |
def on_CB_04_Plane(self): | |
global switchCreatePlane | |
global FreeCAD_ParamGetSet | |
if switchCreatePlane == 0: | |
switchCreatePlane = 1 | |
else: | |
switchCreatePlane = 0 | |
FreeCAD_ParamGetSet.SetBool(u"switchCreatePlane", switchCreatePlane) #*True or False | |
def on_RB_00_ClipBoard(self): | |
global seTMemoClipBoard | |
global FreeCAD_ParamGetSet | |
#self.RB_00_ClipBoard.setChecked(True) | |
seTMemoClipBoard = 0 | |
FreeCAD_ParamGetSet.SetInt(u"seTMemoClipBoard", seTMemoClipBoard) # 0, 1, 2 | |
def on_RB_01_ClipBoard(self): | |
global seTMemoClipBoard | |
global FreeCAD_ParamGetSet | |
#self.RB_01_ClipBoard.setChecked(True) | |
seTMemoClipBoard = 1 | |
FreeCAD_ParamGetSet.SetInt(u"seTMemoClipBoard", seTMemoClipBoard) # 0, 1, 2 | |
def on_RB_02_ClipBoard(self): | |
global seTMemoClipBoard | |
global FreeCAD_ParamGetSet | |
#self.RB_02_ClipBoard.setChecked(True) | |
seTMemoClipBoard = 2 | |
FreeCAD_ParamGetSet.SetInt(u"seTMemoClipBoard", seTMemoClipBoard) # 0, 1, 2 | |
def on_RB_03_ClipBoard(self): | |
global seTMemoClipBoard | |
global FreeCAD_ParamGetSet | |
#self.RB_03_ClipBoard.setChecked(True) | |
seTMemoClipBoard = 3 | |
FreeCAD_ParamGetSet.SetInt(u"seTMemoClipBoard", seTMemoClipBoard) # 0, 1, 2 | |
def on_CB_05_Position(self): | |
global FCmw | |
global seTPositionFlyRightLeft | |
global seTWidgetPosition | |
global FreeCAD_ParamGetSet | |
if seTPositionFlyRightLeft != 1: | |
if self.CB_05_Position.isChecked(): | |
FCmw.addDockWidget(QtCore.Qt.LeftDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window Left | |
FreeCAD_ParamGetSet.SetInt(u"seTPositionFlyRightLeft", 3) #*1, 2, other | |
FreeCAD_ParamGetSet.SetBool(u"seTWidgetPosition", True) # True or False | |
seTPositionFlyRightLeft = 3 | |
seTWidgetPosition = True | |
else: | |
FCmw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewFreeCADWidget)# add the widget to the main window Right | |
FreeCAD_ParamGetSet.SetInt(u"seTPositionFlyRightLeft", 2) #*1, 2, other | |
FreeCAD_ParamGetSet.SetBool(u"seTWidgetPosition", False) # True or False | |
seTPositionFlyRightLeft = 2 | |
seTWidgetPosition = False | |
def on_ZeroInfo(self): # reset to 0 | |
global typeObject | |
global diffuseColorRF, diffuseColorVF, diffuseColorBF, diffuseColorTF, unsignedEncodeColor | |
global longueurObjet, rayonObjet, perimetre, typeLongueur, numberEdges | |
global Plan_xy, Plan_xy_V, Plan_yz, Plan_yz_V, Plan_zx, Plan_zx_V | |
global surface,surfaceFace,volume_,seTDensiteValue,poids,uniteM, uniteMs, uniteS, uniteSs, uniteV, uniteVs, uniteP, unitePs, uniteAs | |
global boundBoxCenterX, boundBoxCenterY, boundBoxCenterZ, CenterOfMassX, CenterOfMassY, CenterOfMassZ | |
global boundBoxLX, boundBoxLY, boundBoxLZ, boundBox_S, massOrGravity | |
global MatrixX1, MatrixY1, MatrixZ1, Matrix_1 | |
global MatrixX2, MatrixY2, MatrixZ2, Matrix_2 | |
global MatrixX3, MatrixY3, MatrixZ3, Matrix_3 | |
global Matrix12, Matrix13, Matrix14, Matrix15 | |
global Vertx, Edges, EdgesLong, Faces, FacesSurf, FacesCoor, compt_E, compt_F, compt_VF, RowCountTest, ESCAPE, directionObj, direcValueAt, direcNormalAt | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixOfInertiaRaw | |
global MatrixX1_16, MatrixY1_16, MatrixZ1_16, MatrixX2_16, MatrixY2_16, MatrixZ2_16, MatrixX3_16, MatrixY3_16, MatrixZ3_16 | |
global MatrixX1_17, MatrixY1_17, MatrixZ1_17, MatrixX2_17, MatrixY2_17, MatrixZ2_17, MatrixX3_17, MatrixY3_17, MatrixZ3_17 | |
global DeterminantM | |
global seTMaterialPrice, seTMaterialCost, seTMaterialSuffixCost | |
global seTIndexUnitLength | |
global BsplineNombreDeNoeuds, BsplineRayonApproximatif, BsplineNumberElement, BsplineCutLength, setBSplineToByArcValue, BSplinetoByArcValeurS | |
global transparenceFace | |
global typeNormalAt | |
global nombreArretesMesh | |
global nombreFacesMesh | |
global nombrePointsMesh | |
#### | |
transparenceFace = 0 | |
longueurObjet = rayonObjet = perimetre = 0.0 | |
numberEdges = 0 | |
nombreArretesMesh = nombreFacesMesh = nombrePointsMesh = 0 | |
diffuseColorRF = diffuseColorVF = diffuseColorBF = diffuseColorTF = unsignedEncodeColor = 0.0 | |
surface = surfaceFace = volume_ = poids = 0.0 | |
Plan_xy = Plan_yz = Plan_zx = 0.0 | |
Plan_xy_V = Plan_yz_V = Plan_zx_V = "" | |
MatrixX1 = MatrixY1 = MatrixZ1 = Matrix_1 = 0.0 | |
MatrixX2 = MatrixY2 = MatrixZ2 = Matrix_2 = 0.0 | |
MatrixX3 = MatrixY3 = MatrixZ3 = Matrix_3 = 0.0 | |
Matrix12 = Matrix13 = Matrix14 = Matrix15 = 0.0 | |
directionObj = direcValueAt = direcNormalAt = "[]" | |
setMomentOfInertia_16 = 1 | |
setMomentOfInertiaMassique_17 = 1 | |
MatrixOfInertiaRaw = "Raw : " | |
MatrixX1_16 = MatrixY1_16 = MatrixZ1_16 = MatrixX2_16 = MatrixY2_16 = MatrixZ2_16 = MatrixX3_16 = MatrixY3_16 = MatrixZ3_16 = 0.0 | |
MatrixX1_17 = MatrixY1_17 = MatrixZ1_17 = MatrixX2_17 = MatrixY2_17 = MatrixZ2_17 = MatrixX3_17 = MatrixY3_17 = MatrixZ3_17 = 0.0 | |
DeterminantM = 0.0 | |
#### | |
self.LE_N_Edges.setText(str(nombreArretesMesh)) | |
self.LE_N_Facets.setText(str(nombreFacesMesh)) | |
self.LE_N_Points.setText(str(nombrePointsMesh)) | |
self.LE_CRed.setText(str(Around(diffuseColorRF))) | |
self.LE_CGreen.setText(str(Around(diffuseColorVF))) | |
self.LE_CBlue.setText(str(Around(diffuseColorBF))) | |
self.LE_Transparent.setText(str(Around(diffuseColorTF))) | |
self.LE_ConversionUnsigned.setText(str(unsignedEncodeColor)) | |
self.LE_9_Direction.setText(str(directionObj)) | |
self.LE_10_ValueAt.setText(str(direcValueAt)) | |
self.LE_10b_NormalAt.setText(str(direcNormalAt)) | |
self.PB_Line_NormalAT.setText(typeNormalAt) | |
self.SBox_Transparence.setValue(transparenceFace) | |
self.LA_14x.setText(massOrGravity + u" X") | |
self.LA_14y.setText(massOrGravity + u" Y") | |
self.LA_14z.setText(massOrGravity + u" Z") | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
boundBox_S = "[X: "+str(Around(boundBoxLX * uniteM)) + " " + uniteMs+"] x [Y: "+str(Around(boundBoxLY * uniteM)) + " " + uniteMs+"] x [Z: "+str(Around(boundBoxLZ * uniteM)) + " " + uniteMs+"] Diagonal: " + str(Around(boundBoxDiag * uniteM)) + " " + uniteMs | |
self.LE_6.setText(str(Around(float(perimetre) * float(uniteM))) + " " +uniteMs) | |
self.LE_8xy.setText(str(Around(Plan_xy))+uniteAs) | |
self.LE_8xya.setText(str(Plan_xy_V)) | |
self.LE_8yz.setText(str(Around(Plan_yz))+uniteAs) | |
self.LE_8yza.setText(str(Plan_yz_V)) | |
self.LE_8zx.setText(str(Around(Plan_zx))+uniteAs) | |
self.LE_8zxa.setText(str(Plan_zx_V)) | |
self.LE_9a.setText(str(Around(surface * uniteS)) + " " + uniteSs) | |
self.LE_10a.setText(str(Around(surfaceFace * uniteS)) + " " + uniteSs) | |
self.LE_11a.setText(str(Around(volume_ * uniteV)) + " " + uniteVs) | |
self.LE_12a.setText(str(Around(poids)) + " " + unitePs) | |
self.LE_Cost.setText(str(Around(seTMaterialCost)) + seTMaterialSuffixCost) #CostMaterial | |
self.LE_13x.setText(str(Around(boundBoxCenterX * uniteM)) + " " + uniteMs) | |
self.LE_13y.setText(str(Around(boundBoxCenterY * uniteM)) + " " + uniteMs) | |
self.LE_13z.setText(str(Around(boundBoxCenterZ * uniteM)) + " " + uniteMs) | |
self.LE_14x.setText(str(Around(CenterOfMassX * uniteM)) + " " + uniteMs) | |
self.LE_14y.setText(str(Around(CenterOfMassY * uniteM)) + " " + uniteMs) | |
self.LE_14z.setText(str(Around(CenterOfMassZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_01_XLength.setText(str(Around(boundBoxLX * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_02_YLength.setText(str(Around(boundBoxLY * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_03_ZLength.setText(str(Around(boundBoxLZ * uniteM)) + " " + uniteMs) | |
self.LE_007_BB_04_Diagonal.setText(str(Around(boundBoxDiag * uniteM)) + " " + uniteMs) | |
self.displayMatrixMomentOfInertia() | |
ui.paletteBase() | |
def on_PB_05_Help_Forum_clicked(self):# Help Forum | |
self.PB_05_Help_Forum.setStyleSheet(u"QPushButton {background-color: QPalette.Base}") #red | |
try: | |
webbrowser.open(__Forum2__) | |
except Exception: | |
self.PB_05_Help_Forum.setStyleSheet(u"QPushButton {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.PB_05_Help_Forum.setText(u"Not access") | |
def on_PB_06_Help_Wiki(self): # Help Wiki | |
self.PB_06_Help_Wiki.setStyleSheet(u"QPushButton {background-color: QPalette.Base}") #red | |
try: | |
webbrowser.open(__Wiki__) | |
except Exception: | |
self.PB_06_Help_Wiki.setStyleSheet(u"QPushButton {border-width: 2px; border-style: solid; border-color: red}") #red | |
self.PB_06_Help_Wiki.setText(u"Not access") | |
#### Spreadsheet debut ################################################################################################ | |
def decodeColonne(self, colonne = "A"): # converti la chaine A ... ZZ en numero de colonne ex: A = 1; AA = 27 | |
colonne = re.split('[0-9]+', colonne, flags=re.IGNORECASE)[0] # supp the alphanumeric number ex: A2 = A; A12 = A (1A return 0) | |
try: | |
if len(colonne) > 1: | |
return ((ord(colonne[0].upper()) - 64) * 26 ) + (ord(colonne[1].upper()) - 64) # max 2 car (AAAA return 27) | |
else: | |
return (ord(colonne.upper()) - 64 ) | |
except Exception: | |
return 0 | |
def decodeOccupation(self, dataTableau = ""): # decode the max occupation Colonnes, Lines and give the cell occupation | |
# | |
#lineMax, colonneMax, cellsOccupation = decodeOccupation(FreeCAD.ActiveDocument.getObject(str(Sheet.Name))) | |
# | |
# try: | |
tyty = dataTableau.cells.Content | |
tyty = tyty.split(">") | |
#### | |
cellsOccupation = [] | |
cellsSorted = [] # search the "A1" definition | |
for i in tyty[1:-2]: | |
i = i[i.find('"')+1:] # split les cases dans la chaine XML | |
i = i[:i.find('"')] | |
if (i[0] >= "A") and (i[0]<="Z"): # doit etre une lettre A a Z ( >= 0.18) | |
cellsOccupation.append(i) | |
cellsSorted = copy.deepcopy(cellsOccupation) | |
cellsSorted.sort() | |
#### | |
linesMax = 0 | |
for i in cellsSorted: # recherche le max (ligne et colonne) | |
colonnesMax = re.split('[0-9]+', i, flags=re.IGNORECASE) # colonne max (AA) | |
dummy = int(re.split('[A-Z]+', i, flags=re.IGNORECASE)[1]) # line | |
if dummy > linesMax: | |
linesMax = dummy # lines max | |
del cellsSorted[:] | |
#### | |
return linesMax, self.decodeColonne(colonnesMax[0]), cellsOccupation # return linesMax , colonnesMax, cellsOccupation | |
# except Exception: | |
# App_Console_PrintError("Error data, Enter object <Sheet object> ex:") | |
# App_Console_PrintError("lineMax, colonneMax, cellsOccupation = decodeOccupation(FreeCAD.ActiveDocument.getObject(str(Sheet.Name)))") | |
# return 0, 0, [] | |
def caseTableau(self, ligne = 1, colonne = 1): # calcule et code la case du tableur ex caseTableau(1, 2) return B1 | |
if ligne < 1: ligne = 1 | |
if ligne > 16384: ligne = 16384 | |
if colonne < 1: colonne = 1 | |
if colonne > 702: colonne = 702 | |
if (colonne > 26): | |
if abs(colonne % 26) == 0: | |
return chr(64 + (abs(int(colonne / 26)) -1)) + chr(90) + str(ligne) | |
else: | |
return chr(64 + (abs(int(colonne / 26)))) + chr(64 + (abs(colonne % 26))) + str(ligne) | |
else: | |
return chr(colonne + 64) + str(ligne) | |
def on_PB_SpreadSheet_clicked(self): | |
global newSpreadSheetName #; newSpreadSheetName = "FCSpreadSheet" | |
self.ComboB_SpreadSheet.clear() | |
for i in FreeCAD.ActiveDocument.Objects: # reload for search all SpreadSheet | |
obj = FreeCAD.ActiveDocument.getObject(i.Name).TypeId.split("::")[0] | |
if obj == "Spreadsheet": | |
self.ComboB_SpreadSheet.addItem(_fromUtf8(str(i.Name))) | |
App.activeDocument().recompute(None,True,True)# | |
def On_ComboB_SpreadSheet(self, text): | |
global newSpreadSheetName | |
newSpreadSheetName = text | |
self.LE_SpreadSheet.setText(newSpreadSheetName) | |
def on_LE_SpreadSheet_Pressed(self, text): | |
global newSpreadSheetName | |
newSpreadSheetName = text | |
App.activeDocument().recompute(None,True,True)# | |
def on_PB_03_Create_SpreadSheet_clicked(self): # create spreadSheet project | |
global document_ | |
global object_Label | |
global object_Name | |
global typeObject | |
global object_Type | |
global subElemName | |
global position0 | |
global position1 | |
global position2 | |
global longueurObjet | |
global rayonObjet | |
global detected | |
global perimetre | |
global diffuseColorRF | |
global diffuseColorVF | |
global diffuseColorBF | |
global diffuseColorTF | |
global Plan_xy_V | |
global Plan_yz_V | |
global Plan_zx_V | |
global surface | |
global surfaceFace | |
global volume_ | |
global seTDensiteValue | |
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 directionObj | |
global direcValueAt | |
global direcNormalAt | |
global Matrix_1 | |
global Matrix_2 | |
global Matrix_3 | |
global Matrix12 | |
global Matrix13 | |
global Matrix14 | |
global Matrix15 | |
global DeterminantM | |
global setMomentOfInertia_16 | |
global setMomentOfInertiaMassique_17 | |
global MatrixOfInertiaRaw | |
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 | |
global nombreArretesMesh | |
global nombreFacesMesh | |
global nombrePointsMesh | |
global colorShapeFaceDiffuseColor | |
global BsplineDetect | |
global BsplineNombreDeNoeuds | |
global BsplinePointsCoor | |
global seTMaterialCost | |
global seTMaterialPrice | |
global seTMaterialSuffixCost | |
global materialAssociated | |
global seTMaterialCurrentIndex | |
global setPathLatestDirectory | |
global newSpreadSheetName | |
global TextColorText_R ; TextColorText_R = 0.627451 # color red 1 = 255 | |
global TextColorText_G ; TextColorText_G = 0.627451 # color green 1 = 255 | |
global TextColorText_B ; TextColorText_B = 0.643137 # color blue 1 = 255 | |
global TextColorText_L ; TextColorText_L = 1.000000 # color blue 1 = 255 | |
ligne = 1 | |
colonne = 1 | |
tableau = "" | |
try: | |
tableau = FreeCAD.ActiveDocument.getObjectsByLabel(newSpreadSheetName)[0] # for append in existant SpreadSheet | |
ligne = self.decodeOccupation(tableau)[0] + 1 | |
except Exception: | |
tableau = App.activeDocument().addObject('Spreadsheet::Sheet',newSpreadSheetName)# for create SpreadSheet | |
self.on_PB_SpreadSheet_clicked() | |
# try: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Information of element")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+1), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+2), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"________________________")) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (dateEu() + " "+ heure())) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Document name")); tableau.set(self.caseTableau(ligne,colonne+1), document_) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Label of the object")); tableau.set(self.caseTableau(ligne,colonne+1), object_Label) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Internal name of the object")); tableau.set(self.caseTableau(ligne,colonne+1), object_Name) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Element name")); tableau.set(self.caseTableau(ligne,colonne+1), str(subElemName)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Object Type (Shape)")); tableau.set(self.caseTableau(ligne,colonne+1), typeObject) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Object Type")); tableau.set(self.caseTableau(ligne,colonne+1), object_Type) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Mouse coordinates")); tableau.set(self.caseTableau(ligne,colonne+1), u"X"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(position0 * uniteM))); tableau.set(self.caseTableau(ligne,colonne+3), uniteMs); tableau.set(self.caseTableau(ligne,colonne+4),u"Y"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(position1 * uniteM))); tableau.set(self.caseTableau(ligne,colonne+6), uniteMs); tableau.set(self.caseTableau(ligne,colonne+7), u"Z"); tableau.set(self.caseTableau(ligne,colonne+8), str(Around(position2 * uniteM))); tableau.set(self.caseTableau(ligne,colonne+9), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
#### couleurs | |
tableau.set(self.caseTableau(ligne,colonne), (u"Color on selection")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Red")); tableau.set(self.caseTableau(ligne,colonne+1), str(int(diffuseColorRF*255.0))); tableau.set(self.caseTableau(ligne,colonne+2),u"Green"); tableau.set(self.caseTableau(ligne,colonne+3), str(int(diffuseColorVF*255.0))); tableau.set(self.caseTableau(ligne,colonne+4),u"Blue"); tableau.set(self.caseTableau(ligne,colonne+5), str(int(diffuseColorBF*255.0))); tableau.set(self.caseTableau(ligne,colonne+6), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+7), str(int(diffuseColorTF*255.0))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if len(colorShapeFace) != 0: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Object Color (float) ")); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(colorShapeFace[0])); tableau.set(self.caseTableau(ligne,colonne+3), u"Green" ); tableau.set(self.caseTableau(ligne,colonne+4), str(colorShapeFace[1])); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue"); tableau.set(self.caseTableau(ligne,colonne+6), str(colorShapeFace[2])); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(colorShapeFace[3])) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Object Color (int ) ")); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(int(colorShapeFace[0]*255.0))); tableau.set(self.caseTableau(ligne,colonne+3), u"Green" ); tableau.set(self.caseTableau(ligne,colonne+4), str(int(colorShapeFace[1]*255.0))); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue"); tableau.set(self.caseTableau(ligne,colonne+6), str(int(colorShapeFace[2]*255.0))); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(int(colorShapeFace[3]*255.0))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if len(colorShapeLine) != 0: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Object Color (float) ")); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(colorShapeLine[0])); tableau.set(self.caseTableau(ligne,colonne+3), u"Green" ); tableau.set(self.caseTableau(ligne,colonne+4), str(colorShapeLine[1])); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue"); tableau.set(self.caseTableau(ligne,colonne+6), str(colorShapeLine[2])); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(colorShapeLine[3])) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Color Line(s) (int ) ")); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(int(colorShapeLine[0]*255.0))); tableau.set(self.caseTableau(ligne,colonne+3), u"Green" ); tableau.set(self.caseTableau(ligne,colonne+4), str(int(colorShapeLine[1]*255.0))); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue"); tableau.set(self.caseTableau(ligne,colonne+6), str(int(colorShapeLine[2]*255.0))); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(int(colorShapeLine[3]*255.0))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if len(colorShapePoint) != 0: | |
try: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Color Point(s) (float) ")); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(colorShapePoint[0])); tableau.set(self.caseTableau(ligne,colonne+3), u"Green" ); tableau.set(self.caseTableau(ligne,colonne+4), str(colorShapePoint[1])); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue"); tableau.set(self.caseTableau(ligne,colonne+6), str(colorShapePoint[2])); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(colorShapePoint[3])) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Color Point(s) (int ) ")); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(int(colorShapePoint[0]*255.0))); tableau.set(self.caseTableau(ligne,colonne+3), u"Green" ); tableau.set(self.caseTableau(ligne,colonne+4), str(int(colorShapePoint[1]*255.0))); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue"); tableau.set(self.caseTableau(ligne,colonne+6), str(int(colorShapePoint[2]*255.0))); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(int(colorShapePoint[3]*255.0))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
except Exception: | |
None | |
tableau.set(self.caseTableau(ligne,colonne), (typeLongueur)); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(longueurObjet * uniteM))); tableau.set(self.caseTableau(ligne,colonne+2), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if detected[0:4] == "Mesh": | |
tableau.set(self.caseTableau(ligne,colonne), (u"Components Mesh")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"_______________")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Number of Edges")); tableau.set(self.caseTableau(ligne,colonne+1), str(nombreArretesMesh)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Number of Sides")); tableau.set(self.caseTableau(ligne,colonne+1), str(nombreFacesMesh)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Number of points")); tableau.set(self.caseTableau(ligne,colonne+1), str(nombrePointsMesh)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if detected == "<PointKernel object>": | |
tableau.set(self.caseTableau(ligne,colonne), (u"Components Points")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"_________________")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Number of points")); tableau.set(self.caseTableau(ligne,colonne+1), str(nombrePointsMesh)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
#### detail of Cercle | |
if rayonObjet != 0.0: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Object radius")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(rayonObjet * uniteM))); tableau.set(self.caseTableau(ligne,colonne+2), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Shape Perimeter")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(perimetre * uniteM))); tableau.set(self.caseTableau(ligne,colonne+2), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if self.GBox_012_SpreadSheet.isChecked(): | |
#### detail of Cercle BSpline begin | |
if (str(BsplineDetect) == "<BSplineCurve object>"): | |
tableau.set(self.caseTableau(ligne,colonne), (u"Number of nodes")); tableau.set(self.caseTableau(ligne,colonne+1), str(BsplineNombreDeNoeuds)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
for i in enumerate(BsplinePointsCoor): # nombre de points noeuds | |
tableau.set(self.caseTableau(ligne,colonne), (u"Nodes" + str(i[0]))); tableau.set(self.caseTableau(ligne,colonne+1), u"X" + str(i[0] + 1)); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(i[1][0]))); tableau.set(self.caseTableau(ligne,colonne+3), u"Y" + str(i[0] + 1)); tableau.set(self.caseTableau(ligne,colonne+4), str(Around(i[1][1]))); tableau.set(self.caseTableau(ligne,colonne+5), u"Z" + str(i[0] + 1)); tableau.set(self.caseTableau(ligne,colonne+6), str(Around(i[1][2]))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
ligne += 1 | |
#### detail of Cercle BSpline end | |
tableau.set(self.caseTableau(ligne,colonne), (u"Vertexes and details")); tableau.set(self.caseTableau(ligne,colonne+1), u" Number of Edges"); tableau.set(self.caseTableau(ligne,colonne+2), str(compt_E)); tableau.set(self.caseTableau(ligne,colonne+3), u" Number of Faces"); tableau.set(self.caseTableau(ligne,colonne+4), str(compt_F)); tableau.set(self.caseTableau(ligne,colonne+5), u" Number Vertexes faces"); tableau.set(self.caseTableau(ligne,colonne+6), str(compt_VF)); tableau.set(self.caseTableau(ligne,colonne+7), u" Détail Total"); tableau.set(self.caseTableau(ligne,colonne+8), str(RowCountTest)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
co = 0 | |
aa = 0 | |
for j in enumerate(Edges): | |
tableau.set(self.caseTableau(ligne,colonne), (str(j[1]) + (str(Around(float(EdgesLong[co]) * float(uniteM)))))); tableau.set(self.caseTableau(ligne,colonne+1), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
co+=1 | |
for a in range(aa,aa+6): | |
try: | |
chaine = str(Vertx[a]).split(":") | |
tableau.set(self.caseTableau(ligne,colonne), (chaine[0])); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(float(chaine[1]) * float(uniteM)))); tableau.set(self.caseTableau(ligne,colonne+2), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
except Exception: | |
None | |
aa += 6 | |
ligne += 1 | |
ligne += 1 | |
co = 0 | |
cco = 0 | |
co2 = 0 | |
for j in enumerate(Faces): | |
tableau.set(self.caseTableau(ligne,colonne), str(j[1])); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(float(FacesSurf[co]) * float(uniteS)))); tableau.set(self.caseTableau(ligne,colonne+2), uniteSs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
co += 1 | |
if len(colorShapeFaceDiffuseColor) != 0: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Float color Face" + str(j[0]+1))); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(colorShapeFaceDiffuseColor[j[0]][0])); tableau.set(self.caseTableau(ligne,colonne+3), u"Green "); tableau.set(self.caseTableau(ligne,colonne+4), str(colorShapeFaceDiffuseColor[j[0]][1])); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue "); tableau.set(self.caseTableau(ligne,colonne+6), str(colorShapeFaceDiffuseColor[j[0]][2])); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(colorShapeFaceDiffuseColor[j[0]][3])) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Integer color Face" + str(j[0]+1))); tableau.set(self.caseTableau(ligne,colonne+1), u"Red"); tableau.set(self.caseTableau(ligne,colonne+2), str(int(colorShapeFaceDiffuseColor[j[0]][0]*255.0))); tableau.set(self.caseTableau(ligne,colonne+3), u"Green "); tableau.set(self.caseTableau(ligne,colonne+4), str(int(colorShapeFaceDiffuseColor[j[0]][1]*255.0))); tableau.set(self.caseTableau(ligne,colonne+5), u"Blue "); tableau.set(self.caseTableau(ligne,colonne+6), str(int(colorShapeFaceDiffuseColor[j[0]][2]*255.0))); tableau.set(self.caseTableau(ligne,colonne+7), u"Transparency"); tableau.set(self.caseTableau(ligne,colonne+8), str(int(colorShapeFaceDiffuseColor[j[0]][3]*255.0))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
for jj in range(cco,len(FacesCoor)):# Faces coordinates | |
cco+=1 | |
if FacesCoor[jj] == "T": | |
ligne += 1 | |
break | |
else: | |
chaine = str(FacesCoor[jj]).split(":") | |
tableau.set(self.caseTableau(ligne,colonne), (chaine[0])); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(float(chaine[1]) * float(uniteM)))); tableau.set(self.caseTableau(ligne,colonne+2), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
co2 += 1 | |
if co2 == 3: | |
ligne += 1 | |
co2 = 0 | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Plane")); tableau.set(self.caseTableau(ligne,colonne+1), u" XY:"); tableau.set(self.caseTableau(ligne,colonne+2), self.LE_8xy.text()); tableau.set(self.caseTableau(ligne,colonne+3), u" coordinates:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Plan_xy_V)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Plane")); tableau.set(self.caseTableau(ligne,colonne+1), u" YZ:"); tableau.set(self.caseTableau(ligne,colonne+2), self.LE_8yz.text()); tableau.set(self.caseTableau(ligne,colonne+3), u" coordinates:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Plan_yz_V)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Plane")); tableau.set(self.caseTableau(ligne,colonne+1), u" ZX:"); tableau.set(self.caseTableau(ligne,colonne+2), self.LE_8zx.text()); tableau.set(self.caseTableau(ligne,colonne+3), u" coordinates:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Plan_zx_V)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Shape area")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(surface * uniteS))); tableau.set(self.caseTableau(ligne,colonne+2), uniteSs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Face area")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(surfaceFace * uniteS))); tableau.set(self.caseTableau(ligne,colonne+2), uniteSs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Volume of the form")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(volume_ * uniteV))); tableau.set(self.caseTableau(ligne,colonne+2), uniteVs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Mass")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(poids))); tableau.set(self.caseTableau(ligne,colonne+2), unitePs); tableau.set(self.caseTableau(ligne,colonne+3), u" Density:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Around(seTDensiteValue))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Shape center")); tableau.set(self.caseTableau(ligne,colonne+1), u" X:"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(boundBoxCenterX * uniteM))); tableau.set(self.caseTableau(ligne,colonne+3), uniteMs); tableau.set(self.caseTableau(ligne,colonne+4), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(boundBoxCenterY * uniteM))); tableau.set(self.caseTableau(ligne,colonne+6), uniteMs); tableau.set(self.caseTableau(ligne,colonne+7), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+8), str(Around(boundBoxCenterZ * uniteM))); tableau.set(self.caseTableau(ligne,colonne+9), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Center of mass")); tableau.set(self.caseTableau(ligne,colonne+1), u" X:"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(CenterOfMassX * uniteM))); tableau.set(self.caseTableau(ligne,colonne+3), uniteMs); tableau.set(self.caseTableau(ligne,colonne+4), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(CenterOfMassY * uniteM))); tableau.set(self.caseTableau(ligne,colonne+6), uniteMs); tableau.set(self.caseTableau(ligne,colonne+7), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+8), str(Around(CenterOfMassZ * uniteM))); tableau.set(self.caseTableau(ligne,colonne+9), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Overall dimensions")); tableau.set(self.caseTableau(ligne,colonne+1), u" X:"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(boundBoxLX * uniteM))); tableau.set(self.caseTableau(ligne,colonne+3), uniteMs); tableau.set(self.caseTableau(ligne,colonne+4), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(boundBoxLY * uniteM))); tableau.set(self.caseTableau(ligne,colonne+6), uniteMs); tableau.set(self.caseTableau(ligne,colonne+7), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+8), str(Around(boundBoxLZ * uniteM))); tableau.set(self.caseTableau(ligne,colonne+9), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Diagonal dimensions")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(boundBoxDiag * uniteM))); tableau.set(self.caseTableau(ligne,colonne+2), uniteMs) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if directionObj != "[]": | |
tableau.set(self.caseTableau(ligne,colonne), (u"Direction")); tableau.set(self.caseTableau(ligne,colonne+1), u" X:"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(directionObj[0]))); tableau.set(self.caseTableau(ligne,colonne+3), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Around(directionObj[1]))); tableau.set(self.caseTableau(ligne,colonne+5), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+6), str(Around(directionObj[2]))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if direcValueAt != "[]": | |
tableau.set(self.caseTableau(ligne,colonne), (u"ValueAt")); tableau.set(self.caseTableau(ligne,colonne+1), u" X:"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(direcValueAt[0]))); tableau.set(self.caseTableau(ligne,colonne+3), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Around(direcValueAt[1]))); tableau.set(self.caseTableau(ligne,colonne+5), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+6), str(Around(direcValueAt[2]))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
if direcNormalAt != "[]": | |
tableau.set(self.caseTableau(ligne,colonne), (u"NormalAt")); tableau.set(self.caseTableau(ligne,colonne+1), u" X:"); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(direcNormalAt[0]))); tableau.set(self.caseTableau(ligne,colonne+3), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+4), str(Around(direcNormalAt[1]))); tableau.set(self.caseTableau(ligne,colonne+5), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+6), str(Around(direcNormalAt[2]))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
ligne += 1 | |
if detected[0:4] == "Mesh": | |
None | |
else: | |
tableau.set(self.caseTableau(ligne,colonne), (u"Matrix of inertia")); tableau.set(self.caseTableau(ligne,colonne+1), uniteMs + "^" + str(setMomentOfInertia_16)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" Raw:")); tableau.set(self.caseTableau(ligne,colonne+1), str(MatrixOfInertiaRaw)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(MatrixX1_16))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(MatrixY1_16))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(MatrixZ1_16))); tableau.set(self.caseTableau(ligne,colonne+6), u" :"); tableau.set(self.caseTableau(ligne,colonne+7), str(Around(Matrix_1))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(MatrixX2_16))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(MatrixY2_16))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(MatrixZ2_16))); tableau.set(self.caseTableau(ligne,colonne+6), u" :"); tableau.set(self.caseTableau(ligne,colonne+7), str(Around(Matrix_2))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(MatrixX3_16))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(MatrixY3_16))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(MatrixZ3_16))); tableau.set(self.caseTableau(ligne,colonne+6), u" :"); tableau.set(self.caseTableau(ligne,colonne+7), str(Around(Matrix_3))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(Matrix12))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(Matrix13))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(Matrix14))); tableau.set(self.caseTableau(ligne,colonne+6), u" :"); tableau.set(self.caseTableau(ligne,colonne+7), str(Around(Matrix15))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Matrix inertia massique")); tableau.set(self.caseTableau(ligne,colonne+1), unitePs + uniteSs + "^" + str(setMomentOfInertiaMassique_17)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(MatrixX1_17))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(MatrixY1_17))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(MatrixZ1_17))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(MatrixX2_17))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(MatrixY2_17))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(MatrixZ2_17))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u" X:")); tableau.set(self.caseTableau(ligne,colonne+1), str(Around(MatrixX3_17))); tableau.set(self.caseTableau(ligne,colonne+2), u" Y:"); tableau.set(self.caseTableau(ligne,colonne+3), str(Around(MatrixY3_17))); tableau.set(self.caseTableau(ligne,colonne+4), u" Z:"); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(MatrixZ3_17))) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Matrix Determinant")); tableau.set(self.caseTableau(ligne,colonne+1), str(DeterminantM)) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Decimal Determinant")); tableau.set(self.caseTableau(ligne,colonne+1), str(decimal.Decimal(DeterminantM))) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
materiel = materialAssociated[seTMaterialCurrentIndex].rstrip().split(",") | |
nomMateriel = materiel[0] | |
densitexMateriel= str(Around(float(materiel[1]))) | |
prixMateriel = str(Around(float(materiel[2]))) | |
infoMateriel = materiel[3] | |
tableau.set(self.caseTableau(ligne,colonne), (u"Material")) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"Name")); tableau.set(self.caseTableau(ligne,colonne+1), u"Density"); tableau.set(self.caseTableau(ligne,colonne+2), u"Volume"); tableau.set(self.caseTableau(ligne,colonne+3), u"Unit"); tableau.set(self.caseTableau(ligne,colonne+4), u"Price (kg/dm3)"); tableau.set(self.caseTableau(ligne,colonne+5), u"Total cost"); tableau.set(self.caseTableau(ligne,colonne+6), u"Devise"); tableau.set(self.caseTableau(ligne,colonne+7), u"Info") | |
tableau.setBackground(self.caseTableau(ligne,colonne) , (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+1), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+2), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+3), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+4), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+5), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+6), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+7), (TextColorText_R, TextColorText_G, TextColorText_B, TextColorText_L)) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (nomMateriel)); tableau.set(self.caseTableau(ligne,colonne+1), densitexMateriel); tableau.set(self.caseTableau(ligne,colonne+2), str(Around(volume_ * uniteV))); tableau.set(self.caseTableau(ligne,colonne+3), uniteVs); tableau.set(self.caseTableau(ligne,colonne+4), prixMateriel); tableau.set(self.caseTableau(ligne,colonne+5), str(Around(seTMaterialCost))); tableau.set(self.caseTableau(ligne,colonne+6), seTMaterialSuffixCost); tableau.set(self.caseTableau(ligne,colonne+7), infoMateriel) | |
ligne += 1 | |
tableau.set(self.caseTableau(ligne,colonne), (u"End ")); tableau.set(self.caseTableau(ligne,colonne+1), document_); tableau.set(self.caseTableau(ligne,colonne+2), object_Label) | |
tableau.setBackground(self.caseTableau(ligne,colonne), (0.9372549019607843, 0.1607843137254902, 0.1607843137254902, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+1), (0.9372549019607843, 0.1607843137254902, 0.1607843137254902, TextColorText_L)) | |
tableau.setBackground(self.caseTableau(ligne,colonne+2), (0.9372549019607843, 0.1607843137254902, 0.1607843137254902, TextColorText_L)) | |
ligne += 1 | |
tableau.recompute() | |
# except Exception: | |
# App_Console_PrintMessage(u"Erreur d'enregistrement du fichier " + SaveName) | |
# errorDialog(u"Erreur d'enregistrement du fichier " + SaveName) | |
#### Spreadsheet Fin ################################################################################################ | |
def on_PB_04_Quit(self): # Exit button | |
global ui | |
global path | |
global infoFaceMesh | |
global switchNotInfoOnBeginning | |
global switchVersionSearch | |
global switchWarning | |
global switchCreatePoint | |
global switchCreateAxis | |
global switchCreatePlane | |
global switchDisplayInfoObject | |
global switchClearDisplayReportView | |
global seTWidgetPosition | |
global switchBoundBoxCreateText | |
global seTBoundBoxTextHeigth | |
global seTBoundBoxTextArround | |
global seTMemoClipBoard | |
global seTTextHeigthValue | |
global seTDecimalValue | |
global seTMaterialCurrentIndex | |
global seTMaterialFileName | |
global seTMaterialSavePathName | |
global seTDensiteValue | |
global seTDensiteDecimalNumber | |
global seTDensiteSingleStep | |
global seTDensiteSuffixChain | |
global seTPositionFlyRightLeft | |
global materialAssociated | |
global seTMaterialPrice | |
global seTMaterialSuffixDevise | |
global seTMaterialSuffixCost | |
global seTMaterialCost | |
global seTIndexUnitWeight | |
global seTIndexUnitLength | |
global seTUnitSymbolMicro | |
global seTUnitSymbolCube | |
global seTUnitSymbolCarre | |
global setPathLatestDirectory | |
global switchQFileDialogMint | |
global setMeshTopologyValue | |
global setBSplineToByArcValue | |
global switchBSplineCreateCircleConstructorAxis | |
global switchBSplineCreateCircleConstructor | |
global switchCreateLineDiVatNatOnClick | |
global FreeCAD_ParamGetSet | |
#### Write Configuration begin #### | |
FreeCAD_ParamGetSet.SetBool(u"switchNotInfoOnBeginning", switchNotInfoOnBeginning) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchVersionSearch", switchVersionSearch) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchWarning", switchWarning) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchCreatePoint", switchCreatePoint) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchCreateAxis", switchCreateAxis) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchCreatePlane", switchCreatePlane) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchDisplayInfoObject", switchDisplayInfoObject) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchClearDisplayReportView", switchClearDisplayReportView)#*True or False | |
FreeCAD_ParamGetSet.SetBool(u"seTWidgetPosition", seTWidgetPosition) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchBoundBoxCreateText", switchBoundBoxCreateText) # True or False | |
FreeCAD_ParamGetSet.SetFloat(u"seTBoundBoxTextHeigth", seTBoundBoxTextHeigth) # 3.0 | |
FreeCAD_ParamGetSet.SetInt(u"seTBoundBoxTextArround", seTBoundBoxTextArround) # 3 | |
FreeCAD_ParamGetSet.SetInt(u"seTMemoClipBoard", seTMemoClipBoard) # 0, 1, 2 | |
FreeCAD_ParamGetSet.SetInt(u"seTTextHeigthValue", seTTextHeigthValue) # 11 | |
FreeCAD_ParamGetSet.SetInt(u"seTDecimalValue", seTDecimalValue) # 4 | |
FreeCAD_ParamGetSet.SetInt(u"seTMaterialCurrentIndex", seTMaterialCurrentIndex) # 0 | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialFileName", seTMaterialFileName) # "FCInfo_material.txt" | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialSavePathName", seTMaterialSavePathName) # "C:\...\Macro\FCInfo_material.txt" | |
FreeCAD_ParamGetSet.SetFloat(u"seTMaterialPrice", seTMaterialPrice) # x | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialSuffixDevise", seTMaterialSuffixDevise) # " Eu (By Kg)# Suffix device | |
FreeCAD_ParamGetSet.SetString(u"seTMaterialSuffixCost", seTMaterialSuffixCost) # " Eu # Suffix cost | |
FreeCAD_ParamGetSet.SetFloat(u"seTMaterialCost", seTMaterialCost) # x | |
FreeCAD_ParamGetSet.SetFloat(u"seTDensiteValue", seTDensiteValue) # 1.0 | |
FreeCAD_ParamGetSet.SetInt(u"seTDensiteDecimalNumber", seTDensiteDecimalNumber) # 4 | |
FreeCAD_ParamGetSet.SetFloat(u"seTDensiteSingleStep", seTDensiteSingleStep) # 1.0 | |
FreeCAD_ParamGetSet.SetString(u"seTDensiteSuffixChain", seTDensiteSuffixChain) # " kg (by dm3)" | |
FreeCAD_ParamGetSet.SetInt(u"seTPositionFlyRightLeft", seTPositionFlyRightLeft) # 1, 2, other | |
#FreeCAD_ParamGetSet.SetInt(u"seTIndexUnitWeight", seTIndexUnitWeight) # x | |
#FreeCAD_ParamGetSet.SetInt(u"seTIndexUnitLength", seTIndexUnitLength) # x | |
FreeCAD_ParamGetSet.SetString(u"seTUnitSymbolMicro", seTUnitSymbolMicro) # "U" | |
FreeCAD_ParamGetSet.SetString(u"seTUnitSymbolCube", seTUnitSymbolCube) # "3" | |
FreeCAD_ParamGetSet.SetString(u"seTUnitSymbolCarre", seTUnitSymbolCarre) # "2" | |
FreeCAD_ParamGetSet.SetBool("switchQFileDialogMint", switchQFileDialogMint) # Special Mint | |
FreeCAD_ParamGetSet.SetString(u"setPathLatestDirectory", setPathLatestDirectory) # "C:\ ???" | |
FreeCAD_ParamGetSet.SetFloat(u"setBSplineToByArcValue", setBSplineToByArcValue) # 0.00001 | |
FreeCAD_ParamGetSet.SetFloat(u"setMeshTopologyValue", setMeshTopologyValue) # 0.1 | |
FreeCAD_ParamGetSet.SetBool(u"switchBSplineCreateCircleConstructorAxis", switchBSplineCreateCircleConstructorAxis)# True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchBSplineCreateCircleConstructor", switchBSplineCreateCircleConstructor) # True or False | |
FreeCAD_ParamGetSet.SetBool(u"switchCreateLineDiVatNatOnClick", switchCreateLineDiVatNatOnClick) # True or False | |
#### Write Configuration end #### | |
#### save the material begin #### | |
ui.on_PB_Save_Material_clicked() # save material | |
#### save the material end #### | |
App_Console_PrintMessage(u"End FCInfo\r\n") | |
try: | |
Gui.ActiveDocument.ActiveView.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), infoFaceMesh) | |
except Exception: | |
None | |
FreeCADGui.Selection.removeObserver(s) # Uninstalls resident function (desactivated for read after LeftDock RightDock) | |
try: | |
self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # destroy | |
self.window.deleteLater() # destroy | |
self.window.destroy() # destroy | |
except Exception: | |
self.window.hide() | |
None | |
######################################################################################################################### | |
class SelObserver: | |
def addSelection(self,document, object, element, position): # Selection | |
global ui | |
global sel | |
global document_ | |
global object_Label | |
global subElemName | |
global position0 | |
global position1 | |
global position2 | |
global switchInertia | |
global infoFaceMesh | |
global switch_setVisible_GBox_001_Document # | |
global switch_setVisible_GBox_002_Coordinate_Mouse # | |
global switch_setVisible_GBox_003_Color | |
global switch_setVisible_GBox_004_Object_Mesh | |
global switch_setVisible_GBox_005_Value_Unit | |
global switch_setVisible_GBox_006_Inclination | |
global switch_setVisible_GBox_007_Surface_and_Volume | |
global switch_setVisible_GBox_008_Cost_And_Price | |
global switch_setVisible_GBox_009_BoundBox | |
global switch_setVisible_GBox_010_Center_Mass | |
global switch_setVisible_GBox_011_Inertia | |
global switch_setVisible_GBox_012_SpreadSheet | |
global switch_setVisible_GBox_013_SpreadSheet_Creation | |
global switch_setVisible_GBox_014_Main_Tools # | |
if switchInertia == 0: # for create plane without refresh | |
sel = FreeCADGui.Selection.getSelection() | |
document_ = document | |
object_Label = object | |
subElemName = element | |
position0 = (position[0]) | |
position1 = (position[1]) | |
position2 = (position[2]) | |
if len(sel)==0: | |
App_Console_PrintMessage(u"Select an object" + "\n") | |
errorDialog(u"Select an object") | |
else: | |
# ui.on_PB_01_Refrech_clicked() | |
####Special_Sketcher | |
try: | |
sketch = Gui.Selection.getSelection()[0] | |
except Exception: None | |
#print(sketch.TypeId) | |
App.ActiveDocument.recompute() | |
if (Gui.ActiveDocument.getInEdit() and (sketch.TypeId == "Sketcher::SketchObject")): # sketcher open | |
ui.LE_5.setStyleSheet(u"QLineEdit {color : QPalette.Base}") # origin system | |
nameSketch = sketch.Name | |
ui.GBox_004_Object_Mesh.setVisible(False) | |
ui.GBox_003_Color.setEnabled(False) | |
ui.GBox_012_SpreadSheet.setEnabled(False) | |
ui.GBox_007_Surface_and_Volume.setEnabled(False) | |
ui.GBox_008_Cost_And_Price.setEnabled(False) | |
ui.GBox_009_BoundBox.setEnabled(False) | |
ui.GBox_010_Center_Mass.setEnabled(False) | |
ui.GBox_011_Inertia.setEnabled(False) | |
ui.GBox_013_SpreadSheet_Creation.setEnabled(False) | |
if "Constraint" in subElemName: | |
ui.LE_5.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: red}") # constraint | |
else: | |
try: | |
indexSubObject = int(subElemName[4:]) - 1 # index | |
if App.ActiveDocument.getObject(nameSketch).getConstruction(indexSubObject): | |
ui.LE_5.setStyleSheet(u"QLineEdit {border-width: 2px; border-style: solid; border-color: blue}") # construction | |
except Exception: | |
None | |
elif sketch.TypeId == "Mesh::Feature": # Mesh | |
#infoFaceMesh = Gui.ActiveDocument.ActiveView.addEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), getNormal) | |
# ui.on_ZeroInfo() | |
if switch_setVisible_GBox_004_Object_Mesh == True: | |
ui.GBox_004_Object_Mesh.setVisible(True) | |
ui.LA_N_Edges.setEnabled(True) | |
ui.LA_N_Facets.setEnabled(True) | |
ui.LE_N_Edges.setEnabled(True) | |
ui.LE_N_Facets.setEnabled(True) | |
if switch_setVisible_GBox_005_Value_Unit == True: | |
ui.GBox_005_Value_Unit.setVisible(True) | |
if switch_setVisible_GBox_006_Inclination == True: | |
ui.GBox_006_Inclination.setVisible(True) | |
if switch_setVisible_GBox_007_Surface_and_Volume == True: | |
ui.GBox_007_Surface_and_Volume.setVisible(True) | |
if switch_setVisible_GBox_008_Cost_And_Price == True: | |
ui.GBox_008_Cost_And_Price.setVisible(True) | |
if switch_setVisible_GBox_009_BoundBox == True: | |
ui.GBox_009_BoundBox.setVisible(True) | |
if switch_setVisible_GBox_010_Center_Mass == True: | |
ui.GBox_010_Center_Mass.setVisible(True) | |
ui.LE_14x.setEnabled(True) | |
ui.LE_14y.setEnabled(True) | |
ui.LE_14z.setEnabled(True) | |
if switch_setVisible_GBox_011_Inertia == True: | |
ui.GBox_011_Inertia.setVisible(False) | |
if switch_setVisible_GBox_012_SpreadSheet == True: | |
ui.GBox_012_SpreadSheet.setVisible(False) | |
#ui.GBox_013_SpreadSheet_Creation.setEnabled(False) | |
ui.on_ZeroInfo() | |
elif sketch.TypeId == "Points::FeatureCustom": # Points | |
if switch_setVisible_GBox_004_Object_Mesh == True: | |
ui.GBox_004_Object_Mesh.setVisible(True) | |
ui.LA_N_Edges.setEnabled(False) | |
ui.LA_N_Facets.setEnabled(False) | |
ui.LE_N_Edges.setEnabled(False) | |
ui.LE_N_Facets.setEnabled(False) | |
ui.GBox_005_Value_Unit.setVisible(False) | |
ui.GBox_006_Inclination.setVisible(False) | |
ui.GBox_007_Surface_and_Volume.setVisible(False) | |
ui.GBox_008_Cost_And_Price.setVisible(False) | |
ui.GBox_011_Inertia.setVisible(False) | |
ui.GBox_012_SpreadSheet.setVisible(False) | |
ui.GBox_013_SpreadSheet_Creation.setVisible(False) | |
ui.LE_14x.setEnabled(False) | |
ui.LE_14y.setEnabled(False) | |
ui.LE_14z.setEnabled(False) | |
ui.on_ZeroInfo() | |
else: | |
if switch_setVisible_GBox_003_Color == True: | |
ui.GBox_003_Color.setVisible(True) | |
ui.GBox_003_Color.setEnabled(True) | |
ui.GBox_004_Object_Mesh.setVisible(False) | |
if switch_setVisible_GBox_005_Value_Unit == True: | |
ui.GBox_005_Value_Unit.setVisible(True) | |
ui.GBox_005_Value_Unit.setEnabled(True) | |
ui.LE_5.setStyleSheet(u"QLineEdit {color : QPalette.Base}") # origin system | |
if switch_setVisible_GBox_006_Inclination == True: | |
ui.GBox_006_Inclination.setVisible(True) | |
ui.GBox_006_Inclination.setEnabled(True) | |
if switch_setVisible_GBox_007_Surface_and_Volume == True: | |
ui.GBox_007_Surface_and_Volume.setVisible(True) | |
ui.GBox_007_Surface_and_Volume.setEnabled(True) | |
if switch_setVisible_GBox_008_Cost_And_Price == True: | |
ui.GBox_008_Cost_And_Price.setVisible(True) | |
ui.GBox_008_Cost_And_Price.setEnabled(True) | |
if switch_setVisible_GBox_009_BoundBox == True: | |
ui.GBox_009_BoundBox.setVisible(True) | |
ui.GBox_009_BoundBox.setEnabled(True) | |
if switch_setVisible_GBox_010_Center_Mass == True: | |
ui.GBox_010_Center_Mass.setVisible(True) | |
ui.GBox_010_Center_Mass.setEnabled(True) | |
ui.LE_14x.setEnabled(True) | |
ui.LE_14x.setEnabled(True) | |
ui.LE_14y.setEnabled(True) | |
ui.LE_14y.setEnabled(True) | |
ui.LE_14z.setEnabled(True) | |
ui.LE_14z.setEnabled(True) | |
if switch_setVisible_GBox_011_Inertia == True: | |
ui.GBox_011_Inertia.setVisible(True) | |
ui.GBox_011_Inertia.setEnabled(True) | |
if switch_setVisible_GBox_012_SpreadSheet == True: | |
try: | |
ui.GBox_012_SpreadSheet.setVisible(True) | |
ui.GBox_012_SpreadSheet.setEnabled(True) | |
except Exception: | |
None | |
if switch_setVisible_GBox_013_SpreadSheet_Creation == True: | |
ui.GBox_013_SpreadSheet_Creation.setVisible(True) | |
ui.GBox_013_SpreadSheet_Creation.setEnabled(True) | |
####SpecialSketcher | |
ui.on_PB_01_Refrech_clicked() | |
else: | |
ui.GBox_012_SpreadSheet | |
ui.GBox_012_SpreadSheet.setTitle(u"Details of the form") | |
####SpecialSketcher | |
########################################################################################################################## | |
if switchNotInfoOnBeginning == 0: # 0 =display the info | |
App_Console_PrintMessage(u"____________________________________" + "\n") | |
App_Console_PrintMessage(u"#### FCInfo Configuration begin ####" + "\n") | |
App_Console_PrintMessage(u"####" + "\n") | |
App_Console_PrintMessage(u"\t" + "**** Location ****" + "\n") | |
App_Console_PrintMessage(u"User parameter:BaseApp/Preferences/Macros/FCMmacros/FCInfo/" + "\n") | |
App_Console_PrintMessage(u"####" + "\n\n") | |
App_Console_PrintMessage(u"switchNotInfoOnBeginning # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Display or not this text information on run macro" + "\n") | |
App_Console_PrintMessage(u"\t\t" + "[False] = display this information" + "\n") | |
App_Console_PrintMessage(u"\t\t" + " True = this Information is Not displayed On Beginning" + "\n\n") | |
App_Console_PrintMessage(u"switchVersionSearch # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Search if one new version exist on run macro" + "\n\n") | |
App_Console_PrintMessage(u"switchWarning # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Display or not display the window warning in case not good selection" + "\n\n") | |
App_Console_PrintMessage(u"switchCreatePoint # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Check the Create point checkBox" + "\n\n") | |
App_Console_PrintMessage(u"switchCreateAxis # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Check the Create axis checkBox" + "\n\n") | |
App_Console_PrintMessage(u"switchCreatePlane # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Check the Create plane checkBox" + "\n\n") | |
App_Console_PrintMessage(u"switchDisplayInfoObject # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Check the info checkBox" + "\n\n") | |
App_Console_PrintMessage(u"switchClearDisplayReportView# SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "if switchClearDisplayReportView is TRUE the ReportView is cleared" + "\n\n") | |
App_Console_PrintMessage(u"seTWidgetPosition # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Check the Widget Position Left/Right checkBox" + "\n") | |
App_Console_PrintMessage(u"\t" + "if seTWidgetPosition [False] : if seTPositionFlyRightLeft = 2 = docked to Right" + "\n") | |
App_Console_PrintMessage(u"\t" + "if seTWidgetPosition True : if seTPositionFlyRightLeft = 3 = docked to Left" + "\n") | |
App_Console_PrintMessage(u"\t" + "if it is 1 the window macro is not docked" + "\n\n") | |
App_Console_PrintMessage(u"switchBoundBoxCreateText # SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Create the text dimension of the BoundBox" + "\n\n") | |
App_Console_PrintMessage(u"seTBoundBoxTextHeigth # seTBoundBoxTextHeigth = 3.0" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give the Heigth of the text dimension (independent of the seTTextHeigthValue)" + "\n\n") | |
App_Console_PrintMessage(u"seTBoundBoxTextArround # seTBoundBoxTextArround = 3" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give the arround of the text dimensions (independent of the seTDecimalValue)" + "\n\n") | |
App_Console_PrintMessage(u"seTMemoClipBoard # SetInt [0], 1, 2, 3" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give one value [0], 1, 2, 3 clipBoard" + "\n") | |
App_Console_PrintMessage(u"\t\t" + "[0] = desactivate the clipBoard" + "\n") | |
App_Console_PrintMessage(u"\t\t" + " 1 = the data string is memorised to : FreeCAD.Vector( X, Y, Z )" + "\n") | |
App_Console_PrintMessage(u"\t\t" + " 2 = the data string is memorised to : X, Y, Z" + "\n") | |
App_Console_PrintMessage(u"\t\t" + " 3 = the data string is memorised to : X Y Z" + "\n\n") | |
App_Console_PrintMessage(u"seTTextHeigthValue # SetInt 11" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give one text heigth value of the macro" + "\n\n") | |
App_Console_PrintMessage(u"seTDecimalValue # SetInt 4" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give the number of decimal displayed" + "\n") | |
App_Console_PrintMessage(u"\t" + "If the number is -1 the total decimal value is displayed)" + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialCurrentIndex # SetInt 0" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set the index of the ComboBox" + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialFileName # SetString FCInfo_material.txt" + "\n") | |
App_Console_PrintMessage(u"\t" + "Name of the material file" + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialSavePathName # SetString C:\...\Macro\FCInfo_material.txt" + "\n") | |
App_Console_PrintMessage(u"\t" + "Path name of the material file" + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialPrice # SetFloat" + "\n") | |
App_Console_PrintMessage(u"\t" + "Material price by Kg " + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialSuffixDevise # SetString" + "\n") | |
App_Console_PrintMessage(u"\t" + "Devise money" + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialSuffixCost # seTMaterialSuffixCost" + "\n") | |
App_Console_PrintMessage(u"\t" + "Suffix Devise cost" + "\n\n") | |
App_Console_PrintMessage(u"seTMaterialCost # SetFloat" + "\n") | |
App_Console_PrintMessage(u"\t" + "Material cost" + "\n\n") | |
App_Console_PrintMessage(u"seTDensiteValue # SetFloat 1.0" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give the densite value" + "\n\n") | |
App_Console_PrintMessage(u"seTDensiteDecimalNumber # SetInt 4" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give the number of decimal for the densite value" + "\n\n") | |
App_Console_PrintMessage(u"seTDensiteSingleStep # SetFloat 1.0" + "\n") | |
App_Console_PrintMessage(u"\t" + "Give the step for one click, by default 1.0 (possible 0.01 or ...)" + "\n\n") | |
App_Console_PrintMessage(u"seTDensiteSuffixChain # SetString kg (by dm3)" + "\n") | |
App_Console_PrintMessage(u"\t" + "Choice your suffix string" + "\n\n") | |
App_Console_PrintMessage(u"seTPositionFlyRightLeft # SetInt 2" + "\n") | |
App_Console_PrintMessage(u"\t" + "Choice your position, Fly, [Right], Left" + "\n") | |
App_Console_PrintMessage(u"\t\t" + " 1 = the macro window is fly (not docked)" + "\n") | |
App_Console_PrintMessage(u"\t\t" + "[2] = the macro window is positionned to Right" + "\n") | |
App_Console_PrintMessage(u"\t\t" + " 3 or other = the macro window is positionned to Left" + "\n") | |
App_Console_PrintMessage(u"seTIndexUnitWeight # SetInt" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set unit Mass index" + "\n\n") | |
App_Console_PrintMessage(u"seTUnitSymbolMicro # U" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set Symbol Micro" + "\n\n") | |
App_Console_PrintMessage(u"seTUnitSymbolCube # 3" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set Symbol Cube" + "\n\n") | |
App_Console_PrintMessage(u"seTUnitSymbolCarre # 2" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set Symbol Square" + "\n\n") | |
App_Console_PrintMessage(u"seTIndexUnitLength # SetInt" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set unit Length index" + "\n\n") | |
App_Console_PrintMessage(u"setBSplineToByArcValue # SetFloat 0.00001" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set unit for cut the BSpline for seack the radius on point given" + "\n\n") | |
App_Console_PrintMessage(u"setMeshTopologyValue # SetFloat 0.1" + "\n") | |
App_Console_PrintMessage(u"\t" + "Set unit for create the Mesh to Shape" + "\n\n") | |
App_Console_PrintMessage(u"switchBSplineCreateCircleConstructorAxis #SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Display the axis of the circles (arcs) for create the BSpline" + "\n\n") | |
App_Console_PrintMessage(u"switchBSplineCreateCircleConstructor #SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Display the circles cretors for create the BSpline" + "\n\n") | |
App_Console_PrintMessage(u"switchCreateLineDiVatNatOnClick #SetBool True or [False]" + "\n") | |
App_Console_PrintMessage(u"\t" + "Create the Line info on point (0,0,0) or on point mouse clicked (x,y,z) if it is True" + "\n") | |
App_Console_PrintMessage(u"\t" + "If it is True one '*' is displayed in front of text. EX: '*Direction'" + "\n\n") | |
#### | |
App_Console_PrintMessage(u"#### section GroupBox begin" + "\n") | |
App_Console_PrintMessage(u"This switch hidde or display the GroupBox concerned " + "\n\n") | |
App_Console_PrintMessage(u"All operation of research info and calcul not change only the cosmetic hidden/display is visual" + "\n\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_001_Document # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_002_Coordinate_Mouse # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_003_Color # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_004_Object_Mesh # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_005_Value_Unit # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_006_Inclination # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_007_Surface_and_Volume # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_008_Cost_And_Price # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_009_BoundBox # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_010_Center_Mass # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_011_Inertia # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_012_SpreadSheet # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_013_SpreadSheet_Creation # [True] or False " + "\n") | |
App_Console_PrintMessage(u"switch_setVisible_GBox_014_Main_Tools # [True] or False " + "\n") | |
App_Console_PrintMessage(u"#### section GroupBox end" + "\n\n") | |
#### | |
App_Console_PrintError(u"####FCinfo Warning####################################################" + "\n") | |
App_Console_PrintError(u"## Matrix of inertia ##" + "\n") | |
App_Console_PrintError(u"## Verify this section by person knowing the inertia position ##" + "\n") | |
App_Console_PrintError(u"## ONLY IF THE OBJECT IS PRESENT IN ONE BODY ##" + "\n") | |
App_Console_PrintError(u"## and post your knowledges in the forum tread if it is not correct ##" + "\n") | |
App_Console_PrintError(u"## http://forum.freecadweb.org/viewtopic.php?f=10&t=3185 ##" + "\n") | |
App_Console_PrintError(u"######################################################################" + "\n\n") | |
App_Console_PrintError(u"###########################################################################" + "\n") | |
App_Console_PrintError(u"** **" + "\n") | |
App_Console_PrintError(u"* Use at your own risk. The author assumes no liability for data loss. *" + "\n") | |
App_Console_PrintError(u"* It is advised to backup your data frequently. *" + "\n") | |
App_Console_PrintError(u"* If you do not trust the software do not use it. *" + "\n") | |
App_Console_PrintError(u"** **" + "\n") | |
App_Console_PrintError(u"###########################################################################" + "\n\n") | |
App_Console_PrintMessage(u"#### FCInfo Configuration end ####" + "\n") | |
App_Console_PrintMessage(u"__________________________________" + "\n\n") | |
#### | |
doc = FreeCAD.activeDocument() | |
if doc == None: | |
doc = FreeCAD.newDocument(u"FCInfo") | |
Gui.Selection.clearSelection() | |
#sel = FreeCADGui.Selection.getSelection() | |
try: | |
infoFaceMesh = Gui.ActiveDocument.ActiveView.addEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), getNormal) | |
except Exception: | |
None | |
s=SelObserver() | |
FreeCADGui.Selection.addObserver(s) # install the function resident mode | |
mw = FreeCADGui.getMainWindow() | |
dw=mw.findChildren(QtWidgets.QDockWidget) | |
for i in dw: | |
if str(i.objectName()) == __Title__: | |
if i.isVisible(): | |
i.setVisible(False) | |
else: | |
if seTPositionFlyRightLeft == 1: # MainWindow | |
None | |
else: | |
myNewFreeCADWidget = QtWidgets.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 seTPositionFlyRightLeft == 1: # MainWindow | |
MainWindow = QtWidgets.QMainWindow() # create a new window volant | |
MainWindow.setObjectName(__Title__) # macro internal Name | |
ui = Ui_MainWindow() | |
ui.setupUi(MainWindow) | |
MainWindow.show() | |
#####DockWidget################################################################################ | |
# | |
else: | |
myNewFreeCADWidget = QtWidgets.QDockWidget() # create a new dockwidget | |
myNewFreeCADWidget.setObjectName(__Title__) | |
ui = Ui_MainWindow() | |
ui.setupUi(myNewFreeCADWidget) | |
FCmw = FreeCADGui.getMainWindow() | |
if seTPositionFlyRightLeft == 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 | |
ui.on_PB_SpreadSheet_clicked() # cherche les SpreadSheet |
Thanks for your reply and the link to the forum thread. I'm using linux so Win10 settings don't apply here.
The problem has nothing to do with hidpi per se, but is caused by using "setGeometry". Size and position of widgets should be controlled by layout management. setGeometry is 90's visual basic style programming, and even then it didn't work correctly on 100dpi screens.
I will try to modify the macro accordingly and post a follow up next week.
hi
see this new post in the FreeCAD forum Skalierungsproblem mit 4k Monitor
ps: I will try to finish the new version (adapted for the Body (difficult) , placement , inclination of the plane with the angle given by the object , round the data , icon include in the macro .... )
mario
See my changes in the fork, i converted the macro to use Qt Layouts.
Would be really nice if you could put this gist into a repository, that would make contributing easier.
Hi
Done thanks for your changes,
now i convert the French FCInfo
mario
Hi
thanks for report
corrected "ver 01.22-rmu" now the macro is totally uninstalled i use :
try:
self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # destroy
self.window.deleteLater() # destroy
self.window.destroy() # destroy
except Exception:
None
instead:
self.window.hide()
and i adding the possibility display or not the "Error Message" window "False" by default
if you wand activate the warning window go to :
FreeCAD >Menu >Tools >Edit parameters... >BaseApp/Preferences/Macros/FCMmacros/FCInfo > switchWarning
True or False on choice
tell me if is run well
mario
Great thanks!
It fine now!
Hi
many thanks for report, good for my future macro's
mario
Why is the area moment of inertia units in mm^5? it should be mm^4, am I understanding this wrong?
Hi
Thanks for report, i have no knowledge about Inertia , i report only the data given by FreeCAd:
code: selection.Shape.MatrixOfInertia
the ^5 is added by pinq https://forum.freecadweb.org/viewtopic.php?f=22&t=23888 FCMacro and moment of inertia of assembly
the number of exhibitors (exposant) was one of my requests see
https://forum.freecadweb.org/viewtopic.php?p=555110#p555110 Momentof Interia - FCInfo macro (^2 ^3 ^4 .......) no reply !
if you have knowledge about Inertia ^4 and if it is possible or exist ^2 ^3 ^6....... i am ready to listen to you and upgrade my macro
if this is possible i can add one "spinBox" for select ^1 to ....^10.. ^20 (and verify with object in the existent Body)
PS: if you need ^4 i can give you the way to adapt the code to your responsibility
mario
This should be moved to a repo. This is way too much code for a Gist.
Please do a find and replace of "componants" to "components" (it's a misspelling)
Hi
This should be moved to a repo. This is way too much code for a Gist.
Ok
Please do a find and replace of "componants" to "components" (it's a misspelling)
done Version 1.28b 1.28c thanks
mario
Hi
@vpalagummi would you please test this version , i adding 2 spinBox you can choice the value
https://forum.freecad.org/viewtopic.php?p=747685#p747685
FCInfo_Avec_SpinBox_Moment_Inertia_Non_Official_Version_17-03-2024.zip
thanks for report
mario
hi
@speters
many thanks for appreciate my little macro
for the Gist repository i have try but error.. error .. error and i have abandoned
@rmu75
thanks for report
for the moment i do not have the opportunity for corrected the HDPI problem in the macro (Qt5 allows to work with the HDPI)
want to read this post for the same problem FCInfo Macro and try the UR_ method for solve momently this problem
how can i get the length of a closed sketch ? (by UR_ )
Sorry for the late reply
(thanks for report your test)
mario