FreeCAD-macros

Форк
0
/
Macro_FCCircularText.FCMacro 
1465 строк · 66.4 Кб
1
# -*- coding: utf-8 -*-
2
from __future__ import unicode_literals
3
"""
4
***************************************************************************
5
*   Copyright (c) 2014 2015 <mario52>                                     *
6
*                                                                         *
7
*   This file is a supplement to the FreeCAD CAx development system.      *
8
*                                                                         *
9
*   This program is free software; you can redistribute it and/or modify  *
10
*   it under the terms of the GNU Lesser General Public License (LGPL)    *
11
*   as published by the Free Software Foundation; either version 2 of     *
12
*   the License, or (at your option) any later version.                   *
13
*   for detail see the LICENCE text file.                                 *
14
*                                                                         *
15
*   This software is distributed in the hope that it will be useful,      *
16
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18
*   GNU Library General Public License for more details.                  *
19
*                                                                         *
20
*   You should have received a copy of the GNU Library General Public     *
21
*   License along with this macro; if not, write to the Free Software     *
22
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
23
*   USA                                                                   *
24
***************************************************************************
25
*   http://www.freecadweb.org/wiki/Macro_FCCircularText                   *
26
*           WARNING! All changes in this file will be lost and            *
27
*                  may cause malfunction of the program                   *
28
***************************************************************************
29
"""
30
# FCCircularText.FCMacro
31
# ver 0.10 #
32
##################################################################################################
33
# OS: Ubuntu 14.04.1 LTS                          # OS: Ubuntu 14.04.2 LTS
34
# Platform: 32-bit                                # Word size of OS: 32-bit
35
# Version: 0.14.2935 (Git)                        # Word size of FreeCAD: 32-bit
36
# Branch: master                                  # Version: 0.16.4928 (Git)
37
# Hash: eab159b6ee675012bf79de838c206a311e911d85  # Branch: master
38
# Python version: 2.7.6                           # Hash: d8f63bcfd10301f3d1e141cced4370f0782238d0
39
# Qt version: 4.8.6                               # Python version: 2.7.6
40
# Coin version: 4.0.0a                            # Qt version: 4.8.6
41
# SoQt version: 1.6.0a                            # Coin version: 4.0.0a
42
# OCC version: 6.7.0                              # OCC version: 6.8.0.oce-0.17
43
##################################################################################################
44
# OS: Windows Vista                               # OS: Windows Vista
45
# Word size of OS: 32-bit                         # Word size of OS: 32-bit
46
# Word size of FreeCAD: 32-bit                    # Word size of FreeCAD: 32-bit
47
# Version: 0.15.4527 (Git)                        # Version: 0.15.4671 (Git)
48
# Branch: master                                  # Branch: releases/FreeCAD-0-15
49
# Hash: 0da2e4c45a9a259c26abd54c2a35393e1c15696f  # Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
50
# Python version: 2.7.8                           # Python version: 2.7.8
51
# Qt version: 4.8.6                               # Qt version: 4.8.6
52
# Coin version: 4.0.0a                            # Coin version: 4.0.0a
53
# OCC version: 6.7.1                              # OCC version: 6.8.0.oce-0.17
54
##################################################################################################
55

56
__Title__="FCCircularText"
57
__Author__ = "Mario52"
58
__Version__ = "00.11"
59
__Date__    = "12/06/2015"
60
__License__ = "LGPL-2.0-or-later"
61

62
__Comment__ = "This macro creates a text around a cylinder"
63
__Web__ = "http://forum.freecadweb.org/viewtopic.php?f=3&t=7384"
64
__Wiki__ = "http://www.freecadweb.org/wiki/Macro_FCCircularText"
65
__Icon__  = "/usr/lib/freecad/Mod/plugins/icons/FCCircularTextButtom.png"
66
__IconW__  = "C:/Documents and Settings/YourUserName/Application Data/FreeCAD"
67
__Help__ = "start the macro and follow the instructions"
68
__Status__ = "stable"
69
__Requires__ = "freecad 0.14.3706"
70
__Communication__ = "http://www.freecadweb.org/wiki/User:Mario52"
71

72

73
try:
74
    import PyQt4
75
    from PyQt4 import QtGui ,QtCore
76
    from PyQt4.QtGui import *
77
    from PyQt4.QtCore import *
78
except Exception:
79
    import PySide
80
    from PySide import QtGui ,QtCore
81
    from PySide.QtGui import *
82
    from PySide.QtCore import *
83

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

89
App=FreeCAD
90
Gui=FreeCADGui
91

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

101
import platform
102

103
class ConfigManager():
104

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

108
	def get(self,param,default,defaultWindows=None,defaultMac=None):
109
			os=platform.system()
110
			#os='Linux'
111
			#os='Windows'
112
			#os='Darwin'
113
			v=False
114
			if not defaultWindows:
115
				defaultWindows=default
116
			if not defaultMac:
117
				defaultMac=default
118
			if os =='Windows' :
119
				default= defaultWindows
120
			if os =='Darwin' :
121
				default= defaultMac
122
			if default.__class__ == unicode:
123
				default=str(default)
124
			if default.__class__ == int:
125
				v=FreeCAD.ParamGet('User parameter:'+self.name).GetInt(param)
126
				if not v:
127
					FreeCAD.ParamGet('User parameter:'+self.name).SetInt(param,default)
128
			if default.__class__ == float:
129
				v=FreeCAD.ParamGet('User parameter:'+self.name).GetFloat(param)
130
				if not v:
131
					FreeCAD.ParamGet('User parameter:'+self.name).SetFloat(param,default)
132
			if default.__class__ == str:
133
				v=FreeCAD.ParamGet('User parameter:'+self.name).GetString(param)
134
				if not v:
135
					FreeCAD.ParamGet('User parameter:'+self.name).SetString(param,default)
136
			if default.__class__ == bool:
137
				v=FreeCAD.ParamGet('User parameter:'+self.name).GetBool(param)
138
				if not v:
139
					FreeCAD.ParamGet('User parameter:'+self.name).SetBool(param,default)
140
			if not v:
141
				v=default
142
			return v
143

144
global points           ;points   = 0.0
145
global coor_X           ;coor_X   = 0.0
146
global coor_Y           ;coor_Y   = 0.0
147
global coor_Z           ;coor_Z   = 0.0
148
global vec              ;vec      = 0
149

150
global PolicePath
151

152
cm=ConfigManager("circular text")
153
PolicePath=cm.get("PolicePath","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-M.ttf","C:/Windows/Fonts/ARIAL.TTF",".../macfontdir/macfont.ttf")
154

155
global rayon            ;rayon           = 10.0               # radius
156
global texte            ;texte           = "FreeCAD the best" # FreeCad The Best your text
157
global debut            ;debut           = 0                  # begin text
158
global rotation         ;rotation        = 360                # must exceed the number of characters of text
159
global SizeCaractere    ;SizeCaractere   = 2.0                # size font
160

161
global precision        ;precision       = 0.0
162
global correctionAngle  ;correctionAngle = 10.0
163
global correctionRayon  ;correctionRayon = 0.15
164
global debout           ;debout          = 1                  # 1=stand   0=flat
165
global exterieur        ;exterieur       = 1                  # 1=external 0=internal
166
global baseHelix        ;baseHelix       = 0.0                # base of helix
167
global endHelix         ;endHelix        = 0.0                # end of helix (height)
168
global pasHelix         ;pasHelix        = 2.0                # Pas of helix
169
global nombreCarParTour ;nombreCarParTour= 10                 # number char by Pas
170

171
global PlacementX       ;PlacementX      = 0.0                # Placement character axis X
172
global PlacementY       ;PlacementY      = 0.0                # Placement character axis Y
173
global PlacementZ       ;PlacementZ      = 0.0                # Placement character axis Z
174

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

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

184
global comP             ;comP            = ""                 # container
185
global nameL            ;nameL           = ""                 # container
186
global epaisseur        ;epaisseur       = 0.0                # epaisseur extrusion character
187
global epaisSupp        ;epaisSupp       = 0.0                # epaisseur extrusion support
188
global extrusion        ;extrusion       = 0.0                # epaisseur extrusion
189

190
global compount1        ;compount1       = 0                  # cree un compose des carachteres
191

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

197
try:
198
    _fromUtf8 = QtCore.QString.fromUtf8
199
except AttributeError:
200
    def _fromUtf8(s):
201
        return s
202

203
try:
204
    _encoding = QtGui.QApplication.UnicodeUTF8
205
    def _translate(context, text, disambig):
206
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
207
except AttributeError:
208
    def _translate(context, text, disambig):
209
        return QtGui.QApplication.translate(context, text, disambig)
210

211
class Ui_MainWindow(object):
212

213
    def setupUi(self, MainWindow):
214
        self.window = MainWindow
215

216
        path = FreeCAD.ConfigGet("AppHomePath")
217
        #path = FreeCAD.ConfigGet("UserAppData")
218

219
        global PolicePath
220
        global rayon
221
        global texte
222
        global rotation
223
        global SizeCaractere
224
        global debout
225
        global exterieur
226

227
        global precision
228
        global correctionAngle
229
        global correctionRayon
230
        global baseHelix
231
        global endHelix
232
        global nombreCarParTour
233

234
        global epaisseur
235
        global epaisSupp
236

237
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
238
        MainWindow.resize(370, 638)
239
        MainWindow.setMaximumSize(QtCore.QSize(370, 638))
240
        MainWindow.setMinimumSize(QtCore.QSize(370, 638))
241
        self.centralWidget = QtGui.QWidget(MainWindow)
242
        self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
243
        self.groupBox_02 = QtGui.QGroupBox(self.centralWidget)
244
        self.groupBox_02.setGeometry(QtCore.QRect(10, 100, 351, 301))
