Skip to content

Instantly share code, notes, and snippets.

@mario52a
Last active December 30, 2025 17:09
Show Gist options
  • Select an option

  • Save mario52a/cfce0b58e62b036e910be0e503b14b80 to your computer and use it in GitHub Desktop.

Select an option

Save mario52a/cfce0b58e62b036e910be0e503b14b80 to your computer and use it in GitHub Desktop.
Create the resistance, give the value or the color code, you can also calculate the total value with a serial or parallel resistance
# -*- coding: utf-8 -*-
__Title__ = "code_Colors_Resistance"
__Author__ = "Mario52"
__UrlGist__ = "https://gist.github.com/mario52a/cfce0b58e62b036e910be0e503b14b80"
__UrlWiki__ = "https://wiki.freecad.org/Macro_Code_Colors_Resistance"
__Version__ = "0.1a"
__Date__ = "2025/12/12"
__Comment__ = "Display the resistance value, the color code and calculate the total value with a serial or parallel resistance"
####
import PySide
try:
from PySide import QtWidgets
from PySide.QtWidgets import *
except Exception:
None
from PySide import QtGui , QtCore
from PySide.QtGui import *
from PySide.QtCore import *
####
from FreeCAD import Base
import Part, Draft
import Sketcher
import re
import math
from math import *
import random
##
global FreeCAD_ParamGetSet ; FreeCAD_ParamGetSet = FreeCAD.ParamGet(u"User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__) # FreeCAD_ParamGetSet
##
FreeCAD_ParamGetSet.SetString(u"Version", __Version__ + " (" + __Date__ + ")")
global macroPath ; macroPath = "" #
macroPath = FreeCAD.ParamGet(u"User parameter:BaseApp/Preferences/Macro").GetString(u"MacroPath") + "/" # macro path
##
#### geometry
global switchGeometryMainWindow; switchGeometryMainWindow = False
global setMainWindowMoveX # ; setMainWindowMoveX= 0 # position X macro window
global setMainWindowMoveY # ; setMainWindowMoveY= 0 # position Y macro window
global setFrameWindowSizeX ; setFrameWindowSizeX = 550 # dimension X macro window
global setFrameWindowSizeY ; setFrameWindowSizeY = 255 # dimension Y macro window
switchGeometryMainWindow = FreeCAD_ParamGetSet.GetBool(u"switchGeometryMainWindow")
setMainWindowMoveX = FreeCAD_ParamGetSet.GetInt(u"setMainWindowMoveX")
setMainWindowMoveY = FreeCAD_ParamGetSet.GetInt(u"setMainWindowMoveY")
setFrameWindowSizeX= FreeCAD_ParamGetSet.GetInt(u"setFrameWindowSizeX", setFrameWindowSizeX)
FreeCAD_ParamGetSet.SetInt(u"setFrameWindowSizeX", setFrameWindowSizeX)
setFrameWindowSizeY= FreeCAD_ParamGetSet.GetInt(u"setFrameWindowSizeY", setFrameWindowSizeY)
FreeCAD_ParamGetSet.SetInt(u"setFrameWindowSizeY", setFrameWindowSizeY)
#### geometry
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
##
self.construction = []
self.fusion = []
self.deletComp = []
self.E24_Serie = ["E24_Serie", "10", "11", "12", "13", "15", "16", "18", "20", "22", "24", "27", "30", "33", "36", "39", "43", "47", "51", "56", "62", "68", "75", "82", "91", "0"]
self.DrawStyle = 0
self.corps = ""
self.text_Puissance = ""
self.capsule_1 = ""
self.capsule_2 = ""
self.capsule_1A_Arrondi = ""
self.capsule_2A_Arrondi = ""
self.capsule_1B_Arrondi = ""
self.capsule_2B_Arrondi = ""
self.soudure = self.soudure_Chamfer = ""
self.contacts_Resistance_Rayon = 0.3
self.contacts_Resistance_Longueur = 20.0
self.calculResistance = []
self.compteurOperations = 1
##
## couleurs Bandes #R, V, B
self.BK_Black = ( 0, 0, 0) # 256 # #000000
self.BN_Brown = (150, 75, 0) # 2521497856 # #964b00
self.RD_Red = (255, 0, 0) # 4278190336 # #ff0000
self.OG_Orange = (255, 176, 0) # 4289724672 # #ffb000
self.YE_Yellow = (239, 239, 0) # 4025417984 # #efef00
self.GN_Green = ( 0, 166, 0) # 10879232 # #00a600
self.BU_Blue = ( 51, 102, 255) # 862388224 # #3366ff
self.VT_Violet = (160, 0, 160) # 2684395776 # #a000a0
self.GY_Grey = (143, 143, 143) # 2408550400 # #8f8f8f
self.WH_White = (255, 255, 255) # 4294967296 # #ffffff
self.Nul = ( 6, 192, 230) # 113305344 # #06c0e6
## #
self.GD_Gold = (255, 215, 0) # 4292280576 # #ffd700
self.SR_Silver = (192, 192, 192) # 3233857792 # #c0c0c0
self.PK_Pink = (215, 160, 166) # 3617629952 # #d7a0a6
## couleurs Bandes
## couleur contacts
self.CO_Capsule = self.SR_Silver # only cylinder
self.CO_Contacts= self.SR_Silver #
## couleur contacts
## couleur Corps resistance
self.BK_BlackCorps = ( 0, 0, 0) # 256 # #000000 composite de carbone
self.BN_BrownCorps = (134, 79, 76) # 2253344000 # #864f4c carbone
self.RD_RedCorps = (142, 10, 0) # 2383020288 # #8e0a00 Metal Film Resistor # red-brown for type SFR25H)
self.GN_GreenCorps = (130, 235, 195) # 2196489216 # #82ebc3 vert clair # light-green for type SFR25 # (type PR03) MCKNP
self.BU_BlueCorps = (46, 121, 163) # 779723776 # #2e79a3 bleu peliculle metalique #
self.BU_BlueCorps2 = (115, 184, 190) # 1941487360 # #73b8be bleu 2 peliculle metalique #
self.BU_BlueCorps3 = ( 4, 203, 231) # 80472064 # #04cbe7 bleu 3 peliculle metalique # light-blue for type SFR16S # (serie VR25, VR37, VR68)
self.VT_VioletCorps = (121, 105, 214) # 2036979456 # #7969d6 violet # ceramiques à film Ohmite OU et OUM # (type PR02)
self.GY_GreyCorps = (134, 139, 155) # 2257296384 # #868b9b gris # oxyde metalique
self.GY_GreyCorps2 = (156, 158, 159) # 2627641344 # #9c9e9f gris 2 # oxyde metalique
self.BG_BeigeCorps = (196, 160, 108) # 3298848000 # #c4a06c beige peliculle carbonne # carbone
## couleur Corps resistance
## couleurs Int
self.couleursInt = [ 256, 2521497856, 4278190336, 4289724672, 4025417984, 10879232, 862388224, 2684395776, 2408550400,
4294967296, 113305344, 4292280576, 3233857792, 3617629952, 256, 2253344000, 2383020288, 2196489216,
779723776, 1941487360, 80472064, 2036979456, 2257296384, 2627641344, 3298848000]
## couleurs Int
## couleurs Hex
self.couleursHex = [ "#000000", "#964b00", "#ff0000", "#ffb000", "#efef00", "#00a600", "#3366ff", "#a000a0", "#8f8f8f",
"#ffffff", "#06c0e6", "#ffd700", "#c0c0c0", "#d7a0a6", "#000000", "#864f4c", "#8e0a00", "#82ebc3",
"#2e79a3", "#73b8be", "#04cbe7", "#7969d6", "#868b9b", "#9c9e9f", "#c4a06c"]
## couleurs Hex
self.couleur_123 = [self.BK_Black, self.BN_Brown, self.RD_Red, self.OG_Orange, self.YE_Yellow,
self.GN_Green, self.BU_Blue, self.VT_Violet, self.GY_Grey, self.WH_White,
self.Nul]
self.couleur_4 = [self.BK_Black, self.BN_Brown, self.RD_Red, self.OG_Orange, self.YE_Yellow,
self.GN_Green, self.BU_Blue, self.VT_Violet, self.GY_Grey, self.WH_White,
self.GD_Gold, self.SR_Silver, self.PK_Pink, self.Nul]
self.couleur_5 = [self.BK_Black, self.BN_Brown, self.RD_Red, self.GN_Green, self.BU_Blue,
self.VT_Violet, self.GY_Grey, self.GD_Gold, self.SR_Silver, self.Nul]
self.couleur_6 = [self.BK_Black, self.BN_Brown, self.RD_Red, self.OG_Orange, self.YE_Yellow,
self.GN_Green, self.BU_Blue, self.VT_Violet, self.GY_Grey, self.Nul]
self.couleur_Corps= [self.BK_BlackCorps, self.BN_BrownCorps, self.RD_RedCorps, self.GN_GreenCorps, self.BU_BlueCorps,
self.BU_BlueCorps2, self.BU_BlueCorps3,self.VT_VioletCorps, self.GY_GreyCorps, self.GY_GreyCorps2, self.BG_BeigeCorps]
self.value_1 = "" # valeur bande 1
self.value_2 = "" # valeur bande 2
self.value_3 = "" # valeur bande 3
self.value_4 = ["", 0] # valeur bande 4
self.value_5 = ["", 0] # valeur bande 5
self.value_6 = "" # valeur bande 6
self.valeur = self.valeurMini = self.valeurMaxi = 0.0
self.total_Str = ""
self.original_Value_Str = ""
self.serie_Resistance = "SFR25"
self.MainWindow = MainWindow
MainWindow.setWindowIcon(QtGui.QIcon(macroPath+u"code_Colors_Resistance.png")) # change l'icone de la fenetre principale
self.MainWindow.setGeometry(setMainWindowMoveX, setMainWindowMoveY, setFrameWindowSizeX, setFrameWindowSizeY)
FreeCAD_ParamGetSet.SetBool(u"switchGeometryMainWindow", switchGeometryMainWindow)
#self.MainWindow.resize(822, 512)
self.centralwidget = QWidget(self.MainWindow)
self.frame0 = QFrame() # principal
self.frame0.setFrameShape(QFrame.StyledPanel)
self.frame0.setFrameShadow(QFrame.Raised)
self.frame = QFrame() # global
self.frame.setFrameShape(QFrame.StyledPanel)
self.frame.setFrameShadow(QFrame.Raised)
self.frame2 = QFrame() # section calcul resistances
self.frame2.setFrameShape(QFrame.StyledPanel)
self.frame2.setFrameShadow(QFrame.Raised)
self.frame3 = QFrame() # radioBouton
self.frame3.setFrameShape(QFrame.StyledPanel)
self.frame3.setFrameShadow(QFrame.Raised)
self.frame4 = QFrame() # code resistance
self.frame4.setFrameShape(QFrame.StyledPanel)
self.frame4.setFrameShadow(QFrame.Raised)
self.frame5 = QFrame() # creation
self.frame5.setFrameShape(QFrame.StyledPanel)
self.frame5.setFrameShadow(QFrame.Raised)
self.frame6 = QFrame() # affichage resultat
self.frame6.setFrameShape(QFrame.StyledPanel)
self.frame6.setFrameShadow(QFrame.Raised)
self.frame7 = QFrame() # progressBar
self.frame7.setFrameShape(QFrame.StyledPanel)
self.frame7.setFrameShadow(QFrame.Raised)
self.frame8 = QFrame() # barre d outils
self.frame8.setFrameShape(QFrame.StyledPanel)
self.frame8.setFrameShadow(QFrame.Raised)
####
self.RB_01_Mode_4 = QRadioButton()
self.RB_01_Mode_4.setChecked(True)
self.RB_01_Mode_4.clicked.connect(self.on_RB_01_Mode_4)
self.RB_02_Mode_5 = QRadioButton()
self.RB_02_Mode_5.clicked.connect(self.on_RB_02_Mode_5)
self.RB_03_Mode_6 = QRadioButton()
self.RB_03_Mode_6.clicked.connect(self.on_RB_03_Mode_6)
####
self.SPB_01_Color_1 = QSpinBox()
self.SPB_01_Color_1.setMinimum(0)
self.SPB_01_Color_1.setMaximum(10)
self.SPB_01_Color_1.valueChanged.connect(self.on_SPB_01_Color_1)
self.SPB_02_Color_2 = QSpinBox()
self.SPB_02_Color_2.setMinimum(0)
self.SPB_02_Color_2.setMaximum(10)
self.SPB_02_Color_2.valueChanged.connect(self.on_SPB_02_Color_2)
self.SPB_03_Color_3 = QSpinBox()
#self.SPB_03_Color_3.setVisible(False)
self.SPB_03_Color_3.setEnabled(False)
self.SPB_03_Color_3.setMinimum(0)
self.SPB_03_Color_3.setMaximum(10)
self.SPB_03_Color_3.valueChanged.connect(self.on_SPB_03_Color_3)
self.SPB_04_Multiply = QSpinBox()
self.SPB_04_Multiply.setPrefix("(Idx ")
self.SPB_04_Multiply.setSuffix(") Nul")
self.SPB_04_Multiply.setMinimum(0)
self.SPB_04_Multiply.setMaximum(13)
self.SPB_04_Multiply.valueChanged.connect(self.on_SPB_04_Multiply)
self.SPB_05_Tolerance = QSpinBox()
self.SPB_05_Tolerance.setMinimum(0)
self.SPB_05_Tolerance.setMaximum(9)
self.SPB_05_Tolerance.valueChanged.connect(self.on_SPB_05_Tolerance)
self.SPB_06_Temperature = QSpinBox()
self.SPB_06_Temperature.setMinimum(0)
self.SPB_06_Temperature.setMaximum(9)
#self.SPB_06_Temperature.setVisible(False)
self.SPB_06_Temperature.setEnabled(False)
self.SPB_06_Temperature.valueChanged.connect(self.on_SPB_06_Temperature)
####
self.LA_07_Result = QLabel()
font = QtGui.QFont()
font.setPointSize(14)
self.LA_07_Result.setFont(font)
self.LA_07_Result.setAlignment(QtCore.Qt.AlignCenter)
self.LA_08_Mini = QLabel()
self.LA_08_Mini.setAlignment(QtCore.Qt.AlignLeft)
self.LA_09_Maxi = QLabel()
self.LA_09_Maxi.setAlignment(QtCore.Qt.AlignRight)
####
self.CBB_01_Color_1 = QComboBox()
self.CBB_01_Color_1.addItem("0 (BK Black)")
self.CBB_01_Color_1.setItemData(0, QColor(self.BK_Black[0], self.BK_Black[1], self.BK_Black[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_01_Color_1.addItem("1 (BN Brown)")
self.CBB_01_Color_1.setItemData(1, QColor(self.BN_Brown[0], self.BN_Brown[1], self.BN_Brown[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("2 (RD Red)")
self.CBB_01_Color_1.setItemData(2, QColor(self.RD_Red[0], self.RD_Red[1], self.RD_Red[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("3 (OG Orange)")
self.CBB_01_Color_1.setItemData(3, QColor(self.OG_Orange[0], self.OG_Orange[1], self.OG_Orange[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("4 (YE Yellow)")
self.CBB_01_Color_1.setItemData(4, QColor(self.YE_Yellow[0], self.YE_Yellow[1], self.YE_Yellow[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("5 (GN Green)")
self.CBB_01_Color_1.setItemData(5, QColor(self.GN_Green[0], self.GN_Green[1], self.GN_Green[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("6 (BU Blue)")
self.CBB_01_Color_1.setItemData(6, QColor(self.BU_Blue[0], self.BU_Blue[1], self.BU_Blue[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("7 (VT Violet)")
self.CBB_01_Color_1.setItemData(7, QColor(self.VT_Violet[0], self.VT_Violet[1], self.VT_Violet[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("8 (GY Grey)")
self.CBB_01_Color_1.setItemData(8, QColor(self.GY_Grey[0], self.GY_Grey[1], self.GY_Grey[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("9 (WH White)")
self.CBB_01_Color_1.setItemData(9, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.addItem("Nul")
self.CBB_01_Color_1.setItemData(10, QColor(self.Nul[0],self.Nul[1],self.Nul[2]), Qt.BackgroundRole)
self.CBB_01_Color_1.setCurrentIndex(10)
self.CBB_01_Color_1.activated.connect(self.On_CBB_01_Color_1)
self.CBB_01_Color_1.currentIndexChanged.connect(self.On_CBB_01_Color_1)
####
self.CBB_02_Color_2 = QComboBox()
self.CBB_02_Color_2.addItem("0 (BK Black)")
self.CBB_02_Color_2.setItemData(0, QColor(self.BK_Black[0], self.BK_Black[1], self.BK_Black[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_02_Color_2.addItem("1 (BN Brown)")
self.CBB_02_Color_2.setItemData(1, QColor(self.BN_Brown[0], self.BN_Brown[1], self.BN_Brown[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("2 (RD Red)")
self.CBB_02_Color_2.setItemData(2, QColor(self.RD_Red[0], self.RD_Red[1], self.RD_Red[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("3 (OG Orange)")
self.CBB_02_Color_2.setItemData(3, QColor(self.OG_Orange[0], self.OG_Orange[1], self.OG_Orange[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("4 (YE Yellow)")
self.CBB_02_Color_2.setItemData(4, QColor(self.YE_Yellow[0], self.YE_Yellow[1], self.YE_Yellow[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("5 (GN Green)")
self.CBB_02_Color_2.setItemData(5, QColor(self.GN_Green[0], self.GN_Green[1], self.GN_Green[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("6 (BU Blue)")
self.CBB_02_Color_2.setItemData(6, QColor(self.BU_Blue[0], self.BU_Blue[1], self.BU_Blue[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("7 (VT Violet)")
self.CBB_02_Color_2.setItemData(7, QColor(self.VT_Violet[0], self.VT_Violet[1], self.VT_Violet[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("8 (GY Grey)")
self.CBB_02_Color_2.setItemData(8, QColor(self.GY_Grey[0], self.GY_Grey[1], self.GY_Grey[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("9 (WH White)")
self.CBB_02_Color_2.setItemData(9, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.addItem("Nul")
self.CBB_02_Color_2.setItemData(10, QColor(self.Nul[0],self.Nul[1],self.Nul[2]), Qt.BackgroundRole)
self.CBB_02_Color_2.setCurrentIndex(10)
self.CBB_02_Color_2.activated.connect(self.On_CBB_02_Color_2)
self.CBB_02_Color_2.currentIndexChanged.connect(self.On_CBB_02_Color_2)
####
self.CBB_03_Color_3 = QComboBox()
#self.CBB_03_Color_3.setVisible(False)
self.CBB_03_Color_3.setEnabled(False)
self.CBB_03_Color_3.addItem("0 (BK Black)")
self.CBB_03_Color_3.setItemData(0, QColor(self.BK_Black[0], self.BK_Black[1], self.BK_Black[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_03_Color_3.addItem("1 (BN Brown)")
self.CBB_03_Color_3.setItemData(1, QColor(self.BN_Brown[0], self.BN_Brown[1], self.BN_Brown[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("2 (RD Red)")
self.CBB_03_Color_3.setItemData(2, QColor(self.RD_Red[0], self.RD_Red[1], self.RD_Red[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("3 (OG Orange)")
self.CBB_03_Color_3.setItemData(3, QColor(self.OG_Orange[0], self.OG_Orange[1], self.OG_Orange[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("4 (YE Yellow)")
self.CBB_03_Color_3.setItemData(4, QColor(self.YE_Yellow[0], self.YE_Yellow[1], self.YE_Yellow[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("5 (GN Green)")
self.CBB_03_Color_3.setItemData(5, QColor(self.GN_Green[0], self.GN_Green[1], self.GN_Green[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("6 (BU Blue)")
self.CBB_03_Color_3.setItemData(6, QColor(self.BU_Blue[0], self.BU_Blue[1], self.BU_Blue[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("7 (VT Violet)")
self.CBB_03_Color_3.setItemData(7, QColor(self.VT_Violet[0], self.VT_Violet[1], self.VT_Violet[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("8 (GY Grey)")
self.CBB_03_Color_3.setItemData(8, QColor(self.GY_Grey[0], self.GY_Grey[1], self.GY_Grey[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("9 (WH White)")
self.CBB_03_Color_3.setItemData(9, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.addItem("Nul")
self.CBB_03_Color_3.setItemData(10, QColor(self.Nul[0],self.Nul[1],self.Nul[2]), Qt.BackgroundRole)
self.CBB_03_Color_3.setCurrentIndex(10)
self.CBB_03_Color_3.activated.connect(self.On_CBB_03_Color_3)
self.CBB_03_Color_3.currentIndexChanged.connect(self.On_CBB_03_Color_3)
####
self.CBB_04_Multiply = QComboBox()
self.CBB_04_Multiply.addItem("X 1 (BK Black)")
self.CBB_04_Multiply.setItemData(0, QColor(self.BK_Black[0], self.BK_Black[1], self.BK_Black[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_04_Multiply.addItem("X 10 (BN Brown)")
self.CBB_04_Multiply.setItemData(1, QColor(self.BN_Brown[0], self.BN_Brown[1], self.BN_Brown[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 100 (RD Red)")
self.CBB_04_Multiply.setItemData(2, QColor(self.RD_Red[0], self.RD_Red[1], self.RD_Red[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 1000 (OG Orange)")
self.CBB_04_Multiply.setItemData(3, QColor(self.OG_Orange[0], self.OG_Orange[1], self.OG_Orange[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 10 000 (YE Yellow)")
self.CBB_04_Multiply.setItemData(4, QColor(self.YE_Yellow[0], self.YE_Yellow[1], self.YE_Yellow[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 100 000 (GN Green)")
self.CBB_04_Multiply.setItemData(5, QColor(self.GN_Green[0], self.GN_Green[1], self.GN_Green[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 1 000 000 (BU Blue)")
self.CBB_04_Multiply.setItemData(6, QColor(self.BU_Blue[0], self.BU_Blue[1], self.BU_Blue[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 10 000 000 (VT Violet)")
self.CBB_04_Multiply.setItemData(7, QColor(self.VT_Violet[0], self.VT_Violet[1], self.VT_Violet[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 100 000 000 (GY Grey)")
self.CBB_04_Multiply.setItemData(8, QColor(self.GY_Grey[0], self.GY_Grey[1], self.GY_Grey[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 1 000 000 000 (WH White)")
self.CBB_04_Multiply.setItemData(9, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 0.1 (GD Gold)")
self.CBB_04_Multiply.setItemData(10, QColor(self.GD_Gold[0], self.GD_Gold[1], self.GD_Gold[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 0.01 (SR Silver)")
self.CBB_04_Multiply.setItemData(11, QColor(self.SR_Silver[0], self.SR_Silver[1], self.SR_Silver[2] ), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("X 0.001 (PK Pink)")
self.CBB_04_Multiply.setItemData(12, QColor(self.PK_Pink[0], self.PK_Pink[1], self.PK_Pink[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.addItem("Nul")
self.CBB_04_Multiply.setItemData(13, QColor(self.Nul[0],self.Nul[1],self.Nul[2]), Qt.BackgroundRole)
self.CBB_04_Multiply.setCurrentIndex(13)
self.CBB_04_Multiply.activated.connect(self.On_CBB_04_Multiply)
self.CBB_04_Multiply.currentIndexChanged.connect(self.On_CBB_04_Multiply)
####
self.CBB_05_Tolrerance = QComboBox()
self.CBB_05_Tolrerance.addItem("0 (BK Black)")
self.CBB_05_Tolrerance.setItemData(0, QColor(self.BK_Black[0], self.BK_Black[1], self.BK_Black[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_05_Tolrerance.addItem("1% (BN Brown)")
self.CBB_05_Tolrerance.setItemData(1, QColor(self.BN_Brown[0], self.BN_Brown[1], self.BN_Brown[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("2% (RD Red)")
self.CBB_05_Tolrerance.setItemData(2, QColor(self.RD_Red[0], self.RD_Red[1], self.RD_Red[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("0.5% (GN Green)")
self.CBB_05_Tolrerance.setItemData(3, QColor(self.GN_Green[0], self.GN_Green[1], self.GN_Green[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("0.25% (BU Blue)")
self.CBB_05_Tolrerance.setItemData(4, QColor(self.BU_Blue[0], self.BU_Blue[1], self.BU_Blue[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("0.1% (VT Violet)")
self.CBB_05_Tolrerance.setItemData(5, QColor(self.VT_Violet[0], self.VT_Violet[1], self.VT_Violet[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("0.05% (GY Grey")
self.CBB_05_Tolrerance.setItemData(6, QColor(self.GY_Grey[0], self.GY_Grey[1], self.GY_Grey[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("5% (GD Gold)")
self.CBB_05_Tolrerance.setItemData(7, QColor(self.GD_Gold[0], self.GD_Gold[1], self.GD_Gold[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("10% (SR Silver)")
self.CBB_05_Tolrerance.setItemData(8, QColor(self.SR_Silver[0], self.SR_Silver[1], self.SR_Silver[2] ), Qt.BackgroundRole)
self.CBB_05_Tolrerance.addItem("Nul")
self.CBB_05_Tolrerance.setItemData(9, QColor(self.Nul[0],self.Nul[1],self.Nul[2]), Qt.BackgroundRole)
self.CBB_05_Tolrerance.setCurrentIndex(9)
self.CBB_05_Tolrerance.activated.connect(self.On_CBB_05_Tolrerance)
self.CBB_05_Tolrerance.currentIndexChanged.connect(self.On_CBB_05_Tolrerance)
####
self.CBB_06_Temperature = QComboBox()
#self.CBB_06_Temperature.setVisible(False)
self.CBB_06_Temperature.setEnabled(False)
self.CBB_06_Temperature.addItem("200 PPM (BK Black)")
self.CBB_06_Temperature.setItemData(0, QColor(self.BK_Black[0], self.BK_Black[1], self.BK_Black[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_06_Temperature.addItem("100 PPM (BN Brown)")
self.CBB_06_Temperature.setItemData(1, QColor(self.BN_Brown[0], self.BN_Brown[1], self.BN_Brown[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("50 PPM (RD Red)")
self.CBB_06_Temperature.setItemData(2, QColor(self.RD_Red[0], self.RD_Red[1], self.RD_Red[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("15 PPM (OG Orange)")
self.CBB_06_Temperature.setItemData(3, QColor(self.OG_Orange[0], self.OG_Orange[1], self.OG_Orange[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("25 PPM (YE Yellow)")
self.CBB_06_Temperature.setItemData(4, QColor(self.YE_Yellow[0], self.YE_Yellow[1], self.YE_Yellow[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("20 PPM (GN Green)")
self.CBB_06_Temperature.setItemData(5, QColor(self.GN_Green[0], self.GN_Green[1], self.GN_Green[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("10 PPM (BU Blue)")
self.CBB_06_Temperature.setItemData(6, QColor(self.BU_Blue[0], self.BU_Blue[1], self.BU_Blue[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("5 PPM (VT Violet)")
self.CBB_06_Temperature.setItemData(7, QColor(self.VT_Violet[0], self.VT_Violet[1], self.VT_Violet[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("1 PPM (GY Grey)")
self.CBB_06_Temperature.setItemData(8, QColor(self.GY_Grey[0], self.GY_Grey[1], self.GY_Grey[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.addItem("Nul")
self.CBB_06_Temperature.setItemData(9, QColor(self.Nul[0],self.Nul[1],self.Nul[2]), Qt.BackgroundRole)
self.CBB_06_Temperature.setCurrentIndex(9)
self.CBB_06_Temperature.activated.connect(self.On_CBB_06_Temperature)
self.CBB_06_Temperature.currentIndexChanged.connect(self.On_CBB_06_Temperature)
####
self.CBB_00_Unit_Multiple = QComboBox()
self.CBB_00_Unit_Multiple.addItem("Ohm")
self.CBB_00_Unit_Multiple.setItemData(0, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_00_Unit_Multiple.addItem("Kilo Ohm")
self.CBB_00_Unit_Multiple.setItemData(1, QColor(255, 226, 226), Qt.BackgroundRole)
self.CBB_00_Unit_Multiple.addItem("Mega Ohm")
self.CBB_00_Unit_Multiple.setItemData(2, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_00_Unit_Multiple.addItem("Giga Ohm")
self.CBB_00_Unit_Multiple.setItemData(3, QColor(255, 226, 226), Qt.BackgroundRole)
self.CBB_00_Unit_Multiple.activated.connect(self.On_CBB_00_Unit_Multiple)
####
self.CBB_011_Puissance = QComboBox()
self.CBB_011_Puissance.addItem("1/8 Watt (W)")
self.CBB_011_Puissance.setItemData(0, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_011_Puissance.addItem("1/4 Watt (W)")
self.CBB_011_Puissance.setItemData(1, QColor(255, 226, 226), Qt.BackgroundRole)
self.CBB_011_Puissance.setCurrentIndex(1)
self.CBB_011_Puissance.addItem("1/2 Watt (W)")
self.CBB_011_Puissance.setItemData(2, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_011_Puissance.addItem("1 Watt (W)")
self.CBB_011_Puissance.setItemData(3, QColor(255, 226, 226), Qt.BackgroundRole)
self.CBB_011_Puissance.addItem("2 Watts (W)")
self.CBB_011_Puissance.setItemData(4, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_011_Puissance.addItem("3 Watts (W)")
self.CBB_011_Puissance.setItemData(5, QColor(255, 226, 226), Qt.BackgroundRole)
self.CBB_011_Puissance.addItem("5 Watts (W)")
self.CBB_011_Puissance.setItemData(6, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_011_Puissance.activated.connect(self.On_CBB_011_Puissance)
####
self.CBB_012_Color_Corps = QComboBox()
self.CBB_012_Color_Corps.addItem("Black (Body)")
self.CBB_012_Color_Corps.setItemData(0, QColor(self.BK_BlackCorps[0], self.BK_BlackCorps[1], self.BK_BlackCorps[2]), Qt.BackgroundRole) # composite de carbone
self.CBB_012_Color_Corps.setItemData(0, QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]), Qt.ForegroundRole)
self.CBB_012_Color_Corps.addItem("Brown (Body)")
self.CBB_012_Color_Corps.setItemData(1, QColor(self.BN_BrownCorps[0], self.BN_BrownCorps[1], self.BN_BrownCorps[2]), Qt.BackgroundRole)
self.CBB_012_Color_Corps.addItem("Red (Body)")
self.CBB_012_Color_Corps.setItemData(2, QColor(self.RD_RedCorps[0], self.RD_RedCorps[1], self.RD_RedCorps[2]), Qt.BackgroundRole)
self.CBB_012_Color_Corps.addItem("Green (Body)")
self.CBB_012_Color_Corps.setItemData(3, QColor(self.GN_GreenCorps[0], self.GN_GreenCorps[1], self.GN_GreenCorps[2]), Qt.BackgroundRole) # vert clair
self.CBB_012_Color_Corps.addItem("Blue (Body)")
self.CBB_012_Color_Corps.setItemData(4, QColor(self.BU_BlueCorps[0], self.BU_BlueCorps[1], self.BU_BlueCorps[2]), Qt.BackgroundRole) # peliculle métalique
self.CBB_012_Color_Corps.addItem("Blue2 (Body)")
self.CBB_012_Color_Corps.setItemData(5, QColor(self.BU_BlueCorps2[0], self.BU_BlueCorps2[1], self.BU_BlueCorps2[2]), Qt.BackgroundRole) # peliculle métalique
self.CBB_012_Color_Corps.addItem("Blue3 (Body)")
self.CBB_012_Color_Corps.setItemData(6, QColor(self.BU_BlueCorps3[0], self.BU_BlueCorps3[1], self.BU_BlueCorps3[2]), Qt.BackgroundRole) # peliculle métalique
self.CBB_012_Color_Corps.addItem("Violet (Body)")
self.CBB_012_Color_Corps.setItemData(7, QColor(self.VT_VioletCorps[0], self.VT_VioletCorps[1], self.VT_VioletCorps[2]), Qt.BackgroundRole)
self.CBB_012_Color_Corps.addItem("Grey (Body)")
self.CBB_012_Color_Corps.setItemData(8, QColor(self.GY_GreyCorps[0], self.GY_GreyCorps[1], self.GY_GreyCorps[2]), Qt.BackgroundRole)
self.CBB_012_Color_Corps.addItem("Grey2 (Body)")
self.CBB_012_Color_Corps.setItemData(9, QColor(self.GY_GreyCorps2[0], self.GY_GreyCorps2[1], self.GY_GreyCorps2[2]), Qt.BackgroundRole)
self.CBB_012_Color_Corps.addItem("Beige (Body)")
self.CBB_012_Color_Corps.setItemData(10, QColor(self.BG_BeigeCorps[0], self.BG_BeigeCorps[1], self.BG_BeigeCorps[2]), Qt.BackgroundRole) # beige peliculle carbonne
self.CBB_012_Color_Corps.setCurrentIndex(6)
self.CBB_012_Color_Corps.activated.connect(self.On_CBB_012_Color_Corps)
self.CBB_012_Color_Corps.highlighted.connect(self.On_CBB_012_Color_Corps_Hov)
####
self.LE_03_Entree_Valeur = QLineEdit()
self.LE_03_Entree_Valeur.setPlaceholderText("Resistance Value")
self.LE_03_Entree_Valeur.setFocusPolicy(Qt.StrongFocus)
self.LE_03_Entree_Valeur.returnPressed.connect(self.on_LE_03_Entree_Valeur)
#self.LE_03_Entree_Valeur.returnPressed.connect(self.on_PB_07_Calcul_Valider)
####
self.CBB_07_E24_Serie = QComboBox()
for serie in range(len(self.E24_Serie)):
self.CBB_07_E24_Serie.addItem(str(self.E24_Serie[serie]))
if serie % 2 != 0:
self.CBB_07_E24_Serie.setItemData(serie, QColor(255, 226, 226), Qt.BackgroundRole)
else:
self.CBB_07_E24_Serie.setItemData(serie, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_07_E24_Serie.activated.connect(self.On_CBB_07_E24_Serie)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.Nul[0]), int(self.Nul[1]), int(self.Nul[2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
self.CBB_07_E24_Serie.setPalette(palette)
####
self.CBB_08_Type_Contact = QComboBox()
self.CBB_08_Type_Contact.addItem("Contact Right")
self.CBB_08_Type_Contact.setItemData(0, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_08_Type_Contact.addItem("Contact Curved")
self.CBB_08_Type_Contact.setItemData(1, QColor(255, 226, 226), Qt.BackgroundRole)
self.CBB_08_Type_Contact.setCurrentIndex(1)
self.CBB_08_Type_Contact.addItem("Vertical resistance 1")
self.CBB_08_Type_Contact.setItemData(2, QColor(223, 242, 254), Qt.BackgroundRole)
self.CBB_08_Type_Contact.addItem("Vertical resistance 2P")
self.CBB_08_Type_Contact.setItemData(3, QColor(255, 226, 226), Qt.BackgroundRole)
#self.CBB_08_Type_Contact.activated.connect(self.On_CBB_08_Type_Contact)
####
self.LA_01_Color_1 = QLabel()
self.LA_02_Color_2 = QLabel()
self.LA_03_Color_3 = QLabel()
self.LA_03_Color_3.setEnabled(False)
self.LA_04_Multiply = QLabel()
self.LA_05_Tolerance = QLabel()
self.LA_06_Temperature = QLabel()
self.LA_06_Temperature.setEnabled(False)
####
self.progressBar_00 = QProgressBar()
self.progressBar_00.setMaximum(7)
self.progressBar_00.setMinimum(0)
self.progressBar_00.hide()
self.progressBar_00.setAlignment(QtCore.Qt.AlignCenter)
####
self.PB_06_By_Color = QPushButton()
self.PB_06_By_Color.setIcon(QtGui.QIcon.fromTheme("Image",QtGui.QIcon(":/icons/colors.svg")))
self.PB_06_By_Color.clicked.connect(self.on_PB_06_By_Color)
self.PB_05_TestColors = QPushButton()
self.PB_05_TestColors.setIcon(QtGui.QIcon.fromTheme("drawStyle",QtGui.QIcon(":/icons/preferences-general.svg")))
self.PB_05_TestColors.clicked.connect(self.on_PB_05_TestColors)
self.PB_04_View = QPushButton()
self.PB_04_View.setIcon(QtGui.QIcon.fromTheme("drawStyle",QtGui.QIcon(":/icons/DrawStyleShaded.svg")))
self.PB_04_View.clicked.connect(self.on_PB_04_View)
self.PB_03_Reset = QPushButton()
self.PB_03_Reset.setIcon(QtGui.QIcon.fromTheme("refresh",QtGui.QIcon(":/icons/view-refresh.svg")))
self.PB_03_Reset.clicked.connect(self.on_PB_03_Reset)
self.PB_02_Create = QPushButton()
self.PB_02_Create.setIcon(QtGui.QIcon.fromTheme("valid",QtGui.QIcon(":/icons/button_valid.svg")))
self.PB_02_Create.clicked.connect(self.on_PB_02_Create)
self.CB_01_Construction = QCheckBox()
self.CB_01_Construction.setIcon(QtGui.QIcon.fromTheme("Construct",QtGui.QIcon(":/icons/Arch_Survey.svg")))
#self.CB_01_Construction.clicked.connect(self.on_CB_01_Construction)
self.PB_01_Quit = QPushButton()
self.PB_01_Quit.setIcon(QtGui.QIcon.fromTheme("quit",QtGui.QIcon(":/icons/application-exit.svg")))
self.PB_01_Quit.clicked.connect(self.on_PB_01_Quit)
#### calcul Resistances Serie Parallele
self.PB_09_Clear_TextEdit = QPushButton()
self.PB_09_Clear_TextEdit.setIcon(QtGui.QIcon.fromTheme("Cancel",QtGui.QIcon(":/icons/edit_Cancel.svg")))
self.PB_09_Clear_TextEdit.clicked.connect(self.on_PB_09_Clear_TextEdit)
self.PB_08_Calcul_Resultat = QPushButton()
self.PB_08_Calcul_Resultat.setIcon(QtGui.QIcon.fromTheme("Equal",QtGui.QIcon(":/icons/constraints/Constraint_EqualLength.svg")))
self.PB_08_Calcul_Resultat.clicked.connect(self.on_PB_08_Calcul_Resultat)
self.textEdit = QTextEdit()
self.textEdit.append("Formula_____________________")
self.textEdit.setTextColor(QtGui.QColor("Green")) # Serial
self.textEdit.append("Series : R = r1 + r2 + r3 ...")
self.textEdit.setTextColor(QtGui.QColor("Darkblue")) # Parallel
self.textEdit.append("Parallel : 1/R = 1/r1 + 1/r2 + 1/r3 ...")
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.textEdit.append("_____________________________ ...")
self.textEdit.setTextColor(QtGui.QColor("Green"))
self.textEdit.append(str(self.compteurOperations) + " IDX : Begin_____________________")
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.textEdit.textCursor().selectionEnd()
#self.textEdit.textChanged.connect(self.on_textEdit_Changed)
self.CBB_09_Calcul_Memo = QComboBox()
self.CBB_09_Calcul_Memo.activated.connect(self.On_CBB_09_Calcul_Memo)
self.CB_02_Calcul_SeriePara = QCheckBox()
self.CB_02_Calcul_SeriePara.setIcon(QtGui.QIcon.fromTheme("Parallel",QtGui.QIcon(":/icons/constraints/Constraint_Parallel.svg")))
self.CB_02_Calcul_SeriePara.clicked.connect(self.on_CB_02_Calcul_SeriePara)
self.LE_02_Calcul_Entree = QLineEdit()
self.LE_02_Calcul_Entree.setPlaceholderText("Resistance Value")
self.LE_02_Calcul_Entree.returnPressed.connect(self.on_PB_07_Calcul_Valider)
self.PB_07_Calcul_Valider = QPushButton()
self.PB_07_Calcul_Valider.setIcon(QtGui.QIcon.fromTheme("Adding",QtGui.QIcon(":/icons/list-add.svg")))
self.PB_07_Calcul_Valider.clicked.connect(self.on_PB_07_Calcul_Valider)
#### calcul Resistances Serie Parallele
# Gui.runCommand('Std_Undo',0)
# Gui.runCommand('Std_Redo',0)
####
#### GridLayout begin ######
self.grid0 = QGridLayout(self.centralwidget)
self.grid0.setContentsMargins(10, 10, 10, 10)
self.grid0.addWidget(self.frame0, 0, 0, 1, 1)
####
self.grid = QGridLayout(self.frame)
self.grid.setContentsMargins(10, 10, 10, 10)
##
self.grid3 = QGridLayout(self.frame3)
self.grid3.setContentsMargins(10, 10, 10, 10)
self.grid3.addWidget(self.RB_01_Mode_4, 0, 0)
self.grid3.addWidget(self.RB_02_Mode_5, 0, 1)
self.grid3.addWidget(self.RB_03_Mode_6, 0, 2)
self.grid3.addWidget(self.CBB_011_Puissance, 0, 3)
self.grid3.addWidget(self.CBB_08_Type_Contact, 0, 4)
self.grid3.addWidget(self.CBB_012_Color_Corps, 0, 5)
self.grid.addWidget(self.frame3, 0, 0, 1, 6)
##
self.grid4 = QGridLayout(self.frame4)
self.grid4.setContentsMargins(10, 10, 10, 10)
self.grid4.addWidget(self.LA_01_Color_1, 1, 0)
self.grid4.addWidget(self.LA_02_Color_2, 1, 1)
self.grid4.addWidget(self.LA_03_Color_3, 1, 2)
self.grid4.addWidget(self.LA_04_Multiply, 1, 3)
self.grid4.addWidget(self.LA_05_Tolerance, 1, 4)
self.grid4.addWidget(self.LA_06_Temperature, 1, 5)
#
self.grid4.addWidget(self.CBB_01_Color_1, 2, 0)
self.grid4.addWidget(self.CBB_02_Color_2, 2, 1)
self.grid4.addWidget(self.CBB_03_Color_3, 2, 2)
self.grid4.addWidget(self.CBB_04_Multiply, 2, 3)
self.grid4.addWidget(self.CBB_05_Tolrerance, 2, 4)
self.grid4.addWidget(self.CBB_06_Temperature, 2, 5)
self.grid.addWidget(self.frame4, 1, 0, 1, 6)
#
self.grid4.addWidget(self.SPB_01_Color_1, 3, 0)
self.grid4.addWidget(self.SPB_02_Color_2, 3, 1)
self.grid4.addWidget(self.SPB_03_Color_3, 3, 2)
self.grid4.addWidget(self.SPB_04_Multiply, 3, 3)
self.grid4.addWidget(self.SPB_05_Tolerance, 3, 4)
self.grid4.addWidget(self.SPB_06_Temperature, 3, 5)
##
self.grid5 = QGridLayout(self.frame5)
self.grid5.setContentsMargins(10, 10, 10, 10)
self.grid5.addWidget(self.LE_03_Entree_Valeur, 0, 0)
self.grid5.addWidget(self.CBB_07_E24_Serie, 0, 1)
self.grid5.addWidget(self.CBB_00_Unit_Multiple, 0, 2)
self.grid5.addWidget(self.PB_02_Create, 1, 0, 1, 3)
self.grid.addWidget(self.frame5, 2, 0, 1, 3)
##
self.grid6 = QGridLayout(self.frame6)
self.grid6.setContentsMargins(10, 10, 10, 10)
self.grid6.addWidget(self.LA_07_Result, 0, 0, 1, 2)
self.grid6.addWidget(self.LA_08_Mini, 1, 0)
self.grid6.addWidget(self.LA_09_Maxi, 1, 1)
self.grid.addWidget(self.frame6, 2, 3, 1, 3)
##
self.grid7 = QGridLayout(self.frame7)
self.grid7.setContentsMargins(10, 10, 10, 10)
self.grid7.addWidget(self.progressBar_00, 0, 0, 1, 6)
self.grid.addWidget(self.frame7, 3, 0, 1, 6)
##
self.grid8 = QGridLayout(self.frame8)
self.grid8.addWidget(self.PB_03_Reset, 7, 0)
self.grid8.addWidget(self.PB_04_View, 7, 1)
self.grid8.addWidget(self.PB_06_By_Color, 7, 2)
self.grid8.addWidget(self.PB_05_TestColors, 7, 3)
self.grid8.addWidget(self.CB_01_Construction, 7, 4)
self.grid8.addWidget(self.PB_01_Quit, 7, 5)
self.grid.addWidget(self.frame8, 4, 0, 1, 6)
##
self.grid0.addWidget(self.frame, 0, 0, 1, 1)
####
self.gridd = QGridLayout(self.frame2)
self.gridd.setContentsMargins(10, 10, 10, 10)
##
self.gridd.addWidget(self.LE_02_Calcul_Entree, 0, 0)
self.gridd.addWidget(self.PB_07_Calcul_Valider, 0, 1)
self.gridd.addWidget(self.textEdit, 0, 2, 2, 1)
self.gridd.addWidget(self.PB_08_Calcul_Resultat, 0,3)
##
self.gridd.addWidget(self.CBB_09_Calcul_Memo, 1, 0)
self.gridd.addWidget(self.CB_02_Calcul_SeriePara, 1, 1)
self.gridd.addWidget(self.PB_09_Clear_TextEdit, 1, 3)
self.grid0.addWidget(self.frame2, 1, 0, 1, 1)
#### GridLayout end ######
self.MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QStatusBar(self.MainWindow)
self.MainWindow.setStatusBar(self.statusbar)
####
self.on_PB_03_Reset() # activation
####
self.retranslateUi(self.MainWindow)
QtCore.QMetaObject.connectSlotsByName(self.MainWindow)
self.MainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # PySide cette fonction met la fenetre en avant
####
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
self.MainWindow.setWindowTitle(_translate("self.MainWindow", "Code Colors Resistance (Ver: " + __Version__ + "-" + __Date__ + ")"))
self.RB_01_Mode_4.setText(_translate("self.MainWindow", "4 Colors"))
self.RB_02_Mode_5.setText(_translate("self.MainWindow", "5 Colors"))
self.RB_03_Mode_6.setText(_translate("self.MainWindow", "6 Colors"))
self.LA_01_Color_1.setText(_translate("self.MainWindow", "First (1)"))
self.LA_02_Color_2.setText(_translate("self.MainWindow", "Second (2)"))
self.LA_03_Color_3.setText(_translate("self.MainWindow", "Third (3)"))
self.LA_04_Multiply.setText(_translate("self.MainWindow", "Multilpy (4)"))
self.LA_05_Tolerance.setText(_translate("self.MainWindow", "Tolerance (5)"))
self.LA_06_Temperature.setText(_translate("self.MainWindow", "Temperature (6)"))
self.CBB_01_Color_1.setToolTip(_translate("self.MainWindow", "First color"))
self.CBB_02_Color_2.setToolTip(_translate("self.MainWindow", "Second color"))
self.CBB_03_Color_3.setToolTip(_translate("self.MainWindow", "Third color"))
self.CBB_04_Multiply.setToolTip(_translate("self.MainWindow", "Fourth color"))
self.CBB_05_Tolrerance.setToolTip(_translate("self.MainWindow", "Fifth color"))
self.CBB_06_Temperature.setToolTip(_translate("self.MainWindow", "Sixth color"))
self.SPB_01_Color_1.setToolTip(_translate("self.MainWindow", "First color"))
self.SPB_02_Color_2.setToolTip(_translate("self.MainWindow", "Second color"))
self.SPB_03_Color_3.setToolTip(_translate("self.MainWindow", "Third color"))
self.SPB_04_Multiply.setToolTip(_translate("self.MainWindow", "Fourth color"))
self.SPB_05_Tolerance.setSuffix(_translate("self.MainWindow", ") Nul"))
self.SPB_05_Tolerance.setToolTip(_translate("self.MainWindow", "Fifth color"))
self.SPB_05_Tolerance.setPrefix("(Idx ")
self.SPB_06_Temperature.setToolTip(_translate("self.MainWindow", "Sixth color"))
self.PB_03_Reset.setText(_translate("self.MainWindow", "Reset"))
self.PB_03_Reset.setToolTip(_translate("self.MainWindow", "Reset the values"))
self.PB_04_View.setText(_translate("self.MainWindow", "View"))
self.PB_04_View.setToolTip(_translate("self.MainWindow", "View As Is / Shaded"))
self.PB_06_By_Color.setText(_translate("self.MainWindow", "By Colors"))
self.PB_06_By_Color.setToolTip(_translate("self.MainWindow", "Color by face:\nSelect the face and choice the color"))
self.PB_05_TestColors.setText(_translate("self.MainWindow", "Random"))
self.PB_05_TestColors.setToolTip(_translate("self.MainWindow", "Create resistance with Random Color"))
self.CB_01_Construction.setText(_translate("self.MainWindow", "Construction"))
self.CB_01_Construction.setToolTip(_translate("self.MainWindow", "If the checkBox is checked\nall object of the construction are erased"))
self.PB_01_Quit.setText(_translate("self.MainWindow", "Quit"))
self.PB_01_Quit.setToolTip(_translate("self.MainWindow", "Quit Code Colors Resistance"))
self.LE_03_Entree_Valeur.setToolTip(_translate("self.MainWindow", "Value of the resistance"))
self.CBB_07_E24_Serie.setToolTip(_translate("self.MainWindow", "Selection E24 serie"))
self.CBB_00_Unit_Multiple.setToolTip(_translate("self.MainWindow", "Conversion the value displayed"))
self.LA_07_Result.setText(_translate("self.MainWindow", "?"))
self.LA_08_Mini.setText(_translate("self.MainWindow", "Mini"))
self.LA_09_Maxi.setText(_translate("self.MainWindow", "Maxi"))
self.PB_02_Create.setText(_translate("self.MainWindow", "Create resistance"))
self.PB_02_Create.setToolTip(_translate("self.MainWindow", "Create the Resistance"))
self.PB_09_Clear_TextEdit.setText(_translate("self.MainWindow", "Clear"))
self.PB_09_Clear_TextEdit.setToolTip(_translate("self.MainWindow", "Clear the window text editor"))
self.PB_08_Calcul_Resultat.setText(_translate("self.MainWindow", " Result"))
self.PB_08_Calcul_Resultat.setToolTip(_translate("self.MainWindow", "The [Result] of the calculation is stored in the ComboBox"))
self.CB_02_Calcul_SeriePara.setText(_translate("self.MainWindow", "Parallel"))
self.CB_02_Calcul_SeriePara.setToolTip(_translate("self.MainWindow", "The mix serial and parallel is not possible" + "\n"
"The calculation is only Serial or Parallel" + "\n"
"Check for Parallel"))
self.CBB_09_Calcul_Memo.setToolTip(_translate("self.MainWindow", "The result of the calculation is stored in format:" + "\n"
"1IDX Ser: 10.0" + "\n"
"__________" + "\n"
"1IDX = index of the operation" + "\n"
"Ser = the operation is Serial (Green)" + "\n"
"Par = the operation is Parallel (Blue)" + "\n"
"10.0 = the result of the operation" + "\n\n"
"This listing is not erasable"))
#self.PB_07_Calcul_Valider.setText(_translate("self.MainWindow", "+"))
self.PB_07_Calcul_Valider.setToolTip(_translate("self.MainWindow", "Adding the value for calculation "))
#### creation contact courbe protection Vertical Begin
def contacts_Courbe_Vertical_Type_1_Protection(self, Longueur_PG = 2.0, Longueur_PD = 3.0, hauteur_Cercle = 4.0, distance_Entre_Pins = 2.54):
## cree le fil Vertical Type_1 protection (Longueur_Pin G , Longueur_Pin D , hauteur_Cercle (axe), distance_Entre_Pins (contacts et diametre cercle):
FreeCAD.ActiveDocument.openTransaction("contacts_Vertical_1_Protection") # memorise les actions (avec annuler restore)
filContact = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject', 'Sketch_Contacts')
filContact.Placement = App.Placement(App.Base.Vector(0.0, 0.0, 0.0), App.Rotation(0.707107, 0.0, 0.0, 0.707107))
##
filContact.addGeometry(Part.LineSegment(App.Base.Vector(0.0,Longueur_PG,0),App.Base.Vector(0.0,hauteur_Cercle,0)),False)
filContact.addGeometry(Part.ArcOfCircle(Part.Circle(App.Base.Vector(distance_Entre_Pins/2.0, hauteur_Cercle, 0), App.Base.Vector(0.0, 0.0, 1.0), distance_Entre_Pins/2.0), radians(0.0), radians(180.0) , False))
filContact.addGeometry(Part.LineSegment(App.Base.Vector(distance_Entre_Pins,1.0,0),App.Base.Vector(distance_Entre_Pins,hauteur_Cercle,0)),False)
##
filContact.addConstraint(Sketcher.Constraint('Coincident', 0, 2, 1, 2))
filContact.addConstraint(Sketcher.Constraint('Coincident', 1, 1, 2, 2))
filContact.addConstraint(Sketcher.Constraint('Tangent', 0, 2, -2, 0))
##
filContact.addConstraint(Sketcher.Constraint('Radius', 1, distance_Entre_Pins/2.0)) # rayon cercle
##
filContact.addConstraint(Sketcher.Constraint('DistanceY', -1, 1, 1, 3, hauteur_Cercle)) # accroche axe courbe a la base
filContact.addConstraint(Sketcher.Constraint('DistanceY', -1, 1, 0, 2, hauteur_Cercle)) # hauteur courbe G a la base
filContact.addConstraint(Sketcher.Constraint('DistanceY', -1, 1, 1, 1, hauteur_Cercle)) # hauteur courbe D a la base
filContact.addConstraint(Sketcher.Constraint('DistanceY', 2, 1, 2, 2, Longueur_PD)) # Longueur_PD Longueur_patte_droite
filContact.addConstraint(Sketcher.Constraint('DistanceY', 0, 1, 0, 2, Longueur_PG)) # Longueur_PG Longueur_patte_gauche
##
filContact.addConstraint(Sketcher.Constraint('DistanceX', 0, 1, 2, 1, distance_Entre_Pins)) # diametre cercle
##
App.activeDocument().recompute(None,True,True)
return filContact
#### creation contact courbe protection Vertical End
#### creation contact courbe Vertical Begin
def contacts_Courbe_Vertical_Type_1_Creation(self,longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 4, distance_Entre_Pins = 2.54):
## cree le fil Vertical Type_1 creation (longueurSousZero_G, longueurSousZero_D, hauteurCentreCercle, distance_Entre_Pins = Diametre du cercle (courbe)
FreeCAD.ActiveDocument.openTransaction("contacts_Vertical_1_Creation") # memorise les actions (avec annuler restore)
filContact = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject', 'Sketch_Contacts')
filContact.Placement = App.Placement(App.Base.Vector(0.0, 0.0, 0.0), App.Rotation(0.707107, 0.0, 0.0, 0.707107))
##
filContact.addGeometry(Part.LineSegment(App.Base.Vector(0.0,-longueurSZ_G,0),App.Base.Vector(0.0,0.0,0)),False)
filContact.addGeometry(Part.LineSegment(App.Base.Vector(0.0,0.0,0),App.Base.Vector(0.0,hauteur,0)),False)
filContact.addGeometry(Part.ArcOfCircle(Part.Circle(App.Base.Vector(distance_Entre_Pins/2.0, hauteur, 0), App.Base.Vector(0.0, 0.0, 1.0), distance_Entre_Pins/2.0), radians(0.0), radians(180.0) , False))
filContact.addGeometry(Part.LineSegment(App.Base.Vector(distance_Entre_Pins,0.0,0),App.Base.Vector(distance_Entre_Pins,-longueurSZ_D)),False)
filContact.addGeometry(Part.LineSegment(App.Base.Vector(distance_Entre_Pins,0.0,0),App.Base.Vector(distance_Entre_Pins,hauteur,0)),False)
##
filContact.addConstraint(Sketcher.Constraint('Vertical', 0))
filContact.addConstraint(Sketcher.Constraint('Vertical', 1))
filContact.addConstraint(Sketcher.Constraint('Vertical', 4))
##
filContact.addConstraint(Sketcher.Constraint('Coincident', 0, 2, 1, 1))
filContact.addConstraint(Sketcher.Constraint('Coincident', 0, 2, -1, 1))
filContact.addConstraint(Sketcher.Constraint('Coincident', 1, 2, 2, 2))
filContact.addConstraint(Sketcher.Constraint('Coincident', 2, 1, 3, 2))
filContact.addConstraint(Sketcher.Constraint('Coincident', 3, 1, 4, 1))
##
filContact.addConstraint(Sketcher.Constraint('Radius', 2, distance_Entre_Pins/2.0)) # rayon cercle
##
filContact.addConstraint(Sketcher.Constraint('DistanceY', 1, 1, 1, 2, hauteur)) # hauteur axe de la courbe G , 180 degrees
filContact.addConstraint(Sketcher.Constraint('DistanceY', 3, 1, 3, 2, hauteur)) # hauteur axe de la courbe D , 0 degrees
filContact.addConstraint(Sketcher.Constraint('DistanceY',-1, 1, 2, 3, hauteur)) # hauteur centre cercle axe de la courbe D
filContact.addConstraint(Sketcher.Constraint('DistanceY', 0, 1, 0, 2, longueurSZ_G)) # pied sous zero G
filContact.addConstraint(Sketcher.Constraint('DistanceY', 4, 2, 4, 1, longueurSZ_D)) # pied sous zero D
filContact.addConstraint(Sketcher.Constraint('DistanceX', 1, 2, 2, 1, distance_Entre_Pins))#
filContact.addConstraint(Sketcher.Constraint('DistanceX', 0, 2, 3, 1, distance_Entre_Pins))
##
App.activeDocument().recompute(None,True,True)
return filContact
#### creation contact courbe Vertical End
#### creation fil contact begin
def contacts_Courbe1_Dimensions(self, objet = "", longueurG = 4, longueurD = 4, hauteurG = 6, hauteurD = 6):
## modification dimensions
FreeCAD.ActiveDocument.openTransaction("contacts_Courbe1_Dimensions") # memorise les actions (avec annuler restore)
if "Contacts" in objet.Name:
objet.setDatum( 6, longueurG) # longueurG
objet.setDatum( 7, longueurD) # longueurD
objet.setDatum(12, hauteurG) # hauteurG
objet.setDatum(13, hauteurD) # hauteurD
FreeCAD.ActiveDocument.recompute(None,True,True)
#return objet
def contacts_Courbe1_Arrondi(self, objet = "", arrondi = 1.0):
## modification courbe
FreeCAD.ActiveDocument.openTransaction("contacts_Courbe1_Arrondi") # memorise les actions (avec annuler restore)
if "Contacts" in objet.Name:
objet.setDatum( 8, arrondi) # DistanceX
objet.setDatum( 9, arrondi) # DistanceX
objet.setDatum(10, arrondi) # DistanceY
objet.setDatum(11, arrondi) # DistanceY
objet.setDatum(18, arrondi) # DistanceY
objet.setDatum(19, arrondi) # DistanceY
FreeCAD.ActiveDocument.recompute(None,True,True)
#return objet
def contacts_Courbe1_Creation(self, longueurG = 4, longueurD = 4, hauteurG = 6, hauteurD = 6, coinsCourbure = 1.0):
## cree le fil contacts Courbe
FreeCAD.ActiveDocument.openTransaction("contacts_Courbe1_Creation") # memorise les actions (avec annuler restore)
filContact = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject', 'Sketch_Contacts')
filContact.Placement = App.Placement(App.Base.Vector(0.0, 0.0, 0.0), App.Rotation(0.707107, 0.0, 0.0, 0.707107))
##
filContact.addGeometry(Part.LineSegment(App.Base.Vector(-6.0, -8.0, 0.0),App.Base.Vector(-6.0, -coinsCourbure, 0.0)),False)
filContact.addGeometry(Part.LineSegment(App.Base.Vector(6.0, -coinsCourbure, 0.0),App.Base.Vector(6.0, -8.0, 0.0)),False)
filContact.addGeometry(Part.LineSegment(App.Base.Vector(-4.0,0.0,0),App.Base.Vector(0,0,0)),False)
filContact.addGeometry(Part.LineSegment(App.Base.Vector( 4.0,0.0,0),App.Base.Vector(0,0,0)),False)
##
filContact.addGeometry(Part.ArcOfCircle(Part.Circle(App.Base.Vector(-4.0, -coinsCourbure, 0.0), App.Base.Vector(0.0, -0.0, -1.0), coinsCourbure), radians(90.0), radians(180.0) , False))
filContact.addGeometry(Part.ArcOfCircle(Part.Circle(App.Base.Vector(4.0, -coinsCourbure, 0.0), App.Base.Vector(0.0, -0.0, -1.0), coinsCourbure), radians(0.0), radians(90.0), False))
##
filContact.addConstraint(Sketcher.Constraint('Vertical', 0))
filContact.addConstraint(Sketcher.Constraint('Vertical', 1))
filContact.addConstraint(Sketcher.Constraint('Horizontal', 2))
filContact.addConstraint(Sketcher.Constraint('Horizontal', 3))
filContact.addConstraint(Sketcher.Constraint('Coincident', 2, 2, 3, 2))
filContact.addConstraint(Sketcher.Constraint('Coincident', 2, 2, -1, 1))
filContact.addConstraint(Sketcher.Constraint('DistanceX', 2, 1, 2, 2, longueurG)) #6 longueurG
filContact.addConstraint(Sketcher.Constraint('DistanceX', 3, 2, 3, 1, longueurD)) #7 longueurD
filContact.addConstraint(Sketcher.Constraint('DistanceX', 0, 2, 2, 1, coinsCourbure)) #8
filContact.addConstraint(Sketcher.Constraint('DistanceX', 3, 1, 1, 1, coinsCourbure)) #9
filContact.addConstraint(Sketcher.Constraint('DistanceY', 0, 2, 2, 1, coinsCourbure)) #10
filContact.addConstraint(Sketcher.Constraint('DistanceY', 1, 1, 3, 1, coinsCourbure)) #11
filContact.addConstraint(Sketcher.Constraint('DistanceY', 0, 1, 0, 2, hauteurG)) #12 hauteurG
filContact.addConstraint(Sketcher.Constraint('DistanceY', 1, 2, 1, 1, hauteurD)) #13 hauteurD
filContact.addConstraint(Sketcher.Constraint('Coincident', 4, 1, 2, 1))
filContact.addConstraint(Sketcher.Constraint('Coincident', 4, 2, 0, 2))
filContact.addConstraint(Sketcher.Constraint('Coincident', 5, 2, 3, 1))
filContact.addConstraint(Sketcher.Constraint('Coincident', 5, 1, 1, 1))
filContact.addConstraint(Sketcher.Constraint('DistanceY', 4, 3, 2, 1, coinsCourbure)) #18
filContact.addConstraint(Sketcher.Constraint('DistanceY', 5, 3, 3, 1, coinsCourbure)) #19
FreeCAD.ActiveDocument.recompute()
return filContact
#### creation fil contact end
def on_SPB_01_Color_1(self, value):
if value == 10:
value = ""
self.CBB_01_Color_1.setCurrentIndex(10)
else:
self.CBB_01_Color_1.setCurrentIndex(value)
self.displayResultStr()
def on_SPB_02_Color_2(self, value):
if value == 10:
value = ""
self.CBB_02_Color_2.setCurrentIndex(10)
else:
self.CBB_02_Color_2.setCurrentIndex(value)
self.displayResultStr()
def on_SPB_03_Color_3(self, value):
if value == 10:
value = ""
self.CBB_03_Color_3.setCurrentIndex(10)
else:
self.CBB_03_Color_3.setCurrentIndex(value)
self.displayResultStr()
def on_SPB_04_Multiply(self, value):
self.CBB_04_Multiply.setCurrentIndex(value)
self.displayResultStr()
def on_SPB_05_Tolerance(self, value):
self.CBB_05_Tolrerance.setCurrentIndex(value)
self.displayResultStr()
def on_SPB_06_Temperature(self, value):
self.CBB_06_Temperature.setCurrentIndex(value)
self.displayResultStr()
def on_RB_01_Mode_4(self):
self.on_PB_03_Reset()
self.LA_03_Color_3.setEnabled(False)
self.SPB_03_Color_3.setEnabled(False)
self.CBB_03_Color_3.setEnabled(False)
self.LA_06_Temperature.setEnabled(False)
self.SPB_06_Temperature.setEnabled(False)
self.CBB_06_Temperature.setEnabled(False)
def on_RB_02_Mode_5(self):
self.on_PB_03_Reset()
self.LA_03_Color_3.setEnabled(True)
self.SPB_03_Color_3.setEnabled(True)
self.CBB_03_Color_3.setEnabled(True)
self.LA_06_Temperature.setEnabled(False)
self.SPB_06_Temperature.setEnabled(False)
self.CBB_06_Temperature.setEnabled(False)
def on_RB_03_Mode_6(self):
self.on_PB_03_Reset()
self.LA_03_Color_3.setEnabled(True)
self.SPB_03_Color_3.setEnabled(True)
self.CBB_03_Color_3.setEnabled(True)
self.SPB_06_Temperature.setEnabled(True)
self.LA_06_Temperature.setEnabled(True)
self.CBB_06_Temperature.setEnabled(True)
def On_CBB_00_Unit_Multiple(self, index):
self.displayResultStr()
def On_CBB_011_Puissance(self, index):
text = self.CBB_011_Puissance.itemText(index)
def On_CBB_012_Color_Corps(self, index):
#(bleu clair pour le type SFR16S, vert clair pour le type SFR25 et brun-rouge pour le type SFR25H) norme IEC 60068-2-45.
text = self.CBB_012_Color_Corps.itemText(index)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_Corps[index][0]), int(self.couleur_Corps[index][1]), int(self.couleur_Corps[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.BK_BlackCorps[0], self.BK_BlackCorps[1], self.BK_BlackCorps[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_012_Color_Corps.setPalette(palette)
self.statusbar.showMessage("Color Corps: " +str(index) + " " + text)
index = self.CBB_012_Color_Corps.currentIndex()
def On_CBB_07_E24_Serie(self, index):
text = self.CBB_07_E24_Serie.itemText(index)
self.on_PB_03_Reset()
if text == "E24_Serie":
None
elif text == "0":
self.on_PB_03_Reset()
self.RB_01_Mode_4.setChecked(True)
self.on_RB_01_Mode_4()
self.On_CBB_04_Multiply(0) # bande 4
self.LA_07_Result.setText("0")
self.LA_08_Mini.setText("Mini : 0")
self.LA_09_Maxi.setText("Maxi : 0")
else:
self.on_PB_03_Reset()
self.RB_01_Mode_4.setChecked(True)
self.on_RB_01_Mode_4()
self.On_CBB_01_Color_1(int(text[0])) # bande 1
self.On_CBB_02_Color_2(int(text[1])) # bande 2
self.On_CBB_04_Multiply(0) # bande 4
self.On_CBB_05_Tolrerance(8) # bande 5
def convert_RGB_To_Int(self, Rouge = 1, Vert = 1, Bleu = 1, Transparence = 255):
#ori donne erreur avec blanc = 255 def convert_RGB_To_Int(self, Rouge = 1, Vert = 1, Bleu = 1, Transparence = 256):
# Rouge, Vert, Bleu, Transparence)
converti = int((Rouge*256*256*256 ) + (Vert*256*256) + (Bleu*256) + (Transparence))
#convertiHex = hex(converti)
return converti
def on_LE_03_Entree_Valeur(self): # entree section resistance
self.original_Value_Str = self.LE_03_Entree_Valeur.text()
self.LE_02_Calcul_Entree.setText(self.LE_03_Entree_Valeur.text())
self.on_PB_07_Calcul_Valider()
self.on_PB_08_Calcul_Resultat()
self.textEdit.textCursor().selectionEnd()
self.LE_03_Entree_Valeur.setText("")
def On_CBB_012_Color_Corps_Hov(self, index): # hovering mouse
text = self.CBB_012_Color_Corps.itemText(index)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_Corps[index][0]), int(self.couleur_Corps[index][1]), int(self.couleur_Corps[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.BK_BlackCorps[0], self.BK_BlackCorps[1], self.BK_BlackCorps[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_012_Color_Corps.setPalette(palette)
self.CBB_012_Color_Corps.setCurrentIndex(index)
try:
resistance_Apparence = (App.Material(DiffuseColor = self.convert_RGB_To_Int(self.couleur_Corps[index][0],self.couleur_Corps[index][1],self.couleur_Corps[index][2]),
AmbientColor = 1431655935,
SpecularColor = 2290649343,
EmissiveColor = 255,
Shininess = 0.8999999762,
Transparency = 0.0,))
self.corps.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_1.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_1A.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_1A_Arrondi.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_1B_Arrondi.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_2B_Arrondi.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_2.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_2A.ViewObject.ShapeAppearance = resistance_Apparence
self.capsule_2A_Arrondi.ViewObject.ShapeAppearance = resistance_Apparence
self.soudure_Chamfer.ViewObject.ShapeAppearance = resistance_Apparence
except Exception: # colore the complete corps with hovering the mouse only the construction model
try:
for obj in FreeCAD.ActiveDocument.Objects:
if obj.Name == "Corps":
self.corps = App.ActiveDocument.getObject(obj.Name)
self.corps.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "capsule_1":
self.capsule_1 = App.ActiveDocument.getObject(obj.Name)
self.capsule_1.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "Chamfer":
self.capsule_1A = App.ActiveDocument.getObject(obj.Name)
self.capsule_1A.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "Fillet_2x":
self.capsule_1A_Arrondi = App.ActiveDocument.getObject(obj.Name)
self.capsule_1A_Arrondi.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "capsule_2":
self.capsule_2 = App.ActiveDocument.getObject(obj.Name)
self.capsule_2.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "Chamfer001":
self.capsule_2A = App.ActiveDocument.getObject(obj.Name)
self.capsule_2A.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "Fillet_2x001":
self.capsule_2A_Arrondi = App.ActiveDocument.getObject(obj.Name)
self.capsule_2A_Arrondi.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "soudures":
self.soudure = App.ActiveDocument.getObject(obj.Name)
self.soudure.ViewObject.ShapeAppearance = resistance_Apparence
if obj.Name == "Chamfer002":
self.soudure_Chamfer = App.ActiveDocument.getObject(obj.Name)
self.soudure_Chamfer.ViewObject.ShapeAppearance = resistance_Apparence
except Exception:
None
self.statusbar.showMessage("Color Corps: " +str(index) + " " + text)
def displayResultStr(self, nombreDecimalesINT = 0, nombreZeroInt = 0):
self.LA_07_Result.setText("")
self.total_Str = total_Str_Convert = ""
self.valeur = self.valeurMini = self.valeurMaxi = 0.0
if self.value_1 + self.value_2 + self.value_3 != "":
if self.value_4[0] == "":
self.valeur = int(self.value_1 + self.value_2 + self.value_3 )
else:
valueInt = self.value_1 + self.value_2 + self.value_3
self.valeur = float(valueInt) * float(self.value_4[1])
self.valeurMini = (float(self.valeur) - ((float(self.valeur)/100.0) * self.value_5[1]))
self.valeurMaxi = (float(self.valeur) + ((float(self.valeur)/100.0) * self.value_5[1]))
####
index = self.CBB_00_Unit_Multiple.currentIndex()
text = self.CBB_00_Unit_Multiple.itemText(index)
####
if index == 0:
grandeur = " Ohm(s) "
total_Float_Convert = float(self.valeur)
total_Str_Convert = str(float(self.valeur))
elif index == 1:
grandeur = " Kilo Ohm(s) "
total_Float_Convert = float(self.valeur)/1000.0
total_Str_Convert = str(float(self.valeur)/1000.0)
elif index == 2:
grandeur = " Mega Ohm(s) "
total_Float_Convert = float(self.valeur)/1000000
total_Str_Convert = str(float(self.valeur)/1000000)
elif index == 3:
grandeur = " Giga Ohm(s) "
total_Float_Convert = float(self.valeur)/1000000000
total_Str_Convert = str(float(self.valeur)/1000000000)
####
self.total_Str = total_Str_Convert + grandeur + self.value_5[0] + " " + self.value_6
self.LA_07_Result.setText(self.total_Str) # gras
####
self.LA_08_Mini.setText("Mini : " + str(self.valeurMini))
self.LA_09_Maxi.setText("Maxi : " + str(self.valeurMaxi))
####
def On_CBB_01_Color_1(self, index): # bande 1
text = ""; self.value_1 = ""
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_123[index][0]), int(self.couleur_123[index][1]), int(self.couleur_123[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_01_Color_1.setCurrentIndex(0)
self.CBB_01_Color_1.setPalette(palette)
text = self.CBB_01_Color_1.itemText(index)
self.statusbar.showMessage("Color_1: " + text)
if index == 10:
self.value_1 = ""
self.SPB_01_Color_1.setValue(0)
self.CBB_01_Color_1.setCurrentIndex(10)
else:
self.SPB_01_Color_1.setValue(index)
self.value_1 = str(index)
self.displayResultStr()
def On_CBB_02_Color_2(self, index): # bande 2
text = ""; self.value_2 = ""
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_123[index][0]), int(self.couleur_123[index][1]), int(self.couleur_123[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0: #texte blanc
brush = QtGui.QBrush(QtGui.QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_02_Color_2.setCurrentIndex(0) #ajoute
self.CBB_02_Color_2.setPalette(palette)
text = self.CBB_02_Color_2.itemText(index)
self.statusbar.showMessage("Color_2: " + text)
if index == 10:
self.value_2 = ""
self.SPB_02_Color_2.setValue(0)
self.CBB_02_Color_2.setCurrentIndex(10)
else:
self.SPB_02_Color_2.setValue(index)
self.value_2 = str(index)
self.displayResultStr()
def On_CBB_03_Color_3(self, index): # bande 3
text = ""; self.value_3 = ""
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_123[index][0]), int(self.couleur_123[index][1]), int(self.couleur_123[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_03_Color_3.setCurrentIndex(0) #ajoute
self.CBB_03_Color_3.setPalette(palette)
text = self.CBB_03_Color_3.itemText(index)
self.statusbar.showMessage("Color_3: " + text)
if index == 10:
self.value_3 = ""
self.SPB_03_Color_3.setValue(0)
self.CBB_03_Color_3.setCurrentIndex(10)
else:
self.SPB_03_Color_3.setValue(index)
self.value_3 = str(index)
self.displayResultStr()
def On_CBB_04_Multiply(self, index): # bande 4
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_4[index][0]), int(self.couleur_4[index][1]), int(self.couleur_4[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_04_Multiply.setPalette(palette)
text = self.CBB_04_Multiply.itemText(index)
self.value_4 = ["", 0]
if index == 0:
self.value_4 = [" ", 1]
elif index == 1:
self.value_4 = ["0", 10]
elif index == 2:
self.value_4 = ["00", 100]
elif index == 3:
self.value_4 = ["000", 1000]
elif index == 4:
self.value_4 = ["0000", 10000]
elif index == 5:
self.value_4 = ["00000", 100000]
elif index == 6:
self.value_4 = ["000000", 1000000]
elif index == 7:
self.value_4 = ["0000000", 10000000]
elif index == 8:
self.value_4 = ["00000000", 100000000]
elif index == 9:
self.value_4 = ["000000000", 1000000000]
elif index == 10:
self.value_4 = ["0.1", 0.1]
elif index == 11:
self.value_4 = ["0.01", 0.01]
elif index == 12:
self.value_4 = ["0.001", 0.001]
elif index == 13:
self.value_4 = ["", 0] #Nul
self.SPB_04_Multiply.setSuffix(")( " + text + " )")
self.SPB_04_Multiply.setValue(index)
self.statusbar.showMessage("Multiply: " + text)
self.displayResultStr()
def On_CBB_05_Tolrerance(self, index): # bande 5
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_5[index][0]), int(self.couleur_5[index][1]), int(self.couleur_5[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_05_Tolrerance.setPalette(palette)
text = self.CBB_05_Tolrerance.itemText(index)
self.value_5 = ["", 0]
if index == 0:
self.value_5 = [" 0%", 1] #
elif index == 1:
self.value_5 = [" 1%", 1] #
elif index == 2:
self.value_5 = [" 2%", 2] #
elif index == 3:
self.value_5 = [" 0.5%", 0.5] #
elif index == 4:
self.value_5 = [" 0.25%", 0.25] #
elif index == 5:
self.value_5 = [" 0.1%", 0.1] #
elif index == 6:
self.value_5 = [" 0.05%", 0.05] #
elif index == 7:
self.value_5 = [" 5%", 5] #
elif index == 8:
self.value_5 = [" 10%", 10] #
elif index == 9:
self.value_5 = [" 0", 1] #Nul
self.SPB_05_Tolerance.setSuffix(")( " + text + " )")
self.SPB_05_Tolerance.setValue(index)
self.statusbar.showMessage("Tolrerance: " + text)
self.displayResultStr()
def On_CBB_06_Temperature(self, index): # bande 6
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(int(self.couleur_6[index][0]), int(self.couleur_6[index][1]), int(self.couleur_6[index][2])))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
if index == 0:
brush = QtGui.QBrush(QtGui.QColor(self.WH_White[0], self.WH_White[1], self.WH_White[2]))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
self.CBB_06_Temperature.setPalette(palette)
text = self.CBB_06_Temperature.itemText(index)
self.value_6 = ""
if index == 0:
self.value_6 = " 200 PPM"
elif index == 1:
self.value_6 = " 100 PPM"
elif index == 2:
self.value_6 = " 50 PPM"
elif index == 3:
self.value_6 = " 15 PPM"
elif index == 4:
self.value_6 = " 25 PPM"
elif index == 5:
self.value_6 = " 20 PPM"
elif index == 6:
self.value_6 = " 10 PPM"
elif index == 7:
self.value_6 = " 5 PPM"
elif index == 8:
self.value_6 = " 1 PPM"
elif index == 9:
self.value_6 = "" #Nul
self.SPB_06_Temperature.setSuffix(")( " + text + " )")
self.SPB_06_Temperature.setPrefix("(Idx ")
self.SPB_06_Temperature.setValue(index)
self.statusbar.showMessage("Temperature: " + text)
self.displayResultStr()
def on_PB_03_Reset(self):
self.value_1 = ""
self.value_2 = ""
self.value_3 = ""
self.value_4 = ["", 1]
self.value_5 = ["", 0]
self.value_6 = ""
self.valeur = self.valeurMini = self.valeurMaxi = 0.0
self.DrawStyle = 0
self.PB_04_View.setIcon(QtGui.QIcon.fromTheme("drawStyle",QtGui.QIcon(":/icons/DrawStyleShaded.svg")))
self.PB_02_Create.setStyleSheet("QPushButton {" + "background-color: QPalette.Base" + "}") # origin system
self.SPB_01_Color_1.setValue(0)
self.SPB_02_Color_2.setValue(0)
self.SPB_03_Color_3.setValue(0)
self.SPB_04_Multiply.setValue(0)
self.SPB_05_Tolerance.setValue(0)
self.SPB_06_Temperature.setValue(0)
self.CBB_01_Color_1.setCurrentIndex(10)
self.On_CBB_01_Color_1(10) # activation Nul
self.CBB_02_Color_2.setCurrentIndex(10)
self.On_CBB_02_Color_2(10) # activation Nul
self.CBB_03_Color_3.setCurrentIndex(10)
self.On_CBB_03_Color_3(10) # activation Nul
self.CBB_04_Multiply.setCurrentIndex(13)
self.On_CBB_04_Multiply(13) # activation Nul
self.CBB_05_Tolrerance.setCurrentIndex(9)
self.On_CBB_05_Tolrerance(9) # activation Nul
self.CBB_06_Temperature.setCurrentIndex(9)
self.On_CBB_06_Temperature(9) # activation Nul
self.CBB_07_E24_Serie.setCurrentIndex(0)
self.value_1 = ""
self.value_2 = ""
self.value_3 = ""
self.value_4 = ["", 1]
self.value_5 = ["", 0]
self.value_6 = ""
self.valeur = self.valeurMini = self.valeurMaxi = 0.0
self.displayResultStr()
self.LA_07_Result.setText("?")
self.LA_08_Mini.setText("Mini : ")
self.LA_09_Maxi.setText("Maxi : ")
self.statusbar.showMessage("_Reset_")
def fusionObjects(self, tableau = ""):
from BOPTools import BOPFeatures
bp = BOPFeatures.BOPFeatures(App.activeDocument())
bp.make_multi_fuse(tableau)
App.ActiveDocument.recompute()
return App.ActiveDocument.ActiveObject
def ArrondiCylindre_2x(self, name, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 0, fillet2 = 0.0, fillet22 = 0.0, couleurInt = 11206655):
# special pour cylindre conversion en capsule wires 1, 2, 3
Arrondi = FreeCAD.ActiveDocument.addObject("Part::Fillet","Fillet_2x")
Arrondi.Base = FreeCAD.ActiveDocument.getObject(name.Name)
__fillets__ = [] # 1 = wire1 (couture)
if fillet1 + fillet11 != 0:
__fillets__.append((wireNum1, fillet1, fillet11)) # 2 = wire2
if fillet2 + fillet22 != 0:
__fillets__.append((wireNum2, fillet2, fillet22)) # 3 = wire3
self.deletComp.append(Arrondi.Name)
try:
Arrondi.Edges = __fillets__
Arrondi.Label = name.Label
del __fillets__
Arrondi.ViewObject.ShapeAppearance = (App.Material(DiffuseColor = couleurInt, AmbientColor = 1431655935, SpecularColor = 2290649343, EmissiveColor = 255, Shininess = 0.8999999762, Transparency = 0.0,))
App.ActiveDocument.recompute(None,True,True)
return Arrondi
except Exception:
None
def ChamferCylindre_2x(self, name = "", wireNum1 = 0, chamfer1 = 0.0, chamfer11 = 0.0, wireNum2 = 0, chamfer2 = 0.0, chamfer22 = 0.0, couleurInt = 11206655):
Chamfer = FreeCAD.ActiveDocument.addObject("Part::Chamfer","Chamfer")
Chamfer.Base = FreeCAD.ActiveDocument.getObject(name.Name)
__fillets__ = []
if chamfer1 + chamfer11 != 0:
__fillets__.append((wireNum1, chamfer1, chamfer11))
if chamfer2 + chamfer22 != 0:
__fillets__.append((wireNum2, chamfer2, chamfer22))
self.deletComp.append(Chamfer.Name)
try:
Chamfer.Edges = __fillets__
Chamfer.Label = name.Label
del __fillets__
FreeCAD.ActiveDocument.getObject(name.Name).Visibility = False
Chamfer.ViewObject.ShapeAppearance = (App.Material(DiffuseColor = couleurInt, AmbientColor = 1431655935, SpecularColor = 2290649343, EmissiveColor = 255, Shininess = 0.8999999762, Transparency = 0.0,))
App.activeDocument().recompute(None,True,True)
return Chamfer
except Exception:
None
def boBox(self, objet = "", index = 0): # boundBox dimensions
try:
import Part, Draft
BBox = ["","","","","","","","","","","","",""]
boundBox_ = objet.Shape.BoundBox
BBox[0] = boundBox_
BBox[1] = boundBox_.Center
BBox[2] = boundBox_.DiagonalLength
##
BBox[3] = boundBox_.XLength
BBox[4] = boundBox_.YLength
BBox[5] = boundBox_.ZLength
##
BBox[6] = boundBox_.XMax
BBox[7] = boundBox_.YMax
BBox[8] = boundBox_.ZMax
##
BBox[9] = boundBox_.XMin
BBox[10] = boundBox_.YMin
BBox[11] = boundBox_.ZMin
BBox[12] = ("0 BoundBox", "1 Center" , "2 DiagonalLength",
"3 XLength" , "4 YLength", "5 ZLength",
"6 XMax" , "7 YMax" , "8 ZMax",
"9 XMin" , "10 YMin" , "11 ZMin", "12 Info")
return BBox[index]
except Exception:
None
def bandesCouleurs(self, nom = "Cylindre", rayon = 0.7, longueur = 2.0, couleurInt = 11206655, placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0)):
# cylindre a plat XZ
FreeCAD.ActiveDocument.openTransaction(nom) # memorise les actions (avec annuler restore)
cylindre = App.ActiveDocument.addObject("Part::Cylinder", nom)
self.deletComp.append(cylindre.Name)
cylindre.ViewObject.Visibility = True
cylindre.Label = nom
cylindre.Radius = rayon
cylindre.Height = longueur
cylindre.Placement=App.Placement(App.Vector(placement[0] - (self.boBox(cylindre, 5)/2.0), placement[1], placement[2]),
App.Rotation(rotation[0], rotation[1] + 90.0, rotation[2]),
App.Vector(pointRotation[0], pointRotation[1], pointRotation[2]))
cylindre.ViewObject.ShapeAppearance = (App.Material(DiffuseColor = couleurInt, AmbientColor = 1431655935, SpecularColor = 2290649343, EmissiveColor = 255, Shininess = 0.8999999762, Transparency = 0.0,))
return cylindre
def creation_et_Couleurs_Bandes(self):
bande_01 = bande_02 = bande_03 = bande_04 = bande_05 = bande_06 = ""
#try:
index_Puissance = self.CBB_011_Puissance.currentIndex()
self.text_Puissance = self.CBB_011_Puissance.itemText(index_Puissance)
bande_04_Value_Int = self.CBB_04_Multiply.currentIndex()
bande_05_Value_Int = self.CBB_05_Tolrerance.currentIndex()
bande_06_Value_Int = self.CBB_06_Temperature.currentIndex()
if self.text_Puissance == "1/8 Watt (W)": #3.4 x 1.9
#### Construction resistance 1/8 Debut ####
if self.RB_01_Mode_4.isChecked(): #le nom pour le label est adapte
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 0.953, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-1.05 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 0.86, longueur = 0.30, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-0.40 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 0.86, longueur = 0.30, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 0.86, longueur = 0.30, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (0.40 , 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 0.953, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-1.05 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-0.48 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.164 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.164 , 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (0.48 , 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 0.953, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-1.05 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-0.48 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.164 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.164 , 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 0.86, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (0.48 , 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 0.953, longueur = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (0.950, 0.0, 0.0))
#### Construction resistance 1/8 Fin ####
if self.text_Puissance == "1/4 Watt (W)":
#### Construction resistance 1/4 Debut ####
if self.RB_01_Mode_4.isChecked(): #6.5 x 2.5
if self.value_1 != "" : # le nom pour le label est adapte
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 1.2510, longueur = 0.70, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-2.21 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-1.0 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.0 , 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 1.2510, longueur = 0.70, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-2.21 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-1.0 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.33 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.33 , 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.0 , 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 1.2510, longueur = 0.70, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-2.21 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-1.0 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.33 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.33 , 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 1.1520, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.0 , 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 1.2510, longueur = 0.50, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (2.12, 0.0, 0.0))
#### Construction resistance 1/4 Fin ####
if self.text_Puissance == "1/2 Watt (W)":
#### Construction resistance 1/2 Debut #### 9 x 3.3
if self.RB_01_Mode_4.isChecked(): #le nom pour le label est adapte
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 1.665, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-3.10, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-1.8, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.8, 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 1.665, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-3.10, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-1.8, 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.60, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.60, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.8, 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 1.665, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-3.10, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-1.8, 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.60, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.60, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 1.56, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.8, 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 1.665, longueur = 0.8, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (3.0, 0.0, 0.0))
#### Construction resistance 1/2 Fin ####
if self.text_Puissance == "1 Watt (W)":
#### Construction resistance 1 Debut #### 11.5 x 4.5
if self.RB_01_Mode_4.isChecked(): #le nom pour le label est adapte
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.26, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-4.232 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-2.0 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (2.0 , 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.26, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-4.232 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-2.8 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-0.9 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.9 , 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (2.8 , 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.26, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-4.232 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-2.8 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-1.4 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.4 , 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 2.07, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (2.8, 0.0, 0.0))
#### Construction resistance 1 Fin ####
if self.text_Puissance == "2 Watts (W)":
#### Construction resistance 2 Debut #### 15.5 x 5
if self.RB_01_Mode_4.isChecked(): #le nom pour le label est adapte
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-5.0 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.0 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (3.0 , 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-5.0 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.0 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-1.0 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (1.0 , 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (3.0 , 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-5.0 , 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.0 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-1.5 , 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (1.5 , 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 2.32, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (3.0, 0.0, 0.0))
#### Construction resistance 2 Fin ####
if self.text_Puissance == "3 Watts (W)":
#### Construction resistance 3 Debut #### 17.5 x 6.0
if self.RB_01_Mode_4.isChecked(): #le nom pour le label est adapte
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-5.8, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.0, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (3.0, 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-5.8, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.0 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-1.00, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (1.00, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (3.0, 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-5.8, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.8, 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-1.8, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.2, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (2.2, 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 2.81, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (4.2, 0.0, 0.0))
#### Construction resistance 3 Fin ####
if self.text_Puissance == "5 Watts (W)":
#### Construction resistance 5 Debut #### 24.5 x 8.5
if self.RB_01_Mode_4.isChecked(): #le nom pour le label est adapte
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-9.0, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-3.0, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (3.0, 0.0, 0.0))
elif self.RB_02_Mode_5.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-9.0, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-4.50 , 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-1.50, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (1.50, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (4.50, 0.0, 0.0))
elif self.RB_03_Mode_6.isChecked():
if self.value_1 != "" :
bande_01 = self.bandesCouleurs(nom = "Bande_01", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_1)][0], self.couleur_123[int(self.value_1)][1], self.couleur_123[int(self.value_1)][2]), placement = (-9.0, 0.0, 0.0))
if self.value_2 != "" :
bande_02 = self.bandesCouleurs(nom = "Bande_02", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_2)][0], self.couleur_123[int(self.value_2)][1], self.couleur_123[int(self.value_2)][2]), placement = (-6.0, 0.0, 0.0))
if self.value_3 != "" :
bande_03 = self.bandesCouleurs(nom = "Bande_03", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_123[int(self.value_3)][0], self.couleur_123[int(self.value_3)][1], self.couleur_123[int(self.value_3)][2]), placement = (-3.0, 0.0, 0.0))
if self.value_4[0] != "" :
bande_04 = self.bandesCouleurs(nom = "Bande_04", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_4[bande_04_Value_Int][0], self.couleur_4[bande_04_Value_Int][1], self.couleur_4[bande_04_Value_Int][2]), placement = (0.0, 0.0, 0.0))
if self.value_5[0] != "" :
bande_05 = self.bandesCouleurs(nom = "Bande_05", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_5[bande_05_Value_Int][0], self.couleur_5[bande_05_Value_Int][1], self.couleur_5[bande_05_Value_Int][2]), placement = (3.0, 0.0, 0.0))
if self.value_6 != "":
bande_06 = self.bandesCouleurs(nom = "Bande_06", rayon = 4.02, longueur = 1.50, couleurInt = self.convert_RGB_To_Int(self.couleur_6[bande_06_Value_Int][0], self.couleur_6[bande_06_Value_Int][1], self.couleur_6[bande_06_Value_Int][2]), placement = (6.0, 0.0, 0.0))
#### Construction resistance 5 Fin ####
#except Exception:
# None
try:
self.construction.append(bande_01.Name)
except Exception: None
try:
self.construction.append(bande_02.Name)
except Exception: None
try:
self.construction.append(bande_03.Name)
except Exception: None
try:
self.construction.append(bande_04.Name)
except Exception: None
try:
self.construction.append(bande_05.Name)
except Exception: None
try:
self.construction.append(bande_06.Name)
except Exception: None
#### creation des Bandes Fin ####
def on_PB_06_By_Color(self):
self.MainWindow.hide()
try:
FreeCAD.ActiveDocument.openTransaction("Color Face")
couleur = QColorDialog.getColor()
if couleur.isValid():
couleurName = couleur.name() # hexa "#ef2929"
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 = 255.0 # transparence de 0 a 255
obj_Obj = FreeCADGui.Selection.getSelection() # selection objet
for i in range(len(obj_Obj)):
cols = colors = []
cols = FreeCAD.ActiveDocument.getObject(obj_Obj[i].Name).ViewObject.DiffuseColor
sub_Obj = FreeCADGui.Selection.getSelectionEx()[i].SubObjects
if len(cols) == 1:
for x in obj_Obj[i].Shape.Faces:
colors += [(cols[0])]
else:
colors = cols
for ii in range(len(sub_Obj)):
fce = int(Gui.Selection.getSelectionEx()[i].SubElementNames[ii][4:])-1
colors[fce] = (float(r)/255,float(v)/255,float(b)/255,float(t)/255)
#obj_Obj[i].ViewObject.DiffuseColor = colors
FreeCAD.ActiveDocument.getObject(obj_Obj[i].Name).ViewObject.DiffuseColor = colors
FreeCAD.ActiveDocument.getObject(obj_Obj[i].Name).ViewObject.Transparency = 0
else:
#self.PB_06_By_Color.setIcon(QtGui.QIcon.fromTheme("drawStyle",QtGui.QIcon(":/icons/preferences-general.svg")))
None
except Exception:
None
Gui.Selection.clearSelection()
self.MainWindow.show()
def on_PB_05_TestColors(self): # random colors
if self.RB_01_Mode_4.isChecked():
self.on_PB_03_Reset()
self.On_CBB_01_Color_1(random.randint(0, 9))
self.On_CBB_02_Color_2(random.randint(0, 9))
self.On_CBB_04_Multiply(random.randint(0, 12))
self.On_CBB_05_Tolrerance(random.randint(0, 8))
elif self.RB_02_Mode_5.isChecked():
self.on_PB_03_Reset()
self.On_CBB_01_Color_1(random.randint(0, 9))
self.On_CBB_02_Color_2(random.randint(0, 9))
self.On_CBB_03_Color_3(random.randint(0, 9))
self.On_CBB_04_Multiply(random.randint(0, 12))
self.On_CBB_05_Tolrerance(random.randint(0, 8))
elif self.RB_03_Mode_6.isChecked():
self.on_PB_03_Reset()
self.On_CBB_01_Color_1(random.randint(0, 9))
self.On_CBB_02_Color_2(random.randint(0, 9))
self.On_CBB_03_Color_3(random.randint(0, 9))
self.On_CBB_04_Multiply(random.randint(0, 12))
self.On_CBB_05_Tolrerance(random.randint(0, 8))
self.On_CBB_06_Temperature(random.randint(0, 8))
corpsColor= random.randint(0, 10)
self.CBB_012_Color_Corps.setCurrentIndex(corpsColor)
self.On_CBB_012_Color_Corps(corpsColor)
self.on_PB_02_Create()
def on_PB_04_View(self):
if self.DrawStyle == 1:
self.DrawStyle = 0
Gui.runCommand('Std_DrawStyle',0)
self.PB_04_View.setIcon(QtGui.QIcon.fromTheme("drawStyle",QtGui.QIcon(":/icons/DrawStyleShaded.svg"))) #DrawStyleAsls
else:
self.DrawStyle = 1
Gui.runCommand('Std_DrawStyle',5)
self.PB_04_View.setIcon(QtGui.QIcon.fromTheme("drawStyle",QtGui.QIcon(":/icons/DrawStyleAsIs.svg"))) #DrawStyleAsls
def on_Create_Part_SimpleCopy(self, fuseObject):
### Begin command Part_SimpleCopy avec ShapeAppearance
__shape = Part.getShape(App.ActiveDocument.getObject(fuseObject.Name),'',needSubElement=False,refine=False)
App.ActiveDocument.addObject('Part::Feature','Fusion').Shape=__shape
App.ActiveDocument.recompute(None,True,True)
simpleCopie = App.ActiveDocument.ActiveObject
simpleCopie.Label=App.ActiveDocument.getObject(fuseObject.Name).Label
simpleCopie.ViewObject.ShapeAppearance=getattr(App.ActiveDocument.getObject(fuseObject.Name).getLinkedObject(True).ViewObject,'ShapeAppearance',App.ActiveDocument.getObject('Fusion').ViewObject.ShapeAppearance)
#simpleCopie.ViewObject.LineColor=getattr(App.ActiveDocument.getObject(fuseObject.Name).getLinkedObject(True).ViewObject,'LineColor',App.ActiveDocument.getObject('Fusion').ViewObject.LineColor)
#simpleCopie.ViewObject.PointColor=getattr(App.ActiveDocument.getObject(fuseObject.Name).getLinkedObject(True).ViewObject,'PointColor',App.ActiveDocument.getObject('Fusion').ViewObject.PointColor)
App.ActiveDocument.recompute()
return App.ActiveDocument.ActiveObject
#### Begin command Part_SimpleCopy avec DiffuseColor
#colorFaces = []
#colorFaces = fuseObject.ViewObject.DiffuseColor
#__shape = Part.getShape(App.ActiveDocument.getObject('Fusion'),'',needSubElement=False,refine=False)
#App.ActiveDocument.addObject('Part::Feature','Fusion').Shape=__shape
#App.ActiveDocument.ActiveObject.Label = nomResistance
#App.ActiveDocument.ActiveObject.ViewObject.DiffuseColor = colorFaces # toutes les couleurs
#App.ActiveDocument.recompute()
#return App.ActiveDocument.ActiveObject
#### End command Part_SimpleCopy avec DiffuseColor
def create_Sweep(self, object_Object="", object_Path = ""):
Sweep = App.ActiveDocument.addObject('Part::Sweep','Sweep')
Sweep.Sections=[object_Object]
Sweep.Spine=object_Path
Sweep.Solid=True
Sweep.Frenet=True
FreeCAD.ActiveDocument.recompute()
return Sweep
def create_Circle(self, x = 0.0, y = 0.0, z = 0.0, rayon = 1.0):
pl=FreeCAD.Placement()
pl.Rotation.Q=(0.0, 0.0, 0.0, 1.0)
pl.Base=FreeCAD.Vector(x, y, z)
circle = Draft.make_circle(radius=rayon, placement=pl, face=False, support=None)
Draft.autogroup(circle)
FreeCAD.ActiveDocument.recompute()
return circle
def on_PB_02_Create(self):
####
self.progressBar_00.show()
self.progressBar_00.setTextVisible(True)
index_Puissance = self.CBB_011_Puissance.currentIndex()
self.text_Puissance = self.CBB_011_Puissance.itemText(index_Puissance)
index_Color_Corps = self.CBB_012_Color_Corps.currentIndex()
text_Color_Corps = self.CBB_012_Color_Corps.itemText(index_Color_Corps)
self.construction = [] # efface le tableau
self.fusion = []
self.PB_02_Create.setStyleSheet("QPushButton {" + "background-color: QPalette.Base" + "}") # origin system
try:
Gui.activeDocument().activeView().viewFront()
except Exception:
App.newDocument()
Gui.activeDocument().activeView().viewFront()
if text_Color_Corps == "Blue3 (Body)": # light-blue for type SFR16S
self.serie_Resistance = "SFR16S"
elif text_Color_Corps == "Green (Body)": # light-green for type SFR25
self.serie_Resistance = "SFR25"
elif text_Color_Corps == "Red (Body)": # red-brown for type SFR25H
self.serie_Resistance = "SFR25H"
else:
self.serie_Resistance = ""
nomResistance = self.serie_Resistance + " " + self.text_Puissance + " " + self.total_Str
FreeCAD.ActiveDocument.openTransaction("Creation") # memorise les actions (avec annuler restore)
if self.text_Puissance == "1/8 Watt (W)":
#### Construction corps de resistance 1/8 Debut #### 3.4 x 1.9
#### pour bandes de couleurs
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 0.85, longueur = 2.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 0.95, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-1.1, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1, wireNum1 = 2, fillet1= 0.2, fillet11 = 0.2, wireNum2 = 3, fillet2 = 0.1, fillet22 = 0.1, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1A_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 0.95, longueur = 1.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (1.1, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2, wireNum2 = 2, fillet1= 0.2, fillet11 = 0.2, wireNum1 = 3, fillet2 = 0.1, fillet22 = 0.1, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2A_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.4, longueur = 3.4, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.1, chamfer11 = 0.15, wireNum2 = 3, chamfer2 = 0.1, chamfer22 = 0.15, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 1/8 Fin ####
elif self.text_Puissance == "1/4 Watt (W)":
#### Construction corps de resistance 1/4 Debut #### 6.5 x 2.5
####
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 1.15, longueur = 4.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 1.25, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-2.2, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A = self.ChamferCylindre_2x( self.capsule_1, wireNum1 = 2, chamfer1= 0.2, chamfer11 = 0.95, wireNum2 = 3, chamfer2= 0.4, chamfer22 = 0.1, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, wireNum2 = 3, fillet2 = 0.5, fillet22 = 0.5, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1A_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 1.25, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (2.2, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A = self.ChamferCylindre_2x( self.capsule_2, wireNum1 = 3, chamfer1= 0.2, chamfer11 = 0.95, wireNum2 = 2, chamfer2= 0.4, chamfer22 = 0.1, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A, wireNum1 = 2, fillet1= 0.5, fillet11 = 0.5, wireNum2 = 3, fillet2 = 0.3, fillet22 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2A_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.35, longueur = 6.72, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.3, chamfer11 = 0.05, wireNum2 = 3, chamfer2 = 0.3, chamfer22 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 1/4 Fin ####
elif self.text_Puissance == "1/2 Watt (W)":
#### Construction corps de resistance 1/2 Debut #### 9 x 3.3
####
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 1.55, longueur = 7.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 1.65, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-3.325, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A = self.ChamferCylindre_2x( self.capsule_1, wireNum1 = 2, chamfer1= 0.2, chamfer11 = 1.3, wireNum2 = 3, chamfer2= 0.1, chamfer22 = 0.1, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A, wireNum1 = 2, fillet1= 0.4, fillet11 = 0.4, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1A_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 1.65, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (3.325, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A = self.ChamferCylindre_2x( self.capsule_2, wireNum1 = 3, chamfer1= 0.2, chamfer11 = 1.3, wireNum2 = 2, chamfer2= 0.1, chamfer22 = 0.1, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.4, fillet22 = 0.4, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2A_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.35, longueur = 9.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.3, chamfer11 = 0.05, wireNum2 = 3, chamfer2 = 0.3, chamfer22 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 1/2 Fin ####
elif self.text_Puissance == "1 Watt (W)":
#### Construction corps de resistance 1 Debut #### 11.5 x 4.5
####
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 2.05, longueur = 9.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 2.25, longueur = 2.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-4.45, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A = self.ChamferCylindre_2x( self.capsule_1, wireNum1 = 2, chamfer1= 0.4, chamfer11 = 1.75, wireNum2 = 3, chamfer2= 0.2, chamfer22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A, wireNum1 = 2, fillet1= 0.4, fillet11 = 0.4, wireNum2 = 0, fillet2 = 0.0, fillet22 = 0.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A_Arrondi.ViewObject.Visibility = False
self.capsule_1B_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A_Arrondi, wireNum1 = 3, fillet1= 0.2, fillet11 = 0.2, wireNum2 = 0, fillet2 = 0.0, fillet22 = 0.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1B_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 2.25, longueur = 2.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (4.50, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A = self.ChamferCylindre_2x( self.capsule_2, wireNum1 = 3, chamfer1= 0.4, chamfer11 = 1.75, wireNum2 = 2, chamfer2= 0.2, chamfer22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.4, fillet22 = 0.4, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A_Arrondi.ViewObject.Visibility = False
self.capsule_2B_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A_Arrondi, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.2, fillet22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2B_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.5, longueur = 11.6, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.3, chamfer11 = 0.10, wireNum2 = 3, chamfer2 = 0.3, chamfer22 = 0.10, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 1 Fin ####
elif self.text_Puissance == "2 Watts (W)":
#### Construction corps de resistance 2 Debut #### 15.5 x 5
####
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 2.3, longueur = 14.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 2.5, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-6.575, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A = self.ChamferCylindre_2x( self.capsule_1, wireNum1 = 2, chamfer1= 0.2, chamfer11 = 2.0, wireNum2 = 3, chamfer2= 0.2, chamfer22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A, wireNum1 = 2, fillet1= 0.4, fillet11 = 0.4, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A_Arrondi.ViewObject.Visibility = False
self.capsule_1B_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A_Arrondi, wireNum1 = 3, fillet1= 0.2, fillet11 = 0.2, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1B_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 2.5, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (6.575, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A = self.ChamferCylindre_2x( self.capsule_2, wireNum1 = 3, chamfer1= 0.2, chamfer11 = 2.0, wireNum2 = 2, chamfer2= 0.2, chamfer22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.4, fillet22 = 0.4, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A_Arrondi.ViewObject.Visibility = False
self.capsule_2B_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A_Arrondi, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.2, fillet22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2B_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.5, longueur = 15.5, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.3, chamfer11 = 0.10, wireNum2 = 3, chamfer2 = 0.3, chamfer22 = 0.10, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 2 Fin ####
elif self.text_Puissance == "3 Watts (W)":
#### Construction corps de resistance 3 Debut #### 17.5 x 6
####
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 2.8, longueur = 15.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 3.0, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-7.575, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A = self.ChamferCylindre_2x( self.capsule_1, wireNum1 = 2, chamfer1= 0.2, chamfer11 = 2.5, wireNum2 = 3, chamfer2= 0.2, chamfer22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A, wireNum1 = 2, fillet1= 0.4, fillet11 = 0.4, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A_Arrondi.ViewObject.Visibility = False
self.capsule_1B_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A_Arrondi, wireNum1 = 3, fillet1= 0.2, fillet11 = 0.2, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1B_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 3.0, longueur = 1.75, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (7.575, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A = self.ChamferCylindre_2x( self.capsule_2, wireNum1 = 3, chamfer1= 0.2, chamfer11 = 2.5, wireNum2 = 2, chamfer2= 0.2, chamfer22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.4, fillet22 = 0.4, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A_Arrondi.ViewObject.Visibility = False
self.capsule_2B_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A_Arrondi, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.2, fillet22 = 0.2, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2B_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.5, longueur = 17.5, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.3, chamfer11 = 0.10, wireNum2 = 3, chamfer2 = 0.3, chamfer22 = 0.10, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 3 Fin ####
elif self.text_Puissance == "5 Watts (W)":
#### Construction corps de resistance 5 Debut #### 24.5 x 8.5
####
self.progressBar_00.setFormat("Create Corps"); self.progressBar_00.setValue(1)
Gui.updateGui() # refresh the screen
self.corps = self.bandesCouleurs(nom = "Corps", rayon = 4.0, longueur = 20.0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]), placement = (0.0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(self.corps.Name)
self.progressBar_00.setFormat("Create Capsule L"); self.progressBar_00.setValue(2)
Gui.updateGui() # refresh the screen
self.capsule_1 = self.bandesCouleurs(nom = "capsule_1", rayon = 4.25, longueur = 2.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (-10.95, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_1.ViewObject.Visibility = False
self.capsule_1A = self.ChamferCylindre_2x( self.capsule_1, wireNum1 = 2, chamfer1= 0.2, chamfer11 = 3.75, wireNum2 = 3, chamfer2= 0.25, chamfer22 = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A.ViewObject.Visibility = False
self.capsule_1A_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A, wireNum1 = 2, fillet1= 0.4, fillet11 = 0.4, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_1A_Arrondi.ViewObject.Visibility = False
self.capsule_1B_Arrondi = self.ArrondiCylindre_2x( self.capsule_1A_Arrondi, wireNum1 = 3, fillet1= 0.2, fillet11 = 0.2, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_1B_Arrondi.Name)
self.progressBar_00.setFormat("Create Capsule R"); self.progressBar_00.setValue(3)
Gui.updateGui() # refresh the screen
self.capsule_2 = self.bandesCouleurs(nom = "capsule_2", rayon = 4.25, longueur = 2.0, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (10.95, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.capsule_2.ViewObject.Visibility = False
self.capsule_2A = self.ChamferCylindre_2x( self.capsule_2, wireNum1 = 3, chamfer1= 0.2, chamfer11 = 3.75, wireNum2 = 2, chamfer2= 0.25, chamfer22 = 0.25, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A.ViewObject.Visibility = False
self.capsule_2A_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A, wireNum1 = 0, fillet1= 0.0, fillet11 = 0.0, wireNum2 = 3, fillet2 = 0.4, fillet22 = 0.4, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.capsule_2A_Arrondi.ViewObject.Visibility = False
self.capsule_2B_Arrondi = self.ArrondiCylindre_2x( self.capsule_2A_Arrondi, wireNum1 = 3, fillet1= 0.2, fillet11 = 0.2, wireNum2 = 0, fillet2 = 0, fillet22 = 0, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.capsule_2B_Arrondi.Name)
self.progressBar_00.setFormat("Create Welding"); self.progressBar_00.setValue(4)
Gui.updateGui() # refresh the screen
self.soudure = self.bandesCouleurs(nom = "soudures", rayon = 0.5, longueur = 24.5, couleurInt = self.convert_RGB_To_Int(self.CO_Capsule[0],self.CO_Capsule[1],self.CO_Capsule[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.soudure.ViewObject.Visibility = False
self.soudure_Chamfer = self.ChamferCylindre_2x( self.soudure, wireNum1 = 2, chamfer1= 0.3, chamfer11 = 0.10, wireNum2 = 3, chamfer2 = 0.3, chamfer22 = 0.10, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
self.construction.append(self.soudure_Chamfer.Name)
#### Construction corps de resistance 5 Fin ####
self.creation_et_Couleurs_Bandes()
#### contacts Debut ####
self.progressBar_00.setFormat("Create Contacts")
self.progressBar_00.setValue(5)
Gui.updateGui() # refresh the screen
FreeCAD.ActiveDocument.openTransaction("Creation Contact") # memorise les actions (avec annuler restore)
if self.CBB_08_Type_Contact.currentIndex() == 0: # 0 = contact droit
if self.text_Puissance == "1/8 Watt (W)":
self.contacts_Resistance_Rayon = 0.25
self.contacts_Resistance_Longueur = 28.0 * 2.0 + 3.5
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
elif self.text_Puissance == "1/4 Watt (W)":
self.contacts_Resistance_Rayon = 0.3
self.contacts_Resistance_Longueur = 28.0 * 2.0 + 6.5
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
elif self.text_Puissance == "1/2 Watt (W)":
self.contacts_Resistance_Rayon = 0.3
self.contacts_Resistance_Longueur = 28.0 * 2.0 + 9.0
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
elif self.text_Puissance == "1 Watt (W)":
self.contacts_Resistance_Rayon = 0.4
self.contacts_Resistance_Longueur = 35.0 * 2.0 + 11.5
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
elif self.text_Puissance == "2 Watts (W)":
self.contacts_Resistance_Rayon = 0.4
self.contacts_Resistance_Longueur = 35.0 * 2.0 + 15.5
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
elif self.text_Puissance == "3 Watts (W)":
self.contacts_Resistance_Rayon = 0.4
self.contacts_Resistance_Longueur = 35.0 * 2.0 + 17.5
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
elif self.text_Puissance == "5 Watts (W)":
self.contacts_Resistance_Rayon = 0.4
self.contacts_Resistance_Longueur = 38.0 * 2.0 + 24.5
contacts_Fil = self.bandesCouleurs(nom = "contacts_Fil", rayon = self.contacts_Resistance_Rayon, longueur = self.contacts_Resistance_Longueur, couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2]), placement = (0, 0.0, 0.0), rotation = (0.0, 0.0, 0.0), pointRotation = (0.0, 0.0, 0.0))
self.construction.append(contacts_Fil.Name)
elif self.CBB_08_Type_Contact.currentIndex() == 1: # 1 = contact courbe (pontage)
# formule longueur entraxes = (longueurG + coinsCourbure) x 2
# formule X = (longueurG + coinsCourbure)
# formule Z hauteur = (hauteurG + coinsCourbure)
# rayon = rayon du contact
if self.text_Puissance == "1/8 Watt (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 2.54, longueurD = 2.54, hauteurG = 6, hauteurD = 6, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -3.54, y = 0.0, z = -7.0, rayon = 0.25)
elif self.text_Puissance == "1/4 Watt (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 4.04, longueurD = 4.04, hauteurG = 6, hauteurD = 6, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -5.04, y = 0.0, z = -7.0, rayon = 0.3)
elif self.text_Puissance == "1/2 Watt (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 5.35, longueurD = 5.35, hauteurG = 6, hauteurD = 6, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -6.35, y = 0.0, z = -7.0, rayon = 0.3)
elif self.text_Puissance == "1 Watt (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 6.62, longueurD = 6.62, hauteurG = 6, hauteurD = 6, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -7.62, y = 0.0, z = -7.0, rayon = 0.4)
elif self.text_Puissance == "2 Watts (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 7.89, longueurD = 7.89, hauteurG = 10, hauteurD = 10, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -8.89, y = 0.0, z = -11.0, rayon = 0.4)
elif self.text_Puissance == "3 Watts (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 9.16, longueurD = 9.16, hauteurG = 10, hauteurD = 10, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -10.16, y = 0.0, z = -11.0, rayon = 0.4)
elif self.text_Puissance == "5 Watts (W)":
contacts_Fil = self.contacts_Courbe1_Creation(longueurG = 12.97, longueurD = 12.97, hauteurG = 10, hauteurD = 10, coinsCourbure = 1.0)
cercle = self.create_Circle( x = -13.97, y = 0.0, z = -11.0, rayon = 0.4)
#try:
self.progressBar_00.setFormat("Create Sweep")
self.progressBar_00.setValue(6)
Gui.updateGui() # refresh the screen
contacts_Fil.Label = "Contacts_loG"
contacts_Fil.ViewObject.Visibility = False
cercle.ViewObject.Visibility = False
creation_Sweep = self.create_Sweep(object_Object = cercle, object_Path = contacts_Fil)
couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2])
creation_Sweep.ViewObject.ShapeAppearance= (App.Material(DiffuseColor = couleurInt, AmbientColor = 1431655935, SpecularColor = 2290649343, EmissiveColor = 255, Shininess = 0.8999999762, Transparency = 0.0,))
creation_Sweep.Label = "Sweep Fil_Courbe"
self.construction.append(creation_Sweep.Name)
self.deletComp.append(cercle.Name)
self.deletComp.append(contacts_Fil.Name)
self.deletComp.append(creation_Sweep.Name)
#except Exception:
# None
elif self.CBB_08_Type_Contact.currentIndex() == 2 or self.CBB_08_Type_Contact.currentIndex() == 3: # 2 = vertical , 3 = vertical avec protection
### Begin command Part_Fuse
self.progressBar_00.setFormat("Create Contact Horizontal")
self.progressBar_00.setValue(7)
Gui.updateGui() # refresh the screen
from BOPTools import BOPFeatures
bp = BOPFeatures.BOPFeatures(App.activeDocument())
bp.make_multi_fuse(self.construction)
App.ActiveDocument.recompute()
###
fuseObject = App.ActiveDocument.ActiveObject
fuseObject.ViewObject.Visibility = False
fuseObject.Label = nomResistance
self.deletComp.append(fuseObject.Name)
### End command Part_Fuse
fuseObject2 = self.on_Create_Part_SimpleCopy(fuseObject)
### Begin command Std_Delete
for i in self.deletComp:
try:
App.ActiveDocument.removeObject(i)
except Exception:
None
for i in self.construction:
try:
App.ActiveDocument.removeObject(i)
except Exception:
None
### End command Std_Delete
self.construction = []
self.deletComp = []
self.construction.append(fuseObject2.Name)
self.deletComp.append(fuseObject2.Name)
# rotation de la resistance
fuseObject2.Placement = App.Placement(App.Vector(0,0,(self.boBox(fuseObject2, 3)/2) + 0.5), App.Rotation(0,90,0), App.Vector(0,0,0))
# rotation de la resistance
if self.text_Puissance == "1/8 Watt (W)": # 2 = contact Protection vertical
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 4, distance_Entre_Pins = 2.54)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.25) # rayon = 0.25 radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 2, Longueur_PD = 3.5, hauteur_Cercle = 4, distance_Entre_Pins = 2.54)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 2.0, rayon = 0.30) # z = 0,0,0 to base Longueur_PG =(hauteur_Cercle-Longueur_PG) , rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
elif self.text_Puissance == "1/4 Watt (W)":
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 7.3, distance_Entre_Pins = 2.54)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.3) # z = longueurSZ_G = length sous zero , rayon = radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 2, Longueur_PD = 6.5, hauteur_Cercle = 7.3, distance_Entre_Pins = 2.54)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 5.3, rayon = 0.35) # z = 0,0,0 to base Longueur_PG =(hauteur_Cercle-Longueur_PG) , rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
elif self.text_Puissance == "1/2 Watt (W)":
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 9.8, distance_Entre_Pins = 2.54)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.3) # rayon = radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 2, Longueur_PD = 9.0, hauteur_Cercle = 9.8, distance_Entre_Pins = 2.54)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 7.8, rayon = 0.35) # z = 0,0,0 to base Longueur_PG =(hauteur_Cercle-Longueur_PG) , rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
elif self.text_Puissance == "1 Watt (W)":
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 12.2, distance_Entre_Pins = 3.81)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.3) # z = longueurSZ_G = length sous zero , rayon = radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 2, Longueur_PD = 11.0, hauteur_Cercle = 12.2, distance_Entre_Pins = 3.81)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 10.2, rayon = 0.35) # de z = 0,0,0 a base Longueur_PG =(hauteur_Cercle-Longueur_PG) , rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
elif self.text_Puissance == "2 Watts (W)":
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 16.5, distance_Entre_Pins = 3.81)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.3) # z = longueurSZ_G = length sous zero , rayon = radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 2, Longueur_PD = 15.5, hauteur_Cercle = 16.5, distance_Entre_Pins = 3.81)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 14.5, rayon = 0.35) # de z = 0,0,0 a base Longueur_PG =(hauteur_Cercle-Longueur_PG), rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
elif self.text_Puissance == "3 Watts (W)":
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 18.5, distance_Entre_Pins = 3.81)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.3) # z = longueurSZ_G = length sous zero , rayon = radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 2, Longueur_PD = 18.0, hauteur_Cercle = 18.5, distance_Entre_Pins = 3.81)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 16.5, rayon = 0.35) # de z = 0,0,0 a base Longueur_PG =(hauteur_Cercle-Longueur_PG), rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
elif self.text_Puissance == "5 Watts (W)":
contacts_Fil = self.contacts_Courbe_Vertical_Type_1_Creation(longueurSZ_G = 10, longueurSZ_D = 8, hauteur = 25.30, distance_Entre_Pins = 5.08)
cercleS = self.create_Circle( x = 0, y = 0.0, z = -10.0, rayon = 0.4) # z = longueurSZ_G = length sous zero , rayon = radius contact
creation_Sweep = self.create_Sweep( object_Object=cercleS, object_Path = contacts_Fil)
App.activeDocument().recompute(None,True,True)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP = self.contacts_Courbe_Vertical_Type_1_Protection(Longueur_PG = 5, Longueur_PD = 24.5, hauteur_Cercle = 25.30, distance_Entre_Pins = 5.08)
cercle_VP = self.create_Circle( x = 0, y = 0.0, z = 20.3, rayon = 0.45) # de z = 0,0,0 a base Longueur_PG (hauteur_Cercle-Longueur_PG), rayon = radius protection
creation_Sweep_VP = self.create_Sweep( object_Object=cercle_VP, object_Path = contacts_Fil_VP)
creation_Chamfer_VP = self.ChamferCylindre_2x( name = creation_Sweep_VP, wireNum1 = 7, chamfer1 = 0.2, chamfer11 = 0.05, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
creation_Arrondi_VP = self.ArrondiCylindre_2x( name = creation_Chamfer_VP, wireNum1 = 2, fillet1= 0.3, fillet11 = 0.3, couleurInt = self.convert_RGB_To_Int(self.couleur_Corps[index_Color_Corps][0],self.couleur_Corps[index_Color_Corps][1],self.couleur_Corps[index_Color_Corps][2]))
App.activeDocument().recompute(None,True,True)
couleurInt = self.convert_RGB_To_Int(self.CO_Contacts[0],self.CO_Contacts[1],self.CO_Contacts[2])
creation_Sweep.ViewObject.ShapeAppearance = (App.Material(DiffuseColor = couleurInt, AmbientColor = 1431655935, SpecularColor = 2290649343, EmissiveColor = 255, Shininess = 0.8999999762, Transparency = 0.0,))
contacts_Fil.ViewObject.Visibility = False
contacts_Fil.Label = "ContactFil_Vertical"
cercleS.ViewObject.Visibility = False
cercleS.Label = "Cercle_Vertical"
creation_Sweep.Label = "Sweep_Vertical"
self.construction.append(creation_Sweep.Name)
self.deletComp.append(contacts_Fil.Name)
self.deletComp.append(cercleS.Name)
self.deletComp.append(creation_Sweep.Name)
if self.CBB_08_Type_Contact.currentIndex() == 3:
contacts_Fil_VP.ViewObject.Visibility = False
contacts_Fil_VP.Label = "ContactFil_Vertical_P"
cercle_VP.ViewObject.Visibility = False
cercle_VP.Label = "Cercle_Vertical_P"
creation_Sweep_VP.ViewObject.Visibility = False
creation_Sweep_VP.Label = "Sweep_Vertical_P"
creation_Chamfer_VP.ViewObject.Visibility = False
creation_Chamfer_VP.Label = "Chamfer_Vertical_P"
creation_Arrondi_VP.Label = "Arrondi_Vertical_P"
self.construction.append(creation_Arrondi_VP.Name)
self.deletComp.append(contacts_Fil_VP.Name)
self.deletComp.append(cercle_VP.Name)
self.deletComp.append(creation_Sweep_VP.Name)
self.deletComp.append(creation_Chamfer_VP.Name)
self.deletComp.append(creation_Arrondi_VP.Name)
#### contacts Fin ####
App.ActiveDocument.recompute(None,True,True)
self.progressBar_00.setFormat("Create Fuse")
self.progressBar_00.setValue(7)
Gui.updateGui() # refresh the screen
fuseObject = self.fusionObjects(tableau = self.construction)
fuseObject.ViewObject.Visibility = False
fuseObject.Label = nomResistance
self.on_Create_Part_SimpleCopy(fuseObject)
self.deletComp.append(fuseObject.Name)
### Begin command Std_Delete
if self.CB_01_Construction.isChecked():
for i in self.deletComp:
try:
App.ActiveDocument.removeObject(i)
except Exception:
None
### End command Std_Delete
App.ActiveDocument.recompute()
Gui.Selection.clearSelection()
self.deletComp = []
self.construction = [] # efface le tableau
self.progressBar_00.close()
def on_PB_01_Quit(self):
global sObserver
global setMainWindowMoveX
global setMainWindowMoveY
global setFrameWindowSizeX
global setFrameWindowSizeY
#FreeCAD.removeDocumentObserver(sObserver) # desinstalle la fonction residente DocObserver
#### geometry
positionWindowXY = self.MainWindow.geometry()
setMainWindowMoveX = positionWindowXY.x()
setMainWindowMoveY = positionWindowXY.y()
positionWindowXY = self.MainWindow.size()
setFrameWindowSizeX = positionWindowXY.width()
setFrameWindowSizeY = positionWindowXY.height()
FreeCAD_ParamGetSet.SetInt(u"setMainWindowMoveX", setMainWindowMoveX) # setMainWindowMoveX
FreeCAD_ParamGetSet.SetInt(u"setMainWindowMoveY", setMainWindowMoveY) # setMainWindowMoveY
FreeCAD_ParamGetSet.SetInt(u"setFrameWindowSizeX", setFrameWindowSizeX) # setFrameWindowSizeX
FreeCAD_ParamGetSet.SetInt(u"setFrameWindowSizeY", setFrameWindowSizeY) # setFrameWindowSizeY
#### geometry
try:
self.MainWindow.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # destroy
self.MainWindow.deleteLater() # destroy
self.MainWindow.destroy() # destroy
App_Console_PrintMessage(u"Close Mon " + __Title__ + "\n")
except Exception:
self.MainWindow.hide()
def Calcul_Et_Construction(self, valueSTR = "", nombreDecimalesINT = 0):
self.on_PB_03_Reset()
numSTR = decSTR = ""
try:
numSTR = self.original_Value_Str.split(".")[0]
numINT = int(numSTR)
except Exception:
numSTR = "0"
numINT = int(numSTR)
try:
decSTR = self.original_Value_Str.split(".")[1]
decINT = int(decSTR)
if decINT == 0:
decSTR = ""
decSTR = decSTR[:3]
except Exception:
decSTR = ""
decINT = 0
nombreDecimalesINT = len(decSTR)
if self.RB_01_Mode_4.isChecked(): # mode 4 bandes
if (numINT >= 10) and (nombreDecimalesINT != 0):
valueSTR = valueSTR[:-nombreDecimalesINT]
nombreDecimalesINT = 0
if (nombreDecimalesINT == 0):
if len(valueSTR) == 1:
valueSTR = "0" + valueSTR
self.On_CBB_04_Multiply(0) # bande 4
if int(valueSTR) >= 10:
tolerance = (len(valueSTR) - 2)
self.On_CBB_04_Multiply(tolerance) # bande 4
if numINT >= 100:
self.On_CBB_04_Multiply(len(str(numINT)) - 2) # bande 4
self.value_1 = valueSTR[0]
self.value_2 = valueSTR[1]
self.On_CBB_01_Color_1(int(self.value_1)) # bande 1
self.On_CBB_02_Color_2(int(self.value_2)) # bande 2
self.On_CBB_05_Tolrerance(8) # bande 5
else: # nombreDecimalesINT != 0:
if numINT == 0:
valueSTR = decSTR[:2]
if numINT != 0:
decSTR = decSTR[:1]
nombreDecimalesINT = 1
if nombreDecimalesINT > 2: nombreDecimalesINT = 2
if len(valueSTR) == 1: valueSTR = "0" + valueSTR
self.On_CBB_04_Multiply(nombreDecimalesINT) # bande 4
self.value_1 = valueSTR[0]
self.value_2 = valueSTR[1]
self.On_CBB_01_Color_1(int(self.value_1)) # bande 1
self.On_CBB_02_Color_2(int(self.value_2)) # bande 2
self.On_CBB_05_Tolrerance(1) # bande 5 (0,1)
self.On_CBB_04_Multiply(0)
if nombreDecimalesINT == 1:
self.On_CBB_04_Multiply(10) # bande 4
if nombreDecimalesINT == 2:
self.On_CBB_04_Multiply(11) # bande 4
elif (self.RB_02_Mode_5.isChecked()) or (self.RB_03_Mode_6.isChecked()): # mode 5 et 6 bandes
if numINT == 0:
valueSTR = decSTR[:3]
if numINT != 0:
decSTR = decSTR[:1]
if nombreDecimalesINT > 3: nombreDecimalesINT = 3
if len(valueSTR) == 1: valueSTR = "0" + valueSTR
if decSTR != "":
decSTR = decSTR[:3]
nombreDecimalesINT = len(decSTR)
if (numINT >= 100) and (nombreDecimalesINT != 0):
valueSTR = valueSTR[:-nombreDecimalesINT]
nombreDecimalesINT = 0
if (nombreDecimalesINT == 0):
if len(valueSTR) == 1: valueSTR = "00" + valueSTR
if len(valueSTR) == 2: valueSTR = "0" + valueSTR
if int(valueSTR) >= 10:
tolerance = (len(valueSTR) - 3)
self.On_CBB_04_Multiply(tolerance) # bande 4
else:
self.On_CBB_04_Multiply(0) # bande 4
if numINT >= 100:
self.On_CBB_04_Multiply(len(str(numINT)) - 3) # bande 4
self.value_1 = valueSTR[0]
self.value_2 = valueSTR[1]
self.value_3 = valueSTR[2]
self.On_CBB_01_Color_1(int(self.value_1)) # bande 1
self.On_CBB_02_Color_2(int(self.value_2)) # bande 2
self.On_CBB_03_Color_3(int(self.value_3)) # bande 3
self.On_CBB_05_Tolrerance(8) # bande 5
else: # nombreDecimalesINT != 0: # avec decimales
try:
numSTR = self.original_Value_Str.split(".")[0]
numINT = int(numSTR)
except Exception:
numSTR = "0"
numINT = int(numSTR)
try:
decSTR = self.original_Value_Str.split(".")[1]
decINT = int(decSTR)
if decINT == 0:
decSTR = ""
decSTR = decSTR[:3]
except Exception:
decSTR = ""
decINT = 0
nombreDecimalesINT = len(decSTR)
if numINT == 0:
valueSTR = decSTR[:3]
if numINT == 0:
if len(valueSTR) == 1: valueSTR = "00" + valueSTR
if len(valueSTR) == 2: valueSTR = "0" + valueSTR
elif (nombreDecimalesINT != 0) and (numINT != 0):
if (numINT == 1) and (nombreDecimalesINT == 2):
valueSTR = numSTR + decSTR + "0"
if (numINT >= 10) and (nombreDecimalesINT >= 2):
valueSTR = numSTR + decSTR[0]
nombreDecimalesINT = 1
if (numINT <= 9):
if (nombreDecimalesINT == 1):
valueSTR = "0" + valueSTR + "0"
if (nombreDecimalesINT > 1):
decSTR = decSTR[:2]
nombreDecimalesINT = len(decSTR)
self.value_1 = valueSTR[0]
self.value_2 = valueSTR[1]
self.value_3 = valueSTR[2]
self.On_CBB_01_Color_1(int(self.value_1)) # bande 1
self.On_CBB_02_Color_2(int(self.value_2)) # bande 2
self.On_CBB_03_Color_3(int(self.value_3)) # bande 3
self.On_CBB_05_Tolrerance(1) # bande 5 (0,1)
self.On_CBB_04_Multiply(0)
if nombreDecimalesINT == 1:
self.On_CBB_04_Multiply(10) # bande 4
if nombreDecimalesINT == 2:
self.On_CBB_04_Multiply(11) # bande 4
if nombreDecimalesINT == 3:
self.On_CBB_04_Multiply(12) # bande 4
if self.RB_03_Mode_6.isChecked():
self.On_CBB_06_Temperature(6) # bande 6
nombreDecimalesINT = 0
self.displayResultStr(nombreDecimalesINT = nombreDecimalesINT)
self.PB_02_Create.setStyleSheet("QPushButton {" + "background-color: green" + "}") # green
def on_CB_02_Calcul_SeriePara(self):
self.textEdit.setFontWeight(QFont.Bold)
if self.CB_02_Calcul_SeriePara.isChecked():
self.textEdit.setTextColor(QtGui.QColor("Darkblue"))
self.CB_02_Calcul_SeriePara.setText("Serie")
self.textEdit.append("____ Parallel ____ ")
self.CB_02_Calcul_SeriePara.setIcon(QtGui.QIcon.fromTheme("quit",QtGui.QIcon(":/icons/constraints/Constraint_Horizontal.svg")))
else:
self.textEdit.setTextColor(QtGui.QColor("Green"))
self.CB_02_Calcul_SeriePara.setText("Parallel")
self.textEdit.append("____ Serial ____")
self.CB_02_Calcul_SeriePara.setIcon(QtGui.QIcon.fromTheme("quit",QtGui.QIcon(":/icons/constraints/Constraint_Parallel.svg")))
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.textEdit.setFontWeight(QFont.Normal)
def refresh_LE_02_Calcul_Entree(self):
self.LE_02_Calcul_Entree.setStyleSheet("QLineEdit {" + "background-color: QPalette.Base" + "}") # origin system
self.LE_03_Entree_Valeur.setStyleSheet("QLineEdit {" + "background-color: QPalette.Base" + "}") # origin system
def on_PB_07_Calcul_Valider(self): # Enter
self.original_Value_Str = self.LE_02_Calcul_Entree.text()
resultat = re.findall(r"[^0-9^.^,]", self.LE_02_Calcul_Entree.text())
try:
float(self.LE_02_Calcul_Entree.text())
except Exception:
resultat = ""
self.LE_02_Calcul_Entree.setText("")
if (resultat != []):
self.LE_02_Calcul_Entree.setText("")
self.PB_07_Calcul_Valider
self.LE_02_Calcul_Entree.setStyleSheet("QLineEdit {" + "background-color: red" + "}")
self.LE_03_Entree_Valeur.setStyleSheet("QLineEdit {" + "background-color: red" + "}")
QtCore.QTimer().singleShot(300,self.refresh_LE_02_Calcul_Entree)
if (self.LE_02_Calcul_Entree.text() != ""):
dummy = ""
dummy = self.LE_02_Calcul_Entree.text().count(".")
if dummy >= 2:
dummy = self.LE_02_Calcul_Entree.text().split(".")[0]
else:
dummy = self.LE_02_Calcul_Entree.text()
self.calculResistance.append(dummy)
if self.CB_02_Calcul_SeriePara.isChecked():
self.textEdit.setTextColor(QtGui.QColor("Darkblue"))
self.textEdit.append("Pa: " + self.LE_02_Calcul_Entree.text())
else:
self.textEdit.setTextColor(QtGui.QColor("Green"))
self.textEdit.append("Se: " + self.LE_02_Calcul_Entree.text())
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.LE_02_Calcul_Entree.clear()
self.PB_02_Create.setStyleSheet("QPushButton {" + "background-color: QPalette.Base" + "}") # origin system
self.LE_03_Entree_Valeur.setStyleSheet("QPushButton {" + "background-color: QPalette.Base" + "}") # origin system
cursor = QTextCursor()
#cursor.beginEditBlock()
cursor.endEditBlock()
def on_PB_08_Calcul_Resultat(self): # calcul des resistances
resultat = dummy = 0.0
if self.CB_02_Calcul_SeriePara.isChecked(): # Parallel
for i in self.calculResistance:
dummy += (1.0/float(i))
try:
resultat = 1.0/dummy
if (resultat != 0):
self.textEdit.setTextColor(QtGui.QColor("Darkblue"))
self.CBB_09_Calcul_Memo.addItem(str(self.compteurOperations) + " IDX Par: " + str(round(resultat, 5)))
typeCalcul = "Para "
self.compteurOperations += 1
except Exception:
resultat = 0
else:
for i in self.calculResistance: # Serial
dummy += float(i)
resultat = dummy
if (resultat != 0):
self.textEdit.setTextColor(QtGui.QColor("Green"))
self.CBB_09_Calcul_Memo.addItem(str(self.compteurOperations) + " IDX Ser: " + str(round(resultat, 5)))
typeCalcul = "Seri "
self.compteurOperations += 1
if resultat != 0:
self.textEdit.append(" ____________")
self.textEdit.setFontWeight(QFont.Bold)
self.textEdit.setTextColor(QtGui.QColor("blue"))
self.textEdit.append(typeCalcul + "Result = " + str(resultat) + "\n")
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.textEdit.setFontWeight(QFont.Normal)
if self.CB_02_Calcul_SeriePara.isChecked(): # Parallel
self.textEdit.setTextColor(QtGui.QColor("Darkblue")) # Parallel
else:
self.textEdit.setTextColor(QtGui.QColor("Green")) # Serial
self.textEdit.append(str(self.compteurOperations) + " IDX : Begin_____________________")
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.calculResistance = []
resultatNumeric = resultatDecimal = ""
resultatNumeric = str(resultat).split(".")[0]
if len(str(resultat).split(".")) > 1:
resultatDecimal = str(resultat).split(".")[1]
if int(resultatDecimal) == 0:
resultatDecimal = ""
nombreDecimales = len(resultatDecimal)
resultat = resultatNumeric + resultatDecimal
self.Calcul_Et_Construction(valueSTR = resultat)
def On_CBB_09_Calcul_Memo(self, index): # memo des reponses
text = self.CBB_09_Calcul_Memo.itemText(index)
text = text.split(": ")
self.LE_02_Calcul_Entree.setText(text[1])
def on_PB_09_Clear_TextEdit(self):
self.calculResistance = []
self.textEdit.clear()
self.textEdit.setTextColor(QtGui.QColor("Green")) # Serial
self.textEdit.append("Series : R = r1 + r2 + r3 ...")
self.textEdit.setTextColor(QtGui.QColor("Darkblue")) # Parallel
self.textEdit.append("Parallel : 1/R = 1/r1 + 1/r2 + 1/r3 ...")
self.textEdit.setTextColor(QtGui.QColor("Base"))
self.textEdit.append("_____________________________ ...")
if self.CB_02_Calcul_SeriePara.isChecked(): # Parallel
self.textEdit.setTextColor(QtGui.QColor("Darkblue")) # Parallel
else:
self.textEdit.setTextColor(QtGui.QColor("Green")) # Serial
self.textEdit.append(str(self.compteurOperations) + " IDX : Begin_____________________")
self.textEdit.setTextColor(QtGui.QColor("Base"))
#### calcul Resistances Fin
if __name__ == "__main__":
MainWindow = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
@mario52a
Copy link
Author

code_Colors_Resistance The icon macro download and rename to code_Colors_Resistance.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment