Macro FCCircularText: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
(ver 1.19 2021/03/15)
Line 7: Line 7:
|Description={{ColoredText|#ff0000|#ffffff|Latest macro version supports a HiDPI layout (QGridLayout) and runs only on versions 0.18 or higher (requires PySide2/Qt5)}}<br/><br/>For backward compatible version of the macro see [https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/db47f78f2b20a35137ac213b8d1a62d30f525dcb/Macro_FCCircularText.FCMacro FCCircularText] and install manually. <br/><br/>This macro makes use of the [[Draft ShapeString]] tool to create a text line placed in different circular orientations, including circumferential and helical (in the fashion of a Trajan Column). It can also be used to create a clock face with Arabic numerals ''1, 2, 3,'' etc., or Roman numerals ''I, II, III,'' etc.
|Description={{ColoredText|#ff0000|#ffffff|Latest macro version supports a HiDPI layout (QGridLayout) and runs only on versions 0.18 or higher (requires PySide2/Qt5)}}<br/><br/>For backward compatible version of the macro see [https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/db47f78f2b20a35137ac213b8d1a62d30f525dcb/Macro_FCCircularText.FCMacro FCCircularText] and install manually. <br/><br/>This macro makes use of the [[Draft ShapeString]] tool to create a text line placed in different circular orientations, including circumferential and helical (in the fashion of a Trajan Column). It can also be used to create a clock face with Arabic numerals ''1, 2, 3,'' etc., or Roman numerals ''I, II, III,'' etc.
|Author=Mario52
|Author=Mario52
|Version=0.18
|Version=0.19
|Date=2020/01/19
|Date=2021/03/15
|FCVersion=0.18 or higher
|FCVersion=0.19
|Download=[https://www.freecadweb.org/wiki/images/c/c1/FCCircularTextButtom.png ToolBar Icon]
|Download=[https://www.freecadweb.org/wiki/images/c/c1/FCCircularTextButtom.png ToolBar Icon]
}}
}}
Line 19: Line 19:


</translate>
</translate>
{{Codeextralink|https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/a5587c452adc3521edfd167b31d0ed30a31cb205/Macro_FCCircularText.FCMacro}}
{{Codeextralink|https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/237d685e4f9b6390a5588073e2d02c1f8cd05519/Macro_FCCircularText.FCMacro}}
<translate>
<translate>


Line 428: Line 428:
***************************************************************************
***************************************************************************
* http://www.freecadweb.org/wiki/index.php?title=Macro_FCCircularText *
* http://www.freecadweb.org/wiki/index.php?title=Macro_FCCircularText *
* WARNING! All changes in this file will be lost and *
* WARNING! All changes in this file will be lost and *
* may cause malfunction of the program *
* may cause malfunction of the program *
***************************************************************************
***************************************************************************
"""
"""
# FCCircularText.FCMacro # Icon fromTheme FreeCAD
# FCCircularText.FCMacro # Icon fromTheme FreeCAD
# ver 0.14-2 #00.14-4 #00.15 (rmu)#00.16 #0.16b #0.16c #0.16d #0.17 2020/09/26 #0.17b 2020/09/28#0.18 2021/01/19
# ver 0.14-2 #00.14-4 #00.15 (rmu)#00.16 #0.16b #0.16c #0.16d #0.17 2020/09/26 #0.17b 2020/09/28#0.18 2021/01/19 #0.19 2021/03/15
#
#
##################################################################################################
##################################################################################################
Line 439: Line 439:
#Word size of OS: 64-bit
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.19.23546 (Git)
#Version: 0.19.24219 (Git)
#Build type: Release
#Build type: Release
#Branch: master
#Branch: master
#Hash: 8c26baebab320b8c1c3279bc8eb34a1eb6c7a363
#Hash: 6b017f9a16b15b0e628c8d874c4058442dee5548
#Python version: 3.6.8
#Python version: 3.6.8
#Qt version: 5.12.1
#Qt version: 5.12.1
Line 452: Line 452:
__Title__ = "FCCircularText"
__Title__ = "FCCircularText"
__Author__ = "Mario52"
__Author__ = "Mario52"
__Version__ = "0.18"
__Version__ = "0.19"
__Date__ = "2021/01/19" #YYYY/MMM/DD
__Date__ = "2021/03/15" #YYYY/MMM/DD


__Comment__ = "This macro creates a text around a cylinder"
__Comment__ = "This macro creates a text around a cylinder"
Line 484: Line 484:
def vesionSearch():
def vesionSearch():
try:
try:
import urllib
import requests
import requests
contentPage = requests.get("https://wiki.freecadweb.org/Macro_" + __Title__).text
contentPage = requests.get("https://wiki.freecadweb.org/Macro_" + __Title__).text
Line 511: Line 512:
except Exception:
except Exception:
FreeCAD.Console.PrintError("Not search version not connected for testing" + "\n")
FreeCAD.Console.PrintError("Not search version not connected for testing" + "\n")
##
#
##
#
global switchVersionSearch; switchVersionSearch = 0 # Search version switchable in
global switchVersionSearch; switchVersionSearch = 0 # Search version switchable in
# Tools/Edit parameter/BaseApp/Preferences/Macros/FCMmacros/FCCircularText
# Tools/Edit parameter/BaseApp/Preferences/Macros/FCMmacros/FCCircularText
Line 603: Line 604:
global SizeCaractere ;SizeCaractere = 2.0 # size font
global SizeCaractere ;SizeCaractere = 2.0 # size font


global precision ;precision = 0.0
global precision ;precision = 0.0 #
global correctionAngle ;correctionAngle = 10.0
global correctionAngle ;correctionAngle = 5.0 #
global correctionRayon ;correctionRayon = 0.15
global correctionRayon ;correctionRayon = 0.15 #
global debout ;debout = 1 # 1=stand 0=flat
global debout ;debout = 1 # 1=stand 0=flat
global exterieur ;exterieur = 1 # 1=exteral 0=internal
global exterieur ;exterieur = 1 # 1=exteral 0=internal
Line 612: Line 613:
global pasHelix ;pasHelix = 2.0 # Pas of helix
global pasHelix ;pasHelix = 2.0 # Pas of helix
global nombreCarParTour ;nombreCarParTour= 10 # number char by Pas
global nombreCarParTour ;nombreCarParTour= 10 # number char by Pas
global PivotCharachter ;PivotCharachter = 0.0 # pivot character sur lui meme
global PivotCharachter ;PivotCharachter = 0.0 # pivot caractere sur lui meme


global PlacementX ;PlacementX = 0.0 # Placement character axis X
global PlacementX ;PlacementX = 0.0 # Placement character axis X
Line 633: Line 634:


global compount1 ;compount1 = 0 # cree un compose des caracteres
global compount1 ;compount1 = 0 # cree un compose des caracteres

#### for delette last object
global FcString ##;FcString = "" # conteneur
global FcStringPoints ##;FcStringPoints = "" # conteneur
global circleGuide ##;circleGuide = "" # cercle guide repere
global suppExtrude ##;suppExtrude = "" # extrusion
global createCompound ##;createCompound = "" # compound texte
#### for delette last object


# pointColor
# pointColor
Line 652: Line 661:
indoorIcon = [
indoorIcon = [
"60 46 9 1",
"60 46 9 1",
" c None",
" c None",
". c #6F2322",
". c #6F2322",
"+ c #343433",
"+ c #343433",
"@ c #CE1416",
"@ c #CE1416",
"# c #3E3E6E",
"# c #3E3E6E",
"$ c #5C5A58",
"$ c #5C5A58",
"% c #5D5C85",
"% c #5D5C85",
"& c #7A7B99",
"& c #7A7B99",
"* c #8E8DA5",
"* c #8E8DA5",
"************************************************************",
"************************************************************",
"************************************************************",
"************************************************************",
Line 710: Line 719:
helpIcon = [
helpIcon = [
"24 24 4 1",
"24 24 4 1",
" c None",
" c None",
". c #016AC5",
". c #016AC5",
"+ c #F8F8FF",
"+ c #F8F8FF",
"@ c #FFFFFF",
"@ c #FFFFFF",
"........................",
"........................",
".++++++++++++++++++++++.",
".++++++++++++++++++++++.",
Line 741: Line 750:
executeIcon = [
executeIcon = [
"24 24 3 1",
"24 24 3 1",
" c None",
" c None",
". c #4E9A06",
". c #4E9A06",
"+ c #FFFFFF",
"+ c #FFFFFF",
" ",
" ",
" ",
" ",
Line 771: Line 780:
quitIcon = [
quitIcon = [
"24 24 3 1",
"24 24 3 1",
" c None",
" c None",
". c #FFFFFF",
". c #FFFFFF",
"+ c #CC0000",
"+ c #CC0000",
" .... ",
" .... ",
"++++++++++....++++++++++",
"++++++++++....++++++++++",
Line 801: Line 810:
resetIcon = [
resetIcon = [
"24 24 3 1",
"24 24 3 1",
" c None",
" c None",
". c #3465A4",
". c #3465A4",
"+ c #888A85",
"+ c #888A85",
" ",
" ",
" ........ ",
" ........ ",
Line 831: Line 840:
standIcon = [
standIcon = [
"16 16 9 1",
"16 16 9 1",
" c None",
" c None",
". c #010400",
". c #010400",
"+ c #28090D",
"+ c #28090D",
"@ c #4C0000",
"@ c #4C0000",
"# c #770000",
"# c #770000",
"$ c #AE0000",
"$ c #AE0000",
"% c #262826",
"% c #262826",
"& c #CB0000",
"& c #CB0000",
"* c #FD0705",
"* c #FD0705",
"*********** ",
"*********** ",
"*********** ",
"*********** ",
Line 859: Line 868:
flatIcon = [
flatIcon = [
"16 16 9 1",
"16 16 9 1",
" c None",
" c None",
". c #020400",
". c #020400",
"+ c #2B0500",
"+ c #2B0500",
"@ c #620502",
"@ c #620502",
"# c #770301",
"# c #770301",
"$ c #970300",
"$ c #970300",
"% c #B40100",
"% c #B40100",
"& c #E60002",
"& c #E60002",
"* c #FE0004",
"* c #FE0004",
" ",
" ",
" ",
" ",
Line 887: Line 896:
romanIcon = [
romanIcon = [
"16 16 5 1",
"16 16 5 1",
" c None",
" c None",
". c #FD9806",
". c #FD9806",
"+ c #FD9904",
"+ c #FD9904",
"@ c #FD9905",
"@ c #FD9905",
"# c #FD9906",
"# c #FD9906",
" ",
" ",
" ",
" ",
Line 911: Line 920:
arabicIcon = [
arabicIcon = [
"16 16 5 1",
"16 16 5 1",
" c None",
" c None",
". c #F6972B",
". c #F6972B",
"+ c #F6982B",
"+ c #F6982B",
"@ c #F5972B",
"@ c #F5972B",
"# c #F7982B",
"# c #F7982B",
" ",
" ",
" ",
" ",
Line 935: Line 944:
redressIcon = [
redressIcon = [
"16 16 4 1",
"16 16 4 1",
" c None",
" c None",
". c #010400",
". c #010400",
"+ c #000000",
"+ c #000000",
"@ c #FD9905",
"@ c #FD9905",
" ",
" ",
" ",
" ",
Line 958: Line 967:
axialIcon = [
axialIcon = [
"16 16 4 1",
"16 16 4 1",
" c None",
" c None",
". c #000000",
". c #000000",
"+ c #010400",
"+ c #010400",
"@ c #FD9905",
"@ c #FD9905",
" ",
" ",
" ",
" ",
Line 990: Line 999:
setIconTTF = [
setIconTTF = [
"16 16 6 1",
"16 16 6 1",
" c None",
" c None",
". c #204A87",
". c #204A87",
"+ c None",
"+ c None",
"@ c #729FCF",
"@ c #729FCF",
"# c #CC0000",
"# c #CC0000",
"$ c #EDD400",
"$ c #EDD400",
".+++++++++++@@@@",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++++++++@+@++@@",
Line 1,015: Line 1,024:
setIconFON = [
setIconFON = [
"16 16 6 1",
"16 16 6 1",
" c None",
" c None",
". c #204A87",
". c #204A87",
"+ c None",
"+ c None",
"@ c #F57900",
"@ c #F57900",
"# c #CC0000",
"# c #CC0000",
"$ c #EDD400",
"$ c #EDD400",
".+++++++++++@@@@",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++++++++@+@++@@",
Line 1,040: Line 1,049:
setIconOTF = [
setIconOTF = [
"16 16 6 1",
"16 16 6 1",
" c None",
" c None",
". c #204A87",
". c #204A87",
"+ c None",
"+ c None",
"@ c #4E9A06",
"@ c #4E9A06",
"# c #CC0000",
"# c #CC0000",
"$ c #EDD400",
"$ c #EDD400",
".+++++++++++@@@@",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++++++++@+@++@@",
Line 1,065: Line 1,074:
setIconPOL = [
setIconPOL = [
"16 16 12 1",
"16 16 12 1",
" c None",
" c None",
". c #204A87",
". c #204A87",
"+ c None",
"+ c None",
"@ c #06989A",
"@ c #06989A",
"# c #73D216",
"# c #73D216",
"$ c #000000",
"$ c #000000",
"% c #75507B",
"% c #75507B",
"& c #729FCF",
"& c #729FCF",
"* c #CC0000",
"* c #CC0000",
"= c #F57900",
"= c #F57900",
"- c #EDD400",
"- c #EDD400",
"; c #4E9A06",
"; c #4E9A06",
".+++++++++++@#$%",
".+++++++++++@#$%",
".++++++++$+#++&$",
".++++++++$+#++&$",
Line 1,093: Line 1,102:
"......@%++++----",
"......@%++++----",
"................"]
"................"]

setIconDel = [
"24 24 4 1",
" c None",
". c #A40000",
"+ c #EF0013",
"@ c #F00013",
" ",
" .. .. ",
" .@+. .++. ",
" .@+++. .++++. ",
" .+++++. .+++++. ",
" .+++++. .+++++. ",
" .+++++. .+++++. ",
" .+++++. .+++++. ",
" .+++++..+++++. ",
" .++++++++++. ",
" .++++++++. ",
" .++++++. ",
" .++++++. ",
" .++++++++. ",
" .++++++++++. ",
" .+++++..+++++. ",
" .+++++. .+++++. ",
" .+++++. .+++++. ",
" .+++++. .+++++. ",
" .+++++. .+++++. ",
" .++++. .++++. ",
" .++. .++. ",
" .. .. ",
" "]


#import glob
#import glob
Line 1,311: Line 1,351:
self.comboBoxPy.setItemText(line, self.tableau[line][2])
self.comboBoxPy.setItemText(line, self.tableau[line][2])
####Section item color and font end ##########################
####Section item color and font end ##########################

####Section setfont Family switchFontComBox begin#############
####Section setfont Family switchFontComBox begin#############
if (switchFontComBox == 1) and (switchModeTextList == 1):
if (switchFontComBox == 1) and (switchModeTextList == 1):
Line 1,317: Line 1,357:
font = QtGui.QFont()
font = QtGui.QFont()
#font = item.font()
#font = item.font()

typeCar = family(self.tableau[line][2])[1]
typeCar = family(self.tableau[line][2])[1]
font.setBold(False)
font.setBold(False)
font.setItalic(False)
font.setItalic(False)

if len(typeCar) > 0:
if len(typeCar) > 0:
for option in typeCar:
for option in typeCar:
Line 1,377: Line 1,417:
global setPositionCenter
global setPositionCenter
global setPositionTop
global setPositionTop
global switchResetFALSE


MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.setObjectName(_fromUtf8("MainWindow"))
Line 1,382: Line 1,423:
# MainWindow.setMaximumSize(QtCore.QSize(370, 638))
# MainWindow.setMaximumSize(QtCore.QSize(370, 638))
# MainWindow.setMinimumSize(QtCore.QSize(400, 640))
# MainWindow.setMinimumSize(QtCore.QSize(400, 640))
MainWindow.move(900, 40)


self.centralWidget = QtWidgets.QWidget(MainWindow)
self.centralWidget = QtWidgets.QWidget(MainWindow)
Line 1,397: Line 1,439:
self.frame_Option = QtWidgets.QFrame()
self.frame_Option = QtWidgets.QFrame()
self.frame_Option.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_Option.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_Option.setFrameShadow(QtWidgets.QFrame.Plain) #Raised) Sunken
self.frame_Option.setFrameShadow(QtWidgets.QFrame.Plain) #Raised Sunken
# self.textEdit.setMaximumHeight(100)
# self.textEdit.setMaximumHeight(100)
self.PB_Reverse = QtWidgets.QPushButton()
self.PB_Reverse = QtWidgets.QPushButton()
Line 1,408: Line 1,450:
self.PB_Help = QtWidgets.QPushButton(MainWindow)
self.PB_Help = QtWidgets.QPushButton(MainWindow)
self.PB_Help.setIcon(QtGui.QIcon(QtGui.QPixmap(helpIcon))) # help icone dans une variable
self.PB_Help.setIcon(QtGui.QIcon(QtGui.QPixmap(helpIcon))) # help icone dans une variable
self.PB_Help.clicked.connect(self.on_PB_Help_clicked) # help
self.PB_Help.clicked.connect(self.on_PB_Help_clicked) # help


#### matplotlib debut 3/5 setupUi #################################################################
#### matplotlib debut 3/5 setupUi #################################################################
Line 1,536: Line 1,578:
self.RA_Choice_Clock = QtWidgets.QRadioButton()
self.RA_Choice_Clock = QtWidgets.QRadioButton()
self.RA_Choice_Clock.clicked.connect(self.on_RA_Choice_Clock) #connection radioButton
self.RA_Choice_Clock.clicked.connect(self.on_RA_Choice_Clock) #connection radioButton

self.RA_Choice_Mirror = QtWidgets.QRadioButton()
self.RA_Choice_Mirror.setVisible(False)
self.RA_Choice_Mirror.clicked.connect(self.on_RA_Choice_Mirror) #connection radioButton


self.PU_Flat = QtWidgets.QPushButton()
self.PU_Flat = QtWidgets.QPushButton()
Line 1,578: Line 1,624:
self.DS_Base_Helix.valueChanged.connect(self.on_DS_Base_Helix) #connection doubleSpinBox
self.DS_Base_Helix.valueChanged.connect(self.on_DS_Base_Helix) #connection doubleSpinBox
self.label_2 = QtWidgets.QLabel()
self.label_2 = QtWidgets.QLabel()

self.DS_End_Helix = QtWidgets.QDoubleSpinBox()
self.DS_End_Helix = QtWidgets.QDoubleSpinBox()
self.DS_End_Helix.setEnabled(False)
self.DS_End_Helix.setEnabled(False)
Line 1,656: Line 1,702:
self.CB_03_BBox = QtWidgets.QCheckBox()
self.CB_03_BBox = QtWidgets.QCheckBox()
self.CB_04_Progression = QtWidgets.QCheckBox()
self.CB_04_Progression = QtWidgets.QCheckBox()
self.CB_05_Reset = QtWidgets.QCheckBox()
self.CB_05_Reset.clicked.connect(self.on_CB_05_Reset)
if switchResetFALSE == 1:
self.CB_05_Reset.setChecked(True)
self.PB_Delete_Last = QtWidgets.QPushButton()
self.PB_Delete_Last.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconDel))) # del icone dans une variable
self.PB_Delete_Last.clicked.connect(self.on_PB_Delete_Last)


self.PU_Exit = QtWidgets.QPushButton()
self.PU_Exit = QtWidgets.QPushButton()
Line 1,725: Line 1,778:
self.gridLayout_Choice.addWidget(self.RA_Choice_Helix, 0, 1, 1, 1)
self.gridLayout_Choice.addWidget(self.RA_Choice_Helix, 0, 1, 1, 1)
self.gridLayout_Choice.addWidget(self.RA_Choice_Clock, 1, 1, 1, 1)
self.gridLayout_Choice.addWidget(self.RA_Choice_Clock, 1, 1, 1, 1)
# self.gridLayout_Choice.addWidget(self.RA_Choice_Mirror,2, 0, 1, 1)
self.gridLayout_Choice.addWidget(self.PU_Flat, 2, 0, 1, 2)
self.gridLayout_Choice.addWidget(self.PU_Flat, 2, 0, 1, 2)
self.gridLayout_Choice.addWidget(self.graphicsView, 3, 0, 1, 2)
self.gridLayout_Choice.addWidget(self.graphicsView, 3, 0, 1, 2)
Line 1,789: Line 1,843:
##
##
self.gridLayout_frame_Path = QtWidgets.QGridLayout(self.frame_Path)
self.gridLayout_frame_Path = QtWidgets.QGridLayout(self.frame_Path)
# self.gridLayout_frame_Path.setContentsMargins(10, 10, 10, 10)
self.gridLayout_frame_Path.setContentsMargins(10, 10, 10, 10)
self.gridLayout_frame_Path.addWidget(self.RB_Path_01, 0, 1, 1, 1)
self.gridLayout_frame_Path.addWidget(self.RB_Path_01, 0, 1, 1, 1)
self.gridLayout_frame_Path.addWidget(self.RB_Path_02, 0, 2, 1, 1)
self.gridLayout_frame_Path.addWidget(self.RB_Path_02, 0, 2, 1, 1)
Line 1,795: Line 1,849:
##
##
self.gridLayout_frame_Position = QtWidgets.QGridLayout(self.frame_Position)
self.gridLayout_frame_Position = QtWidgets.QGridLayout(self.frame_Position)
# self.gridLayout_frame_Position.setContentsMargins(10, 10, 10, 10)
self.gridLayout_frame_Position.setContentsMargins(10, 10, 10, 10)
self.gridLayout_frame_Position.addWidget(self.RB_Position_01, 0, 0, 1, 1)
self.gridLayout_frame_Position.addWidget(self.RB_Position_01, 0, 0, 1, 1)
self.gridLayout_frame_Position.addWidget(self.RB_Position_02, 0, 1, 1, 1)
self.gridLayout_frame_Position.addWidget(self.RB_Position_02, 0, 1, 1, 1)
Line 1,818: Line 1,872:
self.gridLayout_Command.addWidget(self.CB_03_BBox, 0, 2, 1, 1)
self.gridLayout_Command.addWidget(self.CB_03_BBox, 0, 2, 1, 1)
self.gridLayout_Command.addWidget(self.CB_04_Progression, 0, 3, 1, 1)
self.gridLayout_Command.addWidget(self.CB_04_Progression, 0, 3, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Exit, 1, 0, 1, 1)
self.gridLayout_Command.addWidget(self.CB_05_Reset, 1, 0, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Reset, 1, 1, 1, 1)
self.gridLayout_Command.addWidget(self.PB_Delete_Last, 1, 3, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Benchmarks, 1, 2, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Exit, 2, 0, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Execute, 1, 3, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Reset, 2, 1, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Benchmarks, 2, 2, 1, 1)
self.gridLayout_Command.addWidget(self.PU_Execute, 2, 3, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_06, 6, 0, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_06, 6, 0, 1, 1)
####
####
Line 1,931: Line 1,987:
self.CH_Sp_Placement.setText(_fromUtf8("Placement"))
self.CH_Sp_Placement.setText(_fromUtf8("Placement"))
self.CH_Sp_Placement.setToolTip(_fromUtf8("Placement of character in the choice"))
self.CH_Sp_Placement.setToolTip(_fromUtf8("Placement of character in the choice"))
#carDegrees = b' \xc2\xb0'.decode("utf-8") #thanks wmayer https://forum.freecadweb.org/viewtopic.php?f=13&t=36380&p=308476#p308357
#carDegrees = b' \xc2\xb0'.decode("utf-8") #thanks wmayer https://forum.freecadweb.org/viewtopic.php?f=13&t=36380&p=308476#p308357
self.DS_InclinaisonX.setSuffix(_fromUtf8(" deg"))
self.DS_InclinaisonX.setSuffix(_fromUtf8(" deg"))
self.DS_InclinaisonX.setToolTip(_fromUtf8("Inclination character in axis X"))
self.DS_InclinaisonX.setToolTip(_fromUtf8("Inclination character in axis X"))
Line 1,950: Line 2,006:
self.RA_Choice_Clock.setText(_fromUtf8("Clock"))
self.RA_Choice_Clock.setText(_fromUtf8("Clock"))
self.RA_Choice_Clock.setToolTip(_fromUtf8("Create the text to form a clock"))
self.RA_Choice_Clock.setToolTip(_fromUtf8("Create the text to form a clock"))
self.RA_Choice_Mirror.setText(_fromUtf8("Mirror"))
self.RA_Choice_Mirror.setToolTip(_fromUtf8("Create mirror text (text reversed)"))
self.PU_Flat.setText(_fromUtf8("Mode Stand"))
self.PU_Flat.setText(_fromUtf8("Mode Stand"))
self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
Line 1,986: Line 2,044:
####
####
self.groupBox_055.setTitle(_fromUtf8("Path"))
self.groupBox_055.setTitle(_fromUtf8("Path"))
self.groupBox_055.setToolTip(_fromUtf8("The string follow the wire selected" + "\n"
self.groupBox_055.setToolTip(_fromUtf8("The string follow the wire selected (Based on X, Y plane)" + "\n"
"The buttons Outdoor, Helix, Indoor, Clock and" + "\n"
"The buttons Outdoor, Helix, Indoor, Clock and"
"the button Mode Stand / Flat are ignored"))
"the button Mode Stand / Flat are ignored" + "\n"
"The direction of the text depend of the direction Left/Right of the wire selected" + "\n"
"in this case use the Reverse Button"))
self.RB_Path_01.setText(_fromUtf8("Orthogonal"))
self.RB_Path_01.setText(_fromUtf8("Orthogonal"))
self.RB_Path_01.setToolTip(_fromUtf8("The character is orthogonal"))
self.RB_Path_01.setToolTip(_fromUtf8("The character is orthogonal"))
Line 2,013: Line 2,073:
self.CB_04_Progression.setText(_fromUtf8("Progression"))
self.CB_04_Progression.setText(_fromUtf8("Progression"))
self.CB_04_Progression.setToolTip(_fromUtf8("Visualise the character in construction"))
self.CB_04_Progression.setToolTip(_fromUtf8("Visualise the character in construction"))
self.CB_05_Reset.setText(_fromUtf8("Reset"))
self.CB_05_Reset.setToolTip(_fromUtf8("Reset False by default (reset on all push button execute)" + "\n"
"If you check this option No reset is performed" + "\n"
"and if the result is not good" + "\n"
"ex: the old internal coordinate hare conserved or other..." + "\n"
"push the Reset button or restart FCCircularText"))
self.PB_Delete_Last.setText(_fromUtf8("Del"))
self.PB_Delete_Last.setToolTip(_fromUtf8("Delete the last object created"))
self.PU_Exit.setText(_fromUtf8("Exit"))
self.PU_Exit.setText(_fromUtf8("Exit"))
self.PU_Exit.setToolTip(_fromUtf8("Exit FCCircularText"))
self.PU_Exit.setToolTip(_fromUtf8("Exit FCCircularText"))
self.PU_Reset.setText(_fromUtf8("Reset"))
self.PU_Reset.setText(_fromUtf8("Reset"))
self.PU_Reset.setToolTip(_fromUtf8("Reset the macro and give the number of the characters of windows Textedit"))
self.PU_Reset.setToolTip(_fromUtf8("Reset all parameters of the macro"))
self.PU_Execute.setText(_fromUtf8("Run"))
self.PU_Execute.setText(_fromUtf8("Run"))
self.PU_Execute.setToolTip("Execute the process") # without Compount
self.PU_Execute.setToolTip("Execute the process") # without Compount
Line 2,025: Line 2,093:
self.DS_Pivot_Char.setToolTip(_fromUtf8("Pivot the character"))
self.DS_Pivot_Char.setToolTip(_fromUtf8("Pivot the character"))
self.CH_Pivot_Character.setText(_fromUtf8("Pivot Character"))
self.CH_Pivot_Character.setText(_fromUtf8("Pivot Character"))
self.CH_Pivot_Character.setToolTip(_fromUtf8("Pivot the character"))
self.CH_Pivot_Character.setToolTip(_fromUtf8("Pivot the Character"))


#### matplotlib debut 5/5 #################################################################
#### matplotlib debut 5/5 #################################################################
Line 2,078: Line 2,146:
ui.on_CB_Word()
ui.on_CB_Word()


def on_PB_Reverse(self): #connection Reverse
def on_PB_Reverse(self): #connection Reverse
global texte
global texte


Line 2,147: Line 2,215:
self.DS_PlacementZ.setEnabled(False)
self.DS_PlacementZ.setEnabled(False)
# App.Console.PrintMessage(str("on_PU_Reset_Placement ")+"\n")
# App.Console.PrintMessage(str("on_PU_Reset_Placement ")+"\n")

def on_PU_Reset_Inclination(self): # Reset_Inclination
def on_PU_Reset_Inclination(self): # Reset_Inclination
global inclinaisonX
global inclinaisonX
Line 2,167: Line 2,235:
global exterieur
global exterieur
global epaisseur
global epaisseur
global switchResetFALSE


self.groupBox_05.setVisible(False) #clock
self.groupBox_05.setVisible(False) #clock
Line 2,185: Line 2,254:
self.groupBox_04.setEnabled(False)
self.groupBox_04.setEnabled(False)
self.groupBox_05.setEnabled(False)
self.groupBox_05.setEnabled(False)
if switchResetFALSE == 1: # zero (False) by default = reset
ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Inclination()
ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Inclination()
# App.Console.PrintMessage(str("on_RA_Choice_Outdoor ")+" "+str(exterieur)+"\n")
# App.Console.PrintMessage(str("on_RA_Choice_Outdoor ")+" "+str(exterieur)+"\n")


Line 2,193: Line 2,263:
global exterieur
global exterieur
global epaisseur
global epaisseur
global switchResetFALSE


self.groupBox_04.setVisible(False)
self.groupBox_04.setVisible(False)
Line 2,209: Line 2,280:
self.groupBox_05.setEnabled(False)
self.groupBox_05.setEnabled(False)
self.groupBox_055.setVisible(True) #Path
self.groupBox_055.setVisible(True) #Path
if switchResetFALSE == 1: # zero (False) by default = reset

ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Inclination()
ui.on_PU_Reset_Inclination()
# App.Console.PrintMessage(str("on_RA_Choice_Indoor ")+" "+str(exterieur)+"\n")
# App.Console.PrintMessage(str("on_RA_Choice_Indoor ")+" "+str(exterieur)+"\n")


Line 2,221: Line 2,292:
global debout
global debout
global epaisseur
global epaisseur
global switchResetFALSE


self.groupBox_04.setVisible(True)
self.groupBox_04.setVisible(True)
Line 2,245: Line 2,317:
self.groupBox_05.setEnabled(False)
self.groupBox_05.setEnabled(False)
self.groupBox_055.setVisible(False) #Path
self.groupBox_055.setVisible(False) #Path
if switchResetFALSE == 1: # zero (False) by default = reset

ui.on_PU_Reset_Placement()

ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Inclination()
ui.on_PU_Reset_Inclination()


def on_RA_Choice_Clock(self):
def on_RA_Choice_Clock(self):
Line 2,258: Line 2,329:
global epaisseur
global epaisseur
global PivotCharachter
global PivotCharachter
global switchResetFALSE


self.groupBox_04.setVisible(False)
self.groupBox_04.setVisible(False)
Line 2,283: Line 2,355:
self.groupBox_05.setEnabled(True)
self.groupBox_05.setEnabled(True)
self.groupBox_055.setVisible(False) #path
self.groupBox_055.setVisible(False) #path
if switchResetFALSE == 1: # zero (False) by default = reset
ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Inclination()
ui.on_PU_Reset_Placement()
ui.on_PU_Reset_Inclination()
# App.Console.PrintMessage(str("on_RA_Choice_Clock ")+str(exterieur)+"\n")
# App.Console.PrintMessage(str("on_RA_Choice_Clock ")+str(exterieur)+"\n")


Line 2,305: Line 2,378:
self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable
self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable
# App.Console.PrintMessage(str("on_PU_Flat ")+str(debout)+"\n")
# App.Console.PrintMessage(str("on_PU_Flat ")+str(debout)+"\n")

def on_RA_Choice_Mirror(self):
App.Console.PrintMessage("on_RA_Choice_Mirror"+"\n")


def on_DS_Radius_Circle(self,value):
def on_DS_Radius_Circle(self,value):
Line 2,560: Line 2,636:
self.PU_Redress.setToolTip(_fromUtf8("Click for activate the mode Axial"))
self.PU_Redress.setToolTip(_fromUtf8("Click for activate the mode Axial"))
# App.Console.PrintMessage(str("redressement ")+str(redressement)+"\n")
# App.Console.PrintMessage(str("redressement ")+str(redressement)+"\n")

def on_CB_05_Reset(self): #
global switchResetFALSE

if self.CB_05_Reset.isChecked():
switchResetFALSE = 1
self.CB_05_Reset.setText(_fromUtf8("Reset"))
self.CB_05_Reset.setToolTip(_fromUtf8("Reset False by default (reset on all push button execute)" + "\n"
"If you check this option No reset is performed" + "\n"
"and if the result is not good" + "\n"
"ex: the old internal coordinate hare conserved or other..."
"push the Reset button or restart FCCircularText" + "\n"
" ACTUAL TRUE NOT RESET"))
else:
switchResetFALSE = 0
self.CB_05_Reset.setText(_fromUtf8("Not Reset"))
self.CB_05_Reset.setToolTip(_fromUtf8("Reset False by default (reset on all push button execute)" + "\n"
"If you check this option No reset is performed" + "\n"
"and if the result is not good" + "\n"
"ex: the old internal coordinate hare conserved or other..."
"push the Reset button or restart FCCircularText" + "\n"
" ACTUAL FALSE RESET ALL PUSH EXECUTE BUTTON"))
# App.Console.PrintMessage("on_CB_05_Reset"+"\n")

def on_PB_Delete_Last(self): # delete the last object created
global FcString
global FcStringPoints
global circleGuide
global suppExtrude
global createCompound

try:
App.ActiveDocument.getObject(FcStringPoints.Name).removeObjectsFromDocument()
App.ActiveDocument.removeObject(FcStringPoints.Name)
except Exception: None
try:
App.ActiveDocument.getObject(FcString.Name).removeObjectsFromDocument()
App.ActiveDocument.removeObject(FcString.Name)
except Exception: None
try:
App.ActiveDocument.removeObject(circleGuide.Name)
except Exception: None
try:
App.ActiveDocument.removeObject(suppExtrude.Name)
except Exception: None
try:
App.ActiveDocument.removeObject(createCompound.Name)
except Exception: None
App.ActiveDocument.recompute()
# App.Console.PrintMessage("on_PB_Delete_Last"+"\n")


def on_PU_Reset(self): #
def on_PU_Reset(self): #
Line 2,702: Line 2,828:
sayexc("Error")
sayexc("Error")
# App.Console.PrintMessage(str("Benchmarks")+"\n")
# App.Console.PrintMessage(str("Benchmarks")+"\n")

def on_PU_Execute(self): # Execute
def on_PU_Execute(self): # Execute
global ui
global ui
Line 2,751: Line 2,877:
global epaisSupp
global epaisSupp
global compount1
global compount1

#### for delette
global FcString
global FcStringPoints
global circleGuide
global suppExtrude
global createCompound
#### for delette


points = []
points = []
Line 2,762: Line 2,896:
doc = FreeCAD.ActiveDocument
doc = FreeCAD.ActiveDocument
if doc == None:
if doc == None:
doc = FreeCAD.newDocument()
doc = FreeCAD.newDocument("FCCircularText")

# texte = self.textEdit.toPlainText()
#
# if (self.CB_Word.isChecked()):
# texte = texte.split(" ")
#
# self.groupBox_01.setTitle("Text to be displayed ( "+str(len(texte))+" characters )")


#### Path
#### Path
Line 2,788: Line 2,915:


if (len(ssel) != 0) and (passNoOk == 0): # Path
if (len(ssel) != 0) and (passNoOk == 0): # Path

textLabel = texte[0:10]
if self.CB_Word.isChecked():
if self.CB_Word.isChecked():
textLabel = texte[0]
textLabel = textLabel[0]
else:
else:
textLabel = texte[0:10]
textLabel = textLabel[0:10]

FreeCAD.ActiveDocument.openTransaction("FCCTp")
FcString = doc.addObject("App::DocumentObjectGroup","FcStringP_" + textLabel)
FcString = doc.addObject("App::DocumentObjectGroup","FcStringP_" + textLabel)
if self.CB_01_Points.isChecked():
if self.CB_01_Points.isChecked():
Line 2,801: Line 2,931:
points = selectedEdge.discretize(numberOfPoints) # discretize the element
points = selectedEdge.discretize(numberOfPoints) # discretize the element
pasTab = 0
pasTab = 0

for position in range(len(texte)): # list and display the coordinates
for position in range(len(texte)): # list and display the coordinates

ss=Draft.makeShapeString(String=texte[position],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)
ss=Draft.makeShapeString(String=texte[position],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)

XLongueur = ss.Shape.BoundBox.XLength # Length x boundBox rectangle
XLongueur = ss.Shape.BoundBox.XLength # Length x boundBox rectangle
YLongueur = ss.Shape.BoundBox.YLength # Length y boundBox rectangle
YLongueur = ss.Shape.BoundBox.YLength # Length y boundBox rectangle
Line 2,812: Line 2,942:
YYLongueur = 0.0
YYLongueur = 0.0
ZZLongueur = 0.0
ZZLongueur = 0.0

if self.RB_Position_01.isChecked():
if self.RB_Position_01.isChecked():
None
None
Line 2,819: Line 2,949:
elif self.RB_Position_03.isChecked():
elif self.RB_Position_03.isChecked():
XXLongueur = 0; YYLongueur = -YLongueur; #ZZLongueur = -ZLongueur
XXLongueur = 0; YYLongueur = -YLongueur; #ZZLongueur = -ZLongueur

pl = FreeCAD.Placement() # placement object
pl = FreeCAD.Placement() # placement object

if self.RB_Path_01.isChecked():
if self.RB_Path_01.isChecked():
# pl.Base=FreeCAD.Vector(points[position][0] - (XXLongueur), points[position][1] - (YYLongueur), points[position][2])
# pl.Base=FreeCAD.Vector(points[position][0] - (XXLongueur), points[position][1] - (YYLongueur), points[position][2])
pl.Base=FreeCAD.Vector(points[position][0] + (XXLongueur), points[position][1] + (YYLongueur), points[position][2])
pl.Base=FreeCAD.Vector(points[position][0] + (XXLongueur), points[position][1] + (YYLongueur), points[position][2])
pl.Rotation = App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ)
pl.Rotation = App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ)
Line 2,831: Line 2,961:
if pasTab == 0:
if pasTab == 0:
pointsDirection = []
pointsDirection = []
pointsDirection = lineSelected.discretize(Number = ((len(texte)-1) * 10)) # discretize the path line first selection
pointsDirection = lineSelected.discretize(Number = ((len(texte)-1) * 10)) # discretize the path line first selection
pasTab = 1
pasTab = 1
try:
try:
v=pointsDirection[position*10].sub(pointsDirection[(position*10) + 1]) # avec vecteurs 1 et 2 (direction debut ligne)
v=pointsDirection[position*10].sub(pointsDirection[(position*10) + 1]) # avec vecteurs 1 et 2 (direction debut ligne)
except Exception:
except Exception:
v=pointsDirection[-2].sub(pointsDirection[-1]) # avec vecteurs 1 et 2 (direction debut ligne)
v=pointsDirection[-2].sub(pointsDirection[-1]) # avec vecteurs 1 et 2 (direction debut ligne)

r=App.Rotation(App.Vector(1,0,0),v)
r=App.Rotation(App.Vector(-1,0,0),v)
pl.Rotation.Q = r.Q
pl.Rotation.Q = r.Q
pl = pl.multiply(App.Placement(App.Vector(0,0,0), App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ), App.Vector(0,0,0)))
pl = pl.multiply(App.Placement(App.Vector(0,0,0), App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ), App.Vector(0,0,0)))

try:
try:
pl.Base = pointsDirection[position*10]
pl.Base = pointsDirection[position*10]
Line 2,847: Line 2,977:
pl.Base = pointsDirection[-1]
pl.Base = pointsDirection[-1]
pl = pl.multiply(App.Placement(App.Vector(XXLongueur + PlacementX, YYLongueur + PlacementY, ZZLongueur + PlacementZ), App.Rotation(correctionAngle, 0, 0), App.Vector(0,0,0)))
pl = pl.multiply(App.Placement(App.Vector(XXLongueur + PlacementX, YYLongueur + PlacementY, ZZLongueur + PlacementZ), App.Rotation(correctionAngle, 0, 0), App.Vector(0,0,0)))

####
####
if self.CB_03_BBox.isChecked():
if self.CB_03_BBox.isChecked():
Line 2,854: Line 2,984:
ss.Label = texte[position]
ss.Label = texte[position]
Draft.autogroup(ss)
Draft.autogroup(ss)
# ss.Label = texte[position]
# ss.Label = texte[position]
FcString.addObject(ss) # contener character
FcString.addObject(ss) # contener character
# FcString = doc.addObject("App::DocumentObjectGroup","FcString")
# FcString = doc.addObject("App::DocumentObjectGroup","FcString")

####
####
if epaisseur > 0: # extrusion characrters
if epaisseur > 0: # extrusion characrters
Line 2,873: Line 3,003:
####
####
comP.append(CharExtrude.Shape)
comP.append(CharExtrude.Shape)
# nameL.append(CharExtrude.Name)
# nameL.append(CharExtrude.Name)
FcString.addObject(CharExtrude) # contener extrude
FcString.addObject(CharExtrude) # contener extrude
else: #
else:
ss.Placement = pl
ss.Placement = pl
ss.Support=None
ss.Support=None
Line 2,883: Line 3,013:
None
None
comP.append(ss.Shape)
comP.append(ss.Shape)
# nameL.append(ss.Name)
# nameL.append(ss.Name)
####
####
if self.CB_01_Points.isChecked():
if self.CB_01_Points.isChecked():
Line 2,897: Line 3,027:
except Exception:
except Exception:
App.Console.PrintError(str("Discretize Error or selection error")+"\n")
App.Console.PrintError(str("Discretize Error or selection error")+"\n")
FreeCAD.ActiveDocument.commitTransaction()

#### Path fin
#### Path fin
#

#### Circular begin
else:
else:
FreeCAD.ActiveDocument.openTransaction("FCCTc")
if ((exterieur == 0) and (debout == 0)): # normal circular
if ((exterieur == 0) and (debout == 0)): # normal circular
vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)] #
vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)] #
Line 2,910: Line 3,042:
else:
else:
vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)] #
vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)] #

ligne = Draft.makeWire(vecligne,closed=False,face=False,support=None) # creation de la ligne de base
ligne = Draft.makeWire(vecligne,closed=False,face=False,support=None) # creation de la ligne de base
lineName = ligne.Name
lineName = ligne.Name
Line 2,916: Line 3,048:
ii = -1
ii = -1
ii2 = -1
ii2 = -1

#nombre = len(texte) - 1 # moins 1 pour aller de 0 degres a 0 degres dans la boucle pour compatible avec Path
#nombre = len(texte) - 1 # moins - 1 pour aller de 0 degres a 0 degres dans la boucle pour compatible avec Path
nombre = len(texte) # si pas - 1 ex: pour 36 lettres va de 0 degres a 350 degres
nombre = len(texte) # si pas - 1 ex: pour 36 lettres va de 0 degres a 350 degres


coor_Z = PlacementZ
coor_Z = PlacementZ
boucler = 1
boucler = 1

texteLabel = texte[0:10]
if (exterieur == 0) or (debout == 0):
if (exterieur == 0) or (debout == 0):
texte = texte[::-1]
texte = texte[::-1]
if (exterieur == 0) and (debout == 0):
if (exterieur == 0) and (debout == 0):
texte = texte[::-1]
texte = texte[::-1]

if exterieur == 2: # helix
if exterieur == 2: # helix
if nombreCarParTour == 0:
if nombreCarParTour == 0:
Line 2,944: Line 3,077:
else:
else:
nombreCarParTour = 1
nombreCarParTour = 1

if exterieur == 3: # Clock
if exterieur == 3: # Clock
FcString = doc.addObject("App::DocumentObjectGroup","FcClock")
FcString = doc.addObject("App::DocumentObjectGroup","FcClock")
Line 2,956: Line 3,089:
texte = texte[::-1]
texte = texte[::-1]
else:
else:
textLabel = texte[0:10]
if self.CB_Word.isChecked():
if self.CB_Word.isChecked():
textLabel = texte[0]
textLabel = texteLabel[0]
else:
else:
textLabel = texte[0:10]
textLabel = texteLabel[0:10]
FcString = doc.addObject("App::DocumentObjectGroup","FcString_" + textLabel)
FcString = doc.addObject("App::DocumentObjectGroup","FcString_" + textLabel)
if self.CB_01_Points.isChecked():
if self.CB_01_Points.isChecked():
Line 2,975: Line 3,109:
#for angleTr in range(debut,rotation,((rotation-debut)/nombre)): # old
#for angleTr in range(debut,rotation,((rotation-debut)/nombre)): # old
for angleTrFloat in range((debut*10000),(rotation*10000),int((round(((float(rotation)-float(debut))/float(nombre)),4)*10000)) ): # 10000 pour 4 decimales
for angleTrFloat in range((debut*10000),(rotation*10000),int((round(((float(rotation)-float(debut))/float(nombre)),4)*10000)) ): # 10000 pour 4 decimales
angleTr = (float(angleTrFloat)/10000)
angleTr = (float(angleTrFloat)/10000.0)
ii += 1
ii += 1
ii2 += 1
ii2 += 1
ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))
ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))
print(ii+1," ",angleTr)

a = ligne.End # fin de ligne
a = ligne.End # fin de ligne
coor_X = (a[0])
coor_X = (a[0])
coor_Y = (a[1])
coor_Y = (a[1])

# if (ii < nombre) and (ii2 < len(texte)):
if (ii < nombre) and (ii2 < len(texte)):
if (ii < nombre) and (ii2 < len(texte)):
if exterieur == 3: # clock
if exterieur == 3: # clock
ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr+90), App.Vector(0,0,0))
ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr+90), App.Vector(0,0,0))

try:
try:
a = ligne.Shape.Edges[0].Vertexes[1] # fin de ligne
a = ligne.Shape.Edges[0].Vertexes[1] # fin de ligne
except Exception:
except Exception:
a = ligne.End # 0.19 fin de ligne
a = ligne.End # 0.19 fin de ligne

try:
try:
coor_X = (a.Point.x)
coor_X = (a.Point.x)
Line 3,000: Line 3,133:
coor_X = (a.x) # 0.19 fin de ligne
coor_X = (a.x) # 0.19 fin de ligne
coor_Y = (a.y)
coor_Y = (a.y)

ss=Draft.makeShapeString(String=texte[ii2],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)
ss = Draft.makeShapeString(String=texte[ii2],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)

ss.Label = texte[ii2]
ss.Label = texte[ii2]
FcString.addObject(ss) # contener character
FcString.addObject(ss) # contener character

centreX = (ss.Shape.BoundBox.Center[0])
centreX = (ss.Shape.BoundBox.Center[0])
centreY = (ss.Shape.BoundBox.Center[1])
centreY = (ss.Shape.BoundBox.Center[1])
Line 3,012: Line 3,145:
lengthY = (ss.Shape.BoundBox.YLength)
lengthY = (ss.Shape.BoundBox.YLength)
lengthZ = (ss.Shape.BoundBox.ZLength)
lengthZ = (ss.Shape.BoundBox.ZLength)

plm=""
plm=""
plm=FreeCAD.Placement()
plm=FreeCAD.Placement()
plm.Base=FreeCAD.Vector(coor_X,coor_Y,coor_Z)
plm.Base=FreeCAD.Vector(coor_X,coor_Y,coor_Z)

if debout == 1: # debout
if debout == 1: # debout
if exterieur == 0: # circumferential internal
if exterieur == 0: # circumferential internal
Line 3,035: Line 3,168:
else: # interieur (inferieur)
else: # interieur (inferieur)
plm = App.Placement(App.Vector(-coor_X,-coor_Y,-coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX+PivotCharachter,180+inclinaisonY,180+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
plm = App.Placement(App.Vector(-coor_X,-coor_Y,-coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX+PivotCharachter,180+inclinaisonY,180+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1

if epaisseur > 0: # extrusion characrters
if epaisseur > 0: # extrusion characrters
CharExtrude = Draft.extrude(ss,Base.Vector(0,0,epaisseur))
CharExtrude = Draft.extrude(ss,Base.Vector(0,0,epaisseur))
Line 3,048: Line 3,181:
App.ActiveDocument.getObject(CharExtrude.Name).recompute()
App.ActiveDocument.getObject(CharExtrude.Name).recompute()
comP.append(CharExtrude.Shape)
comP.append(CharExtrude.Shape)
# nameL.append(CharExtrude.Name)
# nameL.append(CharExtrude.Name)
FcString.addObject(CharExtrude) # contener extrude
FcString.addObject(CharExtrude) # contener extrude
else: #
else: #
Line 3,060: Line 3,193:
ss.ViewObject.BoundingBox = True
ss.ViewObject.BoundingBox = True
comP.append(ss.Shape)
comP.append(ss.Shape)
# nameL.append(ss.Name)
# nameL.append(ss.Name)
# points += [FreeCAD.Vector(coor_X,coor_Y,coor_Z)] # coordinates makeBSpline
# points += [FreeCAD.Vector(coor_X,coor_Y,coor_Z)] # coordinates makeBSpline
####
####
if self.CB_01_Points.isChecked():
if self.CB_01_Points.isChecked():
Line 3,069: Line 3,202:
App.ActiveDocument.getObject(pointRepere.Name).recompute()
App.ActiveDocument.getObject(pointRepere.Name).recompute()
FcStringPoints.addObject(pointRepere)
FcStringPoints.addObject(pointRepere)
####
####
if self.CB_04_Progression.isChecked():
if self.CB_04_Progression.isChecked():
FreeCADGui.updateGui() # rafraichi l'ecran
FreeCADGui.updateGui() # rafraichi l'ecran
####
####
FreeCAD.ActiveDocument.commitTransaction()


#BSpline = Draft.makeBSpline(points,closed=False) # makeBSpline repere
#BSpline = Draft.makeBSpline(points,closed=False) # makeBSpline repere
App.ActiveDocument.removeObject(lineName) # remove ligne de base directrice
App.ActiveDocument.removeObject(lineName) # remove ligne de base directrice


FreeCAD.ActiveDocument.openTransaction("FCCTc")
if (self.CB_02_Circle.isChecked()) and (passNoOk == 0):
if (self.CB_02_Circle.isChecked()) and (passNoOk == 0): # create Circle
pll = FreeCAD.Placement()
pll = FreeCAD.Placement()
pll = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),0), App.Vector(0,0,0))
pll = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),0), App.Vector(0,0,0))
circle = Draft.makeCircle(radius=rayon, placement=pll, face=False, support=None)
circleGuide = Draft.makeCircle(radius=rayon, placement=pll, face=False, support=None)
circle.Label = textLabel
circleGuide.Label = "circleRepere_" + textLabel
circle.ViewObject.LineColor = (1.0,0.,0.0)
circleGuide.ViewObject.LineColor = (1.0,0.,0.0)
Draft.autogroup(circle)
Draft.autogroup(circleGuide)


if compount1 == 1: # create compount
if compount1 == 1: # create compount
comp = Part.makeCompound(comP)
comp = Part.makeCompound(comP)
Part.show(comp)
Part.show(comp)
createCompound = App.ActiveDocument.ActiveObject
createCompound.Label = "Comp_" + textLabel
####Boucle de travail fin########################################################################
####Boucle de travail fin########################################################################


Line 3,125: Line 3,262:


App.activeDocument().recompute()
App.activeDocument().recompute()
FreeCAD.ActiveDocument.commitTransaction()
#### Circular end


####Info################################################
####Info################################################
App.Console.PrintMessage("______________" +"\n")
App.Console.PrintMessage("______________" +"\n")
App.Console.PrintMessage( PolicePath + "\n")
App.Console.PrintMessage( PolicePath + "\n")
App.Console.PrintMessage("Texte : " + str(texte)+"\n")
App.Console.PrintMessage("Texte : " + str(texte) + "\n")
App.Console.PrintMessage("Rayon : " + str(rayon)+"\n")
App.Console.PrintMessage("Rayon : " + str(rayon) + "\n")
App.Console.PrintMessage("SizeCaractere : " + str(SizeCaractere)+"\n")
App.Console.PrintMessage("SizeCaractere : " + str(SizeCaractere) + "\n")
App.Console.PrintMessage("Rotation : " + str(debut) + "/" + str(rotation)+"\n")
App.Console.PrintMessage("Rotation : " + str(debut) + "/" + str(rotation) + "\n")
App.Console.PrintMessage("Debout : " + str(debout)+"\n")
App.Console.PrintMessage("Debout : " + str(debout) + "\n")
App.Console.PrintMessage("Placement : " + str(PlacementX) + ", " + str(PlacementY) + ", " + str(PlacementZ) + "\n")
App.Console.PrintMessage("Rotation : " + str(inclinaisonX) + ", " + str(inclinaisonY) + ", " + str(inclinaisonZ) + "\n")
App.Console.PrintMessage("_______________" +"\n")
App.Console.PrintMessage("_______________" +"\n")


Line 3,148: Line 3,289:
global ui
global ui
global s
global s
global switchResetFALSE
global setFontByDefault
global switchModeTextList
global switchModeTextList
global switchFontComBox
global switchFontComBox
global setSystemFonts
global setSystemFonts
global seTtextAlignement
global seTtextAlignement
global setFontByDefault
global switchVersionSearch
global switchVersionSearch


FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente
FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente
###### Write Configuration begin ####
###### Write Configuration begin ####
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchResetFALSE", switchResetFALSE) # True or False
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchResetFALSE", switchResetFALSE) # True or False (by default)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetString("setFontByDefault", setFontByDefault) # "Arial"
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetString("setFontByDefault", setFontByDefault) # "Arial"
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchModeTextList", switchModeTextList) # True or False
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchModeTextList", switchModeTextList) # True or False
Line 3,170: Line 3,312:
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionTop", ui.RB_Position_03.isChecked()) # True or False
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionTop", ui.RB_Position_03.isChecked()) # True or False
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchVersionSearch", switchVersionSearch) # True or False
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchVersionSearch", switchVersionSearch) # True or False

###### Write Configuration end ####
###### Write Configuration end ####

App.Console.PrintMessage("Fin FCCircularText"+"\n")
App.Console.PrintMessage("Fin FCCircularText"+"\n")
self.window.hide()
self.window.hide()
Line 3,184: Line 3,326:
setFontByDefault = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetString("setFontByDefault")
setFontByDefault = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetString("setFontByDefault")
switchResetFALSE = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchResetFALSE")
switchResetFALSE = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchResetFALSE")
#switchResetFALSE: desactive cree des erreurs de fonctionnement !!
#switchResetFALSE: desactive cree des erreurs de fonctionnement attention a l utilisation !!


setPathOrthogonal = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPathOrthogonal")
setPathOrthogonal = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPathOrthogonal")
Line 3,209: Line 3,351:
class SelObserver:
class SelObserver:
def addSelection(self, document, object, element, position): # Selection
def addSelection(self, document, object, element, position): # Selection
global ui
global ui
global PlacementX
global PlacementX
global PlacementY
global PlacementY
Line 3,256: Line 3,398:
## def setSelection(self,doc): # Selection dans ComboView
## def setSelection(self,doc): # Selection dans ComboView
## print "SelObserver quit macro"
## print "SelObserver quit macro"
def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
#ui.on_PU_Reset_Placement()
#ui.on_PU_Reset_Placement()
ui.groupBox_03.setEnabled(True)
ui.groupBox_03.setEnabled(True)
Line 3,278: Line 3,420:
###################################################################################################
###################################################################################################


# create new document
# deselecter tous les objets
doc = FreeCAD.ActiveDocument
if doc == None:
doc = FreeCAD.newDocument("FCCircularText")

# deselectionner tous les objets
try:
try:
for obj in FreeCAD.ActiveDocument.Objects: # deslectionne tout
for obj in FreeCAD.ActiveDocument.Objects: # deselectionne tout
FreeCADGui.Selection.removeSelection(obj)
FreeCADGui.Selection.removeSelection(obj)
except Exception:
except Exception:
Line 3,289: Line 3,436:
ui.setupUi(MainWindow)
ui.setupUi(MainWindow)
MainWindow.show()
MainWindow.show()



}}
}}
Line 3,530: Line 3,678:


==Change log== <!--T:73-->
==Change log== <!--T:73-->

*ver 1.19 2021/03/15 : adding button {{Button|Delette}} the last object created and the code {{incode|FreeCAD.ActiveDocument.openTransaction("FCCTc")}} for Undo/Redo system

**Adding CheckBox {{CheckBox|FALSE|Reset}} for switched/activated (''requested by users'') the natural reset after all push button {{Button|Run}}and {{Button|Run comp}}. This use checkBox is {{ColoredText|not advised}}, is you constade one malfunction pusch the {{Button|Reset}} button or quit FCCircularText and restart.


<!--T:147-->
<!--T:147-->

Revision as of 19:56, 15 March 2021

Other languages:

Macro FCCircularText

Description
Latest macro version supports a HiDPI layout (QGridLayout) and runs only on versions 0.18 or higher (requires PySide2/Qt5)

For backward compatible version of the macro see FCCircularText and install manually.

This macro makes use of the Draft ShapeString tool to create a text line placed in different circular orientations, including circumferential and helical (in the fashion of a Trajan Column). It can also be used to create a clock face with Arabic numerals 1, 2, 3, etc., or Roman numerals I, II, III, etc.

Macro version: 0.19
Last modified: 2021/03/15
FreeCAD version: 0.19
Download: ToolBar Icon
Author: Mario52
Author
Mario52
Download
ToolBar Icon
Links
Macro Version
0.19
Date last modified
2021/03/15
FreeCAD Version(s)
0.19
Default shortcut
None
See also
None

Description

This macro makes use of the Draft ShapeString tool to create a text line placed in different circular orientations, including circumferential and helical in the fashion of a Trajan's Column. It can also be used to create a clock face with Arabic numerals 1, 2, 3, etc., or Roman numerals I, II, III, etc. This latter usage was inspired by the Forum thread Macro to Create Clock Face by FC community member, cblt2l.

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/237d685e4f9b6390a5588073e2d02c1f8cd05519/Macro_FCCircularText.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/237d685e4f9b6390a5588073e2d02c1f8cd05519/Macro_FCCircularText.FCMacro")


360 degree orientation

Example of the macro displaying text in a 360 degree orientation

Usage

Launch the macro folder FcString for created characters and a file FcClock for created clocks.

All the characters are and remain independent. When creating extrusions nothing is deleted. If Compound is created with Run Comp it is copied out of the folder.

The options are shaded by default and are active in all functions if they are checked :

  • Extrude Char.
  • Placement.
  • SP. inclination.

Except for one Clock Service Placement box Z is activated and moves the text in the direction Z to place the text on the support surface.

Notes

  • This macro will gray-out (deactivate) options that are not relevant for a selected function.

Interface

Overview

GUI

First section

  • TextEdit window that lets you copy the text to display (click on the Reset allows to know the number of the input string that is displayed in the window title)
  • The Reverse button reverses the text
  • Word checked, this option consider the text as word, the text is cut on space and write the text word by word (instead character by character in normal use)
  • LineEdit: display the path and name of file font
  • The Help button displays the wiki page in the FreeCAD browser
  • ComboView to choose the font
    • Default ARIAL.TTF

Options available

After the first use, you must modify the following parameters:

User parameter:BaseApp/Preferences/Macros/FCMmacros/FCCircularText

switchModeTextList

  • 0 = normal text mode (and black) cuts the switchFontComBox
  • 1 = allows switchFontComBox 1

switchFontComBox

  • 0 = (and switchModeTextList= 1) text mode (in color) in ComboBox list, faster
  • 1 = (and switchModeTextList= 1) fontFamily slower but more beautiful ComboBoxst!

setSystemFonts

  • 0 = matplotlib.font_manager.findSystemFonts("C:/", "ttf")
  • do all the fonts (in all folders and sub-folders of the DD) time !!
  • 1 = fontman.findSystemFonts(self.pathFont)
  • do all the fonts in the directory (and in all the sub-folders)

seTtextAlignement

  • 0 = AlignLeft (default)
  • 1 = AlignCenter
  • 2 = AlignRight

setFontByDefault

  • Font by Default

switchResetFALSE

  • 0 = reset (default)
  • 1 = no reset (not recommended) some switches can remain open or close unexpectedly!

Example

  1. switchModeTextList= false
  2. switchFontComBox = false
  3. setSystemFonts = false
  4. seTtextAlignement = 0

  1. switchModeTextList= true
  2. switchFontComBox = false
  3. setSystemFonts = false
  4. seTtextAlignement = 0

  1. switchModeTextList= true
  2. switchFontComBox = false
  3. setSystemFonts = false
  4. seTtextAlignement = 1 (0=Left, 1=Centered, 2=Right)

  1. switchModeTextList= true
  2. switchFontComBox = true
  3. setSystemFonts = false
  4. seTtextAlignement = 1

Second Section

Configuring characters in FCCircularText

First zone

Your choice :

  • Mode Stand or Mode Flat : The text will be placed standing or flat (same as clock) options Outdoor and Indoor are reversed.

Second area

This section allows you to configure the overall behavior of characters in all the choices available but with some variation. If the command is not used in the option chosen, it will be grayed out.

  • 10.0 mm Radius of circle : Radius of the circle. (Default 10)
  • 2.0 mm Size character : Character height. (Default 2)
  • 0 deg Begin angle : Starting angle of the first character in the circle. (Default 0 °)
  • 360 deg End angle : Angle end of the last character of the text. (Default 360)
  • 10.0 deg Correction angle : Character correction angle to make it tangent to the circle. (Default 10 °)
  • 0.15 mm Correction radius : Fixed the radius of the circle characters (optional). (Default 0.15)
  • Extrude Char : Checkbox extrusion characters. (Inactive Default)
  • Placement : Text placement in the 3D view. (Inactive Default)
  • Sp. inclination : Inclination of characters in three axes X, Y and Z (example to cover such a cone). (Inactive Default)
Outdoor

Default mode. The text is written on the outside of the circumference of the circle.

Indoor

The text is written on the inner side of the circumference of the circle

Helix

The text is entered on the outer circumference of a helix.

  • The helix area is hidden by default. The window is visible if the radio button Helix is checked
  • All characters configuration options are available.
  • Step of helix which corresponds to the pitch of the helix turns and displays 2 (character height) by default.
  • Char. per turn activates and displays 10 by default, which corresponds to 10 characters per helical turn.
  • If Step of helix (helix pitch) is zero, Spinboxes Base Helix and End Helix are activated.
  • Base Helix provides the basis for starting the helix (even Placement Z). If 'Placement Z' is different from zero, the starting point is added to Z Placement
  • End Helix End of the helix pitch of the helix will be calculated relative to the height and the number of characters per helical turn.


Clock

The figures are part of a circle with Arabic numerals or Romans.

  • By default, the section is hidden. The window is visible if the radio button Clock is checked
  • When the selection is made, the following functions get dark and are usable:
    1. Begin angle.
    2. End angle.
    3. Correction angle.
    4. Correction radius.
    5. The buttom Mode Stand or Mode Flat.
  • The area Clock is activated.
  • Radius of support : If a value is given, support will be created (default 0).
  • If Support number face is different from zero a support is created. (If Extrude support = zero then a face is created).
    • 1 = A circle is created (circle appears).
    • 2 = A rectangle is created (length = (Radius of media * 1.5) width = Radius of support) (Rectangle appears).
    • 3 = A triangle is created (circumscribed) (Triangle appears).
    • 4 = A square is created (Radius of support) (Square appears).
    • 5 = A polygon with the number of faces displayed (circumscribed) (Polygon appears).
  • Extrude support is activated and an extrusion dimension can be given.

  • If Support number face is equal to zero there is no support.
  • Mode Roman : The writing will be in Roman figures I II III IIII V VI VII VIII IX X XI XII
  • Axial  : The figures will be written axially.

Path section

The title section change and display the length of the wire selected.

If you select one wire, arc, circle, line and edge the section Path is coloured in green and the unused command coloured in red

  1. Orthogonal the character is Orthogonal to the view
  2. Tangent the character is Tangent to point path on wire
  1. BB Base the point base of the character is to point path on the wire
  2. BB Center the bounBox center of the character is to point path on the wire
  3. BB Top the top boundBox of the character is to point path on the wire

the last Radio Button used is saved in the parameter of FreeCAD

Command section

  • Exit  : Leaves the macro.
  • Reset  : Reset all values and displays the number of characters displayed in the window.
  • Run Comp : Launches the macro and creates a Compount object of all characters.
  • Run  : Launches the macro

Parameters available

Certain parameter are available in the parameters of FreeCAD see: Menu → Tools → Edit parameters...

  • User parameter: BaseApp/Preferences/Macros/FCMmacros/FCCircularText
    • switchModeTextList :
      • false normal text mode (and black) turns off switchFontComBox
      • true allow switchFontComBox 1 (default)
    • switchFontComBox :
      • false (and switchModeTextList = 1) text mode (in color) in Faster ComboBox list (default)
      • true (and switchModeTextList = 1) font Family in ComboBox list slower but more beautiful!
    • setSystemFonts :
      • false matplotlib.font_manager.findSystemFonts ("C: /", "ttf") do all fonts (in all folders and subfolders of the HD) time !!
      • true fontman.findSystemFonts (self.pathFont)
        make all the fonts in the directory (and in all the subfolders) (default)
    • seTtextAlignement : 0 = AlignLeft (default) 1 = AlignCenter 2 = AlignRight
    • setFontByDefault : Font by Default (the last used)
    • switchResetFALSE : false reset (default), true no reset (not recommended) some switches can stay open or close unexpectedly!
    • setPathOrthogonal : true false
    • setPathTangent : true false
    • setPositionBase : true false
    • setPositionCenter : true false
    • setPositionTop : true false
    • switchVersionSearch : true false
    • Version : FCCircularText version

Launch the macro folder FcString for created characters and a file FcClock for created clocks.

Script

The button icon:

- in .PNG

- in .SVG

(See Customize_Toolbars for more)

See the Code

Macro_Circular_Text.FCMacro


# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
*   Copyright (c) 2014 2015 2016 2017 2018 2019 2020 2021 <mario52>       *
*                                                                         *
*   This file is a supplement to the FreeCAD CAx development system.      *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU Lesser General Public License (LGPL)    *
*   as published by the Free Software Foundation; either version 2 of     *
*   the License, or (at your option) any later version.                   *
*   for detail see the LICENCE text file.                                 *
**                                                                       **
*   Use at your own risk. The author assumes no liability for data loss.  *
*              It is advised to backup your data frequently.              *
*             If you do not trust the software do not use it.             *
**                                                                       **
*   This software is distributed in the hope that it will be useful,      *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU Library General Public License for more details.                  *
*                                                                         *
*   You should have received a copy of the GNU Library General Public     *
*   License along with this macro; if not, write to the Free Software     *
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
*   USA                                                                   *
***************************************************************************
*   http://www.freecadweb.org/wiki/index.php?title=Macro_FCCircularText   *
*           WARNING! All changes in this file will be lost and            *
*                  may cause malfunction of the program                   *
***************************************************************************
"""
# FCCircularText.FCMacro    # Icon fromTheme FreeCAD
# ver 0.14-2 #00.14-4 #00.15 (rmu)#00.16 #0.16b #0.16c #0.16d #0.17 2020/09/26 #0.17b 2020/09/28#0.18 2021/01/19 #0.19 2021/03/15
#
##################################################################################################
#OS: Windows 10 (10.0)
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.19.24219 (Git)
#Build type: Release
#Branch: master
#Hash: 8c26baebab320b8c1c3279bc8eb34a1eb6c7a363
#Python version: 3.6.8
#Qt version: 5.12.1
#Coin version: 4.0.0a
#OCC version: 7.3.0
#Locale: French/Mars (fr_MA)
##################################################################################################
#
__Title__    = "FCCircularText"
__Author__   = "Mario52"
__Version__  = "0.19"
__Date__     = "2021/03/15" #YYYY/MMM/DD

__Comment__  = "This macro creates a text around a cylinder"
__Web__      = "https://forum.freecadweb.org/viewtopic.php?f=3&t=7384%22"
__Wiki__     = "https://wiki.freecadweb.org/Macro_FCCircularText"
__Icon__     = "/usr/lib/freecad/Mod/plugins/icons/FCCircularTextButtom.png"
__IconW__    = "C:/Users/YourUserName/AppData/Roaming/FreeCAD/Macro"
__Help__     = "start the macro and follow the instructions"
__Status__   = "stable"
__Requires__ = "freecad 0.19 and higher"
__Communication__ = "https://wiki.freecadweb.org/index.php?title=User:Mario52"
#

import PySide2
from PySide2 import (QtWidgets, QtCore, QtGui)
from PySide2.QtWidgets import (QWidget, QApplication, QSlider, QGraphicsView, QGraphicsScene, QVBoxLayout, QStyle)
from PySide2.QtGui import (QPainter, QColor, QIcon)
from PySide2.QtSvg import *

import Draft, Part, FreeCAD, math, PartGui, FreeCADGui
from math import sqrt, pi, sin, cos, asin, degrees, radians, tan
from FreeCAD import Base
import os, time, sys

App=FreeCAD
Gui=FreeCADGui
import WebGui

#### Detect version macro ########################################### #26/09/2020
def vesionSearch():
    try:
        import urllib
        import requests
        contentPage = requests.get("https://wiki.freecadweb.org/Macro_" + __Title__).text
        versionDetect = dateDetect = ""
        for i in contentPage.split("\n"):            # list page to line
            if "ctEven macro-version" in i:
                versionDetect = (i.split(">")[1])
            if "ctEven macro-date" in i:
                dateDetect = (i.split(">")[1])
            if (versionDetect != "") and (dateDetect != ""):
                break
        try:
            if (versionDetect == __Version__) and (dateDetect == __Date__):
                None
            else:
                msg = ("New version availlable : " + "\n" + 
                      str(versionDetect) + ":" + str(dateDetect) + "\n" + 
                      "You can install with AddonManager")
                FreeCAD.Console.PrintMessage("your actual version    : " + str(__Version__) + " : " + str(__Date__) + "\n")
                FreeCAD.Console.PrintMessage("new version availlable : " + str(versionDetect) + " : " + str(dateDetect) + "\n")
                diag = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information, 'New Version', msg)
                diag.setWindowModality(QtCore.Qt.ApplicationModal)
                diag.exec_()
        except Exception:
            None
        return versionDetect, dateDetect
    except Exception:
        FreeCAD.Console.PrintError("Not search version not connected for testing" + "\n")
#
#
global switchVersionSearch; switchVersionSearch = 0  # Search version switchable in 
                                                     # Tools/Edit parameter/BaseApp/Preferences/Macros/FCMmacros/FCCircularText
switchVersionSearch = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchVersionSearch")
if switchVersionSearch == 1:
    vesionSearch()
#### Detect version macro ###########################################

import sys,traceback
def sayexc(mess=''):
    exc_type, exc_value, exc_traceback = sys.exc_info()
    ttt=repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
    lls=eval(ttt)
    l=len(lls)
    l2=lls[(l-3):]
    FreeCAD.Console.PrintError(mess + "\n" +"-->  ".join(l2))

import platform
global verPython ;  verPython = sys.version_info

class ConfigManager():

    def __init__(self,name):
        self.name="Plugins/"+name

    def get(self,param,default,defaultWindows=None,defaultMac=None):
            global verPython
            os=platform.system()
            #os='Linux'
            #os='Windows'
            #os='Darwin'
            v=False
            if not defaultWindows:
                defaultWindows=default
            if not defaultMac:
                defaultMac=default
            if os =='Windows' :
                default= defaultWindows
            if os =='Darwin' :
                default= defaultMac

            if verPython.major < 3:
                if default.__class__ == unicode:
                    default=str(default)
#                return unicode(encoder).encode('iso-8859-1')
            else:
#                encoder = str(encoder)
#                return encoder
                None

            if default.__class__ == int:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetInt(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetInt(param,default)
            if default.__class__ == float:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetFloat(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetFloat(param,default)
            if default.__class__ == str:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetString(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetString(param,default)
            if default.__class__ == bool:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetBool(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetBool(param,default)
            if not v:
                v=default
            return v

global ui               ;ui = ""
global s                ;s  = ""
global points           ;points   = 0.0
global coor_X           ;coor_X   = 0.0
global coor_Y           ;coor_Y   = 0.0
global coor_Z           ;coor_Z   = 0.0
global vec              ;vec      = 0

global PolicePath

cm=ConfigManager("circular text")
PolicePath=cm.get("PolicePath","/usr/share/fonts/","C:/Windows/Fonts/ARIAL.TTF","/Library/Fonts/Arial.ttf")

import FreeCADGui
Gui=FreeCADGui
global rayon            ;rayon           = 10.0               # radius
global texte            ;texte           = "FreeCAD the best" #FreeCad The Best your text
global debut            ;debut           = 0                  # begin text
global rotation         ;rotation        = 360                # must exceed the number of characters of text
global SizeCaractere    ;SizeCaractere   = 2.0                # size font

global precision        ;precision       = 0.0                #
global correctionAngle  ;correctionAngle = 5.0                #
global correctionRayon  ;correctionRayon = 0.15               #
global debout           ;debout          = 1                  # 1=stand   0=flat
global exterieur        ;exterieur       = 1                  # 1=exteral 0=internal
global baseHelix        ;baseHelix       = 0.0                # base of helix
global endHelix         ;endHelix        = 0.0                # end of helix (heigth)
global pasHelix         ;pasHelix        = 2.0                # Pas of helix
global nombreCarParTour ;nombreCarParTour= 10                 # number char by Pas
global PivotCharachter  ;PivotCharachter = 0.0                # pivot caractere sur lui meme

global PlacementX       ;PlacementX      = 0.0                # Placement character axis X
global PlacementY       ;PlacementY      = 0.0                # Placement characher axis Y
global PlacementZ       ;PlacementZ      = 0.0                # Placement characher axis Z

global inclinaisonX     ;inclinaisonX    = 0                  # inclination character axis X
global inclinaisonY     ;inclinaisonY    = 0                  # inclination character axis Y
global inclinaisonZ     ;inclinaisonZ    = 0                  # inclination character axis Z + correctionAngle

global cercleClock      ;cercleClock     = rayon              # diameter support clock
global nombreFaces      ;nombreFaces     = 0                  # number Faces of support 0=none 1=circle 2=rectangle 3=triangle 4,5 ... polygon
global romain           ;romain          = 0                  # number roman or arabic
global redressement     ;redressement    = 0                  # character V or circular

global comP             ;comP            = ""                 # contener 
global nameL            ;nameL           = ""                 # contener 
global epaisseur        ;epaisseur       = 0.0                # epaisseur extrusion character
global epaisSupp        ;epaisSupp       = 0.0                # epaisseur extrusion support

global compount1        ;compount1       = 0                  # cree un compose des caracteres

#### for delette last object
global FcString         ##;FcString        = ""                 # conteneur
global FcStringPoints   ##;FcStringPoints  = ""                 # conteneur
global circleGuide      ##;circleGuide     = ""                 # cercle guide repere
global suppExtrude      ##;suppExtrude     = ""                 # extrusion
global createCompound   ##;createCompound  = ""                 # compound texte
#### for delette last object

# pointColor
global red              ;red   = 1.0  # 1 = 255 [ color num x = (1/255)*x ]
global green            ;green = 0.0  #
global blue             ;blue  = 0.0  #

#path#################################################################
global path                                                          #
#path  = FreeCAD.ConfigGet("AppHomePath")                             # path FreeCAD installation
#path  = FreeCAD.ConfigGet("UserAppData")                             # path FreeCAD User data
#path  = "your path"                                                  # your directory path
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro") # macro path
path  = param.GetString("MacroPath","") + "/"                        # macro path
path  = path.replace("\\","/")                                       # convert the "\" to "/"
#FreeCAD.Console.PrintMessage( "Path for the icons : " + path  + "\n")# 
######################################################################

indoorIcon = [
"60 46 9 1",
"   c None",
".  c #6F2322",
"+  c #343433",
"@  c #CE1416",
"#  c #3E3E6E",
"$  c #5C5A58",
"%  c #5D5C85",
"&  c #7A7B99",
"*  c #8E8DA5",
"************************************************************",
"************************************************************",
"************************************************************",
"************************************************************",
"************************************************************",
"********************************++++++++++++****************",
"***************************+++++$$$$$$$$$$$$++**************",
"************************+++$$$$$$$$$$$$$$$$$$$++************",
"**********************++$$$$$$$$$$$$$$$$$$$$$$$$++**********",
"*******************+++$$$$$$$$$$$$$$$$$$$$$$$$$$$$+*********",
"******************++$$$$$$$$$$$$$++++$$$$$$$$$$$$$$+********",
"****************++$$$$$$$$$$+++++$$$$+++++$$$$$$$$$+********",
"***************+$$$$$$$$++++$$$$$$$@@@$$$$++$$$$$+++********",
"*************++$$$$$$$$+$$$$$@@@$$$@$$$$$$$$+$$$+$$+********",
"************+$$$$$$$$++$$$$$$@$$$$$@$$$$$$@@$+++$$$$+*******",
"***********+$$$$$$$$+$$@@@$$$@@@$$$@$$$$$@@@$+$$$$$$+*******",
"**********+$$$$$$$$+$$$@$$$$$@$$$$$@@@$$$@$@$+$$$$$$+*******",
"*********+$$$$$$$$+$$$$@@@$$$@@@$$$$+++++@@@$++$$$$$+*******",
"********+$$$$$$$$+$$$$$@$$$$$$$$$+++****@@*@+@@@$$$+********",
"*******+$$$$$$$$+$@@@$$@@@$$$++++************@*@@++*********",
"******+$$$$$$$$+$$@$@.$$$$$++****************@**@***********",
"******+$$$$$$$$+$$@@@$$$$++******************@@*@***********",
"*****+$$$$$$$$++$$@$@.$++********************@@@@***********",
"*****+$$$$$$$$++$$@$$@+*************************************",
"*****+$$$$$$++$$$$$$+***************************************",
"****+$$$$$$$+$$$$$++****************************************",
"****+$$$$$$$+$@@@.+*****************************************",
"****+$$$$$$$+$@$$+******************************************",
"****+$$$$$$$+$@@@+******************************************",
"****+$$$$$$$$.@$+*******************************************",
"****+$$$$$$$$.@$+*******************************************",
"****+$$$$$$$++$$+*******************************************",
"****+$$$$$$+++$$+*******************************************",
"*****+$$$++$$$+$+*******************************************",
"*****+$++$$$$$+$+*******************************************",
"******+$$$$$$$+++*******************************************",
"*******+$$$$$$$++*******************************************",
"*******+$$$$$$$+********************************************",
"********+$$$$$$+********************************************",
"********+$$$$++*********************************************",
"********++$++***********************************************",
"*********++*************************************************",
"************************************************************",
"************************************************************",
"************************************************************",
"************************************************************"]

helpIcon = [
"24 24 4 1",
"   c None",
".  c #016AC5",
"+  c #F8F8FF",
"@  c #FFFFFF",
"........................",
".++++++++++++++++++++++.",
".++++++++++++++++++++++.",
".++..................++.",
".++..................++.",
".++......@@@@@@......++.",
".++.....@@@@@@@@.....++.",
".++.....@@@..@@@.....++.",
".++.....@@....@@.....++.",
".++.....@@....@@.....++.",
".++...........@@.....++.",
".++..........@@@.....++.",
".++.........@@@......++.",
".++........@@@.......++.",
".++........@@........++.",
".++........@@........++.",
".++..................++.",
".++........@@........++.",
".++........@@........++.",
".++..................++.",
".++..................++.",
".++++++++++++++++++++++.",
".++++++++++++++++++++++.",
"........................"]

executeIcon = [
"24 24 3 1",
"   c None",
".  c #4E9A06",
"+  c #FFFFFF",
"                        ",
"                        ",
"                        ",
"                  .     ",
"                 .+.    ",
"                .+.+.   ",
"               .+...+.  ",
"              .+.....+. ",
"     .       .+.......+.",
"    .+.     .+.......+. ",
"   .+.+.   .+.......+.  ",
"  .+...+. .+.......+.   ",
" .+.....+.+.......+.    ",
".+.......+.......+.     ",
" .+.............+.      ",
"  .+...........+.       ",
"   .+.........+.        ",
"    .+.......+.         ",
"     .+.....+.          ",
"      .+...+.           ",
"       .+.+.            ",
"        .+.             ",
"         .              ",
"                        "]

quitIcon = [
"24 24 3 1",
"   c None",
".  c #FFFFFF",
"+  c #CC0000",
"          ....          ",
"++++++++++....++++++++++",
"+.......++....++.......+",
"+.......++....++.......+",
"+.......++....++.......+",
"+...++++++....++++++...+",
"+...++++++....++++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+......................+",
"+......................+",
"+......................+",
"++++++++++++++++++++++++"]

resetIcon = [
"24 24 3 1",
"   c None",
".  c #3465A4",
"+  c #888A85",
"                        ",
"      ........          ",
"     .++++++++.         ",
"    .++..+....+.  ..... ",
"    .+.. .+....+. .+++. ",
"    .+.   .+....+..+.+. ",
"    ...    .+....+.+.+. ",
"            .+....+..+. ",
"             .+......+. ",
"              .+.....+. ",
"               .+....+. ",
"  ......        .+...+. ",
"  .++++.         .++++. ",
"  .+...+.        ...... ",
"  .+....+.              ",
"  .+.....+.             ",
"  .+......+.            ",
"  .+..+....+.           ",
"  .+.+.+....+.    ...   ",
"  .+.+..+....+.   .+.   ",
"  .+++. .+....+. ..+.   ",
"  .....  .+....+..++.   ",
"          .++++++++.    ",
"           ........     "]

standIcon = [
"16 16 9 1",
"   c None",
".  c #010400",
"+  c #28090D",
"@  c #4C0000",
"#  c #770000",
"$  c #AE0000",
"%  c #262826",
"&  c #CB0000",
"*  c #FD0705",
"***********     ",
"***********     ",
"**  ***  **     ",
"**  *...........",
"    *...........",
"    *..  ...  ..",
"    ***  ...    ",
"    ***  ...    ",
"    ***  ...    ",
"    ***  ...    ",
"    ***  ...    ",
"   ***** ...    ",
"         ...    ",
"         ...    ",
"        .....   ",
"                "]

flatIcon = [
"16 16 9 1",
"   c None",
".  c #020400",
"+  c #2B0500",
"@  c #620502",
"#  c #770301",
"$  c #970300",
"%  c #B40100",
"&  c #E60002",
"*  c #FE0004",
"                ",
"                ",
"                ",
"                ",
"    **    .     ",
"   ***   ...    ",
"   **    ...    ",
"  ***   ..      ",
"  ***   ..      ",
"  ****&#...     ",
" *****$+.....%  ",
" **  &.+%@...@. ",
" **  ..#*&%@....",
"**** ...  *&$...",
" ***  ..   ** ..",
"               ."]

romanIcon = [
"16 16 5 1",
"   c None",
".  c #FD9806",
"+  c #FD9904",
"@  c #FD9905",
"#  c #FD9906",
"                ",
"                ",
"             @@ ",
"         @@@@@  ",
"     @@@@@  @@  ",
"  @@@@  @@  @@  ",
"@@  @@  @@   @@ ",
"@@@ @@   @@  @@ ",
" @@@@    @@  @@ ",
"  +@@    @@  @@ ",
"   #@@@   @  @@@",
"  @@ .@@  @@@@  ",
"  @#  @@@@@     ",
" +@@@@@         ",
" @@             ",
"                "]

arabicIcon = [
"16 16 5 1",
"   c None",
".  c #F6972B",
"+  c #F6982B",
"@  c #F5972B",
"#  c #F7982B",
"                ",
"                ",
"                ",
"          ..    ",
"   ..   .....   ",
"  ...       ..  ",
"    .      ..   ",
"    .+     ..   ",
"    .+    @.    ",
"    .+   #....  ",
"    ...  ...    ",
"  ....          ",
"            ... ",
"     .......    ",
"   ...          ",
"                "]

redressIcon = [
"16 16 4 1",
"   c None",
".  c #010400",
"+  c #000000",
"@  c #FD9905",
"                ",
"                ",
"..   ..+        ",
" .     .        ",
" .    ++  ..    ",
" .   +     .    ",
"...  ...   .    ",
"           .    ",
"   @      ...   ",
"   @            ",
"   @   @    ..+ ",
"   @  @       . ",
"   @@@       .+ ",
"   @@         . ",
"            ..+ ",
"                "]

axialIcon = [
"16 16 4 1",
"   c None",
".  c #000000",
"+  c #010400",
"@  c #FD9905",
"                ",
"                ",
"++   ++.        ",
" +     +        ",
" +    ..     +. ",
" +   .       +. ",
"+++  +++    +   ",
"          ++    ",
"   @       +    ",
"   @            ",
"   @   @        ",
"   @  @    +   +",
"   @@@     + + +",
"   @@      .+.+.",
"                ",
"                "]

#### matplotlib debut 1/5 #################################################################
#import PySide2
#from PySide2 import (QtWidgets, QtCore, QtGui)
#from PySide2.QtWidgets import (QWidget, QApplication, QSlider, QGraphicsView, QGraphicsScene, QVBoxLayout, QStyle)

import re
import operator
from operator import itemgetter #, attrgetter, methodcaller    # pour sort 

setIconTTF = [
"16 16 6 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #729FCF",
"#  c #CC0000",
"$  c #EDD400",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++#####++++@@+@",
".+++$#$$$++@+@+@",
".++++#$+++++++@+",
".++++#$#####++++",
".++++#$+$#$$$+++",
".++++#$++#$+++++",
".@++++$++#$+###+",
".@@++++++#$+#$$$",
"..@@+++++#$+#$++",
"...@@+++++$+###+",
"....@@++++++#$$$",
".....@@+++++#$++",
"......@@+++++$++",
"................"]

setIconFON = [
"16 16 6 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #F57900",
"#  c #CC0000",
"$  c #EDD400",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++###++++++@@+@",
".++#$$$++++@+@+@",
".++#$+++++++++@+",
".++###+###++++++",
".++#$$$#$#$+++++",
".++#$++#$#$+++++",
".@++$++#$#$##+#+",
".@@++++#$#$##$#$",
"..@@+++###$#$##$",
"...@@+++$$$#$##$",
"....@@+++++#$+#$",
".....@@++++#$+#$",
"......@@++++$++$",
"................"]

setIconOTF = [
"16 16 6 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #4E9A06",
"#  c #CC0000",
"$  c #EDD400",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++###++++++@@+@",
".++#$#$++++@+@+@",
".++#$#$+++++++@+",
".++#$#$###++++++",
".++#$#$+#$$+++++",
".++###$+#$++++++",
".@++$$$+#$+###++",
".@@+++++#$+#$$$+",
"..@@++++#$+#$+++",
"...@@++++$+###++",
"....@@+++++#$$$+",
".....@@++++#$+++",
"......@@++++$+++",
"................"]

setIconPOL = [
"16 16 12 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #06989A",
"#  c #73D216",
"$  c #000000",
"%  c #75507B",
"&  c #729FCF",
"*  c #CC0000",
"=  c #F57900",
"-  c #EDD400",
";  c #4E9A06",
".+++++++++++@#$%",
".++++++++$+#++&$",
".++***++++++=@+%",
".++*-*-++++*+&+$",
".++*-*-+++++++*+",
".++***-***++++++",
".++*---*-*-+++++",
".++*-++*-*-+++++",
".$++-++*-*-*++++",
".*@++++*-*-*-+++",
"..#*+++***-*-+++",
"...;#+++---*-+++",
"....%=+++++*-+++",
".....;$++++****+",
"......@%++++----",
"................"]

setIconDel = [
"24 24 4 1",
"   c None",
".  c #A40000",
"+  c #EF0013",
"@  c #F00013",
"                        ",
"   ..              ..   ",
"  .@+.            .++.  ",
" .@+++.          .++++. ",
" .+++++.        .+++++. ",
"  .+++++.      .+++++.  ",
"   .+++++.    .+++++.   ",
"    .+++++.  .+++++.    ",
"     .+++++..+++++.     ",
"      .++++++++++.      ",
"       .++++++++.       ",
"        .++++++.        ",
"        .++++++.        ",
"       .++++++++.       ",
"      .++++++++++.      ",
"     .+++++..+++++.     ",
"    .+++++.  .+++++.    ",
"   .+++++.    .+++++.   ",
"  .+++++.      .+++++.  ",
" .+++++.        .+++++. ",
" .++++.          .++++. ",
"  .++.            .++.  ",
"   ..              ..   ",
"                        "]

#import glob
#files_TTF = glob.glob(self.pathFont + "/*.TTF") 
##################################
import matplotlib
import matplotlib.font_manager
import matplotlib.font_manager as fontman
import matplotlib.font_manager as fontconfig
from matplotlib.font_manager import FontProperties
#from matplotlib.ft2font import FT2Font
##################################

#### Config Begin matplotlib font #######################
                                                        # # https://en.wikipedia.org/wiki/Web_colors
global setColorTTF       ; setColorTTF       = "blue"   # .TTF   color by "extension name" or hexa "#0000FF" 
global setColorFON       ; setColorFON       = "orange" # .FON   color by "extension name" or hexa "#FFA500"
global setColorOTF       ; setColorOTF       = "green"  # .OTF   color by "extension name" or hexa "#008000"
global setColorPOL       ; setColorPOL       = "black"  # .OTHER color by "extension name" or hexa "#000000"
                                                      #####
global switchModeTextList; switchModeTextList= 1        # 0 = mode text normal (et noir) coupe le switchFontComBox
                                                        # 1 = permet le switchFontComBox 1 (default)
                                                      #####
global switchFontComBox  ; switchFontComBox  = 0        # 0 = (et switchModeTextList= 1) mode texte (en couleur) dans liste ComboBox plus rapide (default)
                                                        # 1 = (et switchModeTextList= 1) fontFamily dans liste ComboBox plus lent mais plus beau!
                                                      #####
global setSystemFonts    ; setSystemFonts    = 1        # 0 = matplotlib.font_manager.findSystemFonts("C:/", "ttf") 
                                                        #     fait toutes les fontes (dans tous les dossiers et sous dossiers du DD) time !!
                                                        # 1 = fontman.findSystemFonts(self.pathFont)
                                                        #     fait toutes les fontes du repertoire (et dans tous les sous dossiers) (default)
                                                      #####
global seTtextAlignement ; seTtextAlignement = 0        # 0 = AlignLeft (default)
                                                        # 1 = AlignCenter
                                                        # 2 = AlignRight
                                                      #####
global setFontByDefault  ; setFontByDefault  = "ARIAL"  # Font by Default
                                                      #####
global switchResetFALSE  ; switchResetFALSE  = 0        # 0 = reset (default)
                                                        # 1 = pas de reset (non conseille) certains switch peuvent rester ouvert ou fermer inopinement !
                                                      #####
#### Config End matplotlib font #########################
global setPathOrthogonal ; setPathOrthogonal = 0        # 
global setPathTangent    ; setPathTangent    = 1        # 
global setPositionBase   ; setPositionBase   = 1        # 
global setPositionCenter ; setPositionCenter = 0        # 
global setPositionTop    ; setPositionTop    = 0        # 
#### Config #############################################

def createSpace(texte):    # detecte majuscule et ajoute un espace devant la lettre
    # return createSpace(TexTe) = Tex Te , if createSpace(TEXTE) = TEXTE
    if texte.isupper():
        stringSpace = texte
    else:
        try:
            stringSpace = texte[0]
            for i in texte[1:]:
                if re.search(r"[A-Z]", i): i = " " +  i
                stringSpace += i
        except Exception:
            stringSpace = texte
    return stringSpace

def family(chaine):
    # return family(chaine)[1] = Family , family(chaine)[2] = typeCar (form [a, b, c ...]
    famille = typeCar = ""
    try:
        if chaine.find('-') != -1:
            famille = chaine[:chaine.find('-')]
            typeCar = chaine[chaine.find('-')+1:]
        else:
            famille = chaine
            typeCar = ""
    except Exception:
        famille = chaine
        typeCar = ""
    typeCar = str(createSpace(typeCar)).split()
    return [createSpace(famille), typeCar]

class MyLabelPatience():        # fenetre image d'attente de chargement
    global path
    label = QtWidgets.QLabel()
    label.setText("<img src=" + path + "FCCircularTextButtom.png><b><center>Wait please</center> \n\n<center>i search the fonts !\n\n</right></b>")
    ecran = FreeCADGui.getMainWindow().frameGeometry()
    xF = 250; yF = 250
    xW = (ecran.width()/2) - (xF/2)
    yW = (ecran.height()/2)- (yF/2)
    label.setGeometry(xW, yW, xF, yF)
    label.setStyleSheet("QLabel {background-color : #F0C300;font: 12pt; }");
    label.setWindowFlags(PySide2.QtCore.Qt.WindowFlags(PySide2.QtCore.Qt.FramelessWindowHint))        # pas de bords
    label.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint)         # PySide cette fonction met la fenetre en avant
#### matplotlib fin 1/5 #################################################################

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

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

class Ui_MainWindow(object):

    def __init__(self):
        global path
        self.path          = path

    #### matplotlib debut 2/5 apres __init__ #################################################################
        #### matplotlib font textEdit
        self.FontTextSize  = 20
        self.fonteComp     = ""
        self.font          = QtGui.QFont()
        self.tableau       = [] #Index (), [chemin plus nom fichier (nomPathPolice), nom sans extension (nomSimple), nomSimpleExt (nomSimple + Ext)]
        self.index         = 0  #Index ()
        #### matplotlib font textEdit
    def searchFont(self,pathSearch):
        global PolicePath
        global setSystemFonts
        global seTtextAlignement
        global switchFontComBox
        global switchModeTextList
        global setFontByDefault

        MyLabelPatience.label.show()
        FreeCADGui.updateGui()                                 # rafraichi l'ecran

        files_All_Fonts = ""
        ##https://matplotlib.org/_modules/matplotlib/font_manager.html

        if setSystemFonts == 0:
            files_All_Fonts = matplotlib.font_manager.findSystemFonts(pathSearch, "ttf")  # fait toutes les fontes ? ()
        else:
            files_All_Fonts = fontman.findSystemFonts(pathSearch)                         # fait toutes les fontes (et dans tous les sous dossiers)

        if len(files_All_Fonts) > 0:           
            self.tableau = []
            self.index = 0

            for fonte in files_All_Fonts:
                ####
                nomPathPolice = nomFichier = nomSimpleExt = nomSimple = nomExtension = nameName = ""

                nomPathPolice = fonte.replace("\\","/")     # convert the "\" to "/"
                nomFichier    = nomPathPolice.split("/")    # complet split
                nomSimpleExt  = nomFichier[-1]              # nom avec extension
                nomSimple     = nomFichier[-1][:-4]         # nom sans extension
                nomExtension  = nomSimpleExt[nomSimpleExt.rfind('.')+1:].upper() # extension

                ####
                try:
#                    nameFamily    = matplotlib.font_manager.FontProperties(fname=fonte).get_family()            ##['sans-serif']
#                    nameStyle     = matplotlib.font_manager.FontProperties(fname=fonte).get_style()              #normal
#                    nameVariant   = matplotlib.font_manager.FontProperties(fname=fonte).get_variant()            #normal
#                    nameWeight    = matplotlib.font_manager.FontProperties(fname=fonte).get_weight()             #normal
#                    nameStretch   = matplotlib.font_manager.FontProperties(fname=fonte).get_stretch()            #normal
#                    nameFileComp  = matplotlib.font_manager.FontProperties(fname=fonte).get_file()              ##c:\windows\fonts\NotoNaskhArabicUI-Regular.ttf
#                    nameSize      = matplotlib.font_manager.FontProperties(fname=fonte).get_size()               #10.0
                    nameName      = matplotlib.font_manager.FontProperties(fname=fonte).get_name()              ##Noto Naskh Arabic UI
#                    nameSizePoint = matplotlib.font_manager.FontProperties(fname=fonte).get_size_in_points()     #10.0
#                    nameSlant     = matplotlib.font_manager.FontProperties(fname=fonte).get_slant()              #normal
#                    namePattern   = matplotlib.font_manager.FontProperties(fname=fonte).get_fontconfig_pattern() #:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:file=c:\windows\fonts\NotoNaskhArabicUI-Regular.ttf:size=10.0
                except Exception:
                    nameFamily = nameStyle = nameVariant = nameWeight = nameStretch = nameFileComp = nameSize = nameName = nameSizePoint = nameSlant = namePattern = ""
                ####
                if nameName == "" :
                    nameName = nomSimple
                self.tableau.append([0, nomPathPolice, nomSimple, nomSimpleExt.upper(), nomExtension.upper(), nameName])
                
            self.tableau = sorted(self.tableau, key=itemgetter(3))          # sorted by nomSimple.upper()

            try:
                for line in range(len(self.tableau)):                       # enleve les doubles (bon)
                    if self.tableau[line][2] == self.tableau[line + 1][2]:  # enleve les doubles (bon)
                        del(self.tableau[line + 1])                         # enleve les doubles (bon)
            except Exception:
                None

            self.comboBoxPy.clear()
            for line in range(len(self.tableau)): 
                try:
                    self.tableau[line][0] = line                 # ajoute le numero de ligne
                    if self.tableau[line][2].upper() == setFontByDefault.upper(): # detecte la fonte de base
                        self.index = line
                        PolicePath = self.tableau[line][1]
                    ####Section common color and font begin ######################
                    model = self.comboBoxPy.model()

                    if switchModeTextList == 1:
                        if self.tableau[line][4] == "TTF":
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconTTF), str(line))
                            item.setForeground(QtGui.QColor(setColorTTF))
                        elif self.tableau[line][4] == "FON":
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconFON), str(line))
                            item.setForeground(QtGui.QColor(setColorFON))
                        elif self.tableau[line][4] == "OTF":
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconOTF), str(line))
                            item.setForeground(QtGui.QColor(setColorOTF))
                        else:
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconPOL), str(line))
                            item.setForeground(QtGui.QColor(setColorPOL))

                        if   seTtextAlignement == 0:
                            item.setTextAlignment(QtCore.Qt.AlignLeft)
                        elif seTtextAlignement == 1:
                            item.setTextAlignment(QtCore.Qt.AlignCenter)
                        elif seTtextAlignement == 2:
                            item.setTextAlignment(QtCore.Qt.AlignRight)
                        else:
                            self.comboBoxPy.addItem(self.tableau[line][2])    
                        model.appendRow(item)
                    else:
                        self.comboBoxPy.addItem("")
                    self.comboBoxPy.setItemText(line, self.tableau[line][2])
                    ####Section item color and font end ##########################

                    ####Section setfont Family switchFontComBox begin#############
                    if (switchFontComBox == 1) and (switchModeTextList == 1):
                        typeCar = font = ""
                        font = QtGui.QFont()
                        #font = item.font()

                        typeCar   = family(self.tableau[line][2])[1]
                        font.setBold(False)
                        font.setItalic(False)

                        if len(typeCar) > 0:
                            for option in typeCar:
                                if option == "Bold":
                                    font.setBold(True)
                                if (option == "Italic") or (option == "It") or (option == "Slanted"):
                                    font.setItalic(True)
                                if option == "Oblique":
                                    font.setItalic(True)
                        #'Bold''Regular''Slanted''Italic''Medium''Extra''Light''Condensed''Black''It''Semibold'
                        
                        font.setFamily(self.tableau[line][5])
                        font.setPixelSize(15)
                        if switchModeTextList == 1:
                            item.setFont(font)
                        else:
                            self.comboBoxPy.addItem("")
                    ####Section setfont Family switchFontComBox end###############

                except Exception:
                    FreeCAD.Console.PrintMessage("searchFont()" + "\n")
                    None

            self.lineEdit_NameFile.setText("(" + str(self.index + 1) + "/" + str(len(self.tableau)) + ") " + self.tableau[self.index][1])
            self.comboBoxPy.setCurrentIndex(self.index)
            self.fonteComp = self.tableau[self.index][1]
            MyLabelPatience.label.close()
            #### matplotlib fin 2/5 apres __init__ #################################################################

    def setupUi(self, MainWindow):
        self.window = MainWindow

        global ui
        global PolicePath
        global rayon
        global texte
        global rotation
        global SizeCaractere
        global debout
        global exterieur

        global precision
        global correctionAngle
        global correctionRayon
        global baseHelix
        global endHelix
        global nombreCarParTour

        global epaisseur
        global epaisSupp
        
        global setPathOrthogonal
        global setPathTangent
        global setPositionBase
        global setPositionCenter
        global setPositionTop
        global switchResetFALSE

        MainWindow.setObjectName(_fromUtf8("MainWindow"))
#        MainWindow.resize(360, 400)
#        MainWindow.setMaximumSize(QtCore.QSize(370, 638))
#        MainWindow.setMinimumSize(QtCore.QSize(400, 640))
        MainWindow.move(900, 40)

        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
        self.groupBox_00 = QtWidgets.QGroupBox()

        self.groupBox_01 = QtWidgets.QGroupBox()
#        self.groupBox_01.setMaximumHeight(180)

        ####
        self.textEdit = QtWidgets.QTextEdit()
#        self.textEdit.setStyleSheet("background-color: white; color: red; ")
        self.textEdit.textChanged.connect(self.on_textEdit_Changed)
        ####
        self.frame_Option = QtWidgets.QFrame()
        self.frame_Option.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_Option.setFrameShadow(QtWidgets.QFrame.Plain) #Raised Sunken
#        self.textEdit.setMaximumHeight(100)
        self.PB_Reverse = QtWidgets.QPushButton()
        self.PB_Reverse.clicked.connect(self.on_PB_Reverse)
        self.CB_Word = QtWidgets.QCheckBox(self.groupBox_01)
        self.CB_Word.setText(_fromUtf8("Word"))
        self.CB_Word.clicked.connect(self.on_CB_Word)
        ####

        self.PB_Help = QtWidgets.QPushButton(MainWindow)
        self.PB_Help.setIcon(QtGui.QIcon(QtGui.QPixmap(helpIcon)))      # help icone dans une variable
        self.PB_Help.clicked.connect(self.on_PB_Help_clicked)           # help

        #### matplotlib debut 3/5 setupUi #################################################################
        self.lineEdit_NameFile = QtWidgets.QLineEdit()
        #self.lineEdit_NameFile.returnPressed.connect(self.on_lineEdit_NameFile) 
        self.comboBoxPy = QtWidgets.QComboBox()
        ####
        self.pathFont = PolicePath[:len(PolicePath)-(PolicePath[::-1].index("/"))-1]
        ####
        ui.searchFont(self.pathFont)
        QtCore.QObject.connect(self.comboBoxPy, QtCore.SIGNAL("currentIndexChanged(int)"), self.on_fontComboBoxPython)
        #### matplotlib fin 3/5 setupUi #################################################################
        ####
        self.groupBox_02 = QtWidgets.QGroupBox()

        self.DS_Radius_Circle = QtWidgets.QDoubleSpinBox()
        self.DS_Radius_Circle.setMinimum(-99999999.0)
        self.DS_Radius_Circle.setMaximum(99999999.0)
        self.DS_Radius_Circle.setValue(rayon)
        self.DS_Radius_Circle.valueChanged.connect(self.on_DS_Radius_Circle) #connection doubleSpinBox
        self.label_10 = QtWidgets.QLabel()

        self.DS_Size_Character = QtWidgets.QDoubleSpinBox()
        self.DS_Size_Character.setMinimum(0.0)
        self.DS_Size_Character.setMaximum(99999999.0)
        self.DS_Size_Character.setSingleStep(1.0)
        self.DS_Size_Character.setValue(SizeCaractere)
        self.DS_Size_Character.valueChanged.connect(self.on_DS_Size_Character) #connection doubleSpinBox
        self.label_4 = QtWidgets.QLabel()

        self.S_Begin_Angle = QtWidgets.QSpinBox()
        self.S_Begin_Angle.setMaximum(360.0)
        self.S_Begin_Angle.setValue(debut)
        self.S_Begin_Angle.valueChanged.connect(self.on_S_Begin_Angle) #connection SpinBox
        self.label_13 = QtWidgets.QLabel()

        self.S_End_Angle = QtWidgets.QSpinBox()
        self.S_End_Angle.setMaximum(360)
        self.S_End_Angle.setValue(rotation)
        self.S_End_Angle.valueChanged.connect(self.on_S_End_Angle) #connection SpinBox
        self.label_14 = QtWidgets.QLabel()

        self.DS_Correction_Angle = QtWidgets.QDoubleSpinBox()
        self.DS_Correction_Angle.setMinimum(-359.00)
        self.DS_Correction_Angle.setMaximum(359.00)
        self.DS_Correction_Angle.setValue(correctionAngle)
        self.DS_Correction_Angle.valueChanged.connect(self.on_DS_Correction_Angle) #connection doubleSpinBox
        self.label_7 = QtWidgets.QLabel()

        self.DS_Correction_Radius = QtWidgets.QDoubleSpinBox()
        self.DS_Correction_Radius.setMinimum(-99999999.0)
        self.DS_Correction_Radius.setMaximum(99999999.0)
        self.DS_Correction_Radius.setValue(correctionRayon)
        self.DS_Correction_Radius.valueChanged.connect(self.on_DS_Correction_Radius) #connection doubleSpinBox
        self.label_8 = QtWidgets.QLabel()

        self.DS_Extrude = QtWidgets.QDoubleSpinBox()
        self.DS_Extrude.setEnabled(False)
        self.DS_Extrude.setMinimum(-99999999.0)
        self.DS_Extrude.setMaximum(99999999.0)
        self.DS_Extrude.setValue(epaisseur)
        self.DS_Extrude.valueChanged.connect(self.on_DS_Extrude) #connection doubleSpinBox

        self.CH_Extrude = QtWidgets.QCheckBox()
        self.CH_Extrude.clicked.connect(self.on_CH_Extrude) #connection checkBox

        self.DS_PlacementX = QtWidgets.QDoubleSpinBox()
        self.DS_PlacementX.setEnabled(False)
        self.DS_PlacementX.setSpecialValueText(_fromUtf8(""))
        self.DS_PlacementX.setMinimum(-9999999.0)
        self.DS_PlacementX.setMaximum(9999999.99)
        self.DS_PlacementX.valueChanged.connect(self.on_DS_PlacementX) #connection doubleSpinBox

        self.DS_PlacementY = QtWidgets.QDoubleSpinBox()
        self.DS_PlacementY.setEnabled(False)
        self.DS_PlacementY.setSpecialValueText(_fromUtf8(""))
        self.DS_PlacementY.setMinimum(-9999999.0)
        self.DS_PlacementY.setMaximum(9999999.99)
        self.DS_PlacementY.valueChanged.connect(self.on_DS_PlacementY) #connection doubleSpinBox

        self.DS_PlacementZ = QtWidgets.QDoubleSpinBox()
        self.DS_PlacementZ.setEnabled(False)
        self.DS_PlacementZ.setSpecialValueText(_fromUtf8(""))
        self.DS_PlacementZ.setMinimum(-9999999.0)
        self.DS_PlacementZ.setMaximum(9999999.99)
        self.DS_PlacementZ.valueChanged.connect(self.on_DS_PlacementZ) #connection doubleSpinBox

        self.CH_Sp_Placement = QtWidgets.QCheckBox()
        self.CH_Sp_Placement.clicked.connect(self.on_CH_Sp_Placement) #connection checkBox

        self.DS_InclinaisonX = QtWidgets.QSpinBox()
        self.DS_InclinaisonX.setEnabled(False)
        self.DS_InclinaisonX.setMinimum(-360.0)
        self.DS_InclinaisonX.setMaximum(360.0)
        self.DS_InclinaisonX.setValue(inclinaisonX)
        self.DS_InclinaisonX.valueChanged.connect(self.on_DS_InclinaisonX) #connection doubleSpinBox

        self.DS_InclinaisonY = QtWidgets.QSpinBox()
        self.DS_InclinaisonY.setEnabled(False)
        self.DS_InclinaisonY.setMinimum(-360)
        self.DS_InclinaisonY.setMaximum(360)
        self.DS_InclinaisonY.setValue(inclinaisonY)
        self.DS_InclinaisonY.valueChanged.connect(self.on_DS_InclinaisonY) #connection doubleSpinBox

        self.DS_InclinaisonZ = QtWidgets.QSpinBox()
        self.DS_InclinaisonZ.setEnabled(False)
        self.DS_InclinaisonZ.setMinimum(-360.0)
        self.DS_InclinaisonZ.setMaximum(360.0)
        self.DS_InclinaisonZ.setValue(inclinaisonZ)
        self.DS_InclinaisonZ.valueChanged.connect(self.on_DS_InclinaisonZ) #connection doubleSpinBox

        self.CH_Sp_Inclination = QtWidgets.QCheckBox()
        self.CH_Sp_Inclination.clicked.connect(self.on_CH_Sp_Inclination) #connection checkBox
        ####
        self.groupBox_03 = QtWidgets.QGroupBox()

        self.RA_Choice_Outdoor = QtWidgets.QRadioButton()
        self.RA_Choice_Outdoor.setChecked(True)
        self.RA_Choice_Outdoor.clicked.connect(self.on_RA_Choice_Outdoor) #connection radioButton

        self.RA_Choice_Indoor = QtWidgets.QRadioButton()
        self.RA_Choice_Indoor.clicked.connect(self.on_RA_Choice_Indoor) #connection radioButton

        self.RA_Choice_Helix = QtWidgets.QRadioButton()
        self.RA_Choice_Helix.clicked.connect(self.on_RA_Choice_Helix) #connection radioButton

        self.RA_Choice_Clock = QtWidgets.QRadioButton()
        self.RA_Choice_Clock.clicked.connect(self.on_RA_Choice_Clock) #connection radioButton

        self.RA_Choice_Mirror = QtWidgets.QRadioButton()
        self.RA_Choice_Mirror.setVisible(False)
        self.RA_Choice_Mirror.clicked.connect(self.on_RA_Choice_Mirror) #connection radioButton

        self.PU_Flat = QtWidgets.QPushButton()
        self.PU_Flat.setEnabled(True)
        self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable 
        self.PU_Flat.clicked.connect(self.on_PU_Flat)

        self.graphicsView = QtWidgets.QGraphicsView()
        ####Screen Graphic BitMap
        ##https://doc.qt.io/qtforpython/PySide2/QtCore/Qt.html
        self.graphicsView = QtWidgets.QGraphicsView()
        self.graphicsView.setObjectName("graphicsView")
        self.graphicsView.setFixedSize(215,60)
#        pic = QtGui.QPixmap(indoorIcon)    # png
#        self.scene = QtWidgets.QGraphicsScene()
#        self.scene.addPixmap(QtGui.QPixmap(pic))                        # png (bmp)
#        self.graphicsView.setScene(self.scene)
        ####Screen Graphic BitMap
        ####
        self.groupBox_04 = QtWidgets.QGroupBox()
        self.groupBox_04.setEnabled(False)
        self.groupBox_04.setCheckable(False)
        self.groupBox_04.setVisible(False)

        self.DS_Step_Of_The_Helix = QtWidgets.QDoubleSpinBox()
        self.DS_Step_Of_The_Helix.setMaximum(99999999.99)
        self.DS_Step_Of_The_Helix.setValue(pasHelix)
        self.DS_Step_Of_The_Helix.valueChanged.connect(self.on_DS_Step_Of_The_Helix) #connection doubleSpinBox
        self.label_12 = QtWidgets.QLabel()

        self.DS_Number_Char_Per_Turn = QtWidgets.QSpinBox()
        self.DS_Number_Char_Per_Turn.setMaximum(99999999)
        self.DS_Number_Char_Per_Turn.setValue(nombreCarParTour)
        self.DS_Number_Char_Per_Turn.valueChanged.connect(self.on_DS_Number_Char_Per_Turn) #connection doubleSpinBox
        self.label = QtWidgets.QLabel()

        self.DS_Base_Helix = QtWidgets.QDoubleSpinBox()
        self.DS_Base_Helix.setEnabled(False)
        self.DS_Base_Helix.setMinimum(-99999999.0)
        self.DS_Base_Helix.setMaximum(99999999.0)
        self.DS_Base_Helix.setValue(baseHelix)
        self.DS_Base_Helix.valueChanged.connect(self.on_DS_Base_Helix) #connection doubleSpinBox
        self.label_2 = QtWidgets.QLabel()

        self.DS_End_Helix = QtWidgets.QDoubleSpinBox()
        self.DS_End_Helix.setEnabled(False)
        self.DS_End_Helix.setMinimum(-99999999.0)
        self.DS_End_Helix.setMaximum(99999999.0)
        self.DS_End_Helix.setValue(endHelix)
        self.DS_End_Helix.valueChanged.connect(self.on_DS_End_Helix) #connection doubleSpinBox
        self.label_3 = QtWidgets.QLabel()
        ####
        self.groupBox_05 = QtWidgets.QGroupBox()
        self.groupBox_05.setEnabled(False)
        self.groupBox_05.setVisible(False)

        self.DS_Radius_Support = QtWidgets.QDoubleSpinBox()
        self.DS_Radius_Support.setMaximum(99999999.99)
        self.DS_Radius_Support.setValue(cercleClock)
        self.DS_Radius_Support.valueChanged.connect(self.on_DS_Radius_Support) #connection doubleSpinBox
        self.label_11 = QtWidgets.QLabel()

        self.PU_Roman = QtWidgets.QPushButton()
        self.PU_Roman.setIcon(QtGui.QIcon(QtGui.QPixmap(arabicIcon))) # icone dans une variable 
        self.PU_Roman.clicked.connect(self.on_PU_Roman)

        self.S_Number_Faces_Support = QtWidgets.QSpinBox()
        self.S_Number_Faces_Support.setMaximum(999)
        self.S_Number_Faces_Support.setValue(nombreFaces)
        self.S_Number_Faces_Support.valueChanged.connect(self.on_S_Number_Faces_Support) #connection SpinBox
        self.label_5 = QtWidgets.QLabel()

        self.PU_Redress = QtWidgets.QPushButton()
        self.PU_Redress.setIcon(QtGui.QIcon(QtGui.QPixmap(axialIcon))) # icone dans une variable 
        self.PU_Redress.clicked.connect(self.on_PU_Redress)

        self.DS_Extrude_Support = QtWidgets.QDoubleSpinBox()
        self.DS_Extrude_Support.setMaximum(99999999.0)
        self.DS_Extrude_Support.setEnabled(False)
        self.DS_Extrude_Support.setValue(epaisSupp)
        self.DS_Extrude_Support.valueChanged.connect(self.on_DS_Extrude_Support) #connection doubleSpinBox
        self.label_6 = QtWidgets.QLabel()
        ####
        self.groupBox_055 = QtWidgets.QGroupBox()
        self.groupBox_055.setEnabled(False)

        self.frame_Path = QtWidgets.QFrame()
        self.frame_Path.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_Path.setFrameShadow(QtWidgets.QFrame.Plain) #Raised) Sunken
        self.RB_Path_01 = QtWidgets.QRadioButton()
        self.RB_Path_01.setChecked(setPathOrthogonal)
        self.RB_Path_02 = QtWidgets.QRadioButton()
        self.RB_Path_02.setChecked(setPathTangent)

        self.frame_Position = QtWidgets.QFrame()
        self.frame_Position.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_Position.setFrameShadow(QtWidgets.QFrame.Plain) #.Raised) Sunken
        self.RB_Position_01 = QtWidgets.QRadioButton()
        self.RB_Position_01.setChecked(setPositionBase)
        self.RB_Position_02 = QtWidgets.QRadioButton()
        self.RB_Position_01.setChecked(setPositionCenter)
        self.RB_Position_03 = QtWidgets.QRadioButton()
        self.RB_Position_01.setChecked(setPositionTop)

        self.horizontalSlider_01_Str = QtWidgets.QSlider()
        self.horizontalSlider_01_Str.setOrientation(QtCore.Qt.Horizontal)
        self.label_Path_01 = QtWidgets.QLabel()
        self.horizontalSlider_02_Car = QtWidgets.QSlider()
        self.horizontalSlider_02_Car.setOrientation(QtCore.Qt.Horizontal)
        self.label_Path_02 = QtWidgets.QLabel()
        self.horizontalSlider_03_Tra = QtWidgets.QSlider()
        self.horizontalSlider_03_Tra.setOrientation(QtCore.Qt.Horizontal)
        self.label_Path_03 = QtWidgets.QLabel()

        ####
        self.groupBox_06 = QtWidgets.QGroupBox()

        self.CB_01_Points = QtWidgets.QCheckBox()
        self.CB_02_Circle = QtWidgets.QCheckBox()
        self.CB_03_BBox = QtWidgets.QCheckBox()
        self.CB_04_Progression = QtWidgets.QCheckBox()
        self.CB_05_Reset = QtWidgets.QCheckBox()
        self.CB_05_Reset.clicked.connect(self.on_CB_05_Reset)
        if switchResetFALSE == 1:
            self.CB_05_Reset.setChecked(True)
        self.PB_Delete_Last = QtWidgets.QPushButton()
        self.PB_Delete_Last.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconDel))) # del icone dans une variable 
        self.PB_Delete_Last.clicked.connect(self.on_PB_Delete_Last)

        self.PU_Exit = QtWidgets.QPushButton()
        self.PU_Exit.setIcon(QtGui.QIcon(QtGui.QPixmap(quitIcon))) # quit icone dans une variable 
        #self.PU_Exit.setIconSize(QtCore.QSize(26, 26))
        self.PU_Exit.clicked.connect(self.on_PU_Exit)

        self.PU_Reset = QtWidgets.QPushButton()
        self.PU_Reset.setEnabled(True)
        self.PU_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(resetIcon)))  # reset icone dans une variable 
        self.PU_Reset.clicked.connect(self.on_PU_Reset)

        self.PU_Benchmarks = QtWidgets.QPushButton()
        self.PU_Benchmarks.setIcon(QtGui.QIcon(QtGui.QPixmap(executeIcon)))# execute icone dans une variable 
        self.PU_Benchmarks.clicked.connect(self.on_PU_Benchmarks)

        self.PU_Execute = QtWidgets.QPushButton()
        self.PU_Execute.setIcon(QtGui.QIcon(QtGui.QPixmap(executeIcon)))# execute icone dans une variable 
        self.PU_Execute.clicked.connect(self.on_PU_Execute)
        ####
        #### self.DS_Pivot_Char # pas utilise
        self.DS_Pivot_Char = QtWidgets.QDoubleSpinBox()
        self.DS_Pivot_Char.setEnabled(False)
        self.DS_Pivot_Char.setMinimum(-360.0)
        self.DS_Pivot_Char.setMaximum(360.0)
        self.DS_Pivot_Char.setValue(0.0)
        self.DS_Pivot_Char.valueChanged.connect(self.on_DS_Pivot_Char) #connection doubleSpinBox

        self.CH_Pivot_Character = QtWidgets.QCheckBox()
        self.CH_Pivot_Character.clicked.connect(self.on_CH_Pivot_Character) #connection checkBox
        ####
        ####
        #### gridLayout begin #######################
        self.gridLayout = QtWidgets.QGridLayout(self.centralWidget)
        self.gridLayout.setContentsMargins(10, 10, 10, 10)
        ##
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_00)
        self.groupBox_00.setMaximumHeight(660)
        self.gridLayout_2.setContentsMargins(10, 10, 10, 10)
#        self.gridLayout_2.setSpacing(6)
        ##
        self.gridLayout_Texte = QtWidgets.QGridLayout(self.groupBox_01)  # groupes .....
        self.groupBox_01.setMaximumHeight(160)
#        self.gridLayout_Texte.setSpacing(6)
        self.gridLayout_Texte.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_Texte.addWidget(self.textEdit, 0, 0, 1, 1)
        ##
        self.gridLayout_frame_Option = QtWidgets.QGridLayout(self.frame_Option)
        self.gridLayout_frame_Option.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Option.addWidget(self.PB_Reverse, 0, 0, 1, 1)
        self.gridLayout_frame_Option.addWidget(self.CB_Word, 1, 0, 1, 1)
        self.gridLayout_Texte.addWidget(self.frame_Option, 0, 1, 1, 1)
        ##
        self.gridLayout_Texte.addWidget(self.lineEdit_NameFile,1, 0, 1, 1)#_Font
        self.gridLayout_Texte.addWidget(self.PB_Help,2, 1, 1, 1)
        self.gridLayout_Texte.addWidget(self.comboBoxPy,2, 0, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_01, 0, 0, 1, 1)
        ####
        self.gridLayout_Config = QtWidgets.QGridLayout(self.groupBox_02)
        self.gridLayout_Config.setContentsMargins(10, 10, 10, 10)
        self.groupBox_02.setMaximumHeight(450)
        self.groupBox_02.setMinimumHeight(255)
#        self.gridLayout_Config.setSpacing(6)
        self.gridLayout_Config.addWidget(self.groupBox_03, 0, 0, 7, 2)
#        self.groupBox_03.setMaximumHeight(300)
        self.gridLayout_Choice = QtWidgets.QGridLayout(self.groupBox_03)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Outdoor, 0, 0, 1, 1)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Indoor, 1, 0, 1, 1)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Helix, 0, 1, 1, 1)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Clock, 1, 1, 1, 1)
#        self.gridLayout_Choice.addWidget(self.RA_Choice_Mirror,2, 0, 1, 1)
        self.gridLayout_Choice.addWidget(self.PU_Flat, 2, 0, 1, 2)
        self.gridLayout_Choice.addWidget(self.graphicsView, 3, 0, 1, 2)
        ##
        self.gridLayout_Config.addWidget(self.DS_Radius_Circle, 0, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_10, 0, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Size_Character, 1, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_4, 1, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.S_Begin_Angle, 2, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_13, 2, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.S_End_Angle, 3, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_14, 3, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Correction_Angle, 4, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_7, 4, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Correction_Radius, 5, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_8, 5, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Extrude, 6, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.CH_Extrude, 6, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_PlacementX, 7, 0, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_PlacementY, 7, 1, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_PlacementZ, 7, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.CH_Sp_Placement, 7, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_InclinaisonX, 8, 0, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_InclinaisonY, 8, 1, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_InclinaisonZ, 8, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.CH_Sp_Inclination, 8, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_02, 1, 0, 1, 1)
        ####
        self.gridLayout_Helix = QtWidgets.QGridLayout(self.groupBox_04)
        self.gridLayout_Helix.setContentsMargins(10, 10, 10, 10)
        self.groupBox_04.setMaximumHeight(110)
        self.groupBox_04.setMinimumHeight(110)
#        self.gridLayout_Helix.setSpacing(6)
        self.gridLayout_Helix.addWidget(self.DS_Step_Of_The_Helix, 0, 0, 1, 1)
        self.gridLayout_Helix.addWidget(self.label_12, 0, 1, 1, 1)
        self.gridLayout_Helix.addWidget(self.DS_Number_Char_Per_Turn, 0, 2, 1, 1)
        self.gridLayout_Helix.addWidget(self.label, 0, 3, 1, 1)
        self.gridLayout_Helix.addWidget(self.DS_Base_Helix, 1, 0, 1, 1)
        self.gridLayout_Helix.addWidget(self.label_2, 1, 1, 1, 1)
        self.gridLayout_Helix.addWidget(self.DS_End_Helix, 1, 2, 1, 1)
        self.gridLayout_Helix.addWidget(self.label_3, 1, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_04, 3, 0, 1, 1)
        ####
        self.gridLayout_Clock = QtWidgets.QGridLayout(self.groupBox_05)
        self.gridLayout_Clock.setContentsMargins(10, 10, 10, 10)
        self.groupBox_05.setMaximumHeight(110)
        self.groupBox_05.setMinimumHeight(110)
#        self.gridLayout_Clock.setSpacing(6)
        self.gridLayout_Clock.addWidget(self.DS_Radius_Support, 0, 0, 1, 1)
        self.gridLayout_Clock.addWidget(self.label_11, 0, 1, 1, 1)
        self.gridLayout_Clock.addWidget(self.PU_Roman, 0, 2, 1, 1)
        self.gridLayout_Clock.addWidget(self.S_Number_Faces_Support, 1, 0, 1, 1)
        self.gridLayout_Clock.addWidget(self.label_5, 1, 1, 1, 1)
        self.gridLayout_Clock.addWidget(self.PU_Redress, 1, 2, 1, 1)
        self.gridLayout_Clock.addWidget(self.DS_Extrude_Support, 2, 0, 1, 1)
        self.gridLayout_Clock.addWidget(self.label_6, 2, 1, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_05, 4, 0, 1, 1)
        ####

        self.gridLayout_Path = QtWidgets.QGridLayout(self.groupBox_055)
        self.gridLayout_Path.setContentsMargins(10, 10, 10, 10)
        self.groupBox_055.setMaximumHeight(110)
        self.groupBox_055.setMinimumHeight(110)
        ##
        self.gridLayout_frame_Path = QtWidgets.QGridLayout(self.frame_Path)
        self.gridLayout_frame_Path.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Path.addWidget(self.RB_Path_01, 0, 1, 1, 1)
        self.gridLayout_frame_Path.addWidget(self.RB_Path_02, 0, 2, 1, 1)
        self.gridLayout_Path.addWidget(self.frame_Path, 0, 0, 1, 1)
        ##
        self.gridLayout_frame_Position = QtWidgets.QGridLayout(self.frame_Position)
        self.gridLayout_frame_Position.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Position.addWidget(self.RB_Position_01, 0, 0, 1, 1)
        self.gridLayout_frame_Position.addWidget(self.RB_Position_02, 0, 1, 1, 1)
        self.gridLayout_frame_Position.addWidget(self.RB_Position_03, 0, 2, 1, 1)
        self.gridLayout_Path.addWidget(self.frame_Position, 1, 0, 1, 1)
#        ##
#        self.gridLayout_Path.addWidget(self.horizontalSlider_01_Str, 2, 0, 1, 1)
#        self.gridLayout_Path.addWidget(self.label_Path_01, 2, 1, 1, 1)
#        self.gridLayout_Path.addWidget(self.horizontalSlider_02_Car, 3, 0, 1, 1)
#        self.gridLayout_Path.addWidget(self.label_Path_02, 3, 1, 1, 1)
#        self.gridLayout_Path.addWidget(self.horizontalSlider_03_Tra, 4, 0, 1, 1)
#        self.gridLayout_Path.addWidget(self.label_Path_03, 4, 1, 1, 1)
#        ##
        self.gridLayout_2.addWidget(self.groupBox_055, 5, 0, 1, 1)
        ####
        self.gridLayout_Command = QtWidgets.QGridLayout(self.groupBox_06)
        self.gridLayout_Command.setContentsMargins(10, 10, 10, 10)
        self.groupBox_06.setMaximumHeight(100)
#        self.gridLayout_Command.setSpacing(6)
        self.gridLayout_Command.addWidget(self.CB_01_Points, 0, 0, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_02_Circle, 0, 1, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_03_BBox, 0, 2, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_04_Progression, 0, 3, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_05_Reset, 1, 0, 1, 1)
        self.gridLayout_Command.addWidget(self.PB_Delete_Last, 1, 3, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Exit, 2, 0, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Reset, 2, 1, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Benchmarks, 2, 2, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Execute, 2, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_06, 6, 0, 1, 1)
        ####
        self.gridLayout.addWidget(self.groupBox_00, 0, 0, 1, 1)
        #### gridLayout end #######################

        MainWindow.setCentralWidget(self.centralWidget)
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint)                         # PySide cette fonction met la fenetre en avant
        MainWindow.setWindowTitle(_fromUtf8(__Title__))
        MainWindow.setWindowIcon(QtGui.QIcon(_fromUtf8(self.path + "FCCircularTextButtom.png")))  # change l'icone de la fenetre principale
        self.groupBox_00.setTitle(_fromUtf8("Ver : " + __Version__ + " : " +  __Date__) + " (rmu)")

        self.groupBox_01.setTitle(_fromUtf8("Text to be displayed  ( "+str(len(texte))+" characters )"))
        self.textEdit.setHtml(_fromUtf8(texte))
        self.textEdit.setToolTip(_fromUtf8("Your text to be displayed" + "\n"
                                           "the last character superpose de first character ! " + "\n"
                                           "you must adding one space after the last character" + "\n"
                                           "you must adding space for adjust, the space is consirdered as character"))
        self.PB_Reverse.setText(_fromUtf8("Reverse"))
        self.PB_Reverse.setToolTip(_fromUtf8("Reverse the text edited"))
        try:
            self.lineEdit_NameFile.setText(_fromUtf8("(" + str(self.index + 1) + "/" + str(len(self.tableau)) + ") " + self.tableau[self.index][1]))
        except Exception:
            None
        self.lineEdit_NameFile.setToolTip(_fromUtf8("(Number index / Number Fonts) Complete path and name of Font file"))
        self.PB_Help.setText(_fromUtf8("Help"))
        self.CB_Word.setText(_fromUtf8("Word"))
        self.CB_Word.setToolTip(_fromUtf8("If Word is checked, the text are clipped to each space" + "\n"
                                          "one space egual one character." + "\n\n"
                                          "If in mode Path you work with a circle," + "\n"
                                          "the last character superpose de first character ! " + "\n"
                                          "you must adding one space after the last character" + "\n"
                                          "for spacing the last and the first character" + "\n\n"
                                          "You must work with the space as the character"))
#        self.PB_Decompose.setText(_fromUtf8("Decompose"))

        #### matplotlib debut 4/5 retranslateUi #################################################################
        self.comboBoxPy.setToolTip("Choice your Font" + "\n" +
                                   "\n" +
                                   "You must modify the configuration of display" + "\n" +
                                   "Menu Edit parameter: User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__ + ":" + "\n" +
                                   "####" + "\n" +
                                   "switchModeTextList= 1\t# 0 = mode text normal (the switchFontComBox is enabled)" + "\n"
                                   "\t\t\t# 1 = switchFontComBox authorized (default)" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "switchFontComBox  = 1\t# 0 = mode text in color .. faster" + "\n"
                                   "\t\t\t# 1 = fontFamily listed ComboBox slower but beautiful (default)" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "setSystemFonts    = 1\t# 0 = matplotlib.font_manager.findSystemFonts" + "\n"
                                   "\t\t\t#   all fonts in System font" + "\n"
                                   "\t\t\t# 1 = fontman.findSystemFonts(self.pathFont) (default)" + "\n"
                                   "\t\t\t# all fonts in all directory and sub directory" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "seTtextAlignement = 0\t# 0 = AlignLeft (default)" + "\n"
                                   "\t\t\t# 1 = AlignCenter" + "\n"
                                   "\t\t\t# 2 = AlignRight" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "setFontByDefault = ""ARIAL""\t # ARIAL" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "switchResetFALSE = 0\t # 0 by default." + "\n"
                                   "If you use this option [ switchResetFALSE = 1 ] some switch can be opened when it should not be" + "\n"
                                   "then it is advisable to do a reset after a change one option" + "\n"
                                   "####" + "\n"
                                   "Actual configuration : " + str(switchModeTextList) + ", " + str(switchFontComBox) + ", " + str(setSystemFonts) + ", "
                                                             + str(seTtextAlignement) + ", " + setFontByDefault + ", " + str(switchResetFALSE) + "\n"
                                   "####" + "\n" +
                                   "Read the info")
        #### matplotlib fin 4/5 retranslateUi #################################################################

        self.groupBox_02.setTitle(_fromUtf8("Configuration"))
        self.DS_Radius_Circle.setToolTip(_fromUtf8("Give the radius of circle"))
        self.DS_Radius_Circle.setSuffix(_fromUtf8(" mm"))
        self.label_10.setText(_fromUtf8("Radius of circle"))
        self.DS_Size_Character.setToolTip(_fromUtf8("Size of the font"))
        self.DS_Size_Character.setSuffix(_fromUtf8(" mm"))
        self.label_4.setText(_fromUtf8("Character size"))
        self.S_Begin_Angle.setToolTip(_fromUtf8("Starting text of the circle "))
        self.S_Begin_Angle.setSuffix(_fromUtf8(" deg"))
        self.label_13.setText(_fromUtf8("Starting angle"))
        self.S_End_Angle.setToolTip(_fromUtf8("End text of the circle "))
        self.S_End_Angle.setSuffix(_fromUtf8(" deg"))
        self.label_14.setText(_fromUtf8("Ending angle"))
        self.DS_Correction_Angle.setToolTip(_fromUtf8("Correct angle for tangent the text of thr circle or give a tilt angle" + "\n"
                                                      "this option is adding to the original angle (Sp. inclination)"))
        self.DS_Correction_Angle.setSuffix(_fromUtf8(" deg"))
        self.label_7.setText(_fromUtf8("Correction Angle"))
        self.DS_Correction_Radius.setToolTip(_fromUtf8("Correct of the radius (depend of correction angle)" + "\n"
                                                       "this option is adding to the original radius (Radius of circle)"))
        self.DS_Correction_Radius.setSuffix(_fromUtf8(" mm"))
        self.label_8.setText(_fromUtf8("Correction Radius"))
        self.DS_Extrude.setSuffix(_fromUtf8(" mm"))
        self.DS_Extrude.setToolTip(_fromUtf8("Thickness of the extrude of character. If thickness = 0 then not extrude"))
        self.CH_Extrude.setText(_fromUtf8("Extrude Char."))
        self.CH_Extrude.setToolTip(_fromUtf8("Choice extrude character or not"))
        ####
        self.DS_PlacementX.setSuffix(_fromUtf8(" X mm"))
        self.DS_PlacementX.setToolTip(_fromUtf8("Placement direction X" + "\n" 
                                                "Not used with the Clock option"))
        self.DS_PlacementY.setSuffix(_fromUtf8(" Y mm"))
        self.DS_PlacementY.setToolTip(_fromUtf8("Placement direction Y" + "\n" 
                                                "Not used with the Clock option"))
        self.DS_PlacementZ.setSuffix(_fromUtf8(" Z mm"))
        self.DS_PlacementZ.setToolTip(_fromUtf8("Placement direction Z"+ "\n"
                                                "For Clock option only this Z axis is available"))
        self.CH_Sp_Placement.setText(_fromUtf8("Placement"))
        self.CH_Sp_Placement.setToolTip(_fromUtf8("Placement of character in the choice"))
        #carDegrees = b' \xc2\xb0'.decode("utf-8")    #thanks wmayer    https://forum.freecadweb.org/viewtopic.php?f=13&t=36380&p=308476#p308357
        self.DS_InclinaisonX.setSuffix(_fromUtf8(" deg"))
        self.DS_InclinaisonX.setToolTip(_fromUtf8("Inclination character in axis X"))
        self.DS_InclinaisonY.setSuffix(_fromUtf8(" deg"))
        self.DS_InclinaisonY.setToolTip(_fromUtf8("Inclination character axis Y"))
        self.DS_InclinaisonZ.setSuffix(_fromUtf8(" deg"))
        self.DS_InclinaisonZ.setToolTip(_fromUtf8("Inclination character axis Z"))
        self.CH_Sp_Inclination.setText(_fromUtf8("Sp. inclination"))
        self.CH_Sp_Inclination.setToolTip(_fromUtf8("Inclination of character in the choice or alls plane "))
        ####
        self.groupBox_03.setTitle(_fromUtf8("Choice"))
        self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
        self.RA_Choice_Outdoor.setToolTip(_fromUtf8("Create the text on the outer face of the cylinder"))
        self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
        self.RA_Choice_Indoor.setToolTip(_fromUtf8("Create the text on the inside of the cylinder"))
        self.RA_Choice_Helix.setText(_fromUtf8("Helix"))
        self.RA_Choice_Helix.setToolTip(_fromUtf8("Create the text in a helix"))
        self.RA_Choice_Clock.setText(_fromUtf8("Clock"))
        self.RA_Choice_Clock.setToolTip(_fromUtf8("Create the text to form a clock"))
        self.RA_Choice_Mirror.setText(_fromUtf8("Mirror"))
        self.RA_Choice_Mirror.setToolTip(_fromUtf8("Create mirror text (text reversed)"))
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
        self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
        ####
        self.groupBox_04.setTitle(_fromUtf8("Helix"))
        self.DS_Step_Of_The_Helix.setSuffix(_fromUtf8(" mm"))
        self.DS_Step_Of_The_Helix.setToolTip(_fromUtf8("Step of the text along the helix (min Size Caractere)"))
        self.label_12.setText(_fromUtf8("Step of Helix"))
        self.DS_Number_Char_Per_Turn.setToolTip(_fromUtf8("Number of characters for one turn of helix"))
        self.label.setText(_fromUtf8("Char. per turn"))
        self.DS_Base_Helix.setToolTip(_fromUtf8("Base (begin) of helix (to activate Step of Helix must be zero)"))
        self.DS_Base_Helix.setSuffix(_fromUtf8(" mm"))
        self.label_2.setText(_fromUtf8("Base Helix"))
        self.DS_End_Helix.setToolTip(_fromUtf8("Final height of the helix (to activate Step of Helix must be zero)"))
        self.DS_End_Helix.setSuffix(_fromUtf8(" mm"))
        self.label_3.setText(_fromUtf8("End Helix"))
        ####
        self.groupBox_05.setTitle(_fromUtf8("Clock"))
        self.DS_Radius_Support.setSuffix(_fromUtf8(" mm"))
        self.DS_Radius_Support.setToolTip(_fromUtf8("Radius of the support the clock (By defaut : Radius of circle)"))
        self.label_11.setText(_fromUtf8("Radius of support"))
        self.PU_Roman.setText(_fromUtf8("Mode Arabic"))
        self.PU_Roman.setToolTip(_fromUtf8("The characters is in Roman or Arabic (default)"))
        self.S_Number_Faces_Support.setToolTip(_fromUtf8("Number of side of the support 0=none, 1=circle, 2=rectangle, 3=triangle, 4=square, 5=pentagon . . . . (Thickness egal extrude)"))
        self.label_5.setText(_fromUtf8("Support number face"))
        self.PU_Redress.setText(_fromUtf8("Axial"))
        self.PU_Redress.setToolTip(_fromUtf8("Click for activate the mode Redress"))
        self.DS_Extrude_Support.setToolTip(_fromUtf8("Thickness of the extrude the support." + "\n"
                                                     "If thickness = 0 then not extrude" + "\n"
                                                     "If thickness of support is bigger than character" + "\n"
                                                     "the SpinBox is colored in red" + "\n"
                                                     "if the CheckBox [Extrude Char.] is not checked" + "\n"
                                                     "the SpinBox is colored in orange for warn that the character is at the base of the support"))
        self.DS_Extrude_Support.setSuffix(_fromUtf8(" mm"))
        self.label_6.setText(_fromUtf8("Extrude support"))
        ####
        self.groupBox_055.setTitle(_fromUtf8("Path"))
        self.groupBox_055.setToolTip(_fromUtf8("The string follow the wire selected (Based on X, Y plane)" + "\n"
                                               "The buttons Outdoor, Helix, Indoor, Clock and"
                                               "the button Mode Stand / Flat are ignored" + "\n"
                                               "The direction of the text depend of the direction Left/Right of the wire selected" + "\n"
                                               "in this case use the Reverse Button"))
        self.RB_Path_01.setText(_fromUtf8("Orthogonal"))
        self.RB_Path_01.setToolTip(_fromUtf8("The character is orthogonal"))
        self.RB_Path_02.setText(_fromUtf8("Tangent"))
        self.RB_Path_02.setToolTip(_fromUtf8("The character is tangent on position wire selected"))

        self.RB_Position_01.setText(_fromUtf8("BB Base"))
        self.RB_Position_01.setToolTip(_fromUtf8("The BoundBox of the character is on Base"))
        self.label_Path_01.setText(_fromUtf8("Rotation str"))
        self.RB_Position_02.setText(_fromUtf8("BB Center"))
        self.RB_Position_02.setToolTip(_fromUtf8("The BoundBox of the character is on BB Center"))
        self.label_Path_02.setText(_fromUtf8("Rotation car"))
        self.RB_Position_03.setText(_fromUtf8("BB Top"))
        self.RB_Position_03.setToolTip(_fromUtf8("The BoundBox of the character is on BB Top"))
        self.label_Path_03.setText(_fromUtf8("Translation"))
        ####
        self.groupBox_06.setTitle(_fromUtf8("Command"))
        self.CB_01_Points.setText(_fromUtf8("Points"))
        self.CB_01_Points.setToolTip(_fromUtf8("Create points repere"))
        self.CB_02_Circle.setText(_fromUtf8("Circle"))
        self.CB_02_Circle.setToolTip(_fromUtf8("Create Circle repere"))
        self.CB_03_BBox.setText(_fromUtf8("BoundBox"))
        self.CB_03_BBox.setToolTip(_fromUtf8("Create BoundBox on character"))
        self.CB_04_Progression.setText(_fromUtf8("Progression"))
        self.CB_04_Progression.setToolTip(_fromUtf8("Visualise the character in construction"))
        self.CB_05_Reset.setText(_fromUtf8("Reset"))
        self.CB_05_Reset.setToolTip(_fromUtf8("Reset False by default (reset on all push button execute)" + "\n"
                                              "If you check this option No reset is performed" + "\n"
                                              "and if the result is not good" + "\n"
                                              "ex: the old internal coordinate hare conserved or other..." + "\n"
                                              "push the Reset button or restart FCCircularText"))
        self.PB_Delete_Last.setText(_fromUtf8("Del"))
        self.PB_Delete_Last.setToolTip(_fromUtf8("Delete the last object created"))
        self.PU_Exit.setText(_fromUtf8("Exit"))
        self.PU_Exit.setToolTip(_fromUtf8("Exit FCCircularText"))
        self.PU_Reset.setText(_fromUtf8("Reset"))
        self.PU_Reset.setToolTip(_fromUtf8("Reset all parameters of the macro"))
        self.PU_Execute.setText(_fromUtf8("Run"))
        self.PU_Execute.setToolTip("Execute the process") # without Compount
        self.PU_Benchmarks.setText(_fromUtf8("Run Comp"))
        self.PU_Benchmarks.setToolTip(_fromUtf8("Execute the process and one Compount of the characters is create"))
        ####
        self.DS_Pivot_Char.setSuffix(_fromUtf8(" deg"))
        self.DS_Pivot_Char.setToolTip(_fromUtf8("Pivot the character"))
        self.CH_Pivot_Character.setText(_fromUtf8("Pivot Character"))
        self.CH_Pivot_Character.setToolTip(_fromUtf8("Pivot the Character"))

    #### matplotlib debut 5/5 #################################################################
    def on_fontComboBoxPython(self,indeX):                                          # 0: for fontComboBoxPython
        global PolicePath
        global setFontByDefault

        self.index = indeX
        self.lineEdit_NameFile.setText("(" + str(self.index + 1) + "/" + str(len(self.tableau)) + ") " + self.tableau[self.index][1])
        PolicePath = self.tableau[self.index][1]

        famille = typeCar = self.font = ""
        self.font = QtGui.QFont()
        typeCar   = family(self.tableau[self.index][2])[1]
        self.font.setBold(False)
        self.font.setItalic(False)

        if len(typeCar) > 0:
            for option in typeCar:
                if option == "Bold":
                    self.font.setBold(True)
                if (option == "Italic") or (option == "It") or (option == "Slanted"):
                    self.font.setItalic(True)
                if option == "Oblique":
                    self.font.setItalic(True)
        #'Bold''Regular''Slanted''Italic''Medium''Extra''Light''Condensed''Black''It''Semibold'#+
        
        self.font.setFamily(self.tableau[self.index][5])
        self.font.setPointSize(self.FontTextSize)
        ####
        self.fonteComp   = self.tableau[self.index][1]
        setFontByDefault = self.tableau[self.index][2]
#        FreeCAD.Console.PrintMessage(str(self.index) + " , " + self.tableau[self.index][1] + " , " + self.tableau[self.index][2] + " , ' " + famille + "' , ' " + typeCar + " ' \n")
    #### matplotlib fin 5/5 #################################################################

    def on_lineEdit_NameFile(self):

        self.pathFont = self.lineEdit_NameFile.text() 
        try:
            self.pathFont  = self.pathFont.split(")") [1]
        except Exception:
            self.pathFont  = self.pathFont

        ui.searchFont(self.pathFont)
        QtCore.QObject.connect(self.comboBoxPy, QtCore.SIGNAL("currentIndexChanged(int)"), self.on_fontComboBoxPython)

    def on_textEdit_Changed(self):        #connection textEdit
        global ui

#        self.textEdit.setTextColor(QColor("red"))
#        self.textEdit.setTextColor(QColor("Base"))
        ui.on_CB_Word()

    def on_PB_Reverse(self):              #connection Reverse
        global texte

        texte = self.textEdit.toPlainText()
        texte = texte[::-1]
        self.textEdit.setText(_fromUtf8(texte))

    def on_CB_Word(self):
        global texte

        texte = ""
        texte = self.textEdit.toPlainText()

        try:
            selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]
        except Exception:
            selectedEdge = ""

        if self.CB_Word.isChecked():
            texte = texte.split(" ")
            mot = "word"
        else:
            mot = "characters"

        if (texte.count(" ") == 1) or (texte.count(" ") == 0):
            espace = "space"
        else:
            espace = "spaces"

        if str(selectedEdge) != "":
            self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+ " " + mot + " ) ( " + str(texte.count(" ")) + " " + espace + " ) ( Lenght " + str(round(selectedEdge.Length,3)) + " mm )")
        else:
            self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+ " " + mot + " ) ( " + str(texte.count(" ")) + " " + espace + " )")

    def on_CH_Pivot_Character(self):        #connection checkBox
        global PivotCharachter

        if self.CH_Pivot_Character.isChecked():
            self.DS_Pivot_Char.setEnabled(True)
        else:
            PivotCharachter = 0.0
            self.DS_Pivot_Char.setEnabled(False)
            self.DS_Pivot_Char.setValue(PivotCharachter)
#        App.Console.PrintMessage("PivotCharachter check" + "\n")

    def on_DS_Pivot_Char(self, value):      #connection doubleSpinBox
        global PivotCharachter

        PivotCharachter = value
        App.Console.PrintMessage("PivotCharachter " + str(PivotCharachter)+"\n")

    def on_PU_Reset_Placement(self):           # Reset_Placement
        global PlacementX
        global PlacementY
        global PlacementZ
        global coor_X
        global coor_Y
        global coor_Z

        coor_X = coor_Y = coor_Z = 0.0
        PlacementX = PlacementY = PlacementZ = 0.0
        self.CH_Sp_Placement.setChecked(False)
        self.DS_PlacementX.setValue(PlacementX)
        self.DS_PlacementX.setEnabled(False)
        self.DS_PlacementY.setValue(PlacementY)
        self.DS_PlacementY.setEnabled(False)
        self.DS_PlacementZ.setValue(PlacementZ)
        self.DS_PlacementZ.setEnabled(False)
#        App.Console.PrintMessage(str("on_PU_Reset_Placement ")+"\n")

    def on_PU_Reset_Inclination(self):           # Reset_Inclination
        global inclinaisonX
        global inclinaisonY
        global inclinaisonZ

        inclinaisonX = inclinaisonY = inclinaisonZ = 0.0
        self.CH_Sp_Inclination.setChecked(False)
        self.DS_InclinaisonX.setValue(inclinaisonX)
        self.DS_InclinaisonX.setEnabled(False)
        self.DS_InclinaisonY.setValue(inclinaisonY)
        self.DS_InclinaisonY.setEnabled(False)
        self.DS_InclinaisonZ.setValue(inclinaisonZ)
        self.DS_InclinaisonZ.setEnabled(False)
#        App.Console.PrintMessage(str("on_PU_Reset_Inclination ")+"\n")

    def on_RA_Choice_Outdoor(self):           #
        global ui
        global exterieur
        global epaisseur
        global switchResetFALSE

        self.groupBox_05.setVisible(False)    #clock
        self.groupBox_055.setVisible(True)    #Path

        self.groupBox_04.setVisible(False)
        self.groupBox_05.setVisible(False)
        epaisseur = 0.0
        self.DS_Extrude.setValue(epaisseur)
        self.CH_Extrude.setChecked(False)
        self.DS_Extrude.setEnabled(False)
        exterieur = 1
        self.S_Begin_Angle.setEnabled(True)
        self.S_End_Angle.setEnabled(True)
        self.DS_Correction_Radius.setEnabled(True)
        self.DS_Correction_Angle.setEnabled(True)
        self.PU_Flat.setEnabled(True)
        self.groupBox_04.setEnabled(False)
        self.groupBox_05.setEnabled(False)
        if switchResetFALSE == 1:    # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_RA_Choice_Outdoor ")+" "+str(exterieur)+"\n")

    def on_RA_Choice_Indoor(self):          #
        global ui
        global exterieur
        global epaisseur
        global switchResetFALSE

        self.groupBox_04.setVisible(False)
        self.groupBox_05.setVisible(False)
        epaisseur = 0.0
        self.DS_Extrude.setValue(epaisseur)
        self.CH_Extrude.setChecked(False)
        self.DS_Extrude.setEnabled(False)
        exterieur = 0
        self.S_Begin_Angle.setEnabled(True)
        self.S_End_Angle.setEnabled(True)
        self.DS_Correction_Radius.setEnabled(True)
        self.DS_Correction_Angle.setEnabled(True)
        self.PU_Flat.setEnabled(True)
        self.groupBox_04.setEnabled(False)
        self.groupBox_05.setEnabled(False)
        self.groupBox_055.setVisible(True)    #Path
        if switchResetFALSE == 1:    # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_RA_Choice_Indoor ")+" "+str(exterieur)+"\n")

    def on_RA_Choice_Helix(self):              #
        global ui
        global exterieur
        global cercleClock
        global nombreFaces
        global debout
        global epaisseur
        global switchResetFALSE

        self.groupBox_04.setVisible(True)
        self.groupBox_05.setVisible(False)
        epaisseur = 0.0
        self.DS_Extrude.setValue(epaisseur)
        self.CH_Extrude.setChecked(False)
        self.DS_Extrude.setEnabled(False)
        exterieur = 2
        cercleClock = 0
        nombreFaces = 0
        debout = 1

        self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
        self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))

        self.S_Begin_Angle.setEnabled(True)
        self.S_End_Angle.setEnabled(True)
        self.DS_Correction_Radius.setEnabled(True)
        self.DS_Correction_Angle.setEnabled(True)
        self.PU_Flat.setEnabled(False)##
        self.groupBox_04.setEnabled(True)
        self.groupBox_05.setEnabled(False)
        self.groupBox_055.setVisible(False)    #Path
        if switchResetFALSE == 1:    # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()

    def on_RA_Choice_Clock(self):
        global ui
        global exterieur
        global debout
        global correctionRayon
        global correctionAngle
        global epaisseur
        global PivotCharachter
        global switchResetFALSE

        self.groupBox_04.setVisible(False)
        self.groupBox_05.setVisible(True)
        epaisseur = 0.0
        self.DS_Extrude.setValue(epaisseur)
        self.CH_Extrude.setChecked(False)
        self.DS_Extrude.setEnabled(False)
        exterieur = 3
        debout = 0
        self.PU_Flat.setEnabled(False)
        self.S_Begin_Angle.setEnabled(False)
        self.S_End_Angle.setEnabled(False)
#        correctionRayon = 0
        self.DS_Correction_Radius.setEnabled(False)
        self.DS_Correction_Radius.setValue(0.0)
#        correctionAngle = 10.0
        self.DS_Correction_Angle.setEnabled(False)
        self.DS_Correction_Angle.setValue(0.0)
        PivotCharachter = 0.0
        self.DS_Pivot_Char.setEnabled(False)
        self.DS_Pivot_Char.setValue(PivotCharachter)
        self.CH_Pivot_Character.setChecked(False)
        self.groupBox_04.setEnabled(False)
        self.groupBox_05.setEnabled(True)
        self.groupBox_055.setVisible(False)    #path
        if switchResetFALSE == 1:              # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_RA_Choice_Clock ")+str(exterieur)+"\n")

    def on_PU_Flat(self):         # Flat or Stand
        global debout

        if debout == 1:
            debout = 0
            self.RA_Choice_Outdoor.setText(_fromUtf8("Indoor"))
            self.RA_Choice_Indoor.setText(_fromUtf8("Outdoor"))
            self.PU_Flat.setText(_fromUtf8("Mode Flat"))
            self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Stand"))
            self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(flatIcon))) # icone dans une variable 
        else:
            debout = 1
            self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
            self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
            self.PU_Flat.setText(_fromUtf8("Mode Stand"))
            self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
            self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable 
#        App.Console.PrintMessage(str("on_PU_Flat ")+str(debout)+"\n")

    def on_RA_Choice_Mirror(self):
        App.Console.PrintMessage("on_RA_Choice_Mirror"+"\n")

    def on_DS_Radius_Circle(self,value):
        global rayon
        global cercleClock

        rayon = value  
        cercleClock = rayon
#        App.Console.PrintMessage("on_DS_Radius_Circle Radius"+str(rayon)+"\n")

    def on_DS_Size_Character(self,value):
        global SizeCaractere

        SizeCaractere = value
#        App.Console.PrintMessage("on_DS_Size_Character Size"+str(SizeCaractere)+"\n")

    def on_S_Begin_Angle(self,value):          #
        global debut

        debut = value
#        App.Console.PrintMessage(str("on_S_Begin_Angle ")+str(debut)+"\n")

    def on_S_End_Angle(self,value):            #
        global rotation

        rotation = value
#        App.Console.PrintMessage(str("on_S_End_Angle ")+str(rotation)+"\n")

    def on_DS_PlacementX(self,value):          #
        global PlacementX

        PlacementX = value
#        App.Console.PrintMessage(str("on_DS_PlacementX ")+str(PlacementX)+"\n")

    def on_DS_PlacementY(self,value):          #
        global PlacementY

        PlacementY = value
#        App.Console.PrintMessage(str("on_DS_PlacementY ")+str(PlacementY)+"\n")

    def on_DS_PlacementZ(self,value):          #
        global PlacementZ

        PlacementZ = value
#        App.Console.PrintMessage(str("on_DS_PlacementZ ")+str(PlacementZ)+"\n")

    def on_CH_Sp_Placement(self):              # Placement or not Placement
        global ui

        if self.CH_Sp_Placement.isChecked(): 
            self.DS_PlacementX.setEnabled(True)
            self.DS_PlacementY.setEnabled(True)
            self.DS_PlacementZ.setEnabled(True)
#            App.Console.PrintMessage(str("on_CH_Sp_Placement ")+str("True")+"\n")
        else:
            ui.on_PU_Reset_Placement()
        if self.RA_Choice_Clock.isChecked():
            self.DS_PlacementX.setEnabled(False)
            self.DS_PlacementY.setEnabled(False)
#            App.Console.PrintMessage(str("on_CH_Sp_Placement ")+str("False")+"\n")

    def on_DS_Correction_Angle(self,value):    # 
        global correctionAngle

        correctionAngle = value
#        App.Console.PrintMessage(str("on_DS_Correction_Angle ")+str(correctionAngle)+"\n")

    def on_DS_Correction_Radius(self,value):   # 
        global correctionRayon

        correctionRayon = value
#        App.Console.PrintMessage(str("on_DS_Correction_Radius ")+str(correctionRayon)+"\n")

    def on_DS_Extrude(self,value):             # 
        global epaisseur
        global epaisSupp

        epaisseur = value
        if epaisseur > epaisSupp:
            self.DS_Extrude_Support.setStyleSheet("background-color: QPalette.Base") # origin system
            self.DS_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
            self.CH_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
        else:
            if epaisSupp >= epaisseur:
                self.DS_Extrude.setStyleSheet("background-color: rgb(224, 0, 0)")
                self.DS_Extrude_Support.setStyleSheet("background-color: rgb(224, 0, 0)")
#        App.Console.PrintMessage("on_DS_Extrude "+str(epaisseur)+"\n")

    def on_CH_Extrude(self):                   #
        global epaisseur
        global epaisSupp

        if self.CH_Extrude.isChecked(): 
            self.DS_Extrude.setEnabled(True)
            epaisseur = 1.0
        else:
            self.DS_Extrude.setEnabled(False)
            epaisseur = 0.0
        if (epaisSupp != 0) and (epaisSupp >= epaisseur):
            self.DS_Extrude.setStyleSheet("background-color: rgb(255, 165, 0)")
            self.DS_Extrude_Support.setStyleSheet("background-color: rgb(255, 165, 0)")
            self.CH_Extrude.setStyleSheet("background-color: rgb(255, 165, 0)")
        else:
            self.DS_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
            self.CH_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
        self.DS_Extrude.setValue(epaisseur)
#        App.Console.PrintMessage(str("on_CH_Extrude ")+" "+str(epaisseur)+"\n")

    def on_DS_InclinaisonX(self,value):        # 
        global inclinaisonX

        inclinaisonX = value
#        App.Console.PrintMessage(str("on_DS_InclinaisonX ")+str(inclinaisonX)+"\n")

    def on_DS_InclinaisonY(self,value):        # 
        global inclinaisonY

        inclinaisonY = value
#        App.Console.PrintMessage(str("on_DS_InclinaisonY ")+str(inclinaisonY)+"\n")

    def on_DS_InclinaisonZ(self,value):        # 
        global inclinaisonZ

        inclinaisonZ = value
#        App.Console.PrintMessage(str("on_DS_InclinaisonZ ")+str(inclinaisonZ)+"\n")

    def on_CH_Sp_Inclination(self):            #
        global ui

        if self.CH_Sp_Inclination.isChecked(): 
            self.DS_InclinaisonX.setEnabled(True)
            self.DS_InclinaisonY.setEnabled(True)
            self.DS_InclinaisonZ.setEnabled(True)
        else:
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_CH_Sp_Inclination ")+str(self.CH_Sp_Inclination.isChecked())+"\n")

    def on_DS_Step_Of_The_Helix(self,value):   # 
        global pasHelix
        global baseHelix
        global endHelix

        pasHelix = value
        if pasHelix == 0:
            baseHelix = endHelix = 0.0
            self.DS_Base_Helix.setValue(baseHelix)
            self.DS_Base_Helix.setEnabled(True)
            self.DS_End_Helix.setValue(endHelix)
            self.DS_End_Helix.setEnabled(True)
        else:
            baseHelix = endHelix = 0.0
            self.DS_Base_Helix.setValue(baseHelix)
            self.DS_Base_Helix.setEnabled(False)
            self.DS_End_Helix.setValue(endHelix)
            self.DS_End_Helix.setEnabled(False)
#        App.Console.PrintMessage(str("on_DS_Step_Of_The_Helix ")+str(SizeCaractere)+"\n")

    def on_DS_Number_Char_Per_Turn(self,value):# 
        global nombreCarParTour

        nombreCarParTour = value
#        App.Console.PrintMessage(str("on_DS_Number_Char_Per_Turn ")+str(nombreCarParTour)+"\n")

    def on_DS_Base_Helix(self,value):          # 
        global baseHelix

        baseHelix = value
#        App.Console.PrintMessage(str("on_DS_Base_Helix ")+str(baseHelix)+"\n")

    def on_DS_End_Helix(self,value):           # 
        global endHelix

        endHelix = value
#        App.Console.PrintMessage(str("on_DS_End_Helix ")+str(endHelix)+"\n")

    def on_DS_Radius_Support(self,value):      #  Clock
        global cercleClock

        cercleClock = value
#        App.Console.PrintMessage(str("on_DS_Radius_Support ")+str(cercleClock)+"\n")

    def on_S_Number_Faces_Support(self,value): # number Faces of support 0=none 1=circle 2=rectangle 3=triangle 4,5 ... polygon
        global nombreFaces                     #  Clock

        nombreFaces = value
        self.DS_Extrude_Support.setEnabled(True)
        if nombreFaces == 0:
            self.label_5.setText(_fromUtf8("Support number face"))
            self.DS_Extrude_Support.setEnabled(False)
        elif nombreFaces == 1:
            self.label_5.setText(_fromUtf8("Support Circle"))
        elif nombreFaces == 2:
            self.label_5.setText(_fromUtf8("Support Rectangle"))
        elif nombreFaces == 3:
            self.label_5.setText(_fromUtf8("Support Triangle"))
        elif nombreFaces == 4:
            self.label_5.setText(_fromUtf8("Support Square"))
        else :
            self.label_5.setText(_fromUtf8("Support Polygone"))
#        App.Console.PrintMessage(str("on_S_Number_Faces_Support ")+str(nombreFaces)+"\n")

    def on_DS_Extrude_Support(self,value):     #  Clock
        global epaisSupp
        global epaisseur

        epaisSupp = value
        if epaisSupp >= epaisseur:
            if self.CH_Extrude.isChecked():
                self.DS_Extrude.setStyleSheet("background-color: rgb(224, 0, 0)")
                self.DS_Extrude_Support.setStyleSheet("background-color: rgb(224, 0, 0)")
                self.CH_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
            else:
                self.DS_Extrude.setStyleSheet("background-color: rgb(255, 165, 0)")
                self.DS_Extrude_Support.setStyleSheet("background-color: rgb(255, 165, 0)")
                self.CH_Extrude.setStyleSheet("background-color: rgb(255, 165, 0)")
        else:
            self.DS_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
            self.DS_Extrude_Support.setStyleSheet("background-color: QPalette.Base") # origin system
            self.CH_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
        if epaisSupp == 0:
            self.DS_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
            self.DS_Extrude_Support.setStyleSheet("background-color: QPalette.Base") # origin system
            self.CH_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system

        self.DS_PlacementZ.setEnabled(True)
#        App.Console.PrintMessage(str("on_DS_Extrude_Support ")+str(epaisSupp)+"\n")

    def on_PU_Roman(self):                     # Roman or Arabic Clock
        global romain

        if romain == 1:
            romain = 0
            self.PU_Roman.setText(_fromUtf8("Mode Arabic"))
            self.PU_Roman.setToolTip(_fromUtf8("Click for activate the mode Roman"))
            self.PU_Roman.setIcon(QtGui.QIcon(QtGui.QPixmap(arabicIcon))) # icone dans une variable 
        else:
            romain = 1
            self.PU_Roman.setText(_fromUtf8("Mode Roman"))
            self.PU_Roman.setToolTip(_fromUtf8("Click for activate the mode Arabic"))
            self.PU_Roman.setIcon(QtGui.QIcon(QtGui.QPixmap(romanIcon))) # icone dans une variable 
#        App.Console.PrintMessage(str("romain ")+str(romain)+"\n")

    def on_PU_Redress(self):                   # Redress or circumferencial Clock
        global redressement

        if redressement == 1:
            redressement = 0
            self.PU_Redress.setText(_fromUtf8("Axial"))
            self.PU_Redress.setIcon(QtGui.QIcon(QtGui.QPixmap(axialIcon))) # icone dans une variable 
            self.PU_Redress.setToolTip(_fromUtf8("Click for activate the mode Redress"))
        else:
            redressement = 1
            self.PU_Redress.setText(_fromUtf8("Redress"))
            self.PU_Redress.setIcon(QtGui.QIcon(QtGui.QPixmap(redressIcon))) # icone dans une variable 
            self.PU_Redress.setToolTip(_fromUtf8("Click for activate the mode Axial"))
#        App.Console.PrintMessage(str("redressement ")+str(redressement)+"\n")

    def on_CB_05_Reset(self):                  #
        global switchResetFALSE

        if self.CB_05_Reset.isChecked():
            switchResetFALSE = 1
            self.CB_05_Reset.setText(_fromUtf8("Reset"))
            self.CB_05_Reset.setToolTip(_fromUtf8("Reset False by default (reset on all push button execute)" + "\n"
                                                  "If you check this option No reset is performed" + "\n"
                                                  "and if the result is not good" + "\n"
                                                  "ex: the old internal coordinate hare conserved or other..."
                                                  "push the Reset button or restart FCCircularText" + "\n"
                                                  " ACTUAL TRUE NOT RESET"))
        else:
            switchResetFALSE = 0
            self.CB_05_Reset.setText(_fromUtf8("Not Reset"))
            self.CB_05_Reset.setToolTip(_fromUtf8("Reset False by default (reset on all push button execute)" + "\n"
                                                  "If you check this option No reset is performed" + "\n"
                                                  "and if the result is not good" + "\n"
                                                  "ex: the old internal coordinate hare conserved or other..."
                                                  "push the Reset button or restart FCCircularText" + "\n"
                                                  " ACTUAL FALSE RESET ALL PUSH EXECUTE BUTTON"))
#        App.Console.PrintMessage("on_CB_05_Reset"+"\n")

    def on_PB_Delete_Last(self):                  # delete the last object created
        global FcString
        global FcStringPoints
        global circleGuide
        global suppExtrude
        global createCompound

        try:
            App.ActiveDocument.getObject(FcStringPoints.Name).removeObjectsFromDocument()
            App.ActiveDocument.removeObject(FcStringPoints.Name)
        except Exception: None
        try:
            App.ActiveDocument.getObject(FcString.Name).removeObjectsFromDocument()
            App.ActiveDocument.removeObject(FcString.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(circleGuide.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(suppExtrude.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(createCompound.Name)
        except Exception: None
        App.ActiveDocument.recompute()
#        App.Console.PrintMessage("on_PB_Delete_Last"+"\n")

    def on_PU_Reset(self):                     #
        global ui
        global points
        global coor_X
        global coor_Y
        global coor_Z
        global vec

        global PolicePath

        global rayon
        global texte
        global debut
        global rotation
        global SizeCaractere

        global precision
        global correctionAngle
        global correctionRayon
        global debout
        global exterieur
        global baseHelix
        global endHelix
        global pasHelix
        global nombreCarParTour
        global PivotCharachter

        global PlacementX
        global PlacementY
        global PlacementZ

        global inclinaisonX
        global inclinaisonY
        global inclinaisonZ

        global cercleClock
        global nombreFaces
        global romain
        global redressement

        global comP
        global nameL
        global epaisseur
        global epaisSupp
        global compount1

        texte = ""
        self.CB_Word.setChecked(False)

        exterieur = 1
        self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
        self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
        self.RA_Choice_Outdoor.setChecked(True)

        debout = 1
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
        self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
        self.PU_Flat.setEnabled(True)
        self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable 

        SizeCaractere = 2.0
        self.DS_Size_Character.setValue(SizeCaractere)
        rayon = 10.0
        self.DS_Radius_Circle.setValue(rayon)

        debut = 0
        self.S_Begin_Angle.setValue(debut)
        self.S_Begin_Angle.setEnabled(True)
        rotation = 360
        self.S_End_Angle.setValue(rotation)
        self.S_End_Angle.setEnabled(True)

        correctionAngle = 10.0
        self.DS_Correction_Angle.setValue(correctionAngle)
        self.DS_Correction_Radius.setEnabled(True)
        correctionRayon = 0.15
        self.DS_Correction_Radius.setValue(correctionRayon)
        self.DS_Correction_Angle.setEnabled(True)

        PivotCharachter = 0.0
        self.DS_Pivot_Char.setEnabled(False)
        self.DS_Pivot_Char.setValue(PivotCharachter)
        self.CH_Pivot_Character.setChecked(False)

        epaisseur = 0.0
        self.DS_Extrude.setValue(epaisseur)
        self.DS_Extrude.setEnabled(False)
        self.DS_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system
        self.CH_Extrude.setChecked(False)
        self.CH_Extrude.setStyleSheet("background-color: QPalette.Base") # origin system

        ui.on_PU_Reset_Placement()
        ui.on_PU_Reset_Inclination()

        self.groupBox_04.setEnabled(False)
        baseHelix = 0.0
        self.DS_Base_Helix.setValue(baseHelix)
        self.DS_Base_Helix.setEnabled(False)
        endHelix = 0.0
        self.DS_End_Helix.setValue(endHelix)
        self.DS_Base_Helix.setEnabled(False)
        pasHelix = 2.0
        self.DS_Step_Of_The_Helix.setValue(pasHelix)
        nombreCarParTour = 10
        self.DS_Number_Char_Per_Turn.setValue(nombreCarParTour)

        self.groupBox_05.setEnabled(False)
        cercleClock = rayon
        self.DS_Radius_Support.setValue(cercleClock)
        nombreFaces = 0
        self.S_Number_Faces_Support.setValue(nombreFaces)
        self.label_5.setText(_fromUtf8("Support number face"))
        epaisSupp   = 0.0
        self.DS_Extrude_Support.setEnabled(False)
        self.DS_Extrude_Support.setValue(epaisSupp)
        self.DS_Extrude_Support.setStyleSheet("background-color: QPalette.Base") # origin system

        romain = 0
        self.PU_Roman.setText(_fromUtf8("Mode Arabic"))
        self.PU_Roman.setIcon(QtGui.QIcon(QtGui.QPixmap(arabicIcon))) # icone dans une variable 
        self.PU_Roman.setToolTip(_fromUtf8("Click for activate the mode Roman"))

        redressement = 0
        self.PU_Redress.setText(_fromUtf8("Axial"))
        self.PU_Redress.setIcon(QtGui.QIcon(QtGui.QPixmap(axialIcon))) # icone dans une variable 
        self.PU_Redress.setToolTip(_fromUtf8("Click for activate the mode Redress"))

        compount1 = 0
        ui.on_CB_Word() # texte = self.textEdit.toPlainText()
#        App.Console.PrintMessage(str("on_PU_Reset ")+str()+"\n")

    def on_PU_Benchmarks(self):                # Benchmarks
      try:
        global compount1
        global ui

        compount1 = 1
        ui.on_PU_Execute()
      except:
        sayexc("Error")
#        App.Console.PrintMessage(str("Benchmarks")+"\n")

    def on_PU_Execute(self):         # Execute
        global ui
        global PolicePath
        global switchResetFALSE

        global points
        global coor_X
        global coor_Y
        global coor_Z
        
        global PlacementX
        global PlacementY
        global PlacementZ

        global inclinaisonX
        global inclinaisonY
        global inclinaisonZ

        global vec
        global rayon
        global texte
        global debut
        global rotation
        global SizeCaractere
        global PivotCharachter

        global ii
        global precision
        global correctionAngle
        global correctionRayon
        global debout
        global exterieur
        global baseHelix
        global endHelix
        global pasHelix
        global nombreCarParTour

        global cercleClock
        global nombreFaces
        global romain
        global redressement

        global comP
        global nameL

        global epaisseur
        global epaisSupp
        global compount1

        #### for delette
        global FcString
        global FcStringPoints
        global circleGuide
        global suppExtrude
        global createCompound
        #### for delette

        points   = []
        comP     = []
        nameL    = []

        del   points[:]
        del     comP[:]
        del    nameL[:]

        doc = FreeCAD.ActiveDocument
        if doc == None:
            doc = FreeCAD.newDocument("FCCircularText")

#### Path

        # create text on wire, arc, circle edge... 
        #
        try:
            ssel = FreeCADGui.Selection.getSelectionEx()
            selectedEdge = lineSelected = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]  # select one element
        except Exception:
            selectedEdge = None
            ssel = ""
            Gui.Selection.clearSelection()
            None
        passNoOk = 0
        if (hasattr(selectedEdge,'Surface')) or (hasattr(selectedEdge,'Point')):
            passNoOk = 1

        if (len(ssel) != 0) and (passNoOk == 0):    # Path

            textLabel = texte[0:10]
            if self.CB_Word.isChecked():
                textLabel = textLabel[0]
            else:
                textLabel = textLabel[0:10]

            FreeCAD.ActiveDocument.openTransaction("FCCTp")
            FcString = doc.addObject("App::DocumentObjectGroup","FcStringP_" + textLabel)
            if self.CB_01_Points.isChecked():
                FcStringPoints = doc.addObject("App::DocumentObjectGroup","FcStringPoints_" + textLabel)

            try:
                numberOfPoints = len(texte)                                                        # Decomposition number (or precision you can change)
                points = selectedEdge.discretize(numberOfPoints)                                   # discretize the element
                pasTab = 0

                for position in range(len(texte)):                                                             # list and display the coordinates

                    ss=Draft.makeShapeString(String=texte[position],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)

                    XLongueur = ss.Shape.BoundBox.XLength                                          # Length x boundBox rectangle
                    YLongueur = ss.Shape.BoundBox.YLength                                          # Length y boundBox rectangle
                    ZLongueur = ss.Shape.BoundBox.ZLength                                          # Length z boundBox rectangle
                    XXLongueur = 0.0
                    YYLongueur = 0.0
                    ZZLongueur = 0.0

                    if self.RB_Position_01.isChecked():
                        None
                    elif self.RB_Position_02.isChecked():
                        XXLongueur = -XLongueur/2.0; YYLongueur = -YLongueur/2.0; #ZZLongueur = -ZLongueur/2.0
                    elif self.RB_Position_03.isChecked():
                        XXLongueur = 0; YYLongueur = -YLongueur; #ZZLongueur = -ZLongueur

                    pl = FreeCAD.Placement()                                                # placement object

                    if self.RB_Path_01.isChecked():
#                        pl.Base=FreeCAD.Vector(points[position][0] - (XXLongueur), points[position][1] - (YYLongueur), points[position][2])
                        pl.Base=FreeCAD.Vector(points[position][0] + (XXLongueur), points[position][1] + (YYLongueur), points[position][2])
                        pl.Rotation = App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ)
                        pl = pl.multiply(App.Placement(App.Vector(PlacementX, PlacementY, PlacementZ), App.Rotation(0, 0, 0), App.Vector(0,0,0)))
                    else:
                        ##Extract macro_Perpendicular_To_Wire
                        if pasTab == 0:
                            pointsDirection = []
                            pointsDirection = lineSelected.discretize(Number = ((len(texte)-1) * 10))   # discretize the path line first selection
                            pasTab = 1
                        try:
                            v=pointsDirection[position*10].sub(pointsDirection[(position*10) + 1])      # avec vecteurs 1 et 2 (direction debut ligne)
                        except Exception:
                            v=pointsDirection[-2].sub(pointsDirection[-1])                              # avec vecteurs 1 et 2 (direction debut ligne)

                        r=App.Rotation(App.Vector(-1,0,0),v)
                        pl.Rotation.Q = r.Q
                        pl = pl.multiply(App.Placement(App.Vector(0,0,0), App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ), App.Vector(0,0,0)))

                        try:
                            pl.Base = pointsDirection[position*10]
                        except Exception:
                            pl.Base = pointsDirection[-1]
                        pl = pl.multiply(App.Placement(App.Vector(XXLongueur + PlacementX, YYLongueur + PlacementY, ZZLongueur + PlacementZ), App.Rotation(correctionAngle, 0, 0), App.Vector(0,0,0)))

                    ####
                    if self.CB_03_BBox.isChecked():
                        ss.ViewObject.BoundingBox = True
                    ####
                    ss.Label = texte[position]
                    Draft.autogroup(ss)
#                    ss.Label = texte[position]
                    FcString.addObject(ss)  # contener character
#                    FcString = doc.addObject("App::DocumentObjectGroup","FcString")

                    ####
                    if epaisseur > 0:         # extrusion characrters
                        CharExtrude = Draft.extrude(ss,Base.Vector(0,0,epaisseur))
                        CharExtrude.Placement=pl 
                        CharExtrude.Label = texte[position]
                        App.ActiveDocument.getObject(CharExtrude.Name).recompute()
                        try:
                            CharExtrude.ViewObject.DisplayMode = u"Flat Lines"
                        except Exception:
                            None
                        ####
                        if self.CB_03_BBox.isChecked():
                            CharExtrude.ViewObject.BoundingBox = True
                        ####
                        comP.append(CharExtrude.Shape)
#                            nameL.append(CharExtrude.Name)
                        FcString.addObject(CharExtrude)  # contener extrude
                    else:
                        ss.Placement = pl
                        ss.Support=None
                        try:
                            ss.ViewObject.DisplayMode = u"Flat Lines"
                        except Exception:
                            None
                        comP.append(ss.Shape)
#                            nameL.append(ss.Name)
                    ####
                    if self.CB_01_Points.isChecked():
                        pointRepere = Draft.makePoint(pl.Base)
                        pointRepere.ViewObject.PointColor = (1.0,0.,0.0)
                        pointRepere.Label = texte[position]
                        App.ActiveDocument.getObject(pointRepere.Name).recompute()
                        FcStringPoints.addObject(pointRepere)
                    ####
                    if self.CB_04_Progression.isChecked():
                        FreeCADGui.updateGui()                                 # rafraichi l'ecran
                    ####
            except Exception:
                App.Console.PrintError(str("Discretize Error or selection error")+"\n")
            FreeCAD.ActiveDocument.commitTransaction()
#### Path fin
#
#### Circular begin
        else:
            FreeCAD.ActiveDocument.openTransaction("FCCTc")
            if ((exterieur == 0) and (debout == 0)):    # normal circular
                vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)]      # 
            else:
                if exterieur == 3:
                    vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon - (SizeCaractere/2),0.0,0.0)]      # 
                elif debout == 0:
                    vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon - SizeCaractere,0.0,0.0)]      # 
                else:
                    vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)]      # 

            ligne = Draft.makeWire(vecligne,closed=False,face=False,support=None)     # creation de la ligne de base
            lineName = ligne.Name

            ii  = -1
            ii2 = -1

            #nombre = len(texte) - 1    # moins - 1 pour aller de 0 degres a 0 degres dans la boucle pour compatible avec Path
            nombre = len(texte)        # si pas - 1 ex: pour 36 lettres va de 0 degres a 350 degres

            coor_Z = PlacementZ
            boucler = 1

            texteLabel = texte[0:10]
            if (exterieur == 0) or (debout == 0):
                texte = texte[::-1]
                if (exterieur == 0) and (debout == 0):
                    texte = texte[::-1]

            if exterieur == 2:        # helix
                if nombreCarParTour == 0:
                    nombreCarParTour = 1
                    App.Console.PrintError("Insufficient number"+"\n")
                pas = 0.0
                nombre = nombreCarParTour
                if pasHelix != 0:
                    pas = pasHelix / (nombreCarParTour)
                else:
                    pas = ((((endHelix - SizeCaractere)-baseHelix)/(len(texte) / nombreCarParTour))/(nombreCarParTour)) # pas of helix
                    coor_Z += baseHelix
                boucler = int(len(texte) / nombreCarParTour)
                if (len(texte) % nombreCarParTour) != 0: # calcul number spires Helix
                    boucler += 1
            else:
                nombreCarParTour = 1

            if exterieur == 3:         # Clock
                FcString = doc.addObject("App::DocumentObjectGroup","FcClock")
                if self.CB_01_Points.isChecked():
                    FcStringPoints = doc.addObject("App::DocumentObjectGroup","FcStringPoints_Clock")
                nombre = 12
                if romain == 0:
                    texte = ["1","2","3","4","5","6","7","8","9","10","11","12"]
                else:
                    texte = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"]
                texte = texte[::-1]
            else:
                textLabel = texte[0:10]
                if self.CB_Word.isChecked():
                    textLabel = texteLabel[0]
                else:
                    textLabel = texteLabel[0:10]
                FcString = doc.addObject("App::DocumentObjectGroup","FcString_" + textLabel)
                if self.CB_01_Points.isChecked():
                    FcStringPoints = doc.addObject("App::DocumentObjectGroup","FcStringPoints_" + textLabel)

#            if exterieur == 2:        # helix
#                boucler = int(len(texte) / nombreCarParTour)
#                if (len(texte) % nombreCarParTour) != 0: # calcul number spires Helix
#                    boucler += 1

            ####Boucle principale############################################################################
            for hel in range(boucler):
                ii = -1
                ####Boucle de travail#################################################
                #for angleTr in range(debut,rotation,((rotation-debut)/nombre)): # old
                for angleTrFloat in range((debut*10000),(rotation*10000),int((round(((float(rotation)-float(debut))/float(nombre)),4)*10000)) ): # 10000 pour 4 decimales
                    angleTr = (float(angleTrFloat)/10000.0)
                    ii  += 1
                    ii2 += 1
                    ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))
                    print(ii+1," ",angleTr)
                    a = ligne.End # fin de ligne
                    coor_X = (a[0])
                    coor_Y = (a[1])

                    if (ii < nombre) and (ii2 < len(texte)):
                        if exterieur == 3:                  # clock
                            ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr+90), App.Vector(0,0,0))

                            try:
                                a = ligne.Shape.Edges[0].Vertexes[1]                       # fin de ligne
                            except Exception:
                                a = ligne.End                                              # 0.19 fin de ligne

                            try:
                                coor_X = (a.Point.x)
                                coor_Y = (a.Point.y)
                            except Exception:
                                coor_X = (a.x)                                             # 0.19 fin de ligne
                                coor_Y = (a.y)

                        ss = Draft.makeShapeString(String=texte[ii2],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)

                        ss.Label = texte[ii2]
                        FcString.addObject(ss)  # contener character

                        centreX = (ss.Shape.BoundBox.Center[0])
                        centreY = (ss.Shape.BoundBox.Center[1])
                        centreZ = (ss.Shape.BoundBox.Center[2])
                        lengthX = (ss.Shape.BoundBox.XLength)
                        lengthY = (ss.Shape.BoundBox.YLength)
                        lengthZ = (ss.Shape.BoundBox.ZLength)

                        plm=""
                        plm=FreeCAD.Placement()
                        plm.Base=FreeCAD.Vector(coor_X,coor_Y,coor_Z)

                        if debout == 1:           # debout
                            if exterieur == 0:    # circumferential internal
                                plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr-90-correctionAngle+inclinaisonX,inclinaisonY+PivotCharachter,90+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
                            elif exterieur == 1:  # circumferential external
                                plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,inclinaisonY+PivotCharachter,90+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
                            elif exterieur == 2:  # circumferential helix
                                plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,inclinaisonY+PivotCharachter,90+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
                                coor_Z = coor_Z + pas
                        else:                     # a plat
                            if exterieur == 1:    # exterieur (superieur)
                                plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr-90-correctionAngle+inclinaisonX+PivotCharachter,inclinaisonY,inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
                            elif exterieur == 3:  # circumferential plat (clock)
                                if redressement == 1:
                                    plm = App.Placement(App.Vector(coor_X-centreX,coor_Y-centreY,coor_Z), App.Rotation(inclinaisonX+PivotCharachter,inclinaisonY,inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
                                else:
                                    plm = App.Placement(App.Vector(coor_X-centreX,coor_Y-centreY,coor_Z), App.Rotation(angleTr+inclinaisonX+PivotCharachter,inclinaisonY,inclinaisonZ), App.Vector(centreX,centreY,centreZ)) # pitch,roll...1
                            else:                 # interieur  (inferieur)
                                plm = App.Placement(App.Vector(-coor_X,-coor_Y,-coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX+PivotCharachter,180+inclinaisonY,180+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1   

                        if epaisseur > 0:         # extrusion characrters
                            CharExtrude = Draft.extrude(ss,Base.Vector(0,0,epaisseur))
                            CharExtrude.Label = texte[ii2]
                            CharExtrude.Placement=plm 
                            try:
                                CharExtrude.ViewObject.DisplayMode = u"Flat Lines"
                            except Exception:
                                None
                            if self.CB_03_BBox.isChecked():
                                CharExtrude.ViewObject.BoundingBox = True
                            App.ActiveDocument.getObject(CharExtrude.Name).recompute()
                            comP.append(CharExtrude.Shape)
#                            nameL.append(CharExtrude.Name)
                            FcString.addObject(CharExtrude)  # contener extrude
                        else:                 # 
                            ss.Placement=plm 
                            ss.Support=None
                            try:
                                ss.ViewObject.DisplayMode = u"Flat Lines"
                            except Exception:
                                None
                            if self.CB_03_BBox.isChecked():
                                ss.ViewObject.BoundingBox = True
                            comP.append(ss.Shape)
#                            nameL.append(ss.Name)
#                            points += [FreeCAD.Vector(coor_X,coor_Y,coor_Z)]  # coordinates makeBSpline
                        ####
                        if self.CB_01_Points.isChecked():
                            pointRepere = Draft.makePoint(plm.Base)
                            pointRepere.ViewObject.PointColor = (1.0,0.,0.0)
                            pointRepere.Label = texte[ii2]
                            App.ActiveDocument.getObject(pointRepere.Name).recompute()
                            FcStringPoints.addObject(pointRepere)
                        ####
                        if self.CB_04_Progression.isChecked():
                            FreeCADGui.updateGui()                                 # rafraichi l'ecran
                        ####
            FreeCAD.ActiveDocument.commitTransaction()

            #BSpline = Draft.makeBSpline(points,closed=False)                  # makeBSpline repere
            App.ActiveDocument.removeObject(lineName)     # remove ligne de base directrice

        FreeCAD.ActiveDocument.openTransaction("FCCTc")
        if (self.CB_02_Circle.isChecked()) and (passNoOk == 0): # create Circle
            pll = FreeCAD.Placement()
            pll = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),0), App.Vector(0,0,0))
            circleGuide = Draft.makeCircle(radius=rayon, placement=pll, face=False, support=None)
            circleGuide.Label = "circleRepere_" + textLabel
            circleGuide.ViewObject.LineColor = (1.0,0.,0.0)
            Draft.autogroup(circleGuide)

        if compount1 == 1:                            # create compount
            comp = Part.makeCompound(comP)
            Part.show(comp)
            createCompound = App.ActiveDocument.ActiveObject
            createCompound.Label = "Comp_" + textLabel
        ####Boucle de travail fin########################################################################

        ####Extrude support clock#############################################
        if nombreFaces > 0:                           # support clock
            pl = FreeCAD.Placement()
            if nombreFaces == 1:                      # circle
                pl.Base = FreeCAD.Vector(0.0,0.0,0.0)
                supp = Draft.makeCircle(cercleClock,placement=pl,face=True,support=None)
            if nombreFaces == 2:                      # rectangle
                cercleClock = cercleClock * 2
                pl.Base = FreeCAD.Vector(-cercleClock, (-cercleClock / 2), 0.0)
                supp = Draft.makeRectangle((cercleClock * 2), cercleClock, placement=pl, face = True)
            if nombreFaces > 2:                       # polygone with number faces
                if nombreFaces == 4:
                    rotateSupport = 45
                else:
                    rotateSupport = 90
                pl = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(rotateSupport,0,0), App.Vector(0,0,0))
                supp = Draft.makePolygon(nombreFaces,cercleClock,inscribed = False,placement = pl,face = True,support=None)

            supp.MakeFace = True
            App.activeDocument().recompute()
            FcString.addObject(supp)                  # contener support

            if epaisSupp != 0:                        # extrude support clock
                suppExtrude = Draft.extrude(supp,Base.Vector(0,0,epaisSupp))
                App.ActiveDocument.getObject(suppExtrude.Name).recompute()
                try:
                    suppExtrude.ViewObject.DisplayMode = u"Flat Lines"
                    if self.CB_03_BBox.isChecked():
                        suppExtrude.ViewObject.BoundingBox = True
                except Exception:
                    None

                FcString.addObject(suppExtrude)       # contener support extrude

        App.activeDocument().recompute()
        FreeCAD.ActiveDocument.commitTransaction()
#### Circular end

        ####Info################################################
        App.Console.PrintMessage("______________" +"\n")
        App.Console.PrintMessage( PolicePath + "\n")
        App.Console.PrintMessage("Texte         : " + str(texte) + "\n")
        App.Console.PrintMessage("Rayon         : " + str(rayon) + "\n")
        App.Console.PrintMessage("SizeCaractere : " + str(SizeCaractere) + "\n")
        App.Console.PrintMessage("Rotation      : " + str(debut) + "/" + str(rotation) + "\n")
        App.Console.PrintMessage("Debout        : " + str(debout) + "\n")
        App.Console.PrintMessage("Placement     : " + str(PlacementX) + ", " + str(PlacementY) + ", " + str(PlacementZ) + "\n")
        App.Console.PrintMessage("Rotation      : " + str(inclinaisonX) + ", " + str(inclinaisonY) + ", " + str(inclinaisonZ) + "\n")
        App.Console.PrintMessage("_______________" +"\n")

        ####Reset################################################
        if switchResetFALSE == 0:    # zero (False) by default = reset
            ui.on_PU_Reset()

    def on_PB_Help_clicked(self):
        WebGui.openBrowser("https://wiki.freecadweb.org/Macro_FCCircularText")
        App.Console.PrintMessage("https://wiki.freecadweb.org/Macro_FCCircularText" + "\n")
#        print("Help ")

    def on_PU_Exit(self):                      # Exit
        global ui
        global s
        global switchResetFALSE
        global setFontByDefault
        global switchModeTextList
        global switchFontComBox
        global setSystemFonts
        global seTtextAlignement
        global switchVersionSearch

        FreeCADGui.Selection.removeObserver(s)                              # desinstalle la fonction residente
        ###### Write Configuration begin ####
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchResetFALSE", switchResetFALSE)     # True or False (by default)
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetString("setFontByDefault", setFontByDefault)   # "Arial"
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchModeTextList", switchModeTextList) # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchFontComBox", switchFontComBox)     # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setSystemFonts", setSystemFonts)         # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetInt("seTtextAlignement", seTtextAlignement)    # 0, 1, 2

        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPathOrthogonal", ui.RB_Path_01.isChecked())    # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPathTangent", ui.RB_Path_02.isChecked())       # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionBase", ui.RB_Position_01.isChecked())  # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionCenter", ui.RB_Position_02.isChecked())# True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionTop", ui.RB_Position_03.isChecked())   # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchVersionSearch", switchVersionSearch)        # True or False
        ###### Write Configuration end   ####

        App.Console.PrintMessage("Fin FCCircularText"+"\n")
        self.window.hide()
####
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetString("Version",__Version__ + " (" + __Date__ + ")")# 

###### Read Configuration begin ####
seTtextAlignement  = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetInt("seTtextAlignement")
setSystemFonts     = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setSystemFonts")
switchFontComBox   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchFontComBox")
switchModeTextList = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchModeTextList")
setFontByDefault   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetString("setFontByDefault")
switchResetFALSE   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchResetFALSE") 
#switchResetFALSE: desactive cree des erreurs de fonctionnement attention a l utilisation !!

setPathOrthogonal = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPathOrthogonal")
setPathTangent    = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPathTangent")
setPositionBase   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPositionBase")
setPositionCenter = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPositionCenter")
setPositionTop    = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPositionTop")

if setFontByDefault == "":
    if platform.system()   == "Windows" :
        PolicePath = "C:/Windows/Fonts/"
        setFontByDefault = "ARIAL"
    elif platform.system() == "Linux" :
        PolicePath = "/usr/share/fonts/"
        setFontByDefault = "UBUNTU-M"
    elif platform.system() == "Darwin":
        PolicePath = "/Library/Fonts/"
        setFontByDefault = "Arial"
if platform.system() == "Linux" :
      PolicePath = "/usr/share/fonts/"

###### Read Configuration end   ####
##################################################################################################
class SelObserver:
    def addSelection(self, document, object, element, position):  # Selection
        global ui
        global PlacementX
        global PlacementY
        global PlacementZ
        global correctionAngle

        try:
            selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]  # select one subElement
            if (hasattr(selectedEdge,'Surface')) or (hasattr(selectedEdge,'Point')):
                if (hasattr(selectedEdge,'Point')):
                    PlacementX = position[0]
                    PlacementY = position[1]
                    PlacementZ = position[2]
                    ui.CH_Sp_Placement.setChecked(True)
                    ui.DS_PlacementX.setValue(PlacementX)
                    ui.DS_PlacementY.setValue(PlacementY)
                    ui.DS_PlacementZ.setValue(PlacementZ)
                    ui.on_CH_Sp_Placement()
            else:
                ui.groupBox_03.setEnabled(False)
                ui.groupBox_03.setStyleSheet("background-color: #F8E0E0;")
                ui.DS_Radius_Circle.setEnabled(False)
                ui.DS_Radius_Circle.setStyleSheet("background-color: #F8E0E0;")
                ui.S_Begin_Angle.setEnabled(False)
                ui.S_Begin_Angle.setStyleSheet("background-color: #F8E0E0;")
                ui.S_End_Angle.setEnabled(False)
                ui.S_End_Angle.setStyleSheet("background-color: #F8E0E0;")
                ui.DS_Correction_Radius.setEnabled(False)
                ui.DS_Correction_Radius.setStyleSheet("background-color: #F8E0E0;")
                ui.CB_02_Circle.setChecked(False)
                ui.CB_02_Circle.setEnabled(False)
                ui.CB_02_Circle.setStyleSheet("background-color: #F8E0E0;")
                ui.groupBox_055.setEnabled(True)
                ui.groupBox_055.setStyleSheet("background-color: #E0F8E0;") # #D0F5A9
                ui.groupBox_055.setTitle(_fromUtf8("Path ( " + str(round(selectedEdge.Length, 2)) + " mm )"))
                correctionAngle = 0.0
                ui.DS_Correction_Angle.setValue(correctionAngle)
        except Exception:
            selectedEdge = None
            None

##    def setPreselection(self,doc,obj,sub):             # preselection
##        print "setPreselection"
##    def removeSelection(self,doc,obj,sub):             # Effacer l'objet selectionne
##        print "removeSelection"
##    def setSelection(self,doc):                        # Selection dans ComboView
##        print "SelObserver quit macro"
    def clearSelection(self,doc):                       # Si clic sur l'ecran, effacer la selection
        #ui.on_PU_Reset_Placement()
        ui.groupBox_03.setEnabled(True)
        ui.groupBox_03.setStyleSheet("Base")
        ui.DS_Radius_Circle.setEnabled(True)
        ui.DS_Radius_Circle.setStyleSheet("Base")
        ui.S_Begin_Angle.setEnabled(True)
        ui.S_Begin_Angle.setStyleSheet("Base")
        ui.S_End_Angle.setEnabled(True)
        ui.S_End_Angle.setStyleSheet("Base")
        ui.DS_Correction_Radius.setEnabled(True)
        ui.DS_Correction_Radius.setStyleSheet("Base")
        ui.CB_02_Circle.setEnabled(True)
        ui.CB_02_Circle.setStyleSheet("Base")
        ui.groupBox_055.setTitle(_fromUtf8("Path"))
        ui.groupBox_055.setStyleSheet("Base")
        ui.groupBox_055.setEnabled(False)

s=SelObserver()
FreeCADGui.Selection.addObserver(s)                    # installe la fonction en mode resident
###################################################################################################

# create new document
doc = FreeCAD.ActiveDocument
if doc == None:
    doc = FreeCAD.newDocument("FCCircularText")

# deselectionner tous les objets
try:
    for obj in FreeCAD.ActiveDocument.Objects:         # deselectionne tout
        FreeCADGui.Selection.removeSelection(obj)
except Exception:
    None

MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()

or download the script :

- on github Macro_FCCircularText.FCMacro ver 0.18 2021/01/19

- at the forum Extrude from curved surface of cylinder

Example













Example onto Ellipse






Mode relief:





Example section path



Limitations

Note it is possible that an error may occur between versions. Please post the issue on the forum and wait for the updated fix or rollback to a previous version of the macro. Thank you)

It is possible that two characters may overlap. If this happens, here's a workaround is available using the Rotate-To-Point Macro.


(not fully developed)

Planned:

Writing on a path circular text of position object selected.

Change log

  • ver 1.19 2021/03/15 : adding button Delette the last object created and the code FreeCAD.ActiveDocument.openTransaction("FCCTc") for Undo/Redo system
    • Adding CheckBox Reset for switched/activated (requested by users) the natural reset after all push button Runand Run comp. This use checkBox is not advised, is you constade one malfunction pusch the Reset button or quit FCCircularText and restart.
  • ver 0.17b 2020/09/28 : correction little bug (pl instead plm in path section) and arrange the window (dimension) Clock, Helix, Path
  • ver 0.17 2020/09/26 : adding create circular text on wire (curve, arc, spline, line ...) selected, mode word

ver 16d 2020/09/15 : see the MasterCATZ commented Sep 14, 2020 message

delette the FC 0.18 test section:

#### Test FreeCAD.Version simple ############################################################################################################
if int(FreeCAD.Version()[1]) < 18:      # Version de FreeCAD
    FreeCAD.Console.PrintMessage("This version " + __Title__ + " rmu  work with the FreeCAD 0.18 or higher." + "\n\n")
    FreeCAD.Console.PrintMessage("For the precedent version see the page " + "\n\n")
    FreeCAD.Console.PrintMessage("https://gist.githubusercontent.com/mario52a/a25e802498bae6959335/raw/db47f78f2b20a35137ac213b8d1a62d30f525dcb/Macro_FCCircularText.FCMacro" + "\n\n")
#### Test FreeCAD.Version simple ############################################################################################################
  • ver 0.16 2020/06/07 : little bug in Linux with the path, impost PolicePath = "/usr/share/fonts/" (stay on path /xx/xx/xx/xx/xx/xx/ on entry)
  • ver 0.15 2020/06/01 : For PySide2 Qt5 adding matplotlib fonts in comboView, config on parameter
  • ver 0.14-4 2020/04/25 : corrected for "DisplayMode = u"Flat Lines" :
  • ver 0.14-3 2020/04/25 : adapted for :
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20655 (Git)
Build type: Release
Branch: master
Hash: e8e67e8c5ebbc9f9ed9ea67aba5b891969595ece
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
       carDegrees = b' \xc2\xb0'.decode("utf-8")    #thanks wmayer	https://forum.freecadweb.org/viewtopic.php?f=13&t=36380&p=308476#p308357
       self.DS_InclinaisonX.setSuffix(carDegrees)
       self.DS_InclinaisonY.setSuffix(carDegrees)
       self.DS_InclinaisonZ.setSuffix(carDegrees)
  • ver 0.14-1 2019/06/11 replace "°" to chr(176)
  • ver 0.14 2019/04/27 compatible for Python 3.6.6 and Qt 5.6.2 (cause: unicode() )
latest testing:

#OS: Windows 10
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.19.16523 (Git)
#Build type: Release
#Branch: master
#Hash: 9b3ec233c8b21e0df66fada487cd10f471d60cac
#Python version: 3.6.6
#Qt version: 5.6.2
#Coin version: 4.0.0a
#OCC version: 7.3.0
  • ver 0.13 30/01/2018 add feature Pivot for rotate the character on himself
  • ver 0.13 09/08/2016 replace the button "New font" to "fontComboBox" cause , with Windows 10 the window Font stay empty the files are hidden
  • ver 0.12 03/07/2016 optimize the code for accept the decimal number in determination angle

replace the line

for angleTr in range(debut,rotation,((rotation-debut)/nombre)):

to

for angleTrFloat in range((debut*10000),(rotation*10000),int((round(((float(rotation)-float(debut))/float(nombre)),4)*10000)) ):    # pour 4 decimales
                angleTr = (float(angleTrFloat)/10000)
  • ver 0.10 17/05/2015 adding lines 1365, 1366 only created more clock face ?? ()
supp.MakeFace = True
            App.activeDocument().recompute()
  • ver 0.9 11/05/2015 thank you NormandC for testing

replace

self.DS_InclinaisonX.setSuffix(" X°")
        self.DS_InclinaisonY.setSuffix(" Y°")
        self.DS_InclinaisonZ.setSuffix(" Z°")

to

self.DS_InclinaisonX.setSuffix(unicode(" X°"))
        self.DS_InclinaisonY.setSuffix(unicode(" Y°"))
        self.DS_InclinaisonZ.setSuffix(unicode(" Z°"))
  • ver 0.8 10/05/2015 replace "String=texte[ii2]" to "String=unicode(texte[ii2])" line 1290. cause "TypeError: Property 'FontFile': type must be str or unicode, not QString"
# ver 0.8 10/05/2015 /_ # testing with OS :
##################################################################################################
# OS: Ubuntu 14.04.1 LTS                          # OS: Ubuntu 14.04.2 LTS
# Platform: 32-bit                                # Word size of OS: 32-bit
# Version: 0.14.2935 (Git)                        # Word size of FreeCAD: 32-bit
# Branch: master                                  # Version: 0.16.4928 (Git)
# Hash: eab159b6ee675012bf79de838c206a311e911d85  # Branch: master
# Python version: 2.7.6                           # Hash: d8f63bcfd10301f3d1e141cced4370f0782238d0
# Qt version: 4.8.6                               # Python version: 2.7.6
# Coin version: 4.0.0a                            # Qt version: 4.8.6
# SoQt version: 1.6.0a                            # Coin version: 4.0.0a
# OCC version: 6.7.0                              # OCC version: 6.8.0.oce-0.17
##################################################################################################
# OS: Windows Vista                               # OS: Windows Vista
# Word size of OS: 32-bit                         # Word size of OS: 32-bit
# Word size of FreeCAD: 32-bit                    # Word size of FreeCAD: 32-bit
# Version: 0.15.4527 (Git)                        # Version: 0.15.4671 (Git)
# Branch: master                                  # Branch: releases/FreeCAD-0-15
# Hash: 0da2e4c45a9a259c26abd54c2a35393e1c15696f  # Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
# Python version: 2.7.8                           # Python version: 2.7.8
# Qt version: 4.8.6                               # Qt version: 4.8.6
# Coin version: 4.0.0a                            # Coin version: 4.0.0a
# OCC version: 6.7.1                              # OCC version: 6.8.0.oce-0.17
##################################################################################################
  • ver 0.7 02/02/2015 suppression 2 str App.Console.PrintMessage(str(PolicePath)+"\n") to App.Console.PrintMessage((PolicePath)+"\n") that caused an error with the characters above 128 in the police path.
  • ver 0.6 23/11/2014 corrected "texte = unicode(self.textEdit.toPlainText())" now accept "'éèà@..."
  • ver 0.5 19/11/2014 Gui
  • ver 0.4 10/10/2014 add variable "rotation" in the loop (for i in range(0,rotation,(rotation/nombre)): # 360 a parametrer)
  • ver 0.4 27/08/2014 correction error of de radius (exterieur=0, debout=1)
  • ver 0.3 26/08/2014 add creation text of flat curve
  • ver 0.2 26/08/2014 add creation text of internal curve
  • ver 0.1

(2537)

Links

To comment on the Extrude from curved surface of cylinder