245
        self.groupBox_02.setAccessibleDescription(_fromUtf8(""))
246
        self.groupBox_02.setObjectName(_fromUtf8("groupBox_02"))
247

248
        self.DS_Size_Character = QtGui.QDoubleSpinBox(self.groupBox_02)
249
        self.DS_Size_Character.setGeometry(QtCore.QRect(140, 60, 81, 22))
250
        self.DS_Size_Character.setAccessibleDescription(_fromUtf8(""))
251
        self.DS_Size_Character.setMinimum(0.0)
252
        self.DS_Size_Character.setMaximum(99999999.0)
253
        self.DS_Size_Character.setSingleStep(1.0)
254
        self.DS_Size_Character.setValue(SizeCaractere)
255
        self.DS_Size_Character.setObjectName(_fromUtf8("DS_Size_Character"))
256
        self.DS_Size_Character.setToolTip(_fromUtf8("Size of the font"))
257
        self.DS_Size_Character.valueChanged.connect(self.on_DS_Size_Character) #connection doubleSpinBox
258

259
        self.label_4 = QtGui.QLabel(self.groupBox_02)
260
        self.label_4.setGeometry(QtCore.QRect(230, 60, 91, 16))
261
        self.label_4.setAccessibleDescription(_fromUtf8(""))
262
        self.label_4.setText(_fromUtf8("Size character"))
263
        self.label_4.setObjectName(_fromUtf8("label_4"))
264

265
        self.DS_Extrude = QtGui.QDoubleSpinBox(self.groupBox_02)
266
        self.DS_Extrude.setEnabled(False)
267
        self.DS_Extrude.setGeometry(QtCore.QRect(140, 210, 81, 22))
268
        self.DS_Extrude.setToolTip(_fromUtf8("Thickness of the extrude of character. If thickness = 0 then don't extrude"))
269
        self.DS_Extrude.setAccessibleDescription(_fromUtf8(""))
270
        self.DS_Extrude.setMinimum(-99999999.0)
271
        self.DS_Extrude.setMaximum(99999999.0)
272
        self.DS_Extrude.setValue(epaisseur)
273
        self.DS_Extrude.setObjectName(_fromUtf8("DS_Extrude"))
274
        self.DS_Extrude.valueChanged.connect(self.on_DS_Extrude) #connection doubleSpinBox
275

276
        self.label_7 = QtGui.QLabel(self.groupBox_02)
277
        self.label_7.setGeometry(QtCore.QRect(230, 150, 101, 20))
278
        self.label_7.setAccessibleDescription(_fromUtf8(""))
279
        self.label_7.setText(_fromUtf8("Correction Angle"))
280
        self.label_7.setObjectName(_fromUtf8("label_7"))
281

282
        self.DS_Correction_Angle = QtGui.QDoubleSpinBox(self.groupBox_02)
283
        self.DS_Correction_Angle.setGeometry(QtCore.QRect(140, 150, 81, 22))
284
        self.DS_Correction_Angle.setToolTip(_fromUtf8("Correct angle for tangent the text of the circle or give a tilt angle "))
285
        self.DS_Correction_Angle.setAccessibleDescription(_fromUtf8(""))
286
        self.DS_Correction_Angle.setMinimum(-359.00)
287
        self.DS_Correction_Angle.setMaximum(359.00)
288
        self.DS_Correction_Angle.setValue(correctionAngle)
289
        self.DS_Correction_Angle.setObjectName(_fromUtf8("DS_Correction_Angle"))
290
        self.DS_Correction_Angle.valueChanged.connect(self.on_DS_Correction_Angle) #connection doubleSpinBox
291

292
        self.label_8 = QtGui.QLabel(self.groupBox_02)
293
        self.label_8.setGeometry(QtCore.QRect(230, 180, 111, 16))
294
        self.label_8.setAccessibleDescription(_fromUtf8(""))
295
        self.label_8.setText(_fromUtf8("Correction Radius"))
296
        self.label_8.setObjectName(_fromUtf8("label_8"))
297

298
        self.DS_Correction_Radius = QtGui.QDoubleSpinBox(self.groupBox_02)
299
        self.DS_Correction_Radius.setGeometry(QtCore.QRect(140, 180, 81, 22))
300
        self.DS_Correction_Radius.setToolTip(_fromUtf8("Correct of the radius (depend of correction angle)"))
301
        self.DS_Correction_Radius.setAccessibleDescription(_fromUtf8(""))
302
        self.DS_Correction_Radius.setMinimum(-99999999.0)
303
        self.DS_Correction_Radius.setMaximum(99999999.0)
304
        self.DS_Correction_Radius.setValue(correctionRayon)
305
        self.DS_Correction_Radius.setObjectName(_fromUtf8("DS_Correction_Radius"))
306
        self.DS_Correction_Radius.valueChanged.connect(self.on_DS_Correction_Radius) #connection doubleSpinBox
307

308
        self.DS_Radius_Circle = QtGui.QDoubleSpinBox(self.groupBox_02)
309
        self.DS_Radius_Circle.setGeometry(QtCore.QRect(140, 30, 81, 22))
310
        self.DS_Radius_Circle.setToolTip(_fromUtf8("Give the radius of circle"))
311
        self.DS_Radius_Circle.setAccessibleDescription(_fromUtf8(""))
312
        self.DS_Radius_Circle.setMinimum(-99999999.0)
313
        self.DS_Radius_Circle.setMaximum(99999999.0)
314
        self.DS_Radius_Circle.setValue(rayon)
315
        self.DS_Radius_Circle.setObjectName(_fromUtf8("DS_Radius_Circle"))
316
        self.DS_Radius_Circle.valueChanged.connect(self.on_DS_Radius_Circle) #connection doubleSpinBox
317

318
        self.label_10 = QtGui.QLabel(self.groupBox_02)
319
        self.label_10.setGeometry(QtCore.QRect(230, 30, 101, 16))
320
        self.label_10.setAccessibleDescription(_fromUtf8(""))
321
        self.label_10.setObjectName(_fromUtf8("label_10"))
322

323
        self.groupBox_03 = QtGui.QGroupBox(self.groupBox_02)
324
        self.groupBox_03.setGeometry(QtCore.QRect(10, 20, 101, 211))
325
        self.groupBox_03.setAccessibleDescription(_fromUtf8(""))
326
        self.groupBox_03.setObjectName(_fromUtf8("groupBox_03"))
327

328
        self.RA_Choice_Outdoor = QtGui.QRadioButton(self.groupBox_03)
329
        self.RA_Choice_Outdoor.setGeometry(QtCore.QRect(10, 20, 71, 20))
330
        self.RA_Choice_Outdoor.setAccessibleDescription(_fromUtf8(""))
331
        self.RA_Choice_Outdoor.setChecked(True)
332
        self.RA_Choice_Outdoor.setObjectName(_fromUtf8("RA_Choice_Outdoor"))
333
        self.RA_Choice_Outdoor.clicked.connect(self.on_RA_Choice_Outdoor) #connection radioButton
334

335
        self.RA_Choice_Indoor = QtGui.QRadioButton(self.groupBox_03)
336
        self.RA_Choice_Indoor.setGeometry(QtCore.QRect(10, 40, 71, 20))
337
        self.RA_Choice_Indoor.setAccessibleDescription(_fromUtf8(""))
338
        self.RA_Choice_Indoor.setObjectName(_fromUtf8("RA_Choice_Indoor"))
339
        self.RA_Choice_Indoor.clicked.connect(self.on_RA_Choice_Indoor) #connection radioButton
340

341
        self.RA_Choice_Helix = QtGui.QRadioButton(self.groupBox_03)
342
        self.RA_Choice_Helix.setGeometry(QtCore.QRect(10, 60, 61, 20))
343
        self.RA_Choice_Helix.setAccessibleDescription(_fromUtf8(""))
344
        self.RA_Choice_Helix.setObjectName(_fromUtf8("RA_Choice_Helix"))
345
        self.RA_Choice_Helix.clicked.connect(self.on_RA_Choice_Helix) #connection radioButton
346

347
        self.RA_Choice_Clock = QtGui.QRadioButton(self.groupBox_03)
348
        self.RA_Choice_Clock.setGeometry(QtCore.QRect(10, 80, 61, 20))
349
        self.RA_Choice_Clock.setAccessibleDescription(_fromUtf8(""))
350
        self.RA_Choice_Clock.setObjectName(_fromUtf8("RA_Choice_Clock"))
351
        self.RA_Choice_Clock.clicked.connect(self.on_RA_Choice_Clock) #connection radioButton
352

353
        self.PU_Flat = QtGui.QPushButton(self.groupBox_03)
354
        self.PU_Flat.setEnabled(True)
355
        self.PU_Flat.setGeometry(QtCore.QRect(10, 105, 81, 28))
356
        self.PU_Flat.setAccessibleDescription(_fromUtf8(""))
357
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
358
        self.PU_Flat.setToolTip(_fromUtf8("Click to create the text Flat"))
359
        self.PU_Flat.setObjectName(_fromUtf8("PU_Flat"))
360
        self.PU_Flat.clicked.connect(self.on_PU_Flat)
361

362
        self.graphicsView = QtGui.QGraphicsView(self.groupBox_03)
363
        self.graphicsView.setGeometry(QtCore.QRect(10, 140, 81, 61))
364
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
365

366
        self.label_13 = QtGui.QLabel(self.groupBox_02)
367
        self.label_13.setGeometry(QtCore.QRect(230, 90, 71, 16))
368
        self.label_13.setAccessibleDescription(_fromUtf8(""))
369
        self.label_13.setObjectName(_fromUtf8("label_13"))
370

371
        self.label_14 = QtGui.QLabel(self.groupBox_02)
372
        self.label_14.setGeometry(QtCore.QRect(230, 120, 71, 16))
373
        self.label_14.setAccessibleDescription(_fromUtf8(""))
374
        self.label_14.setObjectName(_fromUtf8("label_14"))
375

376
        self.CH_Extrude = QtGui.QCheckBox(self.groupBox_02)
377
        self.CH_Extrude.setGeometry(QtCore.QRect(230, 210, 105, 20))
378
        self.CH_Extrude.setToolTip(_fromUtf8("Choice extrude character or not"))
379
        self.CH_Extrude.setAccessibleDescription(_fromUtf8(""))
380
        self.CH_Extrude.setObjectName(_fromUtf8("CH_Extrude"))
381
        self.CH_Extrude.clicked.connect(self.on_CH_Extrude) #connection checkBox
382

383
        self.DS_InclinaisonX = QtGui.QSpinBox(self.groupBox_02)
384
        self.DS_InclinaisonX.setEnabled(False)
385
        self.DS_InclinaisonX.setGeometry(QtCore.QRect(10, 270, 61, 22))
386
        self.DS_InclinaisonX.setToolTip(_fromUtf8("Inclination character in axis X"))
387
        self.DS_InclinaisonX.setMinimum(-360)
388
        self.DS_InclinaisonX.setMaximum(360)
389
        self.DS_InclinaisonX.setValue(inclinaisonX)
390
        self.DS_InclinaisonX.setObjectName(_fromUtf8("DS_InclinaisonX"))
391
        self.DS_InclinaisonX.valueChanged.connect(self.on_DS_InclinaisonX) #connection doubleSpinBox
392

393
        self.DS_InclinaisonY = QtGui.QSpinBox(self.groupBox_02)
394
        self.DS_InclinaisonY.setEnabled(False)
395
        self.DS_InclinaisonY.setGeometry(QtCore.QRect(85, 270, 61, 22))
396
        self.DS_InclinaisonY.setToolTip(_fromUtf8("Inclination character axis Y"))
397
        self.DS_InclinaisonY.setMinimum(-360)
398
        self.DS_InclinaisonY.setMaximum(360)
399
        self.DS_InclinaisonY.setValue(inclinaisonY)
400
        self.DS_InclinaisonY.setObjectName(_fromUtf8("DS_InclinaisonY"))
401
        self.DS_InclinaisonY.valueChanged.connect(self.on_DS_InclinaisonY) #connection doubleSpinBox
402

403
        self.DS_InclinaisonZ = QtGui.QSpinBox(self.groupBox_02)
404
        self.DS_InclinaisonZ.setEnabled(False)
405
        self.DS_InclinaisonZ.setGeometry(QtCore.QRect(160, 270, 61, 22))
406
        self.DS_InclinaisonZ.setToolTip(_fromUtf8("Inclination character axis Z"))
407
        self.DS_InclinaisonZ.setMinimum(-360)
408
        self.DS_InclinaisonZ.setMaximum(360)
409
        self.DS_InclinaisonZ.setValue(inclinaisonZ)
410
        self.DS_InclinaisonZ.setObjectName(_fromUtf8("DS_InclinaisonZ"))
411
        self.DS_InclinaisonZ.valueChanged.connect(self.on_DS_InclinaisonZ) #connection doubleSpinBox
412

413
        self.CH_Sp_Inclination = QtGui.QCheckBox(self.groupBox_02)
414
        self.CH_Sp_Inclination.setGeometry(QtCore.QRect(230, 270, 111, 20))
415
        self.CH_Sp_Inclination.setToolTip(_fromUtf8("Inclination of character in the choice or all plane "))
416
        self.CH_Sp_Inclination.setText(_fromUtf8("Sp. inclination"))
417
        self.CH_Sp_Inclination.setObjectName(_fromUtf8("CH_Sp_Inclination"))
418
        self.CH_Sp_Inclination.clicked.connect(self.on_CH_Sp_Inclination) #connection checkBox
419

420
        self.S_Begin_Angle = QtGui.QSpinBox(self.groupBox_02)
421
        self.S_Begin_Angle.setGeometry(QtCore.QRect(140, 90, 81, 22))
422
        self.S_Begin_Angle.setMaximum(360)
423
        self.S_Begin_Angle.setObjectName(_fromUtf8("spinBox"))
424
        self.S_Begin_Angle.setToolTip(_fromUtf8("Starting text of the circle "))
425
        self.S_Begin_Angle.setValue(debut)
426
        self.S_Begin_Angle.valueChanged.connect(self.on_S_Begin_Angle) #connection SpinBox
427

428
        self.S_End_Angle = QtGui.QSpinBox(self.groupBox_02)
429
        self.S_End_Angle.setGeometry(QtCore.QRect(140, 120, 81, 22))
430
        self.S_End_Angle.setMaximum(360)
431
        self.S_End_Angle.setValue(rotation)
432
        self.S_End_Angle.setToolTip(_fromUtf8("End text of the circle "))
433
        self.S_End_Angle.setObjectName(_fromUtf8("S_End_Angle"))
434
        self.S_End_Angle.valueChanged.connect(self.on_S_End_Angle) #connection SpinBox
435

436
        self.DS_PlacementX = QtGui.QDoubleSpinBox(self.groupBox_02)
437
        self.DS_PlacementX.setEnabled(False)
438
        self.DS_PlacementX.setGeometry(QtCore.QRect(10, 240, 62, 22))
439
        self.DS_PlacementX.setToolTip(_fromUtf8("Placement direction X"))
440
        self.DS_PlacementX.setSpecialValueText(_fromUtf8(""))
441
        self.DS_PlacementX.setMinimum(-9999999.0)
442
        self.DS_PlacementX.setMaximum(9999999.99)
443
        self.DS_PlacementX.setObjectName(_fromUtf8("DS_PlacementX"))
444
        self.DS_PlacementX.valueChanged.connect(self.on_DS_PlacementX) #connection doubleSpinBox
445

446
        self.DS_PlacementY = QtGui.QDoubleSpinBox(self.groupBox_02)
447
        self.DS_PlacementY.setEnabled(False)
448
        self.DS_PlacementY.setGeometry(QtCore.QRect(85, 240, 62, 22))
449
        self.DS_PlacementY.setToolTip(_fromUtf8("Placement direction Y"))
450
        self.DS_PlacementY.setSpecialValueText(_fromUtf8(""))
451
        self.DS_PlacementY.setMinimum(-9999999.0)
452
        self.DS_PlacementY.setMaximum(9999999.99)
453
        self.DS_PlacementY.setObjectName(_fromUtf8("DS_PlacementY"))
454
        self.DS_PlacementY.valueChanged.connect(self.on_DS_PlacementY) #connection doubleSpinBox
455

456
        self.DS_PlacementZ = QtGui.QDoubleSpinBox(self.groupBox_02)
457
        self.DS_PlacementZ.setEnabled(False)
458
        self.DS_PlacementZ.setGeometry(QtCore.QRect(160, 240, 62, 22))
459
        self.DS_PlacementZ.setToolTip(_fromUtf8("Placement direction Z"))
460
        self.DS_PlacementZ.setSpecialValueText(_fromUtf8(""))
461
        self.DS_PlacementZ.setMinimum(-9999999.0)
462
        self.DS_PlacementZ.setMaximum(9999999.99)
463
        self.DS_PlacementZ.setObjectName(_fromUtf8("DS_PlacementZ"))
464
        self.DS_PlacementZ.valueChanged.connect(self.on_DS_PlacementZ) #connection doubleSpinBox
465

466
        self.CH_Sp_Placement = QtGui.QCheckBox(self.groupBox_02)
467
        self.CH_Sp_Placement.setGeometry(QtCore.QRect(230, 240, 111, 20))
468
        self.CH_Sp_Placement.setToolTip(_fromUtf8("Placement of character in the choice"))
469
        self.CH_Sp_Placement.setObjectName(_fromUtf8("CH_Sp_Placement"))
470
        self.CH_Sp_Placement.clicked.connect(self.on_CH_Sp_Placement) #connection checkBox
471

472
        self.groupBox_05 = QtGui.QGroupBox(self.centralWidget)
473
        self.groupBox_05.setEnabled(False)
474
        self.groupBox_05.setGeometry(QtCore.QRect(10, 480, 351, 111))
475
        self.groupBox_05.setAccessibleDescription(_fromUtf8(""))
476
        self.groupBox_05.setObjectName(_fromUtf8("groupBox_05"))
477

478
        self.PU_Roman = QtGui.QPushButton(self.groupBox_05)
479
        self.PU_Roman.setGeometry(QtCore.QRect(250, 20, 93, 28))
480
        self.PU_Roman.setAccessibleDescription(_fromUtf8(""))
481
        self.PU_Roman.setText(_fromUtf8("Mode Arabic"))
482
        self.PU_Roman.setObjectName(_fromUtf8("PU_Roman"))
483
        self.PU_Roman.clicked.connect(self.on_PU_Roman)
484

485
        self.PU_Redress = QtGui.QPushButton(self.groupBox_05)
486
        self.PU_Redress.setGeometry(QtCore.QRect(250, 50, 93, 28))
487
        self.PU_Redress.setAccessibleDescription(_fromUtf8(""))
488
        self.PU_Redress.setText(_fromUtf8("Redress"))
489
        self.PU_Redress.setObjectName(_fromUtf8("PU_Redress"))
490
        self.PU_Redress.clicked.connect(self.on_PU_Redress)
491

492
        self.S_Number_Faces_Support = QtGui.QSpinBox(self.groupBox_05)
493
        self.S_Number_Faces_Support.setGeometry(QtCore.QRect(10, 50, 81, 22))
494
        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)"))
495
        self.S_Number_Faces_Support.setAccessibleDescription(_fromUtf8(""))
496
        self.S_Number_Faces_Support.setMaximum(999)
497
        self.S_Number_Faces_Support.setValue(nombreFaces)
498
        self.S_Number_Faces_Support.setObjectName(_fromUtf8("S_Number_Faces_Support"))
499
        self.S_Number_Faces_Support.valueChanged.connect(self.on_S_Number_Faces_Support) #connection SpinBox
500

501
        self.label_5 = QtGui.QLabel(self.groupBox_05)
502
        self.label_5.setGeometry(QtCore.QRect(100, 50, 131, 16))
503
        self.label_5.setAccessibleDescription(_fromUtf8(""))
504
        self.label_5.setText(_fromUtf8("Support number face"))
505
        self.label_5.setObjectName(_fromUtf8("label_5"))
506

507
        self.DS_Radius_Support = QtGui.QDoubleSpinBox(self.groupBox_05)
508
        self.DS_Radius_Support.setGeometry(QtCore.QRect(10, 20, 81, 22))
509
        self.DS_Radius_Support.setToolTip(_fromUtf8("Radius of the support the clock (By default : Radius of circle)"))
510
        self.DS_Radius_Support.setAccessibleDescription(_fromUtf8(""))
511
        self.DS_Radius_Support.setMaximum(99999999.99)
512
        self.DS_Radius_Support.setValue(cercleClock)
513
        self.DS_Radius_Support.setObjectName(_fromUtf8("DS_Radius_Support"))
514
        self.DS_Radius_Support.valueChanged.connect(self.on_DS_Radius_Support) #connection doubleSpinBox
515

516
        self.label_11 = QtGui.QLabel(self.groupBox_05)
517
        self.label_11.setGeometry(QtCore.QRect(100, 20, 121, 16))
518
        self.label_11.setAccessibleDescription(_fromUtf8(""))
519
        self.label_11.setObjectName(_fromUtf8("label_11"))
520

521
        self.doubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox_05)
522
        self.doubleSpinBox.setGeometry(QtCore.QRect(10, 80, 81, 22))
523
        self.doubleSpinBox.setObjectName(_fromUtf8("doubleSpinBox"))
524

525
        self.DS_Extrude_Support = QtGui.QDoubleSpinBox(self.groupBox_05)
526
        self.DS_Extrude_Support.setGeometry(QtCore.QRect(10, 80, 81, 22))
527
        self.DS_Extrude_Support.setToolTip(_fromUtf8("Thickness of the extrude the support. If thickness = 0 then don't extrude"))
528
        self.DS_Extrude_Support.setAccessibleDescription(_fromUtf8(""))
529
        self.DS_Extrude_Support.setMaximum(99999999.0)
530
        self.DS_Extrude_Support.setEnabled(False)
531
        self.DS_Extrude_Support.setValue(epaisSupp)
532
        self.DS_Extrude_Support.setObjectName(_fromUtf8("DS_Extrude_Support"))
533
        self.DS_Extrude_Support.valueChanged.connect(self.on_DS_Extrude_Support) #connection doubleSpinBox
534

535
        self.label_6 = QtGui.QLabel(self.groupBox_05)
536
        self.label_6.setGeometry(QtCore.QRect(100, 80, 121, 16))
537
        self.label_6.setObjectName(_fromUtf8("label_6"))
538

539
        self.groupBox_04 = QtGui.QGroupBox(self.centralWidget)
540
        self.groupBox_04.setEnabled(False)
541
        self.groupBox_04.setGeometry(QtCore.QRect(10, 400, 351, 81))
542
        self.groupBox_04.setAccessibleDescription(_fromUtf8(""))
543
        self.groupBox_04.setLayoutDirection(QtCore.Qt.LeftToRight)
544
        self.groupBox_04.setCheckable(False)
545
        self.groupBox_04.setObjectName(_fromUtf8("groupBox_04"))
546

547
        self.DS_Base_Helix = QtGui.QDoubleSpinBox(self.groupBox_04)
548
        self.DS_Base_Helix.setGeometry(QtCore.QRect(10, 50, 81, 22))
549
        self.DS_Base_Helix.setToolTip(_fromUtf8("Base (beginning) of helix (to activate Step of Helix must be zero)"))
550
        self.DS_Base_Helix.setEnabled(False)
551
        self.DS_Base_Helix.setAccessibleDescription(_fromUtf8(""))
552
        self.DS_Base_Helix.setMinimum(-99999999.0)
553
        self.DS_Base_Helix.setMaximum(99999999.0)
554
        self.DS_Base_Helix.setValue(baseHelix)
555
        self.DS_Base_Helix.setObjectName(_fromUtf8("DS_Base_Helix"))
556
        self.DS_Base_Helix.valueChanged.connect(self.on_DS_Base_Helix) #connection doubleSpinBox
557

558
        self.label = QtGui.QLabel(self.groupBox_04)
559
        self.label.setGeometry(QtCore.QRect(270, 20, 91, 16))
560
        self.label.setAccessibleDescription(_fromUtf8(""))
561
        self.label.setText(_fromUtf8("Char. per turn"))
562
        self.label.setObjectName(_fromUtf8("label"))
563

564
        self.DS_End_Helix = QtGui.QDoubleSpinBox(self.groupBox_04)
565
        self.DS_End_Helix.setGeometry(QtCore.QRect(180, 50, 81, 22))
566
        self.DS_End_Helix.setToolTip(_fromUtf8("Final height of the helix (to activate Step of Helix must be zero)"))
567
        self.DS_End_Helix.setEnabled(False)
568
        self.DS_End_Helix.setAccessibleDescription(_fromUtf8(""))
569
        self.DS_End_Helix.setMinimum(-99999999.0)
570
        self.DS_End_Helix.setMaximum(99999999.0)
571
        self.DS_End_Helix.setValue(endHelix)
572
        self.DS_End_Helix.setObjectName(_fromUtf8("DS_End_Helix"))
573
        self.DS_End_Helix.valueChanged.connect(self.on_DS_End_Helix) #connection doubleSpinBox
574

575
        self.label_2 = QtGui.QLabel(self.groupBox_04)
576
        self.label_2.setGeometry(QtCore.QRect(100, 50, 81, 16))
577
        self.label_2.setAccessibleDescription(_fromUtf8(""))
578
        self.label_2.setText(_fromUtf8("Base Helix"))
579
        self.label_2.setObjectName(_fromUtf8("label_2"))
580

581
        self.label_3 = QtGui.QLabel(self.groupBox_04)
582
        self.label_3.setGeometry(QtCore.QRect(270, 50, 61, 16))
583
        self.label_3.setAccessibleDescription(_fromUtf8(""))
584
        self.label_3.setText(_fromUtf8("End Helix"))
585
        self.label_3.setObjectName(_fromUtf8("label_3"))
586

587
        self.DS_Number_Char_Per_Turn = QtGui.QSpinBox(self.groupBox_04)
588
        self.DS_Number_Char_Per_Turn.setGeometry(QtCore.QRect(180, 20, 81, 22))
589
        self.DS_Number_Char_Per_Turn.setToolTip(_fromUtf8("Number of characters for one turn of helix"))
590
        self.DS_Number_Char_Per_Turn.setAccessibleDescription(_fromUtf8(""))
591
        self.DS_Number_Char_Per_Turn.setMaximum(99999999)
592
        self.DS_Number_Char_Per_Turn.setValue(nombreCarParTour)
593
        self.DS_Number_Char_Per_Turn.setObjectName(_fromUtf8("DS_Number_Char_Per_Turn"))
594
        self.DS_Number_Char_Per_Turn.valueChanged.connect(self.on_DS_Number_Char_Per_Turn) #connection doubleSpinBox
595

596
        self.DS_Step_Of_The_Helix = QtGui.QDoubleSpinBox(self.groupBox_04)
597
        self.DS_Step_Of_The_Helix.setGeometry(QtCore.QRect(10, 20, 81, 22))
598
        self.DS_Step_Of_The_Helix.setToolTip(_fromUtf8("Step of the text along the helix (min Size Character)"))
599
        self.DS_Step_Of_The_Helix.setAccessibleDescription(_fromUtf8(""))
600
        self.DS_Step_Of_The_Helix.setMaximum(99999999.99)
601
        self.DS_Step_Of_The_Helix.setValue(pasHelix)
602

603
        self.DS_Step_Of_The_Helix.setObjectName(_fromUtf8("DS_Step_Of_The_Helix"))
604
        self.DS_Step_Of_The_Helix.valueChanged.connect(self.on_DS_Step_Of_The_Helix) #connection doubleSpinBox
605

606
        self.label_12 = QtGui.QLabel(self.groupBox_04)
607
        self.label_12.setGeometry(QtCore.QRect(100, 20, 81, 16))
608
        self.label_12.setAccessibleDescription(_fromUtf8(""))
609
        self.label_12.setObjectName(_fromUtf8("label_12"))
610

611
        self.PU_Exit = QtGui.QPushButton(self.centralWidget)
612
        self.PU_Exit.setGeometry(QtCore.QRect(10, 600, 81, 28))
613
        self.PU_Exit.setAccessibleDescription(_fromUtf8(""))
614
        self.PU_Exit.setText(_fromUtf8("Exit"))
615
        self.PU_Exit.setObjectName(_fromUtf8("PU_Exit"))
616
        self.PU_Exit.clicked.connect(self.on_PU_Exit)
617

618
        self.PU_Execute = QtGui.QPushButton(self.centralWidget)
619
        self.PU_Execute.setGeometry(QtCore.QRect(280, 600, 81, 28))
620
        self.PU_Execute.setAccessibleDescription(_fromUtf8(""))
621
        self.PU_Execute.setText(_fromUtf8("Run"))
622
        self.PU_Execute.setToolTip("Execute the process") # without Compount
623
        self.PU_Execute.setObjectName(_fromUtf8("PU_Execute"))
624
        self.PU_Execute.clicked.connect(self.on_PU_Execute)
625

626
        self.PU_Reset = QtGui.QPushButton(self.centralWidget)
627
        self.PU_Reset.setGeometry(QtCore.QRect(100, 600, 81, 28))
628
        self.PU_Reset.setToolTip(_fromUtf8("Reset the macro and give the number of the characters of windows Textedit"))
629
        self.PU_Reset.setAccessibleDescription(_fromUtf8(""))
630
        self.PU_Reset.setEnabled(True)
631
        self.PU_Reset.setObjectName(_fromUtf8("PU_Reset"))
632
        self.PU_Reset.clicked.connect(self.on_PU_Reset)
633

634
        self.groupBox_01 = QtGui.QGroupBox(self.centralWidget)
635
        self.groupBox_01.setGeometry(QtCore.QRect(10, 0, 351, 101))
636
        self.groupBox_01.setAccessibleDescription(_fromUtf8(""))
637
        self.groupBox_01.setObjectName(_fromUtf8("groupBox_01"))
638

639
        self.lineEdit = QtGui.QLineEdit(self.groupBox_01)
640
        self.lineEdit.setGeometry(QtCore.QRect(10, 70, 211, 22))
641
        self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
642
        self.lineEdit.setText(PolicePath)
643

644
        self.textEdit = QtGui.QTextEdit(self.groupBox_01)
645
        self.textEdit.setGeometry(QtCore.QRect(10, 20, 331, 41))
646
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
647
        self.textEdit.setText(texte)
648

649
        self.PU_New_Font = QtGui.QPushButton(self.groupBox_01)
650
        self.PU_New_Font.setGeometry(QtCore.QRect(230, 70, 111, 21))
651
        self.PU_New_Font.setToolTip(_fromUtf8("Search your new font"))
652
        self.PU_New_Font.setAccessibleDescription(_fromUtf8(""))
653
        self.PU_New_Font.setText(_fromUtf8("New Font"))
654
        self.PU_New_Font.setObjectName(_fromUtf8("PU_New_Font"))
655
        self.PU_New_Font.clicked.connect(self.on_PU_New_Font)
656

657
        self.PU_Benchmarks = QtGui.QPushButton(self.centralWidget)
658
        self.PU_Benchmarks.setGeometry(QtCore.QRect(190, 600, 81, 28))
659
        self.PU_Benchmarks.setToolTip(_fromUtf8("Execute the process and one Compount of the characters is create"))
660
#        self.PU_Benchmarks.setEnabled(True)
661
        self.PU_Benchmarks.setText("Run Comp")
662
        self.PU_Benchmarks.setObjectName(_fromUtf8("PU_Benchmarks"))
663
        self.PU_Benchmarks.clicked.connect(self.on_PU_Benchmarks)
664

665
        MainWindow.setCentralWidget(self.centralWidget)
666

667
        self.retranslateUi(MainWindow)
668
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
669

670
    def retranslateUi(self, MainWindow):
671
        try:
672
            MainWindow.setWindowFlags(PyQt4.QtCore.Qt.WindowStaysOnTopHint)        # PyQt4 cette fonction met la fenetre en avant
673
        except Exception:
674
            MainWindow.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)       # PySide cette fonction met la fenetre en avant
675
        MainWindow.setWindowTitle("FCCircularText")
676
        self.groupBox_02.setTitle("Configuration FCCircularText Character")
677
        self.label_10.setText("Radius of circle")
678
        self.groupBox_03.setTitle("Choice")
679
        self.RA_Choice_Outdoor.setToolTip("Create the text on the outer face of the cylinder")
680
        self.RA_Choice_Outdoor.setText("Outdoor")
681
        self.RA_Choice_Indoor.setToolTip("Create the text on the inside of the cylinder")
682
        self.RA_Choice_Indoor.setText("Indoor")
683
        self.RA_Choice_Helix.setToolTip("Create the text in a helix")
684
        self.RA_Choice_Helix.setText("Helix")
685
        self.RA_Choice_Clock.setToolTip("Create the text to form a clock")
686
        self.RA_Choice_Clock.setText("Clock")
687
        self.label_13.setText("Begin angle")
688
        self.label_14.setText("End angle")
689
        self.CH_Extrude.setText("Extrude Char.")
690
        self.DS_InclinaisonX.setSuffix(unicode(" °"))
691
        self.DS_InclinaisonY.setSuffix(unicode(" °"))
692
        self.DS_InclinaisonZ.setSuffix(unicode(" °"))
693
        self.DS_PlacementX.setSuffix(" X")
694
        self.DS_PlacementY.setSuffix(" Y")
695
        self.DS_PlacementZ.setSuffix(" Z")
696
        self.CH_Sp_Placement.setText("Placement")
697
        self.groupBox_05.setTitle("Clock")
698
        self.PU_Roman.setToolTip("The characters is in Roman or Arabic (default)")
699
        self.PU_Redress.setToolTip("The numbers is straight or tangent of the circle")
700
        self.label_11.setText("Radius of support")
701
        self.label_6.setText("Extrude support")
702
        self.groupBox_04.setTitle("Helix")
703
        self.label_12.setText("Step of Helix")
704
        self.PU_Exit.setToolTip("Exit FCCircularText")
705
        self.PU_Reset.setText("Reset")
706
        self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+" characters )")
707
        self.lineEdit.setToolTip("Font to default")
708
        self.lineEdit.setText(PolicePath)
709
        self.textEdit.setToolTip("Your text to be displayed")
710
        self.textEdit.setHtml(texte)
711

712
##############################################################################
713

714
    def on_PU_New_Font(self):         # New Font
715
        global PolicePath
716
        OpenName = ""
717
        try:
718
            OpenName = QFileDialog.getOpenFileName(None,QString.fromLocal8Bit("New Font"),PolicePath,"*.ttf") # PyQt4
719
        except Exception:
720
            OpenName, Filter = PySide.QtGui.QFileDialog.getOpenFileName(None, "New Font", PolicePath, "*.ttf")#PySide
721
        try:
722
            if OpenName != "":
723
                PolicePath = OpenName
724
                self.lineEdit.setText(PolicePath)
725
        except Exception:
726
            None
727
        App.Console.PrintMessage("New Font " + (PolicePath)+"\n")
728

729
    def on_PU_Reset_Placement(self):           # Reset_Placement
730
        global PlacementX
731
        global PlacementY
732
        global PlacementZ
733
        global coor_X
734
        global coor_Y
735
        global coor_Z
736
        coor_X = coor_Y = coor_Z = 0.0
737
        PlacementX = PlacementY = PlacementZ = 0.0
738
        self.CH_Sp_Placement.setChecked(False)
739
        self.DS_PlacementX.setValue(PlacementX)
740
        self.DS_PlacementX.setEnabled(False)
741
        self.DS_PlacementY.setValue(PlacementY)
742
        self.DS_PlacementY.setEnabled(False)
743
        self.DS_PlacementZ.setValue(PlacementZ)
744
        self.DS_PlacementZ.setEnabled(False)
745
#        App.Console.PrintMessage(str("on_PU_Reset_Placement ")+"\n")
746

747
    def on_PU_Reset_Inclination(self):           # Reset_Inclination
748
        global inclinaisonX
749
        global inclinaisonY
750
        global inclinaisonZ
751
        inclinaisonX = inclinaisonY = inclinaisonZ = 0.0
752
        self.CH_Sp_Inclination.setChecked(False)
753
        self.DS_InclinaisonX.setValue(inclinaisonX)
754
        self.DS_InclinaisonX.setEnabled(False)
755
        self.DS_InclinaisonY.setValue(inclinaisonY)
756
        self.DS_InclinaisonY.setEnabled(False)
757
        self.DS_InclinaisonZ.setValue(inclinaisonZ)
758
        self.DS_InclinaisonZ.setEnabled(False)
759
#        App.Console.PrintMessage(str("on_PU_Reset_Inclination ")+"\n")
760

761
    def on_RA_Choice_Outdoor(self):           #
762
        global exterieur
763
        global extrusion
764
        global epaisseur
765

766
        extrusion = 0
767
        epaisseur = 0.0
768
        self.DS_Extrude.setValue(epaisseur)
769
        self.CH_Extrude.setChecked(False)
770
        self.DS_Extrude.setEnabled(False)
771
        exterieur = 1
772
        self.S_Begin_Angle.setEnabled(True)
773
        self.S_End_Angle.setEnabled(True)
774
        self.DS_Correction_Radius.setEnabled(True)
775
        self.DS_Correction_Angle.setEnabled(True)
776
        self.PU_Flat.setEnabled(True)
777
        self.groupBox_04.setEnabled(False)
778
        self.groupBox_05.setEnabled(False)
779
        ff2 = ui
780
        ff2.on_PU_Reset_Placement()
781
        ff3 = ui
782
        ff3.on_PU_Reset_Inclination()
783
#        App.Console.PrintMessage(str("on_RA_Choice_Outdoor ")+" "+str(exterieur)+"\n")
784

785
    def on_RA_Choice_Indoor(self):          #
786
        global exterieur
787
        global extrusion
788
        global epaisseur
789

790
        extrusion = 0
791
        epaisseur = 0.0
792
        self.DS_Extrude.setValue(epaisseur)
793
        self.CH_Extrude.setChecked(False)
794
        self.DS_Extrude.setEnabled(False)
795
        exterieur = 0
796
        self.S_Begin_Angle.setEnabled(True)
797
        self.S_End_Angle.setEnabled(True)
798
        self.DS_Correction_Radius.setEnabled(True)
799
        self.DS_Correction_Angle.setEnabled(True)
800
        self.PU_Flat.setEnabled(True)
801
        self.groupBox_04.setEnabled(False)
802
        self.groupBox_05.setEnabled(False)
803
        ff2 = ui
804
        ff2.on_PU_Reset_Placement()
805
        ff3 = ui
806
        ff3.on_PU_Reset_Inclination()
807
#        App.Console.PrintMessage(str("on_RA_Choice_Indoor ")+" "+str(exterieur)+"\n")
808

809
    def on_RA_Choice_Helix(self):              #
810
        global exterieur
811
        global cercleClock
812
        global nombreFaces
813
        global debout
814
        global extrusion
815
        global epaisseur
816

817
        extrusion = 0
818
        epaisseur = 0.0
819
        self.DS_Extrude.setValue(epaisseur)
820
        self.CH_Extrude.setChecked(False)
821
        self.DS_Extrude.setEnabled(False)
822
        exterieur = 2
823
        cercleClock = 0
824
        nombreFaces = 0
825
        debout = 1
826

827
        self.RA_Choice_Outdoor.setText("Outdoor")
828
        self.RA_Choice_Indoor.setText("Indoor")
829
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
830

831
        self.S_Begin_Angle.setEnabled(True)
832
        self.S_End_Angle.setEnabled(True)
833
        self.DS_Correction_Radius.setEnabled(True)
834
        self.DS_Correction_Angle.setEnabled(True)
835
        self.PU_Flat.setEnabled(False)##
836
        self.groupBox_04.setEnabled(True)
837
        self.groupBox_05.setEnabled(False)
838

839
        ff2 = ui
840
        ff2.on_PU_Reset_Placement()
841
        ff3 = ui
842
        ff3.on_PU_Reset_Inclination()
843

844
    def on_RA_Choice_Clock(self):              #
845
        global exterieur
846
        global debout
847
        global correctionRayon
848
        global correctionAngle
849
        global extrusion
850
        global epaisseur
851

852
        extrusion = 0
853
        epaisseur = 0.0
854
        self.DS_Extrude.setValue(epaisseur)
855
        self.CH_Extrude.setChecked(False)
856
        self.DS_Extrude.setEnabled(False)
857
        exterieur = 3
858
        debout = 0
859
        self.PU_Flat.setEnabled(False)
860
        self.S_Begin_Angle.setEnabled(False)
861
        self.S_End_Angle.setEnabled(False)
862
#        correctionRayon = 0
863
        self.DS_Correction_Radius.setEnabled(False)
864
        self.DS_Correction_Radius.setValue(0.0)
865
#        correctionAngle = 10.0
866
        self.DS_Correction_Angle.setEnabled(False)
867
        self.DS_Correction_Angle.setValue(0.0)
868
        self.groupBox_04.setEnabled(False)
869
        self.groupBox_05.setEnabled(True)
870
        ff2 = ui
871
        ff2.on_PU_Reset_Placement()
872
        ff3 = ui
873
        ff3.on_PU_Reset_Inclination()
874
#        App.Console.PrintMessage(str("on_RA_Choice_Clock ")+str(exterieur)+"\n")
875

876
    def on_PU_Flat(self):         # Flat or Stand
877
        global debout
878
        if debout == 1:
879
            debout = 0
880
            self.RA_Choice_Outdoor.setText("Indoor")
881
            self.RA_Choice_Indoor.setText("Outdoor")
882
            self.PU_Flat.setText(_fromUtf8("Mode Flat"))
883
            self.PU_Flat.setToolTip(_fromUtf8("Click to create the text Stand"))
884
        else:
885
            debout = 1
886
            self.RA_Choice_Outdoor.setText("Outdoor")
887
            self.RA_Choice_Indoor.setText("Indoor")
888
            self.PU_Flat.setText(_fromUtf8("Mode Stand"))
889
            self.PU_Flat.setToolTip(_fromUtf8("Click to create the text Flat"))
890
#        App.Console.PrintMessage(str("on_PU_Flat ")+str(debout)+"\n")
891

892
    def on_DS_Radius_Circle(self,value):
893
        global rayon
894
        global cercleClock
895
        rayon = value
896
        cercleClock = rayon
897
#        App.Console.PrintMessage("on_DS_Radius_Circle Radius"+str(rayon)+"\n")
898

899
    def on_DS_Size_Character(self,value):
900
        global SizeCaractere
901
        SizeCaractere = value
902
#        App.Console.PrintMessage("on_DS_Size_Character Size"+str(SizeCaractere)+"\n")
903

904
    def on_S_Begin_Angle(self,value):          #
905
        global debut
906
        debut = value
907
#        App.Console.PrintMessage(str("on_S_Begin_Angle ")+str(debut)+"\n")
908

909
    def on_S_End_Angle(self,value):            #
910
        global rotation
911
        rotation = value
912
#        App.Console.PrintMessage(str("on_S_End_Angle ")+str(rotation)+"\n")
913

914
    def on_DS_PlacementX(self,value):          #
915
        global PlacementX
916
        PlacementX = value
917
#        App.Console.PrintMessage(str("on_DS_PlacementX ")+str(PlacementX)+"\n")
918

919
    def on_DS_PlacementY(self,value):          #
920
        global PlacementY
921
        PlacementY = value
922
#        App.Console.PrintMessage(str("on_DS_PlacementY ")+str(PlacementY)+"\n")
923

924
    def on_DS_PlacementZ(self,value):          #
925
        global PlacementZ
926
        PlacementZ = value
927
#        App.Console.PrintMessage(str("on_DS_PlacementZ ")+str(PlacementZ)+"\n")
928

929
    def on_CH_Sp_Placement(self):              # Placement or not Placement
930
        if self.CH_Sp_Placement.isChecked():
931
            self.DS_PlacementX.setEnabled(True)
932
            self.DS_PlacementY.setEnabled(True)
933
            self.DS_PlacementZ.setEnabled(True)
934
#            App.Console.PrintMessage(str("on_CH_Sp_Placement ")+str("True")+"\n")
935
        else:
936
            ff2 = ui
937
            ff2.on_PU_Reset_Placement()
938
        if self.RA_Choice_Clock.isChecked():
939
            self.DS_PlacementX.setEnabled(False)
940
            self.DS_PlacementY.setEnabled(False)
941
#            App.Console.PrintMessage(str("on_CH_Sp_Placement ")+str("False")+"\n")
942

943
    def on_DS_Correction_Angle(self,value):    #
944
        global correctionAngle
945
        correctionAngle = value
946
#        App.Console.PrintMessage(str("on_DS_Correction_Angle ")+str(correctionAngle)+"\n")
947

948
    def on_DS_Correction_Radius(self,value):   #
949
        global correctionRayon
950
        correctionRayon = value
951
#        App.Console.PrintMessage(str("on_DS_Correction_Radius ")+str(correctionRayon)+"\n")
952

953
    def on_DS_Extrude(self,value):             #
954
        global epaisseur
955
        epaisseur = value
956
#        App.Console.PrintMessage("on_DS_Extrude "+str(epaisseur)+"\n")
957

958
    def on_CH_Extrude(self):                   #
959
        global extrusion
960
        global epaisseur
961
        if self.CH_Extrude.isChecked():
962
            self.DS_Extrude.setEnabled(True)
963
            extrusion = 1
964
            epaisseur = 1.0
965
        else:
966
            self.DS_Extrude.setEnabled(False)
967
            extrusion = 0
968
            epaisseur = 0.0
969
        self.DS_Extrude.setValue(epaisseur)
970
#        App.Console.PrintMessage(str("on_CH_Extrude ")+str(extrusion)+" "+str(epaisseur)+"\n")
971

972
    def on_DS_InclinaisonX(self,value):        #
973
        global inclinaisonX
974
        inclinaisonX = value
975
#        App.Console.PrintMessage(str("on_DS_InclinaisonX ")+str(inclinaisonX)+"\n")
976

977
    def on_DS_InclinaisonY(self,value):        #
978
        global inclinaisonY
979
        inclinaisonY = value
980
#        App.Console.PrintMessage(str("on_DS_InclinaisonY ")+str(inclinaisonY)+"\n")
981

982
    def on_DS_InclinaisonZ(self,value):        #
983
        global inclinaisonZ
984
        inclinaisonZ = value
985
#        App.Console.PrintMessage(str("on_DS_InclinaisonZ ")+str(inclinaisonZ)+"\n")
986

987
    def on_CH_Sp_Inclination(self):            #
988
        if self.CH_Sp_Inclination.isChecked():
989
            self.DS_InclinaisonX.setEnabled(True)
990
            self.DS_InclinaisonY.setEnabled(True)
991
            self.DS_InclinaisonZ.setEnabled(True)
992
        else:
993
            ff3 = ui
994
            ff3.on_PU_Reset_Inclination()
995
#        App.Console.PrintMessage(str("on_CH_Sp_Inclination ")+str(self.CH_Sp_Inclination.isChecked())+"\n")
996

997
    def on_DS_Step_Of_The_Helix(self,value):   #
998
        global pasHelix
999
        global baseHelix
1000
        global endHelix
1001
        pasHelix = value
1002
        if pasHelix == 0:
1003
            baseHelix = endHelix = 0.0
1004
            self.DS_Base_Helix.setValue(baseHelix)
1005
            self.DS_Base_Helix.setEnabled(True)
1006
            self.DS_End_Helix.setValue(endHelix)
1007
            self.DS_End_Helix.setEnabled(True)
1008
        else:
1009
            baseHelix = endHelix = 0.0
1010
            self.DS_Base_Helix.setValue(baseHelix)
1011
            self.DS_Base_Helix.setEnabled(False)
1012
            self.DS_End_Helix.setValue(endHelix)
1013
            self.DS_End_Helix.setEnabled(False)
1014
#        App.Console.PrintMessage(str("on_DS_Step_Of_The_Helix ")+str(SizeCaractere)+"\n")
1015

1016
    def on_DS_Number_Char_Per_Turn(self,value):#
1017
        global nombreCarParTour
1018
        nombreCarParTour = value
1019
#        App.Console.PrintMessage(str("on_DS_Number_Char_Per_Turn ")+str(nombreCarParTour)+"\n")
1020

1021
    def on_DS_Base_Helix(self,value):          #
1022
        global baseHelix
1023
        baseHelix = value
1024
#        App.Console.PrintMessage(str("on_DS_Base_Helix ")+str(baseHelix)+"\n")
1025

1026
    def on_DS_End_Helix(self,value):           #
1027
        global endHelix
1028
        endHelix = value
1029
#        App.Console.PrintMessage(str("on_DS_End_Helix ")+str(endHelix)+"\n")
1030

1031
    def on_DS_Radius_Support(self,value):      #
1032
        global cercleClock
1033
        cercleClock = value
1034
#        App.Console.PrintMessage(str("on_DS_Radius_Support ")+str(cercleClock)+"\n")
1035

1036
    def on_S_Number_Faces_Support(self,value): # number Faces of support 0=none 1=circle 2=rectangle 3=triangle 4,5 ... polygon
1037
        global nombreFaces
1038
        nombreFaces = value
1039
        self.DS_Extrude_Support.setEnabled(True)
1040
        if nombreFaces == 0:
1041
            self.label_5.setText(_fromUtf8("Support number face"))
1042
            self.DS_Extrude_Support.setEnabled(False)
1043
        elif nombreFaces == 1:
1044
            self.label_5.setText(_fromUtf8("Support Circle"))
1045
        elif nombreFaces == 2:
1046
            self.label_5.setText(_fromUtf8("Support Rectangle"))
1047
        elif nombreFaces == 3:
1048
            self.label_5.setText(_fromUtf8("Support Triangle"))
1049
        elif nombreFaces == 4:
1050
            self.label_5.setText(_fromUtf8("Support Square"))
1051
        else :
1052
            self.label_5.setText(_fromUtf8("Support Polygone"))
1053
#        App.Console.PrintMessage(str("on_S_Number_Faces_Support ")+str(nombreFaces)+"\n")
1054

1055
    def on_DS_Extrude_Support(self,value):     #
1056
        global epaisSupp
1057
        epaisSupp = value
1058
        self.DS_PlacementZ.setEnabled(True)
1059
#        App.Console.PrintMessage(str("on_DS_Extrude_Support ")+str(epaisSupp)+"\n")
1060

1061
    def on_PU_Roman(self):                     # Roman or Arabic Clock
1062
        global romain
1063
        if romain == 1:
1064
            romain = 0
1065
            self.PU_Roman.setText(_fromUtf8("Mode Arabic"))
1066
            self.PU_Roman.setToolTip(_fromUtf8("Click to activate Roman mode"))
1067
        else:
1068
            romain = 1
1069
            self.PU_Roman.setText(_fromUtf8("Mode Roman"))
1070
            self.PU_Roman.setToolTip(_fromUtf8("Click to activate Arabic mode"))
1071
#        App.Console.PrintMessage(str("romain ")+str(romain)+"\n")
1072

1073
    def on_PU_Redress(self):                   # Redress or circumferential Clock
1074
        global redressement
1075
        if redressement == 1:
1076
            redressement = 0
1077
            self.PU_Redress.setText(_fromUtf8("Redress"))
1078
            self.PU_Redress.setToolTip(_fromUtf8("Click to activate Axial mode"))
1079
        else:
1080
            redressement = 1
1081
            self.PU_Redress.setText(_fromUtf8("Axial"))
1082
            self.PU_Redress.setToolTip(_fromUtf8("Click to activate Redress mode"))
1083
#        App.Console.PrintMessage(str("redressement ")+str(redressement)+"\n")
1084

1085
    def on_PU_Exit(self):                      # Exit
1086
        App.Console.PrintMessage("Fin FCCircularText"+"\n")
1087
        self.window.hide()
1088

1089
    def on_PU_Reset(self):                     #
1090
        global points
1091
        global coor_X
1092
        global coor_Y
1093
        global coor_Z
1094
        global vec
1095

1096
        global PolicePath
1097

1098
        global rayon
1099
        global texte
1100
        global debut
1101
        global rotation
1102
        global SizeCaractere
1103

1104
        global precision
1105
        global correctionAngle
1106
        global correctionRayon
1107
        global debout
1108
        global exterieur
1109
        global baseHelix
1110
        global endHelix
1111
        global pasHelix
1112
        global nombreCarParTour
1113

1114
        global PlacementX
1115
        global PlacementY
1116
        global PlacementZ
1117

1118
        global inclinaisonX
1119
        global inclinaisonY
1120
        global inclinaisonZ
1121

1122
        global cercleClock
1123
        global nombreFaces
1124
        global romain
1125
        global redressement
1126

1127
        global comP
1128
        global nameL
1129
        global epaisseur
1130
        global epaisSupp
1131
        global extrusion
1132
        global compount1
1133

1134
        texte = ""
1135

1136
        exterieur = 1
1137
        self.RA_Choice_Outdoor.setText("Outdoor")
1138
        self.RA_Choice_Indoor.setText("Indoor")
1139
        self.RA_Choice_Outdoor.setChecked(True)
1140

1141
        debout = 1
1142
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
1143
        self.PU_Flat.setToolTip(_fromUtf8("Click to create the Flat text"))
1144

1145
        SizeCaractere = 2.0
1146
        self.DS_Size_Character.setValue(SizeCaractere)
1147
        rayon = 10.0
1148
        self.DS_Radius_Circle.setValue(rayon)
1149

1150
        debut = 0
1151
        self.S_Begin_Angle.setValue(debut)
1152
        self.S_Begin_Angle.setEnabled(True)
1153
        rotation = 360
1154
        self.S_End_Angle.setValue(rotation)
1155
        self.S_End_Angle.setEnabled(True)
1156

1157
        correctionAngle = 10.0
1158
        self.DS_Correction_Angle.setValue(correctionAngle)
1159
        self.DS_Correction_Radius.setEnabled(True)
1160
        correctionRayon = 0.15
1161
        self.DS_Correction_Radius.setValue(correctionRayon)
1162
        self.DS_Correction_Angle.setEnabled(True)
1163

1164
        extrusion = 0
1165
        epaisseur = 0.0
1166
        self.DS_Extrude.setValue(epaisseur)
1167
        self.CH_Extrude.setChecked(False)
1168
        self.DS_Extrude.setEnabled(False)
1169

1170
        ff2 = ui
1171
        ff2.on_PU_Reset_Placement()
1172
        ff3 = ui
1173
        ff3.on_PU_Reset_Inclination()
1174

1175
        self.groupBox_04.setEnabled(False)
1176
        baseHelix = 0.0
1177
        self.DS_Base_Helix.setValue(baseHelix)
1178
        self.DS_Base_Helix.setEnabled(False)
1179
        endHelix = 0.0
1180
        self.DS_End_Helix.setValue(endHelix)
1181
        self.DS_Base_Helix.setEnabled(False)
1182
        pasHelix = 2.0
1183
        self.DS_Step_Of_The_Helix.setValue(pasHelix)
1184
        nombreCarParTour = 10
1185
        self.DS_Number_Char_Per_Turn.setValue(nombreCarParTour)
1186

1187
        self.groupBox_05.setEnabled(False)
1188
        cercleClock = rayon
1189
        self.DS_Radius_Support.setValue(cercleClock)
1190
        nombreFaces = 0
1191
        self.S_Number_Faces_Support.setValue(nombreFaces)
1192
        self.label_5.setText(_fromUtf8("Support number face"))
1193
        epaisSupp   = 0.0
1194
        self.DS_Extrude_Support.setEnabled(False)
1195
        self.DS_Extrude_Support.setValue(epaisSupp)
1196

1197
        romain = 0
1198
        self.PU_Roman.setText(_fromUtf8("Mode Arabic"))
1199
        self.PU_Roman.setToolTip(_fromUtf8("Click to activate Roman mode"))
1200
        redressement = 0
1201
        self.PU_Redress.setText(_fromUtf8("Redress"))
1202
        self.PU_Redress.setToolTip(_fromUtf8("Click to activate Axial mode"))
1203

1204
        compount1 = 0
1205

1206
        ##### update the setTitle ########################################
1207

1208
        texte = unicode(self.textEdit.toPlainText())
1209
        self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+" characters )")
1210
#        App.Console.PrintMessage(str("on_PU_Reset ")+str()+"\n")
1211

1212
    def on_PU_Benchmarks(self):                # Benchmarks
1213
      try:
1214
        global compount1
1215
        compount1 = 1
1216
        ff = ui
1217
        ff.on_PU_Execute()
1218
#        App.Console.PrintMessage(str("Benchmarks")+"\n")
1219
      except:
1220
        sayexc("Error")
1221

1222
    ##########################################################################
1223

1224
    def on_PU_Execute(self):         # Execute
1225
        global PolicePath
1226

1227
        global points
1228
        global coor_X
1229
        global coor_Y
1230
        global coor_Z
1231

1232
        global PlacementX
1233
        global PlacementY
1234
        global PlacementZ
1235

1236
        global inclinaisonX
1237
        global inclinaisonY
1238
        global inclinaisonZ
1239

1240
        global vec
1241
        global PolicePath
1242
        global rayon
1243
        global texte
1244
        global debut
1245
        global rotation
1246
        global SizeCaractere
1247

1248
        global ii
1249
        global precision
1250
        global correctionAngle
1251
        global correctionRayon
1252
        global debout
1253
        global exterieur
1254
        global baseHelix
1255
        global endHelix
1256
        global pasHelix
1257
        global nombreCarParTour
1258

1259
        global cercleClock
1260
        global nombreFaces
1261
        global romain
1262
        global redressement
1263

1264
        global comP
1265
        global nameL
1266

1267
        global epaisseur
1268
        global epaisSupp
1269
        global extrusion
1270
        global compount1
1271

1272
        points   = []
1273
        comP     = []
1274
        nameL    = []
1275

1276
        del   points[:]
1277
        del     comP[:]
1278
        del    nameL[:]
1279

1280
        doc = FreeCAD.ActiveDocument
1281
        if doc == None:
1282
            doc = FreeCAD.newDocument()
1283

1284
        texte = unicode(self.textEdit.toPlainText())
1285
        self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+" characters )")
1286

1287
        if ((exterieur == 0) and (debout == 0)):
1288
            vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)]      #
1289
        else:
1290
            if exterieur == 3:
1291
                vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon - (SizeCaractere/2),0.0,0.0)]      #
1292
            elif debout == 0:
1293
                vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon - SizeCaractere,0.0,0.0)]      #
1294
            else:
1295
                vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)]      #
1296

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

1300
        ii  = -1
1301
        ii2 = -1
1302

1303
        nombre = len(texte)
1304
        coor_Z = PlacementZ
1305

1306
        if (exterieur == 0) or (debout == 0):
1307
            texte = texte[::-1]
1308
            if (exterieur == 0) and (debout == 0):
1309
                texte = texte[::-1]
1310

1311
        depart = time.clock()     # chrono begin
1312

1313
        if exterieur == 2:        # helix
1314
            if nombreCarParTour == 0:
1315
                nombreCarParTour = 1
1316
                App.Console.PrintError("Insufficient number"+"\n")
1317
            pas = 0.0
1318
            nombre = nombreCarParTour
1319
            if pasHelix != 0:
1320
                pas = pasHelix / (nombreCarParTour)
1321
            else:
1322
                pas = ((((endHelix - SizeCaractere)-baseHelix)/(len(texte) / nombreCarParTour))/(nombreCarParTour)) # pas of helix
1323
                coor_Z += baseHelix
1324
        else:
1325
            nombreCarParTour = 1
1326

1327
        if exterieur == 3:         # Clock
1328
            FcString = doc.addObject("App::DocumentObjectGroup","FcClock")
1329
            nombre = 12
1330
            if romain == 0:
1331
                texte = ["1","2","3","4","5","6","7","8","9","10","11","12"]
1332
            else:
1333
                texte = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"]
1334
            texte = texte[::-1]
1335
        else:
1336
            FcString = doc.addObject("App::DocumentObjectGroup","FcString")
1337

1338
        ####Boucle principale############################################################################
1339
        boucler = len(texte) / nombreCarParTour
1340

1341
        if (len(texte) % nombreCarParTour) != 0: # calcul number spires Helix
1342
            boucler += 1
1343

1344
        for hel in range(boucler):
1345
            ii = -1
1346
            ####Boucle de travail#################################################
1347
            for angleTr in range(debut,rotation,((rotation-debut)/nombre)):
1348
                ii  += 1
1349
                ii2 += 1
1350
                ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))
1351
                a = ligne.Shape.Edges[0].Vertexes[1] # fin de ligne
1352

1353
                coor_X = (a.Point.x)
1354
                coor_Y = (a.Point.y)
1355

1356
                if (ii < nombre) and (ii2 < len(texte)):
1357
                    if exterieur == 3:                  # clock
1358
                        ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),angleTr+90), App.Vector(0,0,0))
1359
                        a = ligne.Shape.Edges[0].Vertexes[1] # fin
1360
                        coor_X = (a.Point.x)
1361
                        coor_Y = (a.Point.y)
1362
                    ss=Draft.makeShapeString(String=unicode(texte[ii2]),FontFile=PolicePath,Size=SizeCaractere,Tracking=0)
1363

1364
                    FcString.addObject(ss)  # container character
1365

1366
                    centreX = (ss.Shape.BoundBox.Center[0])
1367
                    centreY = (ss.Shape.BoundBox.Center[1])
1368
                    centreZ = (ss.Shape.BoundBox.Center[2])
1369
                    lengthX = (ss.Shape.BoundBox.XLength)
1370
                    lengthY = (ss.Shape.BoundBox.YLength)
1371
                    lengthZ = (ss.Shape.BoundBox.ZLength)
1372

1373
                    coor_X = coor_X + PlacementX
1374
                    coor_Y = coor_Y + PlacementY
1375

1376
                    plm=""
1377
                    plm=FreeCAD.Placement()
1378
                    plm.Base=FreeCAD.Vector(coor_X,coor_Y,coor_Z)
1379

1380
                    if debout == 1:           # debout
1381
                        if exterieur == 0:    # circumferential internal
1382
                            plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr-90-correctionAngle+inclinaisonX,inclinaisonY,90+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
1383
                        elif exterieur == 1:  # circumferential external
1384
                            plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,inclinaisonY,90+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
1385
                        elif exterieur == 2:  # circumferential helix
1386
                            plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,inclinaisonY,90+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
1387
                            coor_Z = coor_Z + pas
1388
                    else:                     # a plat
1389
                        if exterieur == 1:    # exterieur (superieur)
1390
                            plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr-90-correctionAngle+inclinaisonX,inclinaisonY,inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
1391
                        elif exterieur == 3:  # circumferential plat (clock)
1392
                            if redressement == 1:
1393
                                plm = App.Placement(App.Vector(coor_X-centreX,coor_Y-centreY,coor_Z), App.Rotation(inclinaisonX,inclinaisonY,inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
1394
                            else:
1395
                                plm = App.Placement(App.Vector(coor_X-centreX,coor_Y-centreY,coor_Z), App.Rotation(angleTr+inclinaisonX,inclinaisonY,inclinaisonZ), App.Vector(centreX,centreY,centreZ)) # pitch,roll...1
1396
                        else:                 # interieur  (inferieur)
1397
                            plm = App.Placement(App.Vector(-coor_X,-coor_Y,-coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,180+inclinaisonY,180+inclinaisonZ), App.Vector(0,0,0)) # pitch,roll...1
1398

1399
                    if epaisseur > 0:         # extrusion characrters
1400
                        CharExtrude = Draft.extrude(ss,Base.Vector(0,0,epaisseur))
1401
                        CharExtrude.Placement=plm
1402
                        comP.append(CharExtrude.Shape)
1403
#                        nameL.append(CharExtrude.Name)
1404
                        FcString.addObject(CharExtrude)  # container extrude
1405
                    else:                 #
1406
                        ss.Placement=plm
1407
                        ss.Support=None
1408
                        comP.append(ss.Shape)
1409
#                        nameL.append(ss.Name)
1410

1411
#                        points += [FreeCAD.Vector(coor_X,coor_Y,coor_Z)]  # coordinates makeBSpline
1412
#        BSpline = Draft.makeBSpline(points,closed=False)                  # makeBSpline repere
1413
        App.ActiveDocument.removeObject(lineName)     # remove ligne de base directrice
1414
        if compount1 == 1:                            # create compount
1415
            comp = Part.makeCompound(comP)
1416
            Part.show(comp)
1417
        ####Boucle de travail fin########################################################################
1418

1419
        ####Extrude support clock#############################################
1420
        if nombreFaces > 0:                           # support clock
1421
            pl = FreeCAD.Placement()
1422
            if nombreFaces == 1:                      # circle
1423
                pl.Base = FreeCAD.Vector(0.0,0.0,0.0)
1424
                supp = Draft.makeCircle(cercleClock,placement=pl,face=True,support=None)
1425
            if nombreFaces == 2:                      # rectangle
1426
                cercleClock = cercleClock * 2
1427
                pl.Base = FreeCAD.Vector(-cercleClock, (-cercleClock / 2), 0.0)
1428
                supp = Draft.makeRectangle((cercleClock * 2), cercleClock, placement=pl, face = True)
1429
            if nombreFaces > 2:                       # polygon with number faces
1430
                if nombreFaces == 4:
1431
                    rotateSupport = 45
1432
                else:
1433
                    rotateSupport = 90
1434
                pl = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(rotateSupport,0,0), App.Vector(0,0,0))
1435
                supp = Draft.makePolygon(nombreFaces,cercleClock,inscribed = False,placement = pl,face = True,support=None)
1436

1437
            supp.MakeFace = True
1438
            App.activeDocument().recompute()
1439
            FcString.addObject(supp)                  # container support
1440

1441
            if epaisSupp != 0:                        # extrude support clock
1442
                suppExtrude = Draft.extrude(supp,Base.Vector(0,0,epaisSupp))
1443
                FcString.addObject(suppExtrude)       # container support extrude
1444

1445
        ####Info################################################
1446
        App.Console.PrintMessage((PolicePath)+"\n")
1447
        App.Console.PrintMessage(u"texte        " + unicode(texte)+"\n")
1448
        App.Console.PrintMessage("rayon         " + str(rayon)+"\n")
1449
        App.Console.PrintMessage("rotation      " + str(rotation)+"\n")
1450
        App.Console.PrintMessage("SizeCaractere " + str(SizeCaractere)+"\n")
1451
        App.Console.PrintMessage("debout        " + str(debout)+"\n")
1452

1453
        ####Reset################################################
1454
        ff = ui
1455
        ff.on_PU_Reset()
1456

1457
        #### Chrono end ####################################
1458
        arrive = time.clock()                                                                    # chrono end
1459
        App.Console.PrintMessage("Time : "+str("%.2f" % ((arrive - depart)/60))+" min"+"\n\n")   # chrono end
1460
        ####################################################
1461

1462
MainWindow = QtGui.QMainWindow()
1463
ui = Ui_MainWindow()
1464
ui.setupUi(MainWindow)
1465
MainWindow.show()
1466

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.