Macro Rotate To Point: Difference between revisions

From FreeCAD Documentation
(create page)
 
m (add # code)
(35 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<translate>
<!--T:1-->
{{Macro|Icon=Macro Rotate To Point|Name=Macro Rotate To Point|Description=Macro for rotate on object on itself with the axis of rotation|Author=Mario52|Version=00.00 (04/03/2017)}}
{{Macro
</translate>
|Name=Macro Rotate To Point
<translate>
|Icon=Macro_Rotate_To_Point.svg
==Description==
|Description={{ColoredText|#ff0000|#ffffff|Updated version of macro modified the GUI to improve HiDPI support (QGridLayout). Run only FC v0.18 or higher (supporting Qt5 and PySide2)}} <br/> <br/> Macro for rotate an object on itself with the axis of rotation the: boundbox center, center of mass, direction of wire, or last point clicked. You must save in a file all coordinate worked and save it in a file "Coordinate [(0.06,1.30,0.0),(85.0,0.0,0.0)]," or in a complete macro for create one animation<br/><br/>For the previous version (Qt4) see [https://gist.githubusercontent.com/mario52a/2fc48333deca5a31e6232c29a9db5e4c/raw/9231d5b1d218357305cc0404e46bf6c107509a0e/Macro%2520Rotate%2520To%2520Point.FCMacro Macro_Rotate_To_Point] and install it manually.
</translate>
|Author=Mario52
<translate>
|Version=00.06
Macro for rotate on object on itself with the axis of rotation the boundbox center, center of mass or last point clicked
|Date=2021/01/12
</translate>
|FCVersion=0.18+
<translate>
|Download=[https://www.freecadweb.org/wiki/images/d/d1/Macro_Rotate_To_Point.svg ToolBar Icon]
==How To Use==
}}
</translate>

<translate>
==Description== <!--T:2-->
Run the macro and select one object and choice:

<!--T:3-->
Macro to rotate an object on itself with the axis of rotation being either the:
* boundbox center
* center of mass
* direction of wire
* last point clicked

==Usage== <!--T:4-->

<!--T:5-->
# Download the macro from the [[Addon Manager]]
# Execute the macro
# Select one object
# Choose one of the following orientations:


</translate>
</translate>
Line 18: Line 34:
{{clear}}
{{clear}}
<translate>
<translate>

*Point Rotation
===Point Rotation=== <!--T:6-->
**Bounbox Center : Select the boundBox center to axis rotation

**Center of Mass : Select the Center of Mass to axis rotation
<!--T:21-->
**Point Clicked : Select the last point mouse to axis rotation 1: select the object 2: use the {{KEY|CTRL}} for choice point extra object
*Boundbox Center: Select the BoundBox center to axis rotation
*Axis Rotation
*Center of Mass: Select the Center of Mass to axis rotation
**Rotation(Z) Yaw : Yaw axis
*Point Clicked: Select the last mouse click as the point for axis rotation
**Rotation(Y) Pitch : Pitch axis
** 1: select the object
**Rotation(X) Roll : Roll axis
** 2: use the {{KEY|CTRL}} key to choose an extra object
*Position : If this checkBox is checked the rotation is disabled, the object placement is done on the axis seleted

*Point : If this checkBox is checked one point is created for visualise the point rotation axis : red X, green Y, blue Z
===Axis Rotation=== <!--T:22-->
*Line Edit : The line edit display the original coordinate to axis selected + the input data give in the spinBox

*Free : If this checkBox is checked the {{KEY|Apply}} is switched ans the rotation or translation is executed in real time
<!--T:23-->
*DoubleSpinBox : enter the modification
*Rotation(Z) Yaw: Yaw axis
*{{KEY|Apply}} : Apply the modification to the object
*Rotation(Y) Pitch: Pitch axis
*{{KEY|Quit}} : Quit the macro
*Rotation(X) Roll: Roll axis
*{{KEY|Original}} : After modify the data of the object you can return to the original placement, If you have not deselected the current object
*Rotation(D) Direction: Rotate around line, wire selected
*{{KEY| 0,0,0 }} : This option place the object in base coordinate 0, 0, 0

*{{KEY|Reset}} : Reset the data in the macro and deselect the current object (same click mouse in the 3DView)
===Coordinates Point clicked=== <!--T:24-->

<!--T:25-->
*DoubleSpinBox: Coordinate X on mouse click (modifiable only with the mode "Point Clicked")
*DoubleSpinBox: Coordinate Y on mouse click (modifiable only with the mode "Point Clicked")
*DoubleSpinBox: Coordinate Z on mouse click (modifiable only with the mode "Point Clicked")

===Work=== <!--T:26-->

<!--T:27-->
*{{CheckBox|Translation}}: If this checkBox is {{CheckBox|TRUE|checked}} the rotation is disabled, the object placement is done on the axis selected.
*{{Button|Point}}: One point is created for visualise the point rotation axis: red X, green Y, blue Z
*Line Edit: The line edit displays the original coordinate to axis selected + the input data given in the spinBox
*{{SpinBox|0,0000}}: Enter the modification
*{{KEY|Apply}}: Apply the modification to the object
*The coordinate is displayed

===Data=== <!--T:28-->

<!--T:29-->
*Window for display the coordinates memorized
*{{Button|Save}}: Save the data in file
*{{Button|Clear}}: Delete and clean the text editor
*{{Button|Delete}}: Delete the selected line
*{{Button|Memorize}}: Memorize and display the coordinate
*{{CheckBox|Macro}}:
**Mode normal {{CheckBox|Macro}} the coordinate is saved in this mode : '''[(0.06,1.30,0.0),(85.0,0.0,0.0)],'''
**Mode macro {{CheckBox|TRUE|0,0 Coordinate}} the coordinate is saved in a complete macro directly in your macros directory with the same name of the document extention .FCMacro
*** '''Options of the macro'''
***'''__pompe____engrenage__''' : Name of document
***'''__22 Coordinates__''' : number of coordinates
***'''Type Key Q to Quit''' : Quit the macro
***'''Type Key D to Decrease speed''' : Decrease the speed of the animation
***'''Type Key I to Increase speed''' : Increase the speed of the animation
***'''Type Key P to Pause/Continue or key RETURN or ESCAPE''' : Pause / Anime
***'''Type Key S to Step by Step (key RETURN or ESCAPE to continue)''' : Step by Step
***'''Type Key M for this message''' : Display this memo
***____________________________
*{{CheckBox|Memo on Click}}:
**Mode normal {{CheckBox|Memo on Click}} : The data is not saved on window, you must push the {{Button|Memo (2)}} button for save the coordinate
**Mode Memo on Click {{CheckBox|TRUE|Memo on Demand}} : The data is automaticly saved with all click op the {{Button|Apply}} button

===Command=== <!--T:30-->

<!--T:31-->
*{{KEY|Quit}}: Quit the macro
*{{KEY|Original}}: After modifying the data of the object you can return to the original placement, If you have not deselected the current object.
*{{KEY| 0,0,0 }}: This option places the object in base coordinate {{incode|0, 0, 0}}
*{{KEY|Reset}}: Reset the data in the macro and deselect the current object (same mouse click in the [[3D view]])
</translate>
</translate>
<translate>
<translate>
==Script==
==Script== <!--T:7-->
</translate>
</translate>
<translate>
The icon for you toolbar PNG [[File:Macro Rotate To Point.png]] SVG [[File:Macro Rotate To Point.svg]]
</translate>
'''Macro Rotate To Point.FCMacro'''


ToolBar Icon PNG [[File:Macro Rotate To Point.png]] SVG [[Image:Macro_Rotate_To_Point.svg]]
{{Code|code=

'''Macro_Rotate_To_Point.FCMacro'''

{{MacroCode|code=
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import unicode_literals
"""
"""
***************************************************************************
***************************************************************************
* Copyright (c) 2017 <mario52> *
* Copyright (c) 2017 2018 2019 2020 2021 <mario52> *
* *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* This file is a supplement to the FreeCAD CAx development system. *
Line 59: Line 124:
* the License, or (at your option) any later version. *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* 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, *
* This software is distributed in the hope that it will be useful, *
Line 76: Line 146:
#
#
#
#
#OS: Windows 10
#OS: Windows 10 (10.0)
#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.16.6706 (Git)
#Version: 0.19.23546 (Git)
#Build type: Release
#Build type: Release
#Branch: releases/FreeCAD-0-16
#Branch: master
#Hash: 6b017f9a16b15b0e628c8d874c4058442dee5548
#Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
#Python version: 2.7.8
#Python version: 3.6.8
#Qt version: 4.8.7
#Qt version: 5.12.1
#Coin version: 4.0.0a
#Coin version: 4.0.0a
#OCC version: 6.8.0.oce-0.17
#OCC version: 7.3.0
#Locale: French/Mars (fr_Ma)
#
#
#
__title__ = "Macro_Rotate_To_Point"
__title__ = "Rotate_To_Point"
__author__ = "Mario52"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__url__ = "https://www.freecadweb.org/"
__Wiki__ = "http://www.freecadweb.org/wiki/index.php?title="
__Wiki__ = "https://www.freecadweb.org/wiki/Macro_Rotate_To_Point"
__version__ = "00.00"
__version__ = "00.06"
__date__ = "04/03/2017"
__date__ = "2021/01/12" #YYYY/MM/DD
#

import WebGui
#WebGui.openBrowser("http://www.freecadweb.org/")

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


import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import *
from PySide.QtCore import *
import Draft, Part, PartGui, FreeCADGui, FreeCAD
import Draft, Part, PartGui, FreeCADGui, FreeCAD
from FreeCAD import Base
from FreeCAD import Base
import DraftVecUtils
import DraftVecUtils
import time
#import time


Gui = FreeCADGui
Gui = FreeCADGui
App = FreeCAD
App = FreeCAD


global ui ; ui = ""
global sourisPass ; sourisPass = 0
global sourisPass ; sourisPass = 0
global positionMouse ; positionMouse = ""
global positionMouse ; positionMouse = ""
Line 127: Line 209:
global rotAngleY ; rotAngleY = 0.0
global rotAngleY ; rotAngleY = 0.0
global rotAngleZ ; rotAngleZ = 0.0
global rotAngleZ ; rotAngleZ = 0.0

global saveOnDisk ; saveOnDisk = []
global saveListView ; saveListView = ""
global memorySelected; memorySelected = []
global countMemory ; countMemory = 0

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

global pathFile
#### Configuration ##############################################################
pathFile = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__ ).GetString("setLastPath")
if pathFile == "":
pathFile = path
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__).SetString("setLastPath",pathFile)
####
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__).SetString("Version",__version__ + " (" + __date__ + ")")
#### Configuration ##############################################################

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

boundBox_Center_Icon = [
"24 24 8 1",
" c None",
". c #284871",
"+ c #234C86",
"@ c #314B64",
"# c #EF2929",
"$ c #4A74A4",
"% c #4478AD",
"& c #4E9A06",
" ",
" # ",
" # ",
" # ",
" &&&&&# ",
" & #&&&&&&& ",
" & +#.. && ",
" &&&&&+%#%%. & & ",
" & ++&&&&&&& & ",
" & +$$$$$$&+@ & ",
" & +%$$$$$$&+@ & ",
"####&###$$$$$+&+####### ",
" & +%$$$$++&+@ & ",
" & +%$$$+++&+@ & ",
" & +$$++++&@ & ",
" & ++++++&@ & ",
" & @@@@@& & ",
" & # & & ",
" &&&&& # &&& ",
" &&&&&& ",
" # ",
" # ",
" # ",
" "
]

centerMass_Icon = [
"24 24 9 1",
" c None",
". c #000100",
"+ c #CD0000",
"@ c #6B6014",
"# c #B0A22C",
"$ c #D5B716",
"% c #E9D235",
"& c #F7E66C",
"* c #FBF4BC",
" ",
" ",
" ",
" ",
" ...... ",
" ..#%%%%#.. ",
" .@&&&%%%%%@. ",
" .@&**&%%%%%%@. ",
" .&***&%%%%%%%. ",
" .#&**&%%+%%%%%#. ",
" .%&&&%%++%%%$$%. ",
" .%%%%+++++$$$$$. ",
" .%%%%%+++++$$$$. ",
" .%%%%$$++$$$$$$. ",
" .#%$$$$+$$$$$$#. ",
" .%$$$$$$$$$$%. ",
" .@%$$$$$$$$$@. ",
" .@%$$$$$$%@. ",
" ..#$$$$#.. ",
" ...... ",
" ",
" ",
" ",
" "
]

point_Clicked_Icon = [
"24 24 7 1",
" c None",
". c #730000",
"+ c #9F0000",
"@ c #E90000",
"# c #C39F03",
"$ c #ECD309",
"% c #FBE851",
" ",
" ##### ",
" #%%%%%# ",
" #%%%%%%$# ",
" #%%%%%$$$$# ",
" #%%%%$$$$$# ",
" #%%%+.$$$$# ",
" #%%%++.$$$# ",
" #%%+@+.$# ",
" #%%+@@+.# ",
" ##+@@@+. ",
" +@@@@+. ",
" +@@@@@+. ",
" +@@@@@@+. ",
" +@@@@@@@.. ",
" +@@@@@@@@.. ",
" +@@@@@@@@@.. ",
" +@@@@@@+.... ",
" +@@@@@+ ",
" +@@++@@. ",
" +@+. .@@. ",
" ++. .@. ",
" .+.. ",
" .. "
]

axis_X_Icon = [
"24 24 6 1",
" c None",
". c #000000",
"+ c #A40000",
"@ c #EE2A2A",
"# c #729FCF",
"$ c #B9BCB5",
" $$ $$$$ ",
" $$$$ $ $ ",
" $$$$$$ $ ",
" $$$$$$ $ ",
" $$$$$$$$ $$$ ",
" $$$$ ",
" $$$$ ",
" $$$$ ",
" $$$$ ",
" $$$$ $$ $$",
" $$##$$ $$ $$",
" . . $####$ $$$ ",
" ... +####$ $$ ",
" .. +@####$$ $ ",
" . ... +@@@+$$$$$ $$ ",
" +@@@+ $$$$$ ",
" +@@@+ $$$$$ ",
" +++@@@+ $$$$$$$ ",
" +@@@@+ $$$$$$ ",
" +@@@+ $$$$$ ",
" +++++ $$$$$ ",
" ",
" ",
" "
]

axis_Y_Icon = [
"24 24 7 1",
" c None",
". c #030303",
"+ c #4E9A06",
"@ c #729FCF",
"# c #B9BCB5",
"$ c #BABDB6",
"% c #8AE134",
" $$ #### ",
" $$$$ # # ",
" $$$$$$ # ",
" $$$$$$ # ",
" $$$$$$$$ ### ",
" $$$$ ",
" $$$$ ",
" $$$$ ",
" $$$$ ",
" $$$$ .. ..",
" $$@@$$ .. ..",
" # # $@@@@$ ... ",
" ### $@@@@+ .. ",
" ## $$@@@@%+ . ",
" # ### $$$$$+%%%+ .. ",
" $$$$$ +%%%+ ",
" $$$$$ +%%%+ ",
" $$$$$$$ +%%%+++ ",
" $$$$$$ +%%%%+ ",
" $$$$$ +%%%+ ",
" $$$$$ +++++ ",
" ",
" ",
" "
]

axis_Z_Icon = [
"24 24 6 1",
" c None",
". c #000000",
"+ c #204A87",
"@ c #1D89B6",
"# c #729FCF",
"$ c #B9BCB5",
" ++ ... ",
" +@@+ . ",
" +@@@@+ . ",
" +@@@@+ . ",
" +++@@+++ ... ",
" +@@+ ",
" +@@+ ",
" +@@+ ",
" +@@+ ",
" +@@+ $$ $$",
" ++##++ $$ $$",
" $ $ +####+ $$$ ",
" $$$ $####$ $$ ",
" $$ $$####$$ $ ",
" $ $$$ $$$$$$$$$$ $$ ",
" $$$$$ $$$$$ ",
" $$$$$ $$$$$ ",
" $$$$$$$ $$$$$$$ ",
" $$$$$$ $$$$$$ ",
" $$$$$ $$$$$ ",
" $$$$$ $$$$$ ",
" ",
" ",
" "
]

direction_Icon = [
"24 24 6 1",
" c None",
". c #000000",
"+ c #A40000",
"@ c #EE2A2A",
"# c #565854",
"$ c #729FCF",
" ",
" ",
" +++++ ",
" +@@+ ",
" +@@@+ ",
" +@@@++ ",
" +@@@+ + ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" +@@@+ ",
" + +@@@+ ",
" ++@@@+ ",
" +@@@+ ",
" +@@+ ",
" +++++ ",
" ",
" ",
" "
]

point_Icon = [
"24 24 8 1",
" c None",
". c #000100",
"+ c #B0A22C",
"@ c #E9D235",
"# c #6B6014",
"$ c #F7E66C",
"% c #FBF4BC",
"& c #D5B716",
" ",
" ",
" ",
" ",
" ...... ",
" ..+@@@@+.. ",
" .#$$$@@@@@#. ",
" .#$%%$@@@@@@#. ",
" .$%%%$@@@@@@@. ",
" .+$%%$@@@@@@@@+. ",
" .@$$$@@@@@&&&&&. ",
" .@@@@@@@&&&&&&&. ",
" .@@@@@&&&&&&&&&. ",
" .@@@@&&&&&&&&&&. ",
" .+@@&&&&&&&&&&+. ",
" .@&&&&&&&&&&&. ",
" .#&&&&&&&&&&#. ",
" .#&&&&&&&&#. ",
" ..+&&&&+.. ",
" ...... ",
" ",
" ",
" ",
" "
]

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

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

save_Icon = [
"24 24 9 1",
" c None",
". c #A30500",
"+ c #5D5F5C",
"@ c #3967A0",
"# c #4B9A00",
"$ c #7E9BBD",
"% c #A9ABA8",
"& c #C7C9C6",
"* c #DCDEDB",
" ",
" @@@@@ ",
" @@$$$$$@ ",
" @$$$$$$$@ ",
" @@@@@@$@$$@ ",
" @$@@@ ",
" +%&&&@$@@@@&%%% ",
" +*@@@$@@@@@@@@&% ",
" +%*@@@@@@@@@@@@*&+ ",
" +***@@@@@@@@@@***+ ",
" +%***&@@@@@@@@&****+ ",
" +****&&@@@@@@&&****+ ",
" +***&&&&@@@@&&&&***+ ",
" +%***&&&&&@@&&&&&****+ ",
" +***&&&&&&&&&&&&&&***+ ",
" %********************+ ",
" %********************+ ",
" %&&&&&&&&&&&&&&&&&&&&+ ",
" %&%%%%%%%%%%%%%%%%%%%+ ",
" %&%%%%%%%%%%%%%%%%%%%+ ",
" %&%&&&%%%%%%%@%%#%%.%+ ",
" %%%%%%%%%%%%%%%%%%%%%+ ",
" ++++++++++++++++++++++ ",
" "
]

clear_Icon = [
"24 24 9 1",
" c None",
". c #000200",
"+ c #8B0606",
"@ c #875209",
"# c #E3383A",
"$ c #C19916",
"% c #C4A163",
"& c #E2C928",
"* c #E4D05A",
" @@@ ",
" @%%%@ ",
" @%*@@ ",
" @%@*%@ ",
" @%$$%@ ",
" @%%$%%@ ",
" @%$$$*@ ",
" @$**+++ ",
" @*%+##+. ",
" ++##+*$ ",
" +#++****$ ",
" ++****&**$ ",
" &**&*&&&*$ ",
" &*&&&*&$&*$ ",
" $*&*&$&&$$*$ ",
" $*&$&*$*&*$*$ ",
" *&$$&&$&&&&*$ ",
" $*&$&**$$**@ ",
" $*&$&****&$ ",
" $*$***$$@ ",
" $***$@ @ ",
" $@$@ ",
" @ ",
" "
]

delete_Icon = [
"24 24 3 1",
" c None",
". c #A40000",
"+ c #EE2A2A",
" ",
" ",
" . . ",
" .+. .+. ",
" .+++. .+++. ",
" .+++++. .+++++. ",
" .+++++++. .+++++++. ",
" .+++++++.+++++++. ",
" .+++++++++++++. ",
" .+++++++++++. ",
" .+++++++++. ",
" .+++++++. ",
" .+++++++++. ",
" .+++++++++++. ",
" .+++++++++++++. ",
" .+++++++.+++++++. ",
" .+++++++. .+++++++. ",
" .+++++. .+++++. ",
" .+++. .+++. ",
" .+. .+. ",
" . . ",
" ",
" ",
" "
]

memo_Allume_Icon = [
"24 24 9 1",
" c None",
". c #4F514E",
"+ c #635D41",
"@ c #676966",
"# c #848784",
"$ c #888A87",
"% c #E9D312",
"& c #FEEE4D",
"* c #FDFFFC",
" ",
" ",
" ",
" ",
" %%%%%% ",
" %%&&&&%% ",
" %%&&&&&&%% ",
" %%&&&**&&&%% ",
" %%&&&****&&&%% ",
" %&&&******&&&% ",
" %&&&******&&&% ",
" %&&&******&&&% ",
" %%&&&****&&&%% ",
" %%&&&**&&&%% ",
" %%&&&&&&%% ",
" %%%&&%%% ",
" .%%%%+ ",
" @..... ",
" ..#$$@ ",
" @@.... ",
" ..$$$@ ",
" @@.... ",
" $$$$ ",
" "
]

memo_Eteint_Icon = [
"24 24 9 1",
" c None",
". c #000000",
"+ c #204A87",
"@ c #555753",
"# c #4F514E",
"$ c #635D41",
"% c #676966",
"& c #848784",
"* c #888A87",
" ",
" ",
" ",
" ",
" ...... ",
" ........ ",
" .......... ",
" ............ ",
" ....+.+.+.+... ",
" ...+.+.+.++... ",
" ...@......@... ",
" ...@......@... ",
" ....@....@.... ",
" ....@..@.... ",
" ...@..@... ",
" ..@..@.. ",
" #@..@$ ",
" %##### ",
" ##&**% ",
" %%#### ",
" ##***% ",
" %%#### ",
" **** ",
" "
]

origin_Icon = [
"24 24 14 1",
" c None",
". c #EF2929",
"+ c #A40000",
"@ c #DDDFDC",
"# c #888A85",
"$ c #DDDEDB",
"% c #DCDEDB",
"& c #DCDEDC",
"* c #DBDDDA",
"= c #BABDB6",
"- c #555753",
"; c #729FCF",
"> c #3465A4",
", c #8191AA",
" ",
" ",
" .+ ",
" ..++ ",
" ....++ ",
" .....+++ ",
" ....@#++++ ",
" ....@@@#++++ ",
" ....@@@@@#++++ ",
" ....@@@@$@@#++++ ",
" ....@@@$@@%@@#++++ ",
" ....@@@@@@@@%@@#++++ ",
" ...@@@%%%%&%%*@@#+++ ",
" ..@@@@@@@@@@@@@@@#++ ",
" #@@=#---@@=====@# ",
" #@@=#---@@;>>>;@# ",
" #@@,#---@@;>>>;@# ",
" #@@,#---@@;>>>;@# ",
" #@@=#---@@-----@# ",
" #@@=#---@@@@@@@@# ",
" #@@=##--@@@@@@@@# ",
" ################# ",
" ",
" "
]

zero_Icon = [
"24 24 6 1",
" c None",
". c #CC0000",
"+ c #000000",
"@ c #BABDB6",
"# c #4E9A06",
"$ c #204A87",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" ++@ ..@ ++@ ",
" ++++@ +..+@ ++++@ ",
" ++@ ++@ ++..++@ ++@ ++@",
" +@ +@ +@.. +@ +@ +@",
"######+@###$$#+@######+@",
"######+@###$$#+@######+@",
" ++@ ++@ ++..++@ ++@ ++@",
" ++++ + ++++ + ++++ ",
" ++ ++ ++ ++ ++ ",
" + .. + ",
" ++ ..++ ",
" ++ ..+ ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. "
]

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

code_Python_Icon = [
"24 24 3 1",
" c None",
". c #3B7AAC",
"+ c #EDD400",
" ",
" ++++++++++++++++++++. ",
" + . ",
" + . ",
" + ..... . ",
" + . ..... . ",
" + ....... + . ",
" + ... +++ . ",
" + ........ ++++ . ",
" + ......... +++++ . ",
" + ......... ++++++ . ",
" + ....... +++++++ . ",
" + ...... +++++++++ . ",
" + ..... +++++++++ . ",
" + .... ++++++++ . ",
" + ... +++ . ",
" + . +++++++ . ",
" + +++++ + . ",
" + +++++ . ",
" + . ",
" + . ",
" + . ",
" +.................... ",
" "
]

code_FC_Icon = [
"24 24 5 1",
" c None",
". c #000000",
"+ c #CB0208",
"@ c #204A86",
"# c #BABDB6",
" ",
" ",
" ",
" ",
" ",
"@@@ @@@ @@@ @@@",
"@ @ @ @",
"@ ++# @ @ ++# @",
"@ ++++# @ @ ++++# @",
"@ ++# ++#@ @ ++# ++#@",
"@ +# +#@ @ +# +#@",
"@ +# +#@ @ +# +#@",
"@ +# +#@ @ +# +#@",
"@ ++# ++#@ @ ++# ++#@",
"@ ++++ @ @ ++++ @",
"@ ++ @ @ ++ @",
"@ @ @ @",
"@ @ @ @",
"@@@ @@@ . @@@ @@@",
" .. ",
" . ",
" .. ",
" .. ",
" "
]

rotate_Icon = [
"24 24 4 1",
" c None",
". c #000100",
"+ c #000201",
"@ c #6695BF",
" ",
" ++++++++ ",
" +@@@@@@@@+ ",
" +@@......@@++ ",
" +@@.@@@@@@.@@@+ ++ ",
" +@@.@@++++@@.@@@+@+ ",
" +@@.@@+ +@@.@@@@+ ",
" +@@.@@+ +@@.@@@+ ",
" +@.@@+ +@@.@@@+ ",
" +@.@+ ++@@@@@@@+ ",
" +@.@+ ++@@@@@@+ ",
" +@.@+ +++@@@+ ",
" +@.@+ +++++ ",
" +@.@+ ",
" +@.@@+ ",
" +@@.@@+ +++ ",
" +@@.@@+ +@+ ",
" +@@.@@+++++@@+ ",
" +@@.@@@@@@@@+ ",
" +@@.....@@+ ",
" +@@@@@@@++ ",
" +++++++ ",
" ",
" "
]

translate_Icon = [
"24 24 9 1",
" c None",
". c #000100",
"+ c #000407",
"@ c #6694BF",
"# c #6D92BE",
"$ c #6A93C5",
"% c #6795C0",
"& c #6F93C0",
"* c #6896C1",
" ",
" ",
" .. ",
" .@. ",
" .@@.. ",
" .@@@@. ",
" .@@@@@. ",
" ..........@@@@@@. ",
" +**&%%&@&@@@@@@@. ",
" .............+@@@$.. ",
" +@@@@@@@@@@@@@@@@@@. ",
" ..........+@@@@@@@@@@. ",
" +@@@@@@@@@@@@@@@@@@+ ",
" ........+@@@@@@@@@++ ",
" +@@@@@@@@@@@@@@@. ",
" ..........@@@@@@. ",
" .@@@@@. ",
" .@@@@. ",
" .@@.. ",
" .@. ",
" .. ",
" ",
" ",
" "
]

OnClickApply_Icon = [
"24 24 9 1",
" c None",
". c #910000",
"+ c #F20001",
"@ c #54595E",
"# c #4B9A00",
"$ c #8A8C89",
"% c #B0B2AE",
"& c #FED758",
"* c #DFE1DC",
" ",
" .. ",
" ....... ",
" ....++ ",
" .+.+++ ",
" ....+++++ ",
" $.+++++++%%%% ",
" **$.++++++***&& ",
" %***$.+++++&*&&& ",
" *****$.++++&&&&* ",
" %******$.+++&&&**% ",
" *******&$.++&&&&** ",
" ***&&&&&&$.+&&&&&&& ",
" %*******&&&$.&&&&**% ",
" *********&&&$&&&**** ",
" ********&&&&&&&&&***% ",
" %*******&&&*&&&*&&&**% ",
" %%%%%%%%&&%%%&%%%&&%%$ ",
" %%%$%%%%%%%%%&%@%#%+%$ ",
" %%%$$%%%%%%%%&%%%%%%%$ ",
" %%%%%%%%%%%%%&%%%%%%%$ ",
" $%%%%%%%%%%%%%%%%%%%%$ ",
" @@@@@@@@@@@@@@@@@@@@@ ",
" "
]

normalWork_Icon = [
"24 24 9 1",
" c None",
". c #565854",
"+ c #555753",
"@ c #2E3436",
"# c #FFFFFF",
"$ c #FCE94F",
"% c #FEFEFE",
"& c #EDD400",
"* c #BABDB6",
" ",
" ...................... ",
" . . ",
" . +++++ +++++ . ",
" . . ",
" . . ",
" . +++++ +++++ . ",
" . . ",
" . . ",
" . +++++ +++++ . ",
" . . ",
" . . ",
" ...................... ",
" ",
" ",
" @@@@@@@@@@@@@@@",
" @#$$#########%@",
" @#&&###@@@#@@%@",
" @%&&%########%@",
" @#**#########%@",
" @@@@@@@@@@@@@@@",
" ",
" ",
" "
]


try:
try:
Line 133: Line 1,108:
def _fromUtf8(s):
def _fromUtf8(s):
return 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)

def errorDialog(msg):
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",msg )
diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # PySide # cette fonction met la fenetre en avant
diag.exec_()
class Ui_MainWindow(object):
class Ui_MainWindow(object):
def __init__(self ):
def __init__(self ):
global path, path2
self.window = MainWindow
self.window = MainWindow
self.path = path
################################################

#self.path = FreeCAD.ConfigGet("AppHomePath")
#self.path = FreeCAD.ConfigGet("UserAppData")
#self.path = "your path"
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path
self.path = param.GetString("MacroPath","") + "/" # macro path
self.path = self.path.replace("\\","/")
print "Path for the icons : " , self.path
################################################
self.vueActive = FreeCADGui.ActiveDocument.ActiveView
self.vueActive = FreeCADGui.ActiveDocument.ActiveView
self.click = self.vueActive.addEventCallback("SoMouseButtonEvent",self.souris)
self.click = self.vueActive.addEventCallback("SoMouseButtonEvent",self.souris)
Line 165: Line 1,121:
global sourisPass
global sourisPass
if (info["Button"] == "BUTTON1") and (info["State"] == "DOWN"):
if (info["Button"] == "BUTTON1") and (info["State"] == "DOWN"):
time.sleep(0.02)
#time.sleep(0.02)
sourisPass = 0
sourisPass = 0
#print "ok"
#print("ok")


def setupUi(self, MainWindow):
def setupUi(self, MainWindow):
self.window = MainWindow
self.window = MainWindow
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(330, 255)
global saveListView
MainWindow.setMinimumSize(QtCore.QSize(330, 10))
# MainWindow.resize(360, 300)
MainWindow.setMaximumSize(QtCore.QSize(330, 255))
# MainWindow.setMinimumSize(QtCore.QSize(330, 10))
# MainWindow.setMaximumSize(QtCore.QSize(330, 330))
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))


####
self.fontGlobal_08 = QtGui.QFont() # pour compatibilite
self.groupBox_Rotation = QtWidgets.QGroupBox(self.centralwidget)
self.fontGlobal_08.setFamily("Arial") # pour compatibilite
self.groupBox_Rotation.setEnabled(False)
self.fontGlobal_08.setPointSize(8.0) # pour compatibilite

self.RB_Bond_Box_Center = QtWidgets.QRadioButton()
self.RB_Bond_Box_Center.setChecked(True)
self.RB_Bond_Box_Center.setIcon(QtGui.QIcon(QtGui.QPixmap(boundBox_Center_Icon))) #icone dans une variable
self.RB_Bond_Box_Center.clicked.connect(self.on_RB_CenterRot)

self.RB_Center_Mass = QtWidgets.QRadioButton()
self.RB_Center_Mass.setIcon(QtGui.QIcon(QtGui.QPixmap(centerMass_Icon))) # icone dans une variable
self.RB_Center_Mass.clicked.connect(self.on_RB_CenterRot)

self.RB_Point_Clicked = QtWidgets.QRadioButton()
self.RB_Point_Clicked.setIcon(QtGui.QIcon(QtGui.QPixmap(point_Clicked_Icon))) # icone dans une variable
self.RB_Point_Clicked.clicked.connect(self.on_RB_CenterRot)

####
self.groupBox_Axis = QtWidgets.QGroupBox()
self.groupBox_Axis.setEnabled(False)

self.RB_Rotation_0 = QtWidgets.QRadioButton() # factice pour bouton invisible
self.RB_Rotation_0.setVisible(False)
# self.RB_Rotation_0.clicked.connect(self.on_RB_Rotation_0)

self.RB_Rotation_X = QtWidgets.QRadioButton()
self.RB_Rotation_X.setChecked(True)
self.RB_Rotation_X.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Z_Icon))) # icone dans une variable
self.RB_Rotation_X.clicked.connect(self.on_RB_Rotation_X)

self.RB_Rotation_Y = QtWidgets.QRadioButton()
self.RB_Rotation_Y.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Y_Icon))) # icone dans une variable
self.RB_Rotation_Y.clicked.connect(self.on_RB_Rotation_Y)
# self.RB_Angle_Y.setFont(QtGui.QFont(self.FontImpost,weight=QtGui.QFont.Bold)) # Bold
# self.RB_Angle_Y.setStyleSheet("color : #008700") # Color text

self.RB_Rotation_Z = QtWidgets.QRadioButton()
self.RB_Rotation_Z.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_X_Icon))) # icone dans une variable
self.RB_Rotation_Z.clicked.connect(self.on_RB_Rotation_Z)

self.RB_Direction_D = QtWidgets.QRadioButton()
self.RB_Direction_D.setIcon(QtGui.QIcon(QtGui.QPixmap(direction_Icon))) # icone dans une variable
self.RB_Direction_D.clicked.connect(self.on_RB_Direction_D)
####

self.groupBox_Pos_Mouse = QtWidgets.QGroupBox()
self.groupBox_Pos_Mouse.setEnabled(False)

self.DS_Pos_Mouse_X = QtWidgets.QDoubleSpinBox()
self.DS_Pos_Mouse_X.setMinimum(-999999.9)
self.DS_Pos_Mouse_X.setMaximum(99999999.9)
self.DS_Pos_Mouse_X.setDecimals(6)
self.DS_Pos_Mouse_X.setSuffix(" X")
# self.DS_Pos_Mouse_X.setIcon(QtGui.QIcon(QtGui.QPixmap(CameraToFace))) # icone dans une variable
self.DS_Pos_Mouse_X.valueChanged.connect(self.on_DS_Pos_Mouse_X)

self.DS_Pos_Mouse_Y = QtWidgets.QDoubleSpinBox()
self.DS_Pos_Mouse_Y.setMinimum(-999999.9)
self.DS_Pos_Mouse_Y.setMaximum(99999999.9)
self.DS_Pos_Mouse_Y.setDecimals(6)
self.DS_Pos_Mouse_Y.setSuffix(" Y")
# self.PB_To_Face.setIcon(QtGui.QIcon(QtGui.QPixmap(CameraToFace))) # icone dans une variable
self.DS_Pos_Mouse_Y.valueChanged.connect(self.on_DS_Pos_Mouse_Y)

self.DS_Pos_Mouse_Z = QtWidgets.QDoubleSpinBox()
self.DS_Pos_Mouse_Z.setMinimum(-999999.9)
self.DS_Pos_Mouse_Z.setMaximum(99999999.9)
self.DS_Pos_Mouse_Z.setDecimals(6)
self.DS_Pos_Mouse_Z.setSuffix(" Z")
# self.PB_To_Face.setIcon(QtGui.QIcon(QtGui.QPixmap(CameraToFace))) # icone dans une variable
self.DS_Pos_Mouse_Z.valueChanged.connect(self.on_DS_Pos_Mouse_Z)

####
self.groupBox_Work = QtWidgets.QGroupBox()
self.groupBox_Work.setEnabled(False)


self.SC_Slider_Bar = QtGui.QSlider(self.centralwidget)
# self.SC_Slider_Bar = QtWidgets.QSlider()
self.SC_Slider_Bar.setGeometry(QtCore.QRect(20, 180, 291, 22))
# self.SC_Slider_Bar.setMinimum(0.0)
self.SC_Slider_Bar.setFont(self.fontGlobal_08) #
# self.SC_Slider_Bar.setMaximum(359.0)
self.SC_Slider_Bar.setMinimum(-360.0)
# self.SC_Slider_Bar.setValue(0.0)
self.SC_Slider_Bar.setMaximum(360.0)
# self.SC_Slider_Bar.setSliderPosition(0)
self.SC_Slider_Bar.setValue(0.0)
# self.SC_Slider_Bar.setOrientation(QtCore.Qt.Horizontal)
self.SC_Slider_Bar.setSliderPosition(0)
# self.SC_Slider_Bar.valueChanged.connect(self.on_SC_Slider_Bar)
self.SC_Slider_Bar.setOrientation(QtCore.Qt.Horizontal)
self.SC_Slider_Bar.setObjectName(_fromUtf8("SC_Slider_Bar"))
self.SC_Slider_Bar.valueChanged.connect(self.on_SC_Slider_Bar)


self.LE_Increment = QtGui.QLineEdit(self.centralwidget)
self.LE_Increment = QtWidgets.QLineEdit()
self.LE_Increment.setGeometry(QtCore.QRect(20,150,121,22))
self.LE_Increment.setFont(self.fontGlobal_08) #
self.LE_Increment.setObjectName(_fromUtf8("LE_Increment"))
self.LE_Increment.setToolTip("Display the original Data + the modification")
self.LE_Increment.setReadOnly(True)
self.LE_Increment.setReadOnly(True)
self.LE_Increment.setText(str(0.0))
self.LE_Increment.setText(str(0.0))
Line 203: Line 1,225:
self.LE_Increment.textChanged.connect(self.on_LE_Increment_Pressed)
self.LE_Increment.textChanged.connect(self.on_LE_Increment_Pressed)


self.DS_Scroll_Bar = QtGui.QDoubleSpinBox(self.centralwidget)
self.DS_Scroll_Bar = QtWidgets.QDoubleSpinBox()
self.DS_Scroll_Bar.setGeometry(QtCore.QRect(150,150,91,22))
self.DS_Scroll_Bar.setFont(self.fontGlobal_08) #
self.DS_Scroll_Bar.setMinimum(-360.0)
self.DS_Scroll_Bar.setMinimum(-360.0)
self.DS_Scroll_Bar.setMaximum(360.0)
self.DS_Scroll_Bar.setMaximum(360.0)
self.DS_Scroll_Bar.setSuffix(" Degrees")
self.DS_Scroll_Bar.setDecimals(4)
self.DS_Scroll_Bar.setDecimals(4)
self.DS_Scroll_Bar.setObjectName(_fromUtf8("DS_Scroll_Bar"))
self.DS_Scroll_Bar.setToolTip("Enter the modification")
self.DS_Scroll_Bar.valueChanged.connect(self.on_DS_Scroll_Bar)
self.DS_Scroll_Bar.valueChanged.connect(self.on_DS_Scroll_Bar)


self.PB_Apply = QtGui.QPushButton(self.centralwidget)
self.PB_Apply = QtWidgets.QPushButton()
self.PB_Apply.setGeometry(QtCore.QRect(250, 150, 61, 23))
self.PB_Apply.setAutoRepeat(True)
self.PB_Apply.setFont(self.fontGlobal_08) #
self.PB_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(apply_Icon))) # icone dans une variable
self.PB_Apply.setObjectName(_fromUtf8("PB_Apply"))
self.PB_Apply.setToolTip("Apply the modification")
self.PB_Apply.clicked.connect(self.on_PB_Apply_clicked)
self.PB_Apply.clicked.connect(self.on_PB_Apply_clicked)


self.groupBox_Axis = QtGui.QGroupBox(self.centralwidget)
self.CB_Position = QtWidgets.QCheckBox()
self.groupBox_Axis.setGeometry(QtCore.QRect(150, 20, 161, 91))
#self.CB_Position.setEnabled(False)
self.groupBox_Axis.setFont(self.fontGlobal_08) #
self.CB_Position.setIcon(QtGui.QIcon(QtGui.QPixmap(translate_Icon))) #icone dans une variable
self.groupBox_Axis.setEnabled(False)
self.CB_Position.clicked.connect(self.on_CB_Position)
self.groupBox_Axis.setObjectName(_fromUtf8("groupBox_Axis"))


# self.CB_Point = QtWidgets.QCheckBox()
####
self.RB_Rotation_0 = QtGui.QRadioButton(self.groupBox_Axis)
# self.CB_Point.setEnabled(False)
self.RB_Rotation_0.setGeometry(QtCore.QRect(10, 60, 111, 17))
# self.CB_Point.clicked.connect(self.on_CB_Point)
self.RB_Rotation_0.setFont(self.fontGlobal_08) #
self.PB_Point = QtWidgets.QPushButton()
self.RB_Rotation_0.setObjectName(_fromUtf8("RB_Rotation_0"))
#self.PB_Point.setEnabled(False)
self.PB_Point.setIcon(QtGui.QIcon(QtGui.QPixmap(point_Icon))) # icone dans une variable
self.RB_Rotation_0.setVisible(False)
# self.RB_Rotation_0.clicked.connect(self.on_RB_Rotation_0)
self.PB_Point.clicked.connect(self.on_CB_Point)


self.RB_Rotation_Z = QtGui.QRadioButton(self.groupBox_Axis)
# self.CB_Free = QtWidgets.QCheckBox()
self.RB_Rotation_Z.setGeometry(QtCore.QRect(10, 60, 111, 17))
# self.CB_Free.setEnabled(False)
self.RB_Rotation_Z.setFont(self.fontGlobal_08) #
## self.CB_Free.clicked.connect(self.on_CB_Free)
self.RB_Rotation_Z.setObjectName(_fromUtf8("RB_Rotation_Z"))
self.RB_Rotation_Z.setToolTip("Rotation on Axis Roll (X)")
self.RB_Rotation_Z.clicked.connect(self.on_RB_Rotation_Z)


self.RB_Rotation_Y = QtGui.QRadioButton(self.groupBox_Axis)
self.groupBox_Data = QtWidgets.QGroupBox()
self.RB_Rotation_Y.setGeometry(QtCore.QRect(10, 40, 111, 17))
self.groupBox_Data.setEnabled(False)
self.RB_Rotation_Y.setFont(self.fontGlobal_08) #
self.RB_Rotation_Y.setObjectName(_fromUtf8("RB_Rotation_Y"))
self.RB_Rotation_Y.setToolTip("Rotation on Axis Pitch (Y)")
self.RB_Rotation_Y.clicked.connect(self.on_RB_Rotation_Y)


self.RB_Rotation_X = QtGui.QRadioButton(self.groupBox_Axis)
self.TE_Memorize = QtWidgets.QListView()
saveListView = QtGui.QStandardItemModel()
self.RB_Rotation_X.setGeometry(QtCore.QRect(10, 20, 111, 17))
self.RB_Rotation_X.setFont(self.fontGlobal_08) #
self.TE_Memorize.setModel(saveListView)
self.RB_Rotation_X.setChecked(True)
self.TE_Memorize.setSelectionRectVisible(True)#
self.RB_Rotation_X.setObjectName(_fromUtf8("RB_Rotation_X"))
self.TE_Memorize.setAlternatingRowColors(True)#
self.RB_Rotation_X.setToolTip("Rotation on Axis Yaw (Z)")
self.TE_Memorize.setStyleSheet("alternate-background-color:#fdeeee;")
self.RB_Rotation_X.clicked.connect(self.on_RB_Rotation_X)
self.TE_Memorize.clicked[QtCore.QModelIndex].connect(self.on_TE_Clicked)
####


self.groupBox_Rotation = QtGui.QGroupBox(self.centralwidget)
self.PB_Save_Memorize = QtWidgets.QPushButton()
self.PB_Save_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(save_Icon))) # icone dans une variable
self.groupBox_Rotation.setGeometry(QtCore.QRect(20, 20, 121, 91))
self.groupBox_Rotation.setFont(self.fontGlobal_08) #
self.PB_Save_Memorize.clicked.connect(self.on_PB_Save_Memorize)
self.groupBox_Rotation.setEnabled(False)
self.groupBox_Rotation.setObjectName(_fromUtf8("groupBox_Rotation"))


self.RB_Point_Clicked = QtGui.QRadioButton(self.groupBox_Rotation)
self.PB_ClearMemo = QtWidgets.QPushButton()
self.PB_ClearMemo.setIcon(QtGui.QIcon(QtGui.QPixmap(clear_Icon))) # icone dans une variable
self.RB_Point_Clicked.setGeometry(QtCore.QRect(10, 60, 111, 17))
self.RB_Point_Clicked.setFont(self.fontGlobal_08) #
self.PB_ClearMemo.clicked.connect(self.on_PB_ClearMemo)
self.RB_Point_Clicked.setObjectName(_fromUtf8("RB_Point_Clicked"))
self.RB_Point_Clicked.setToolTip("Point rotation on Point Mouse clicked on the object"+"\n"
"If twoo points are clicked, the second point is used for axis rotation"+"\n"
"The point axis rotation Can be changed during the work as long as the object is selected"+"\n"
"For this press the CTRL KEY and click the new point rotation")
self.RB_Point_Clicked.clicked.connect(self.on_RB_CenterRot)


self.RB_Center_Mass = QtGui.QRadioButton(self.groupBox_Rotation)
self.PB_Delete_Line_Memory = QtWidgets.QPushButton()
self.PB_Delete_Line_Memory.setIcon(QtGui.QIcon(QtGui.QPixmap(delete_Icon))) # icone dans une variable
self.RB_Center_Mass.setGeometry(QtCore.QRect(10, 40, 111, 17))
self.RB_Center_Mass.setFont(self.fontGlobal_08) #
self.PB_Delete_Line_Memory.clicked.connect(self.on_PB_Delete_Line_Memory)
self.RB_Center_Mass.setObjectName(_fromUtf8("RB_Center_Mass"))
self.RB_Center_Mass.setToolTip("Point rotation on Center Mass")
self.RB_Center_Mass.clicked.connect(self.on_RB_CenterRot)


self.RB_Bond_Box_Center = QtGui.QRadioButton(self.groupBox_Rotation)
self.PB_Memorize = QtWidgets.QPushButton()
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable
self.RB_Bond_Box_Center.setGeometry(QtCore.QRect(10, 20, 111, 17))
self.RB_Bond_Box_Center.setFont(self.fontGlobal_08) #
self.PB_Memorize.clicked.connect(self.on_PB_Memorize)
self.RB_Bond_Box_Center.setChecked(True)
self.RB_Bond_Box_Center.setObjectName(_fromUtf8("RB_Bond_Box_Center"))
self.RB_Bond_Box_Center.setToolTip("Point rotation on BoundBox Center")
self.RB_Bond_Box_Center.clicked.connect(self.on_RB_CenterRot)


self.CB_Position = QtGui.QCheckBox(self.centralwidget)
self.CB_On_Click_Apply = QtWidgets.QCheckBox()
self.CB_On_Click_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(OnClickApply_Icon))) # icone dans une variable
self.CB_Position.setGeometry(QtCore.QRect(20, 120, 71, 17))
self.CB_Position.setFont(self.fontGlobal_08) #
self.CB_On_Click_Apply.clicked.connect(self.on_CB_On_Click_Apply)
self.CB_Position.setEnabled(False)
self.CB_Position.setObjectName(_fromUtf8("CB_Position"))
self.CB_Position.setToolTip("Move the object to axis choice X, Y or Z")
self.CB_Position.clicked.connect(self.on_CB_Position)


self.CB_Point = QtGui.QCheckBox(self.centralwidget)
self.CB_DataInMacro = QtWidgets.QCheckBox()
self.CB_DataInMacro.setIcon(QtGui.QIcon(QtGui.QPixmap(code_Python_Icon))) # icone dans une variable
self.CB_Point.setGeometry(QtCore.QRect(150, 120, 51, 17))
self.CB_Point.setFont(self.fontGlobal_08) #
self.CB_DataInMacro.clicked.connect(self.On_CB_DataInMacro)
self.CB_Point.setEnabled(False)
self.CB_Point.setObjectName(_fromUtf8("CB_Point"))
self.CB_Point.setToolTip("If checked, create one point to visualise the point rotation")
self.CB_Point.clicked.connect(self.on_CB_Point)


self.CB_Free = QtGui.QCheckBox(self.centralwidget)
self.label_00 = QtWidgets.QLabel()
self.CB_Free.setGeometry(QtCore.QRect(270, 120, 71, 17))
self.CB_Free.setFont(self.fontGlobal_08) #
self.CB_Free.setEnabled(False)
self.CB_Free.setObjectName(_fromUtf8("CB_Free"))
self.CB_Free.setToolTip("This checkBox switch the Application button")
# self.CB_Free.clicked.connect(self.on_CB_Free)

self.label_00 = QtGui.QLabel(self.centralwidget)
self.label_00.setGeometry(QtCore.QRect(22, 201, 291, 16))
self.label_00.setFont(self.fontGlobal_08) #
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
#self.label_00.setToolTip("Display the modification Axis and Rotation or Position")
#self.label_00.setToolTip("Display the modification Axis and Rotation or Position")
####
self.label_00.setObjectName(_fromUtf8("label_00"))


self.PB_Reset = QtGui.QPushButton(self.centralwidget)
self.groupBox_Command = QtWidgets.QGroupBox()
self.PB_Reset.setGeometry(QtCore.QRect(247, 220, 65, 23))
self.PB_Reset.setFont(self.fontGlobal_08) #
self.PB_Reset.setObjectName(_fromUtf8("PB_Reset"))
self.PB_Reset.setToolTip("Reset the complete data macro")
self.PB_Reset.clicked.connect(self.on_PB_Reset_clicked)


self.PB_Zero = QtGui.QPushButton(self.centralwidget)
self.PB_Quit = QtWidgets.QPushButton()
self.PB_Quit.setIcon(QtGui.QIcon(QtGui.QPixmap(quit_Icon))) # icone dans une variable
self.PB_Zero.setGeometry(QtCore.QRect(171, 220, 65, 23))
self.PB_Zero.setFont(self.fontGlobal_08) #
self.PB_Quit.clicked.connect(self.on_PB_Quit_clicked)
self.PB_Zero.setObjectName(_fromUtf8("PB_Zero"))
self.PB_Zero.setToolTip("Move the object to the base coordinates 0, 0, 0")
self.PB_Zero.clicked.connect(self.on_PB_Zero_clicked)


self.PB_Original = QtGui.QPushButton(self.centralwidget)
self.PB_Original = QtWidgets.QPushButton()
self.PB_Original.setGeometry(QtCore.QRect(95, 220, 65, 23))
self.PB_Original.setIcon(QtGui.QIcon(QtGui.QPixmap(origin_Icon))) # icone dans une variable
self.PB_Original.setFont(self.fontGlobal_08) #
self.PB_Original.setObjectName(_fromUtf8("PB_Original"))
self.PB_Original.setToolTip("Move the object to the original position")
self.PB_Original.clicked.connect(self.on_PB_Original_clicked)
self.PB_Original.clicked.connect(self.on_PB_Original_clicked)


self.PB_Quit = QtGui.QPushButton(self.centralwidget)
self.PB_Zero = QtWidgets.QPushButton()
self.PB_Zero.setIcon(QtGui.QIcon(QtGui.QPixmap(zero_Icon))) # icone dans une variable
self.PB_Quit.setGeometry(QtCore.QRect(20, 220, 65, 23))
self.PB_Quit.setFont(self.fontGlobal_08) #
self.PB_Zero.clicked.connect(self.on_PB_Zero_clicked)

self.PB_Quit.setObjectName(_fromUtf8("PB_Quit"))
self.PB_Quit.setToolTip("Quite the macro")
self.PB_Reset = QtWidgets.QPushButton()
self.PB_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(reset_Icon))) # icone dans une variable
self.PB_Quit.clicked.connect(self.on_PB_Quit_clicked)
self.PB_Reset.clicked.connect(self.on_PB_Reset_clicked)

#### Gridlayout Header
self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.gridLayout_00_00 = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout_00_00.setContentsMargins(10, 10, 10, 10)#Gauche Haut Droit Bas
#### Gridlayout Header
#### Gridlayout BEGIN
self.grid_00_01 = QtWidgets.QGridLayout()
# self.gridLayoutWidget_3 = QtWidgets.QWidget(self.groupBox_Rotation)
self.grid_00_01.addWidget(self.groupBox_Rotation, 0, 0, 1, 1)
self.grid_00_01.setContentsMargins(0, 0, 0, 0) #Gauche Haut Droite Bas
self.grid_00_01_00 = QtWidgets.QGridLayout(self.groupBox_Rotation)
self.grid_00_01_00.setContentsMargins(10, 10, 0, 10)
self.grid_00_01_00.addWidget(self.RB_Bond_Box_Center, 0, 0, 1, 1)
self.grid_00_01_00.addWidget(self.RB_Center_Mass, 1, 0, 1, 1)
self.grid_00_01_00.addWidget(self.RB_Point_Clicked, 2, 0, 1, 1)
self.gridLayout_00_00.addLayout(self.grid_00_01, 0, 0, 1, 1)
####
self.grid_00_02 = QtWidgets.QGridLayout()
self.grid_00_02.addWidget(self.groupBox_Axis, 0, 0, 1, 1)
self.grid_00_02.setContentsMargins(0, 0, 0, 0)
self.grid_00_02_00 = QtWidgets.QGridLayout(self.groupBox_Axis)
self.grid_00_02_00.setContentsMargins(10, 10, 0, 10)
self.grid_00_02_00.addWidget(self.RB_Rotation_X, 0, 0, 1, 1)
self.grid_00_02_00.addWidget(self.RB_Rotation_Y, 1, 0, 1, 1)
self.grid_00_02_00.addWidget(self.RB_Rotation_Z, 2, 0, 1, 1)
self.grid_00_02_00.addWidget(self.RB_Direction_D, 3, 0, 1, 1)
self.gridLayout_00_00.addLayout(self.grid_00_02, 0, 1, 1, 1)
####
self.grid_00_03 = QtWidgets.QGridLayout()
self.grid_00_03.addWidget(self.groupBox_Pos_Mouse, 1, 0, 1, 1)
self.grid_00_03.setContentsMargins(0, 0, 0, 0)
self.grid_00_03_00 = QtWidgets.QGridLayout(self.groupBox_Pos_Mouse)
self.grid_00_03_00.setContentsMargins(10, 10, 10, 10)
self.grid_00_03_00.addWidget(self.DS_Pos_Mouse_X, 0, 0, 1, 1)
self.grid_00_03_00.addWidget(self.DS_Pos_Mouse_Y, 0, 1, 1, 1)
self.grid_00_03_00.addWidget(self.DS_Pos_Mouse_Z, 0, 2, 1, 1)
self.gridLayout_00_00.addLayout(self.grid_00_03, 1, 0, 1, 2)
####
self.grid_00_044 = QtWidgets.QGridLayout()
self.grid_00_044.addWidget(self.groupBox_Work, 2, 0, 1, 1)
self.grid_00_044.setContentsMargins(0, 0, 0, 0)
self.grid_00_044_00 = QtWidgets.QGridLayout(self.groupBox_Work)
self.grid_00_044_00.addWidget(self.CB_Position, 0, 0, 1, 1)
self.grid_00_044_00.addWidget(self.PB_Point, 0, 1, 1, 1)
# self.grid_00_044_00.addWidget(self.CB_Free, 0, 2, 1, 1)
self.grid_00_044_00.addWidget(self.LE_Increment, 1, 0, 1, 1)
self.grid_00_044_00.addWidget(self.DS_Scroll_Bar, 1, 1, 1, 1)
self.grid_00_044_00.addWidget(self.PB_Apply, 1, 2, 1, 1)
self.grid_00_044_00.addWidget(self.label_00, 2, 0, 1, 3)
# self.grid_00_044_00.addWidget(self.SC_Slider_Bar, 2, 0, 1, 3)
self.gridLayout_00_00.addLayout(self.grid_00_044, 2, 0, 1, 2)
####
self.grid_00_044b = QtWidgets.QGridLayout()
self.grid_00_044b.addWidget(self.groupBox_Data, 3, 0, 1, 1)
self.grid_00_044b.setContentsMargins(0, 0, 0, 0)
self.grid_00_044b_00 = QtWidgets.QGridLayout(self.groupBox_Data)
self.grid_00_044b_00.addWidget(self.TE_Memorize, 0, 0, 1, 4)
self.grid_00_044b_00.addWidget(self.PB_Save_Memorize, 1, 0, 1, 1)
self.grid_00_044b_00.addWidget(self.PB_ClearMemo, 1, 1, 1, 1)
self.grid_00_044b_00.addWidget(self.PB_Delete_Line_Memory, 1, 2, 1, 1)
self.grid_00_044b_00.addWidget(self.PB_Memorize, 1, 3, 1, 1)
self.grid_00_044b_00.addWidget(self.CB_DataInMacro, 2, 0, 1, 1)
self.grid_00_044b_00.addWidget(self.CB_On_Click_Apply, 2, 1, 1, 1)
self.gridLayout_00_00.addLayout(self.grid_00_044b, 3, 0, 1, 2)
####
self.grid_00_08 = QtWidgets.QGridLayout()
self.grid_00_08.addWidget(self.groupBox_Command, 4, 0, 1, 1)
self.grid_00_08.setContentsMargins(0, 0, 0, 0)
self.grid_00_08_00 = QtWidgets.QGridLayout(self.groupBox_Command)
self.grid_00_08_00.addWidget(self.PB_Quit, 0, 0, 1, 1)
self.grid_00_08_00.addWidget(self.PB_Original, 0, 1, 1, 1)
self.grid_00_08_00.addWidget(self.PB_Zero, 0, 2, 1, 1)
self.grid_00_08_00.addWidget(self.PB_Reset, 0, 3, 1, 1)
self.gridLayout_00_00.addLayout(self.grid_00_08, 4, 0, 1, 2)
#### Gridlayout END


MainWindow.setCentralWidget(self.centralwidget)
MainWindow.setCentralWidget(self.centralwidget)
Line 353: Line 1,394:


def retranslateUi(self, MainWindow):
def retranslateUi(self, MainWindow):
global path
MainWindow.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # this function turns the front window (stay to hint)
MainWindow.setWindowTitle("Macro_Rotate_To_Point")
self.groupBox_Axis.setTitle("Axis Rotation")
self.RB_Rotation_Z.setText("Rotation(X) Roll")
self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
self.RB_Rotation_X.setText("Rotation(Z) Yaw")
self.groupBox_Rotation.setTitle("Point Rotation")
self.RB_Center_Mass.setText("Center of Mass")
self.RB_Point_Clicked.setText("Point clicked")
self.RB_Bond_Box_Center.setText("Bounbox Center")
self.CB_Position.setText("Position")
self.CB_Point.setText("Point")
self.CB_Free.setText("Free")
self.PB_Apply.setText("Apply")
self.PB_Original.setText("Original")
self.PB_Reset.setText("Reset")
self.PB_Quit.setText("Quit")
self.PB_Zero.setText("0,0,0")
self.label_00.setText(" Select one Object")


MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint) # this function turns the front window (stay to hint)
def on_SC_Slider_Bar(self,val):
MainWindow.setWindowIcon(QtGui.QIcon(self.path+"Macro_Rotate_To_Point.png")) # change l'icone de la fenetre principale
global valeur
MainWindow.setWindowTitle(__title__ + " (" + __version__ + " : " + __date__ + " (rmu)")

_translate = QtCore.QCoreApplication.translate
self.groupBox_Rotation.setTitle(_translate("MainWindow", "Point Rotation"))
self.RB_Bond_Box_Center.setText(_translate("MainWindow", "Bounbox Center"))
self.RB_Bond_Box_Center.setToolTip(_translate("MainWindow", "Point rotation on BoundBox Center"))
self.RB_Center_Mass.setText(_translate("MainWindow", "Center of Mass"))
self.RB_Center_Mass.setToolTip(_translate("MainWindow", "Point rotation on Center Mass"))
self.RB_Point_Clicked.setText(_translate("MainWindow", "Point clicked"))
self.RB_Point_Clicked.setToolTip(_translate("MainWindow", "Point rotation on Point Mouse clicked on the object"+"\n"
"If twoo points are clicked, the second point is used for axis rotation"+"\n"
"The point axis rotation Can be changed during the work as long as the object is selected"+"\n"
"For this press the CTRL KEY and click the new point rotation"))
####
self.groupBox_Axis.setTitle(_translate("MainWindow", "Axis Rotation"))
self.RB_Rotation_X.setText(_translate("MainWindow", "Rotation(Z) Yaw"))
self.RB_Rotation_X.setToolTip(_translate("MainWindow", "Rotation on Axis Yaw (Z)"))
self.RB_Rotation_Y.setText(_translate("MainWindow", "Rotation(Y) Pitch"))
self.RB_Rotation_Y.setToolTip(_translate("MainWindow", "Rotation on Axis Pitch (Y)"))
self.RB_Rotation_Z.setText(_translate("MainWindow", "Rotation(X) Roll"))
self.RB_Rotation_Z.setToolTip(_translate("MainWindow", "Rotation on Axis Roll (X)"))
self.RB_Direction_D.setText(_translate("MainWindow", "Direction"))
self.RB_Direction_D.setToolTip(_translate("MainWindow", "Rotation or Translation on Direction" + "\n"
"For use the Direction option:" + "\n"
"Select First: the object to Rotate/Translate" + "\n"
"Second: the path: Line, Wire or Edge"))
####
self.groupBox_Work.setTitle(_translate("MainWindow", "Work"))
self.groupBox_Pos_Mouse.setTitle(_translate("MainWindow", "Coordinates Point clicked"))
self.groupBox_Pos_Mouse.setToolTip(_translate("MainWindow", "Position click mouse modification possible only with mode Point clicked"))
self.DS_Pos_Mouse_X.setToolTip(_translate("MainWindow", "Position click mouse X" + "\n" +
"modification only with mode Point clicked"))
self.DS_Pos_Mouse_Y.setToolTip(_translate("MainWindow", "Position click mouse Y" + "\n" +
"modification only with mode Point clicked"))
self.DS_Pos_Mouse_Z.setToolTip(_translate("MainWindow", "Position click mouse Z" + "\n" +
"modification only with mode Point clicked"))
self.CB_Position.setText(_translate("MainWindow", "Translation"))
self.CB_Position.setToolTip(_translate("MainWindow", "Check for move the object to axis choice X, Y or Z"))
#self.CB_Point.setText(_translate("MainWindow", "Point"))
#self.CB_Point.setToolTip(_translate("MainWindow", "If checked, create one point to visualise the point rotation"))
self.PB_Point.setText(_translate("MainWindow", "Point"))
self.PB_Point.setToolTip(_translate("MainWindow", "Create one point to visualise the point rotation"))
#self.CB_Free.setText(_translate("MainWindow", "Free"))
#self.CB_Free.setToolTip(_translate("MainWindow", "This checkBox switch the Application button"))
self.LE_Increment.setToolTip(_translate("MainWindow", "Display the original Data + the modification"))
self.DS_Scroll_Bar.setToolTip(_translate("MainWindow", "Enter the modification"))
self.PB_Apply.setToolTip(_translate("MainWindow", "Apply the modification"))
self.PB_Apply.setText(_translate("MainWindow", "Apply"))
self.label_00.setText(_translate("MainWindow", " Select one Object or give one value Angle/Dimension"))
####
self.groupBox_Data.setTitle(_translate("MainWindow", "Data"))
self.PB_Save_Memorize.setText(_translate("MainWindow", "Save"))
self.PB_Save_Memorize.setToolTip(_translate("MainWindow", "Save the memorized placement" + "\n"
"Format to save : [Placement.Base], [Placement.Rotation.toEuler]" + "\n"
"Ex: [0.0,0.0,0.0],[0.0,0.0,0.0] with the ext: .CoorInfo" + "\n"
"If the file exist, the data is saved in Append (adding) mode" + "\n"
"If the CheckBox is checked for a Macro the file is saved in Write mode"))
self.PB_ClearMemo.setText(_translate("MainWindow", "Clear"))
self.PB_ClearMemo.setToolTip(_translate("MainWindow", "Clear the memo data" + "\n"
"The Reset button is not actif for this option"))
self.PB_Delete_Line_Memory.setText(_translate("MainWindow", "Delete"))
self.PB_Delete_Line_Memory.setToolTip(_translate("MainWindow", "Delete the line selected"))
self.PB_Memorize.setText(_translate("MainWindow", "Memorize"))
self.PB_Memorize.setToolTip(_translate("MainWindow", "Memorize the placement displayed"))
self.CB_DataInMacro.setText(_translate("MainWindow", "Macro"))
self.CB_DataInMacro.setToolTip(_translate("MainWindow", "If checked, the coordinate is saved in Python code (complete macro) in your Macro directory" + "\n"
"Actual : " + path + "\n"
"Select the object and run the macro" + "\n"
"\t" + "The macro saved has various options :" + "\n"
"\t" + " (Q)uit, (D)ecrease, (I)ncrease, (P)ause, (S)tep, (M)emo" + "\n"
"If this is not checked, the data hare saved in coordinate mode" + "\n"
"\t" + "Ex: [0.0,0.0,0.0],[0.0,0.0,0.0] with the ext: .CoorInfo" + "\n"))
self.CB_On_Click_Apply.setText(_translate("MainWindow", "Memo on click"))
self.CB_On_Click_Apply.setToolTip(_translate("MainWindow", "Memorize the coordinates on all Click Apply button"))
####
self.groupBox_Command.setTitle(_translate("MainWindow", "Command"))
self.PB_Quit.setText(_translate("MainWindow", "Quit"))
self.PB_Quit.setToolTip(_translate("MainWindow", "Quite the macro"))
self.PB_Original.setText(_translate("MainWindow", "Original"))
self.PB_Original.setToolTip(_translate("MainWindow", "Move the object to the original position"))
self.PB_Reset.setText(_translate("MainWindow", "Reset"))
self.PB_Reset.setToolTip(_translate("MainWindow", "Reset the complete data macro"))
self.PB_Zero.setText(_translate("MainWindow", "0,0,0"))
self.PB_Zero.setToolTip(_translate("MainWindow", "Move the object to the base coordinates 0, 0, 0"))


def on_DS_Pos_Mouse_X(self,val):
global positionMouse
global axisX

positionMouse = [val, positionMouse[1], positionMouse[2]]
axisX = positionMouse[0]
self.DS_Pos_Mouse_X.setValue(axisX)
# print("on_DS_Pos_Mouse_X ", val)

def on_DS_Pos_Mouse_Y(self,val):
global positionMouse
global axisY

positionMouse = [positionMouse[0], val, positionMouse[2]]
axisY = positionMouse[1]
self.DS_Pos_Mouse_Y.setValue(axisY)
# print("on_DS_Pos_Mouse_Y ", val)

def on_DS_Pos_Mouse_Z(self,val):
global positionMouse
global axisZ

positionMouse = [positionMouse[0], positionMouse[1], val]
axisZ = positionMouse[2]
self.DS_Pos_Mouse_Z.setValue(axisZ)
# print("on_DS_Pos_Mouse_Z ", val)

# def on_SC_Slider_Bar(self,val):
# global ui
# global valeur
# global myObject
#
# if (myObject != "") and (self.CB_Free.isChecked()):
# valeur = val
# self.DS_Scroll_Bar.setValue(1)
# self.SC_Slider_Bar.setValue(valeur)
# ui.on_PB_Apply_clicked()
#
## if self.CB_Free.isChecked():
## ui.on_PB_Apply_clicked()
## else:
## self.DS_Scroll_Bar.setValue(0.0)
## self.SC_Slider_Bar.setValue(0.0)

# print("on_SC_Scroll_Bar ", valeur)

def on_PB_Delete_Line_Memory(self): #self.TE_Memorize #QListView
global countMemory
global saveOnDisk

self.model = model = QtGui.QStandardItemModel()
try:
self.PB_Delete_Line_Memory.setStyleSheet("Base")
lineSelected = self.TE_Memorize.selectionModel().selectedRows()[0].row()
#textLigne = self.TE_Memorize.selectionModel().currentIndex().data() # affiche la ligne selectionnee
self.TE_Memorize.model().removeRow(lineSelected)
del saveOnDisk[lineSelected]
countMemory -= 1
self.PB_Memorize.setText("Memo (" + str(countMemory) + ")")
except Exception:
self.PB_Delete_Line_Memory.setStyleSheet("background-color: rgb(255, 0, 0)")
# print("on_PB_Delete_Line_Memory ")

def on_TE_Clicked(self, index): # click dans la fenetre
global saveOnDisk
global saveListView
global memorySelected

####ori colore la ligne######
# item = saveListView.itemFromIndex(index)
# item.setBackground(QtGui.QBrush(QtGui.QColor("#ef1919")))
# if (item.index().row()) in memorySelected:
## memorySelected.remove(item.index().row())
# baseBackground = self.TE_Memorize.palette().color(QPalette.Window)
# item.setBackground(QtGui.QBrush(QtGui.QColor(baseBackground)))
# else:
# memorySelected.append(item.index().row())
## print(memorySelected)
####ori colore la ligne######

item = saveListView.itemFromIndex(index)
memorySelected = []
memorySelected.append(item.index().row())
# print("on_TE_Clicked ",memorySelected[0]) #self.TE_Memorize

def on_PB_Memorize(self):
global myObject
global myObject
global saveOnDisk
global saveListView
global countMemory
global valeur


if myObject != "":
# if (valeur != 0):
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable
valeur = val
countMemory += 1
self.DS_Scroll_Bar.setValue(valeur)
self.SC_Slider_Bar.setValue(valeur)
xPB = str(myObject.Placement.Base[0])
yPB = str(myObject.Placement.Base[1])
zPB = str(myObject.Placement.Base[2])
xPR = str(myObject.Placement.Rotation.toEuler()[0])
yPR = str(myObject.Placement.Rotation.toEuler()[1])
zPR = str(myObject.Placement.Rotation.toEuler()[2])
#[(3.7,0.0,41.8), (0.0,3.0,0.0)],
#Placement.Base Placement.Rotation.toEuler()
dummy = "[("+xPB+","+yPB+","+zPB+"),("+xPR+","+yPR+","+zPR+")],"
saveOnDisk.append(dummy)
self.PB_Memorize.setText("Memo (" + str(countMemory) + ")")
self.PB_Memorize.setStyleSheet("background-color: rgb(188, 245, 169)"); # bouton
self.PB_Delete_Line_Memory.setStyleSheet("Base")
item = QtGui.QStandardItem(dummy)
saveListView.appendRow(item)
# else:
# self.PB_Memorize.setStyleSheet("background-color: #ff0000;")
# self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable
# print("on_PB_Memorize ",saveListView," ",str(countMemory))


if self.CB_Free.isChecked():
def on_PB_Save_Memorize(self):
ff = ui
global pathFile
global saveOnDisk
ff.on_PB_Apply_clicked()
global countMemory
global path

if countMemory != 0:
if self.CB_DataInMacro.isChecked():
# SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a file FCMacro", path, "FCMacro (*.FCMacro);;Python (*.py)") # PySide2
nomMacro = FreeCAD.ActiveDocument.Name
SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a file FCMacro", path + nomMacro, "(*.FCMacro);;Python (*.py)") # PySide2
else:
SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a file CoorInfo", pathFile, "CoorInfo (*.CoorInfo);;Ascii (*.asc);;TXT (*.txt)") # PySide2

if SaveName == "": # if the name file are not selected then Abord process
App.Console.PrintMessage("Process aborted"+"\n")
else: # if the name file are selected or created then
####new2
pathFile = os.path.dirname(SaveName) + "/" #= C:/Provisoire400/
formatFichier = os.path.splitext(SaveName)[1] #= .png
SaveName = os.path.splitext(SaveName)[0] #= /home/kubuntu/.FreeCAD/Macro/Texture_007_H #= C:/Provisoire400/image3D
SaveNameformatFichier = SaveName + formatFichier #= C:/Provisoire400/image3D.png
####new2
######## sauve le dernier chemin utilise si n'est pas une macro########
if self.CB_DataInMacro.isChecked():
None
else:
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__).SetString("setLastPath",pathFile)
######## sauve le dernier chemin utilise si n'est pas une macro########

App.Console.PrintMessage("Registration of "+SaveNameformatFichier+"\n")
try:
if self.CB_DataInMacro.isChecked():
file = open(SaveNameformatFichier, 'w') #'w'write
else:
file = open(SaveNameformatFichier, 'a') #'a'append
try:
#### macro first section begin
if self.CB_DataInMacro.isChecked():
file.write("##" + "\n")
try:
file.write("##Created by : " + __title__ + " : " + __version__ + ":" + __date__ + " : " + __author__ + "\n")
file.write("##Document : " + FreeCAD.ActiveDocument.Name + "\n")
file.write("##Date : " + str(QDate.currentDate().toString()) + "\n")
file.write("##Object : " + str(FreeCADGui.Selection.getSelection()[0].Name) + "\n")
except Exception: None
file.write("import Draft, Part" + "\n")
file.write("import PySide2" + "\n")
file.write("from pivy import coin" + "\n")
file.write("import time, os" + "\n")
file.write("" + "\n")
file.write("import FreeCAD, FreeCADGui" + "\n")
file.write("App = FreeCAD" + "\n")
file.write("Gui = FreeCADGui" + "\n")
file.write("" + "\n")
file.write("global Document; Document = " + chr(34) + FreeCAD.ActiveDocument.Name + chr(34) + "\n")
file.write("global xxData ; xxData = [] " + "\n")
file.write("global xxKey ; xxKey = " + chr(34) + chr(34) + "\n")
file.write("global v, o, c" + "\n")
file.write("global vitesse ; vitesse = 0.02" + "\n")
file.write("" + "\n")
file.write("def help():" + "\n")
file.write(" global xxData" + "\n")
file.write(" global Document" + "\n")
file.write(' App.Console.PrintMessage("__' + FreeCAD.ActiveDocument.Name + '__"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("__" + str(len(xxData)) + " Coordinates__"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("Type Key Q to Quit"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("Type Key D to Decrease speed"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("Type Key I to Increase speed"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("Type Key P to Pause/Continue or key RETURN or ESCAPE"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("Type Key S to Step by Step (key RETURN or ESCAPE to continue)"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("Type Key M for this message"+"' + chr(92) + 'n")' + "\n")
file.write(' App.Console.PrintMessage("____________________________"+"' + chr(92) + 'n")' + "\n")
file.write('\n')
file.write('class ViewObserver:' + "\n")
file.write(' def logPosition(self, info):' + "\n")
file.write(' global xxKey' + "\n")
file.write(' global v, o, c' + "\n")
file.write(' global vitesse' + "\n")
file.write('' + "\n")
file.write(' xxKey = info["Key"].upper()' + "\n")
file.write(' if xxKey in "QIDPSM" or xxKey == "RETURN" or xxKey == "PAD_ENTER" or xxKey == "ESCAPE":' + "\n")
file.write(' if (xxKey == "Q"): # Quit' + "\n")
file.write(' v.removeEventCallback("SoKeyboardEvent",c)' + "\n")
file.write(' FreeCAD.Console.PrintMessage("End " + Document + "' + chr(92) + 'n")' + "\n")
file.write('' + "\n")
file.write(' if (xxKey == "I"): # Increase' + "\n")
file.write(' vitesse -= 0.01' + "\n")
file.write(' if vitesse <= 0:' + "\n")
file.write(' vitesse = 0' + "\n")
file.write(' App.Console.PrintMessage("Speed maximum"+"' + chr(92) + 'n")' + "\n")
file.write(' else:' + "\n")
file.write(' App.Console.PrintMessage(str(vitesse)+"' + chr(92) + 'n")' + "\n")
file.write('' + "\n")
file.write(' if (xxKey == "D"): # Decrease' + "\n")
file.write(' vitesse += 0.01' + "\n")
file.write(' App.Console.PrintMessage(str(vitesse)+"' + chr(92) + 'n")' + "\n")
file.write('' + "\n")
file.write(' if (xxKey == "M"): # Help memo' + "\n")
file.write(' help()' + "\n")
file.write('##Begin of file' + "\n")
file.write('xxData = [' + "\n")
#### save data
for i in saveOnDisk:
file.write(i + "\n")
#### save data
#### macro second section begin
if self.CB_DataInMacro.isChecked():
file.write(']' + "\n")
file.write('##End of file' + "\n")
file.write('' + "\n")
file.write('createPoint = 0 # 0=not point 1=create point #used by "S" :Step to Step' + "\n")
file.write('try:' + "\n")
file.write(' v = Gui.activeDocument().activeView()' + "\n")
file.write(' o = ViewObserver()' + "\n")
file.write(' c = v.addEventCallback("SoKeyboardEvent",o.logPosition)' + "\n")
file.write('' + "\n")
file.write(' ##Select the object' + "\n")
file.write(' myObject = FreeCADGui.Selection.getSelection()[0] #select the object' + "\n")
file.write(' help() #help message' + "\n")
file.write('' + "\n")
file.write(' ##Loop' + "\n")
file.write(' while xxKey != "Q":' + "\n")
file.write(' comptCoordinate = -1 # coordinte 0 to ...x' + "\n")
file.write(' for p in xxData:' + "\n")
file.write(' #if (xxKey == "Q"): break # Quit the loop after finish the complete loop (commented by default: if used quit the loop as is)' + "\n")
file.write(' comptCoordinate += 1' + "\n")
file.write(' ## p[0]=Coordinate x,y,z; p[1]=Rotation angle x (Roll), y (Pitch), z (Yaw)' + "\n")
file.write(' px = float(p[0][0]); rx = float(p[1][0])' + "\n")
file.write(' py = float(p[0][1]); ry = float(p[1][1])' + "\n")
file.write(' pz = float(p[0][2]); rz = float(p[1][2])' + "\n")
file.write(' myObject.Placement=App.Placement(App.Vector(px,py,pz), App.Rotation(rx,ry,rz), App.Vector(0,0,0))' + "\n")
file.write(' Gui.updateGui() # rafraichi l''ecran' + "\n")
file.write(' time.sleep(vitesse)' + "\n")
file.write('' + "\n")
file.write(' if xxKey == "P": # Pause' + "\n")
file.write(' xxKey = ""' + "\n")
file.write(' comptLoop = 0' + "\n")
file.write(' while xxKey != "P":' + "\n")
file.write(' if xxKey == "RETURN" or xxKey == "PAD_ENTER" or xxKey == "ESCAPE": break' + "\n")
file.write(' comptLoop += 1' + "\n")
file.write(' if comptLoop > 50000:' + "\n")
file.write(' comptLoop = 0' + "\n")
file.write(' App.Console.PrintError("You is in mode Pause : Type P or RETURN or ESCAPE to continue" + "' + chr(92) + 'n")' + "\n")
file.write(' Gui.updateGui() # rafraichi l''ecran' + "\n")
file.write(' xxKey = ""' + "\n")
file.write('' + "\n")
file.write(' if xxKey == "S": # Step by Step' + "\n")
file.write(' App.Console.PrintMessage(str(myObject.Placement) + " #(" + str(comptCoordinate) + ")" + "' + chr(92) + 'n")' + "\n")
file.write(' ####' + "\n")
file.write(' if createPoint == 1:' + "\n")
file.write(' point = Draft.makePoint(myObject.Placement.Base) # create point to Placement.Base' + "\n")
file.write(' Draft.autogroup(point) #' + "\n")
file.write(' FreeCAD.ActiveDocument.recompute() #' + "\n")
file.write(' ####' + "\n")
file.write(' xxKey = ""' + "\n")
file.write(' while xxKey != "S":' + "\n")
file.write(' if xxKey == "RETURN" or xxKey == "PAD_ENTER" or xxKey == "ESCAPE": break' + "\n")
file.write(' xxKey = ""' + "\n")
file.write(' Gui.updateGui() # rafraichi l''ecran' + "\n")
file.write('' + "\n")
file.write('except Exception:' + "\n")
file.write(' FreeCAD.Console.PrintError("' + chr(92) + 'n"+"Not document open, or not object selected" + "' + chr(92) + 'n")' + "\n")
file.write(' try:' + "\n")
file.write(' v.removeEventCallback("SoKeyboardEvent",c)' + "\n")
file.write(' except Exception:' + "\n")
file.write(' None' + "\n")
file.write('' + "\n")
#### macro second section end

except Exception:
App.Console.PrintError("Error write file "+"\n")
finally:
file.close()
except Exception:
App.Console.PrintError("Error Write file "+SaveName+"\n")
# print("on_PB_Save_Memorize")

def on_PB_ClearMemo(self):
global saveOnDisk
global saveListView
global countMemory
global memorySelected

try:
model = saveListView = QtGui.QStandardItemModel()
self.TE_Memorize.model().removeRows(0, countMemory)# model.rowCount()
saveOnDisk = []
self.TE_Memorize.setModel(saveListView)
countMemory = 0
memorySelected = []
self.PB_Memorize.setText("Memo")
self.PB_Memorize.setStyleSheet("Base")
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable
except Exception:
None
# print("on_PB_ClearMemo")

def on_CB_On_Click_Apply(self):

if self.CB_On_Click_Apply.isChecked():
self.CB_On_Click_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(normalWork_Icon))) # icone dans une variable
self.CB_On_Click_Apply.setText(u"Memo on demand")
self.CB_On_Click_Apply.setToolTip(u"Memorize the coordinates on demand")
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable
self.groupBox_Data.setEnabled(True)
else:
else:
self.CB_On_Click_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(OnClickApply_Icon))) # icone dans une variable
self.DS_Scroll_Bar.setValue(0.0)
self.SC_Slider_Bar.setValue(0.0)
self.CB_On_Click_Apply.setText(u"Memo on click")
self.CB_On_Click_Apply.setToolTip(u"Memorize the coordinates on all Click Apply button")
# print "on_SC_Scroll_Bar ", valeur
# print("on_CB_On_Click_Apply")

def On_CB_DataInMacro(self):

if self.CB_DataInMacro.isChecked():
self.CB_DataInMacro.setIcon(QtGui.QIcon(QtGui.QPixmap(code_FC_Icon))) # icone dans une variable
self.CB_DataInMacro.setText(u"Coordinate")
self.PB_Save_Memorize.setText("Save (wr)")
self.PB_Save_Memorize.setToolTip("The file is open in mode Write" + "\n"
"If the file exist, the file is crushed" + "\n"
"")
else:
self.CB_DataInMacro.setIcon(QtGui.QIcon(QtGui.QPixmap(code_Python_Icon))) # icone dans une variable
self.CB_DataInMacro.setText(u"Macro")
self.PB_Save_Memorize.setText("Save (ap)")
self.PB_Save_Memorize.setToolTip("The file is open in mode Append" + "\n"
"If the file exist, the the data hare adding in the file" + "\n"
"")
# print("On_CB_DataInMacro")


def on_DS_Scroll_Bar(self,val):
def on_DS_Scroll_Bar(self,val):
Line 397: Line 1,837:
global rotAngleX, rotAngleY, rotAngleZ
global rotAngleX, rotAngleY, rotAngleZ


if myObject == "":
valeur = val
if (myObject == "") or (valeur == 0):
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable
self.DS_Scroll_Bar.setValue(0.0)
self.DS_Scroll_Bar.setValue(0.0)
self.SC_Slider_Bar.setValue(0.0)
self.DS_Scroll_Bar.setStyleSheet("background-color: rgb(250, 88, 88)")
# self.SC_Slider_Bar.setValue(0.0)
None
None
else:
else:
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable
valeur = val
self.SC_Slider_Bar.setValue(valeur)
self.DS_Scroll_Bar.setStyleSheet("Base")
self.PB_Memorize.setStyleSheet("Base")
# self.SC_Slider_Bar.setValue(valeur)
if self.CB_Position.isChecked(): # translate
if self.CB_Position.isChecked(): # translate


Line 418: Line 1,863:
posX = posY = 0.0
posX = posY = 0.0
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4) + valeur))
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4) + valeur))
elif self.RB_Direction_D.isChecked():
posZ = valeur
posX = posY = 0.0
xD = str(round(myObject.Placement.Base[0],4))
yD = str(round(myObject.Placement.Base[1],4))
zD = str(round(myObject.Placement.Base[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")


self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2))+" , " +
self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2))+" , " +
Line 438: Line 1,890:
rotAngleX = rotAngleY = 0.0
rotAngleX = rotAngleY = 0.0
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4) + valeur))
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4) + valeur))
elif self.RB_Direction_D.isChecked():
rotAngleZ = valeur
rotAngleX = rotAngleY = 0.0
xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")


# self.label_00.setText("[Rot=(" + str(round(rotAngleX,2)) + " , " + str(round(rotAngleY,2)) + " , " + str(round(rotAngleZ,2)) + ")] " +
self.label_00.setText("[Rot=(" + str(round(rotAngleX,2)) + " , " + str(round(rotAngleY,2)) + " , " + str(round(rotAngleZ,2)) + ")] " +
# "[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
"[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
# print "on_DS_Scroll_Bar ", valeur
# print("on_DS_Scroll_Bar ", valeur)


def on_LE_Increment_Pressed(self,text):
def on_LE_Increment_Pressed(self,text):
None
None
# print "on_lineEdit_1_Pressed"
# print("on_lineEdit_1_Pressed")


def on_PB_Apply_clicked(self):
def on_PB_Apply_clicked(self):
global valeur
global valeur
global myObject
global myObject
global positionMouse
global originalPlacement
global originalObject


global axisX, axisY, axisZ
global axisX, axisY, axisZ
Line 458: Line 1,914:
global rotAngleX, rotAngleY, rotAngleZ
global rotAngleX, rotAngleY, rotAngleZ


if (myObject == "") :
if (myObject == "") or (valeur == 0):
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setText(" Select one Object")
self.label_00.setText(" Select one Object or give one value Angle/Dimension")
FreeCAD.Console.PrintError("Select one Object" + "\n")
FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable
if valeur == 0:
self.DS_Scroll_Bar.setStyleSheet("background-color: rgb(250, 88, 88)")
else:
else:
self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable
if self.CB_Position.isChecked(): # translate
if self.CB_Position.isChecked(): # translate


if self.RB_Direction_D.isChecked(): # direction
myObject.Placement = App.Placement(App.Vector(posX, posY, posZ), App.Rotation(0.0,0.0,0.0), App.Vector(0.0,0.0,0.0)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
try:
selectedEdge = FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0] # select one element and axis second object (2 selections)
except Exception:
try:
selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[1] # select one element and axis same object (2 selections)
except Exception:
try:
selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0] # select one element and axis same object (1 selection)
except Exception:
None
#print(selectedEdge)
pointsTrajet = []
try:
pointsTrajet = selectedEdge.discretize(Distance = 1.0) # discretize the element
except Exception:
direction = myObject.Shape.Vertexes[0].Point
pointsTrajet = direction
None
try:
direction = pointsTrajet[1].sub(pointsTrajet[0]) # search the direction line or sub
except Exception:
try:
direction = myObject.Shape.Vertexes[0].Point # direction point
except Exception:
direction = App.Vector(0.0,0.0,0.0)
myObject.Placement.Base = myObject.Placement.Base + App.Vector(direction).scale(valeur, valeur, valeur)
else:
myObject.Placement = App.Placement(App.Vector(posX, posY, posZ), App.Rotation(0.0,0.0,0.0), App.Vector(0.0,0.0,0.0)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)


if self.RB_Rotation_X.isChecked():
if self.RB_Rotation_X.isChecked():
Line 473: Line 1,963:
elif self.RB_Rotation_Z.isChecked():
elif self.RB_Rotation_Z.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))
elif self.RB_Direction_D.isChecked():
xD = str(round(myObject.Placement.Base[0],4))
yD = str(round(myObject.Placement.Base[1],4))
zD = str(round(myObject.Placement.Base[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")


self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2))+" , " +
self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2))+" , " +
Line 480: Line 1,975:


else: # rotation
else: # rotation
if self.RB_Direction_D.isChecked(): # direction

try:
myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(rotAngleX, rotAngleY, rotAngleZ), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
selectedEdge = FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0] # select one element and axis second object (2 selections)
except Exception:
try:
selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[1] # select one element and axis same object (2 selections)
except Exception:
try:
selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0] # select one element and axis same object (1 selection)
except Exception:
None
try:
direction = selectedEdge.Vertexes[1].Point.sub(selectedEdge.Vertexes[0].Point)# search the direction line or sub
except Exception:
try:
direction = objectRotation.Vertexes[0].Point
except Exception:
direction = App.Vector(0.0,0.0,0.0)
#####
# if (self.CB_Free.isChecked()):# valeur = valvaleur = 1.0
# myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(direction), 1), App.Vector(axisX, axisY, axisZ))#.multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
# else:
# myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(direction), valeur), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
#####
myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(direction), valeur), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
else:
myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(rotAngleX, rotAngleY, rotAngleZ), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement) # other method


if self.RB_Rotation_X.isChecked():
if self.RB_Rotation_X.isChecked():
Line 489: Line 2,009:
elif self.RB_Rotation_Z.isChecked():
elif self.RB_Rotation_Z.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
elif self.RB_Direction_D.isChecked():
xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")


self.label_00.setText("[Rot=(" + str(round(myObject.Placement.Rotation.toEuler()[0],2)) + " , " +
self.label_00.setText("[Rot=(" + str(round(myObject.Placement.Rotation.toEuler()[0],2)) + " , " +
Line 494: Line 2,019:
str(round(myObject.Placement.Rotation.toEuler()[2],2)) + ")] " +
str(round(myObject.Placement.Rotation.toEuler()[2],2)) + ")] " +
"[Axis=("+ str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
"[Axis=("+ str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
if self.CB_On_Click_Apply.isChecked():
FreeCAD.ActiveDocument.recompute()
self.on_PB_Memorize()

# print "on_PB_Apply_clicked"
# FreeCAD.ActiveDocument.recompute()
# print("on_PB_Apply_clicked")


def on_RB_Rotation_0(self):
def on_RB_Rotation_0(self):
None
None
# print "on_RB_Rotation_0"
# print("on_RB_Rotation_0")


def on_RB_Rotation_X(self):
def on_RB_Rotation_X(self):
global myObject
global myObject

self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4))) # yaw
if self.CB_Position.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Base[0],4))) # pos X
else:
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4))) # yaw = Z
self.DS_Scroll_Bar.setValue(0.0)
self.DS_Scroll_Bar.setValue(0.0)
# print "on_RB_Rotation_X"
# print("on_RB_Rotation_X")


def on_RB_Rotation_Y(self):
def on_RB_Rotation_Y(self):
global myObject
global myObject

self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4))) # pitch
if self.CB_Position.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Base[1],4))) # pos Y
else:
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4))) # pitch= Y
self.DS_Scroll_Bar.setValue(0.0)
self.DS_Scroll_Bar.setValue(0.0)
# print "on_RB_Rotation_Y"
# print("on_RB_Rotation_Y")


def on_RB_Rotation_Z(self):
def on_RB_Rotation_Z(self):
global myObject
global myObject

self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4))) # roll
if self.CB_Position.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4))) # pos Z
else:
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4))) # roll = X
self.DS_Scroll_Bar.setValue(0.0)
# print("on_RB_Rotation_Z")

def on_RB_Direction_D(self):
global myObject

if self.CB_Position.isChecked():
xD = str(round(myObject.Placement.Base[0],4))
yD = str(round(myObject.Placement.Base[1],4))
zD = str(round(myObject.Placement.Base[2],4))
else:
xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
self.DS_Scroll_Bar.setValue(0.0)
self.DS_Scroll_Bar.setValue(0.0)
# print "on_RB_Rotation_Z"
# print("on_RB_Direction_D")


def on_RB_CenterRot(self): # zero
def on_RB_CenterRot(self): # zero
Line 526: Line 2,080:
try:
try:
self.groupBox_Pos_Mouse.setEnabled(False)
if self.RB_Bond_Box_Center.isChecked(): # axis
if self.RB_Bond_Box_Center.isChecked(): # axis
axisX = myObject.Shape.BoundBox.Center.x
axisX = myObject.Shape.BoundBox.Center.x
axisY = myObject.Shape.BoundBox.Center.y
axisY = myObject.Shape.BoundBox.Center.y
axisZ = myObject.Shape.BoundBox.Center.z
axisZ = myObject.Shape.BoundBox.Center.z
if self.CB_Point.isChecked():
self.label_00.setToolTip("Axis BoundBox.Center")
point = Draft.makePoint(myObject.Shape.BoundBox.Center.x, myObject.Shape.BoundBox.Center.y, myObject.Shape.BoundBox.Center.z)
point.ViewObject.PointColor = (1.0,0.0,0.0)
point.Label = "Point_BoundBox_Center"

elif self.RB_Center_Mass.isChecked():
elif self.RB_Center_Mass.isChecked():
axisX = myObject.Shape.CenterOfMass.x
axisX = myObject.Shape.CenterOfMass.x
axisY = myObject.Shape.CenterOfMass.y
axisY = myObject.Shape.CenterOfMass.y
axisZ = myObject.Shape.CenterOfMass.z
axisZ = myObject.Shape.CenterOfMass.z
if self.CB_Point.isChecked():
self.label_00.setToolTip("Axis Center Of Mass")
point = Draft.makePoint(myObject.Shape.CenterOfMass.x, myObject.Shape.CenterOfMass.y, myObject.Shape.CenterOfMass.z)
point.ViewObject.PointColor = (0.0,1.0,0.0)
point.Label = "Point_CenterOfMass"
elif self.RB_Point_Clicked.isChecked():
elif self.RB_Point_Clicked.isChecked():
axisX = positionMouse[0]
axisX = positionMouse[0]
axisY = positionMouse[1]
axisY = positionMouse[1]
axisZ = positionMouse[2]
axisZ = positionMouse[2]
if self.CB_Point.isChecked():
self.groupBox_Pos_Mouse.setEnabled(True)
self.label_00.setToolTip("Point Mouse")
point = Draft.makePoint(positionMouse[0], positionMouse[1], positionMouse[2])
point.ViewObject.PointColor = (0.0,0.0,1.0)
point.Label = "Point_positionMouse"

except Exception:
except Exception:
self.label_00.setText("Error CenterRot_0")
self.label_00.setText("Error CenterRot_0")
FreeCAD.Console.PrintError("Error CenterRot_0" + "\n" + "or Bad selection" + "\n")
FreeCAD.Console.PrintError("Error CenterRot_0" + "\n" + "or Bad selection" + "\n")
# print "on_RB_CenterRot"
# print("on_RB_CenterRot")


def on_CB_Position(self):
def on_CB_Position(self):
Line 564: Line 2,109:


if self.CB_Position.isChecked():
if self.CB_Position.isChecked():
self.RB_Rotation_Z.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Z_Icon))) # icone dans une variable
self.RB_Rotation_X.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_X_Icon))) # icone dans une variable
self.CB_Position.setIcon(QtGui.QIcon(QtGui.QPixmap(rotate_Icon))) #icone dans une variable
self.CB_Position.setToolTip(u"UnCheck for rotate the object in axis selected")
self.CB_Position.setText(u"Rotation")
self.CB_Position.setToolTip(u"Rotate the object to axis choice X, Y, Z or D")
self.groupBox_Rotation.setEnabled(False)
self.groupBox_Rotation.setEnabled(False)
self.RB_Bond_Box_Center.setChecked(True)
self.RB_Bond_Box_Center.setChecked(True)
self.SC_Slider_Bar.setMinimum(-1000)
self.SC_Slider_Bar.setMaximum(1000)
# self.SC_Slider_Bar.setMinimum(-1000)
self.DS_Scroll_Bar.setMinimum(-1000)
# self.SC_Slider_Bar.setMaximum(1000)
self.DS_Scroll_Bar.setMaximum(1000)
# self.DS_Scroll_Bar.setMinimum(-1000)
# self.DS_Scroll_Bar.setMaximum(1000)


self.groupBox_Axis.setTitle("Axis Direction")
self.groupBox_Axis.setTitle("Axis Translation")
self.RB_Rotation_Z.setText("Direction Z ") # translate
self.RB_Rotation_Z.setText("Translation Z ") # translate
self.RB_Rotation_Y.setText("Direction Y ")
self.RB_Rotation_Y.setText("Translation Y ")
self.RB_Rotation_X.setText("Direction X ")
self.RB_Rotation_X.setText("Translation X ")
self.RB_Direction_D.setText("Translation D ")
self.DS_Scroll_Bar.setSuffix(" mm")


try:
try:
self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2)) + " , " +
self.label_00.setText("[Pl.Base=(" + str(round(myObject.Placement.Base[0],2)) + " , " +
str(round(myObject.Placement.Base[1],2)) + " , " +
str(round(myObject.Placement.Base[1],2)) + " , " +
str(round(myObject.Placement.Base[2],2)) + ")] " +
str(round(myObject.Placement.Base[2],2)) + ")] " +
Line 587: Line 2,141:
elif self.RB_Rotation_Z.isChecked():
elif self.RB_Rotation_Z.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))
self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))
elif self.RB_Direction_D.isChecked():
xD = str(round(myObject.Placement.Base[0],4))
yD = str(round(myObject.Placement.Base[1],4))
zD = str(round(myObject.Placement.Base[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
except Exception:
except Exception:
self.label_00.setText("Error Position_0")
self.label_00.setText("Error Position_0")
FreeCAD.Console.PrintError("Error Position_0" + "\n" + "or Bad selection" + "\n")
FreeCAD.Console.PrintError("Error Position_0" + "\n" + "or Bad selection" + "\n")
else:
else:
self.RB_Rotation_Z.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_X_Icon))) # icone dans une variable
self.RB_Rotation_X.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Z_Icon))) # icone dans une variable
self.CB_Position.setIcon(QtGui.QIcon(QtGui.QPixmap(translate_Icon))) #icone dans une variable
self.CB_Position.setText(u"Translation")
self.CB_Position.setToolTip(u"Check for move the object to axis choice X, Y, Z or D")
self.groupBox_Rotation.setEnabled(True)
self.groupBox_Rotation.setEnabled(True)
self.SC_Slider_Bar.setMinimum(-360)
# self.SC_Slider_Bar.setMinimum(0.0)
self.SC_Slider_Bar.setMaximum(360)
# self.SC_Slider_Bar.setMaximum(359.0)
self.DS_Scroll_Bar.setMinimum(-360)
# self.DS_Scroll_Bar.setMinimum(0.0)
self.DS_Scroll_Bar.setMaximum(360)
# self.DS_Scroll_Bar.setMaximum(359.0)


self.groupBox_Axis.setTitle("Axis Rotation")
self.groupBox_Axis.setTitle("Axis Rotation")
Line 601: Line 2,165:
self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
self.RB_Rotation_X.setText("Rotation(Z) Yaw")
self.RB_Rotation_X.setText("Rotation(Z) Yaw")
self.RB_Direction_D.setText("Rotation(D)")
self.DS_Scroll_Bar.setSuffix(" Degrees")


try:
try:
Line 613: Line 2,179:
elif self.RB_Rotation_Z.isChecked():
elif self.RB_Rotation_Z.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
elif self.RB_Direction_D.isChecked():
xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
except Exception:
except Exception:
self.label_00.setText("Error Position_1")
self.label_00.setText("Error Position_1")
Line 618: Line 2,189:


self.DS_Scroll_Bar.setValue(0.0)
self.DS_Scroll_Bar.setValue(0.0)
# print "on_CB_Position"
# print("on_CB_Position")


def on_CB_Point(self):
def on_CB_Point(self):
ff = ui
global ui
ff.on_RB_CenterRot()
global myObject
# print "on_CB_Point"
global positionMouse
if self.RB_Bond_Box_Center.isChecked(): # axis
# if self.CB_Point.isChecked():
point = Draft.makePoint(myObject.Shape.BoundBox.Center.x, myObject.Shape.BoundBox.Center.y, myObject.Shape.BoundBox.Center.z)
point.ViewObject.PointColor = (1.0,0.0,0.0)
point.Label = "Point_BoundBox_Center"
elif self.RB_Center_Mass.isChecked():
# if self.CB_Point.isChecked():
point = Draft.makePoint(myObject.Shape.CenterOfMass.x, myObject.Shape.CenterOfMass.y, myObject.Shape.CenterOfMass.z)
point.ViewObject.PointColor = (0.0,1.0,0.0)
point.Label = "Point_CenterOfMass"
elif self.RB_Point_Clicked.isChecked():
# if self.CB_Point.isChecked():
point = Draft.makePoint(positionMouse[0], positionMouse[1], positionMouse[2])
point.ViewObject.PointColor = (0.0,0.0,1.0)
point.Label = "Point_positionMouse"
Gui.Selection.addSelection(App.ActiveDocument.getObject(myObject.Name))
FreeCAD.ActiveDocument.recompute()
# ui.on_RB_CenterRot()
# print("on_CB_Point")


def on_PB_Zero_clicked(self):
def on_PB_Zero_clicked(self):
Line 630: Line 2,221:
if (myObject != ""):
if (myObject != ""):
try:
try:
# pl = App.Placement(App.Vector(10.0,10.0,10.0), App.Rotation(0.0, 0.0, 0.0), App.Vector(0.0, 0.0, 0.0))
pl = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(0.0, 0.0, 0.0), App.Vector(0.0, 0.0, 0.0))
pl = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(0.0, 0.0, 0.0), App.Vector(0.0, 0.0, 0.0))
myObject.Placement = pl
myObject.Placement = pl
FreeCAD.ActiveDocument.recompute()
#FreeCAD.ActiveDocument.recompute()
if self.RB_Rotation_X.isChecked():
if self.RB_Rotation_X.isChecked():
Line 642: Line 2,232:
elif self.RB_Rotation_Z.isChecked():
elif self.RB_Rotation_Z.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
elif self.RB_Direction_D.isChecked():
xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
self.label_00.setText("[Rot=(" +str(round(myObject.Placement.Rotation.toEuler()[0],2))+" , "+str(round(myObject.Placement.Rotation.toEuler()[1],2))+" , "+ str(round(myObject.Placement.Rotation.toEuler()[2],2))+")] "+
self.label_00.setText("[Rot=(" +str(round(myObject.Placement.Rotation.toEuler()[0],2))+" , "+str(round(myObject.Placement.Rotation.toEuler()[1],2))+" , "+ str(round(myObject.Placement.Rotation.toEuler()[2],2))+")] "+
Line 649: Line 2,244:
self.LE_Increment.setText(str(0.0))
self.LE_Increment.setText(str(0.0))
FreeCAD.ActiveDocument.recompute()
#FreeCAD.ActiveDocument.recompute()
Gui.activeDocument().activeView().viewTop()
Gui.activeDocument().activeView().viewTop()
Gui.SendMsgToActiveView("ViewFit")
Gui.SendMsgToActiveView("ViewFit")
Line 658: Line 2,253:
else:
else:
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setText(" Select one Object")
self.label_00.setText(" Select one Object or give one value Angle/Dimension")
FreeCAD.Console.PrintError("Select one Object" + "\n")
FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
# print "on_PB_Zero_clicked"
# print("on_PB_Zero_clicked")


def on_PB_Original_clicked(self):
def on_PB_Original_clicked(self):
global ui
global myObject
global myObject
global originalPlacement
global originalPlacement
Line 680: Line 2,276:
elif self.RB_Rotation_Z.isChecked():
elif self.RB_Rotation_Z.isChecked():
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4))) # roll Z
self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4))) # roll Z
elif self.RB_Direction_D.isChecked():
xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
ff = ui
ui.on_RB_CenterRot()
ff.on_RB_CenterRot()
self.label_00.setText("[Rot=(" +str(round(myObject.Placement.Rotation.toEuler()[0],2))+" , "+str(round(myObject.Placement.Rotation.toEuler()[1],2))+" , "+ str(round(myObject.Placement.Rotation.toEuler()[2],2))+")] "+
self.label_00.setText("[Rot=(" +str(round(myObject.Placement.Rotation.toEuler()[0],2))+" , "+str(round(myObject.Placement.Rotation.toEuler()[1],2))+" , "+ str(round(myObject.Placement.Rotation.toEuler()[2],2))+")] "+
"[Axis=("+str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
"[Axis=("+str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
FreeCAD.ActiveDocument.recompute()
#FreeCAD.ActiveDocument.recompute()
except Exception:
except Exception:
self.label_00.setText("Error Original_0")
self.label_00.setText("Error Original_0")
Line 692: Line 2,292:
else:
else:
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setText(" Select one Object")
self.label_00.setText(" Select one Object or give one value Angle/Dimension")
FreeCAD.Console.PrintError("Select one Object" + "\n")
FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
# print("on_PB_Original_clicked")

# print "on_PB_Original_clicked"


def on_PB_Reset_clicked(self):
def on_PB_Reset_clicked(self):
global ui
global originalObject
global originalObject
global myObject
global myObject
Line 704: Line 2,304:
global posX, posY, posZ
global posX, posY, posZ
global rotAngleX, rotAngleY, rotAngleZ
global rotAngleX, rotAngleY, rotAngleZ
global axisX, axisY, axisZ
global countMemory


try:
try:
for obj in FreeCAD.ActiveDocument.Objects: # deslectionne
for obj in FreeCAD.ActiveDocument.Objects: # deslectionne
FreeCADGui.Selection.removeSelection(obj)
FreeCADGui.Selection.removeSelection(obj)
except Except:
except Exception:
None
None

if countMemory == 0:
ui.on_PB_ClearMemo


originalObject = myObject = ""
originalObject = myObject = ""
posX = posY = posZ = rotAngleX = rotAngleY = rotAngleZ = 0.0
posX = posY = posZ = rotAngleX = rotAngleY = rotAngleZ = 0.0
axisX = axisY = axisZ = 0.0
valeur = 0.0
valeur = 0.0


self.DS_Scroll_Bar.setValue(0.0)
self.DS_Scroll_Bar.setStyleSheet("Base")
self.DS_Scroll_Bar.setValue(valeur)
self.DS_Scroll_Bar.setSuffix(" Degrees")
self.LE_Increment.setText(str(0.0))
self.LE_Increment.setText(str(0.0))


Line 722: Line 2,330:
self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
self.RB_Rotation_X.setText("Rotation(Z) Yaw")
self.RB_Rotation_X.setText("Rotation(Z) Yaw")
self.RB_Direction_D.setText("Rotation(D) Direction")


self.groupBox_Rotation.setEnabled(False)
self.groupBox_Rotation.setEnabled(False)
self.groupBox_Axis.setEnabled(False)
self.groupBox_Axis.setEnabled(False)
self.CB_Position.setEnabled(False)
self.groupBox_Pos_Mouse.setEnabled(False)
self.CB_Position.setChecked(False)
self.groupBox_Work.setEnabled(False)
self.CB_Point.setEnabled(False)
self.groupBox_Data.setEnabled(False)

self.CB_Free.setEnabled(False)
self.DS_Pos_Mouse_X.setValue(0.0)
self.DS_Pos_Mouse_Y.setValue(0.0)
self.DS_Pos_Mouse_Z.setValue(0.0)

# self.CB_Position.setEnabled(False)
# self.CB_Position.setChecked(False)
self.CB_Position.setText(u"Translation")
self.CB_Position.setToolTip(u"Move the object to axis choice X, Y or Z")
# self.CB_Point.setEnabled(False)
# self.CB_Point.setChecked(False)
self.PB_Point.setEnabled(False)
# self.CB_Free.setEnabled(False)
# self.CB_Free.setChecked(False)


self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;") # white red bold
self.label_00.setText(" Select one Object")
self.label_00.setText(" Select one Object or give one value Angle/Dimension")

FreeCAD.Console.PrintError("Select one Object" + "\n")
FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
FreeCAD.Console.PrintMessage("Reset" + "\n")
FreeCAD.Console.PrintMessage("Reset" + "\n")
# print("on_PB_Reset_clicked")


def on_PB_Quit_clicked(self):
def on_PB_Quit_clicked(self):
self.vueActive.removeEventCallback("SoMouseButtonEvent",self.click) # desinstalle la fonction souris
self.vueActive.removeEventCallback("SoMouseButtonEvent",self.click) # desinstalle la fonction souris
FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente
FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente
#FreeCAD.Console.PrintMessage("Quit xxxxx" + "\n")
self.window.hide() # hide the window and close the macro
try:
FreeCADGui.Selection.removeObserver(s) # Uninstalls resident function (desactivated for read after LeftDock RightDock)
self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # destroy
self.window.deleteLater() # destroy
self.window.destroy() # destroy
except Exception:
self.window.hide() # hide the window and close the macro
FreeCAD.Console.PrintMessage("Quit Rotate_To_Point" + "\n")
FreeCAD.Console.PrintMessage("Quit Rotate_To_Point" + "\n")


Line 747: Line 2,378:
global sourisPass
global sourisPass
global valeur
global positionMouse
global positionMouse
global originalObject
global originalObject
Line 781: Line 2,413:
axisX = axisY = axisZ = 0.0
axisX = axisY = axisZ = 0.0


ff = ui
valeur = 0.0
ff.on_RB_CenterRot()
ui.DS_Scroll_Bar.setValue(valeur)
ui.DS_Scroll_Bar.setStyleSheet("background-color: rgb(250, 88, 88)")
ff.groupBox_Rotation.setEnabled(True)

ff.groupBox_Axis.setEnabled(True)
ff.CB_Position.setEnabled(True)
ui.DS_Pos_Mouse_X.setValue(positionMouse[0])
ff.CB_Point.setEnabled(True)
ui.DS_Pos_Mouse_Y.setValue(positionMouse[1])
ff.CB_Free.setEnabled(True)
ui.DS_Pos_Mouse_Z.setValue(positionMouse[2])

ff.label_00.setStyleSheet("Base") # origin system
ui.on_RB_CenterRot()
ff.label_00.setText("[Rot =(" + str(round(rotAngleX,2))+ " , " + str(round(rotAngleY,2)) + " , " + str(round(rotAngleZ,2)) + ")] " +
if ui.CB_Position.isChecked():
ui.groupBox_Rotation.setEnabled(False)
else:
ui.groupBox_Rotation.setEnabled(True)
ui.groupBox_Axis.setEnabled(True)
ui.groupBox_Work.setEnabled(True)
ui.groupBox_Data.setEnabled(True)
ui.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable
#ui.groupBox_Pos_Mouse.setEnabled(True)
ui.label_00.setStyleSheet("Base") # origin system
ui.label_00.setText("[Rot =(" + str(round(rotAngleX,2))+ " , " + str(round(rotAngleY,2)) + " , " + str(round(rotAngleZ,2)) + ")] " +
"[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
"[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
ui.PB_Memorize.setStyleSheet("Base")


def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
ff = ui
global ui
ff.on_PB_Reset_clicked()
ui.on_PB_Reset_clicked


###################################################################################################
###################################################################################################

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


try:
try:
for obj in FreeCAD.ActiveDocument.Objects: # deslectionne
for obj in FreeCAD.ActiveDocument.Objects: # deselectionne
FreeCADGui.Selection.removeSelection(obj)
FreeCADGui.Selection.removeSelection(obj)
except Except:
except Exception:
None
None


Line 807: Line 2,455:
FreeCADGui.Selection.addObserver(s) # installe la fonction en mode resident
FreeCADGui.Selection.addObserver(s) # installe la fonction en mode resident


if __name__ == "__main__":
MainWindow = QtGui.QMainWindow()
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
MainWindow.setObjectName("__title__") # macro internal Name
ui.setupUi(MainWindow)
ui = Ui_MainWindow()
MainWindow.show()
ui.setupUi(MainWindow)
MainWindow.show()


}}
}}
<translate>
<translate>

==Example:==
==Example:== <!--T:9-->
</translate>
</translate>
[[File:Macro Rotate To Point 01.gif ]]
[[File:Macro Rotate To Point 01.gif ]]
<translate>
<translate>
==Links==
==Links== <!--T:10-->
</translate>
</translate>
The forum [http://forum.freecadweb.org/viewtopic.php?f=8&t=20925 feature req: placement - rotate part around its midpoint]
The forum [http://forum.freecadweb.org/viewtopic.php?f=8&t=20925 feature req: placement - rotate part around its midpoint]
<translate>
<translate>
<!--T:11-->
My macro to Gist [https://gist.github.com/mario52a mario52a ]
My macro to Gist [https://gist.github.com/mario52a mario52a ]
</translate>
</translate>
<translate>
<translate>
==Version==
==Version== <!--T:12-->
</translate>
</translate>
<translate>
<translate>

04/03/03 ver 00.00
<!--T:32-->
2021/01/12 ver 00.06 : adding the Data section and more options

<!--T:20-->
2020/03/07 ver 00.05.2 : correct the bug translation delete "direction = myObject.Placement.Rotation.multVec(direction)"

<!--T:19-->
2020/03/01 ver 00.05.1 : correct the position of the test "FreeCAD version"

<!--T:18-->
2020/02/29 ver 00.05 : convert to Hdpi (Layout) and add Direction

<!--T:17-->
06/04/2019 ver 00.04 : Python 3

<!--T:16-->
29/03/2018 ver 00.03 : comment the "FreeCAD.ActiveDocument.recompute()" the change value are too slow with complex element in FreeCAD 0.17.... see [https://www.forum.freecadweb.org/viewtopic.php?f=10&t=27732&p=224195#p224195 FC0.17 recompute strange behaviour (regression)]

<!--T:15-->
27/03/2017 ver 00.02 : modify the spinbox "Pos" now accept the negative values

<!--T:14-->
05/03/2017 ver 00.01 : add 3 spinbox for displayed the coordinates X Y Z on click mouse
</translate>
</translate>


<translate>
<languages/>
<!--T:13-->
04/03/2017 ver 00.00


</translate>

Revision as of 12:45, 13 January 2021

Other languages:

Macro Rotate To Point

Description
Updated version of macro modified the GUI to improve HiDPI support (QGridLayout). Run only FC v0.18 or higher (supporting Qt5 and PySide2)

Macro for rotate an object on itself with the axis of rotation the: boundbox center, center of mass, direction of wire, or last point clicked. You must save in a file all coordinate worked and save it in a file "Coordinate [(0.06,1.30,0.0),(85.0,0.0,0.0)]," or in a complete macro for create one animation

For the previous version (Qt4) see Macro_Rotate_To_Point and install it manually.

Macro version: 00.06
Last modified: 2021/01/12
FreeCAD version: 0.18+
Download: ToolBar Icon
Author: Mario52
Author
Mario52
Download
ToolBar Icon
Links
Macro Version
00.06
Date last modified
2021/01/12
FreeCAD Version(s)
0.18+
Default shortcut
None
See also
None

Description

Macro to rotate an object on itself with the axis of rotation being either the:

  • boundbox center
  • center of mass
  • direction of wire
  • last point clicked

Usage

  1. Download the macro from the Addon Manager
  2. Execute the macro
  3. Select one object
  4. Choose one of the following orientations:

Interface Rotate to point

Point Rotation

  • Boundbox Center: Select the BoundBox center to axis rotation
  • Center of Mass: Select the Center of Mass to axis rotation
  • Point Clicked: Select the last mouse click as the point for axis rotation
    • 1: select the object
    • 2: use the CTRL key to choose an extra object

Axis Rotation

  • Rotation(Z) Yaw: Yaw axis
  • Rotation(Y) Pitch: Pitch axis
  • Rotation(X) Roll: Roll axis
  • Rotation(D) Direction: Rotate around line, wire selected

Coordinates Point clicked

  • DoubleSpinBox: Coordinate X on mouse click (modifiable only with the mode "Point Clicked")
  • DoubleSpinBox: Coordinate Y on mouse click (modifiable only with the mode "Point Clicked")
  • DoubleSpinBox: Coordinate Z on mouse click (modifiable only with the mode "Point Clicked")

Work

  • Translation: If this checkBox is checked the rotation is disabled, the object placement is done on the axis selected.
  • Point: One point is created for visualise the point rotation axis: red X, green Y, blue Z
  • Line Edit: The line edit displays the original coordinate to axis selected + the input data given in the spinBox
  • 0,0000 : Enter the modification
  • Apply: Apply the modification to the object
  • The coordinate is displayed

Data

  • Window for display the coordinates memorized
  • Save: Save the data in file
  • Clear: Delete and clean the text editor
  • Delete: Delete the selected line
  • Memorize: Memorize and display the coordinate
  • Macro:
    • Mode normal Macro the coordinate is saved in this mode : [(0.06,1.30,0.0),(85.0,0.0,0.0)],
    • Mode macro 0,0 Coordinate the coordinate is saved in a complete macro directly in your macros directory with the same name of the document extention .FCMacro
      • Options of the macro
      • __pompe____engrenage__ : Name of document
      • __22 Coordinates__ : number of coordinates
      • Type Key Q to Quit : Quit the macro
      • Type Key D to Decrease speed : Decrease the speed of the animation
      • Type Key I to Increase speed : Increase the speed of the animation
      • Type Key P to Pause/Continue or key RETURN or ESCAPE : Pause / Anime
      • Type Key S to Step by Step (key RETURN or ESCAPE to continue) : Step by Step
      • Type Key M for this message : Display this memo
      • ____________________________
  • Memo on Click:
    • Mode normal Memo on Click : The data is not saved on window, you must push the Memo (2) button for save the coordinate
    • Mode Memo on Click Memo on Demand : The data is automaticly saved with all click op the Apply button

Command

  • Quit: Quit the macro
  • Original: After modifying the data of the object you can return to the original placement, If you have not deselected the current object.
  • 0,0,0 : This option places the object in base coordinate 0, 0, 0
  • Reset: Reset the data in the macro and deselect the current object (same mouse click in the 3D view)

Script

ToolBar Icon PNG SVG

Macro_Rotate_To_Point.FCMacro

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
*   Copyright (c) 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                                                                   *
***************************************************************************
*           WARNING! All changes in this file will be lost and            *  
*                  may cause malfunction of the program                   *
***************************************************************************
"""
#
#
#OS: Windows 10 (10.0)
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.19.23546 (Git)
#Build type: Release
#Branch: master
#Hash: 6b017f9a16b15b0e628c8d874c4058442dee5548
#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__   = "Rotate_To_Point"
__author__  = "Mario52"
__url__     = "https://www.freecadweb.org/"
__Wiki__    = "https://www.freecadweb.org/wiki/Macro_Rotate_To_Point"
__version__ = "00.06"
__date__    = "2021/01/12"  #YYYY/MM/DD
#

import WebGui
#WebGui.openBrowser("http://www.freecadweb.org/")

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

import Draft, Part, PartGui, FreeCADGui, FreeCAD
from FreeCAD import Base
import DraftVecUtils
#import time

Gui = FreeCADGui
App = FreeCAD

global ui            ; ui             = ""
global sourisPass    ; sourisPass     = 0
global positionMouse ; positionMouse  = ""

global originalObject; originalObject = ""
global myObject      ; myObject       = ""
global originalPlacement; originalPlacement = ""
global valeur        ; valeur         = 0.0

global axisX         ; axisX          = 0.0
global axisY         ; axisY          = 0.0
global axisZ         ; axisZ          = 0.0

global posX          ; posX           = 0.0
global posY          ; posY           = 0.0
global posZ          ; posZ           = 0.0

global rotAngleX     ; rotAngleX      = 0.0
global rotAngleY     ; rotAngleY      = 0.0
global rotAngleZ     ; rotAngleZ      = 0.0

global saveOnDisk    ; saveOnDisk     = []
global saveListView  ; saveListView   = ""
global memorySelected; memorySelected = []
global countMemory   ; countMemory    = 0

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

global pathFile
#### Configuration ##############################################################
pathFile = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__ ).GetString("setLastPath")
if pathFile == "":
    pathFile = path
    FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__).SetString("setLastPath",pathFile)
####
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__).SetString("Version",__version__ + " (" + __date__ + ")")
#### Configuration ##############################################################

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

boundBox_Center_Icon = [
"24 24 8 1",
" 	c None",
".	c #284871",
"+	c #234C86",
"@	c #314B64",
"#	c #EF2929",
"$	c #4A74A4",
"%	c #4478AD",
"&	c #4E9A06",
"                        ",
"           #            ",
"           #            ",
"           #            ",
"      &&&&&#            ",
"      &    #&&&&&&&     ",
"     &    +#..   &&     ",
"    &&&&&+%#%%. & &     ",
"    &  ++&&&&&&&  &     ",
"    &  +$$$$$$&+@ &     ",
"    & +%$$$$$$&+@ &     ",
"####&###$$$$$+&+####### ",
"    & +%$$$$++&+@ &     ",
"    & +%$$$+++&+@ &     ",
"    &  +$$++++&@  &     ",
"    &   ++++++&@  &     ",
"    &    @@@@@&   &     ",
"    &      #  &  &      ",
"    &&&&&  #  &&&       ",
"         &&&&&&         ",
"           #            ",
"           #            ",
"           #            ",
"                        "
]

centerMass_Icon = [
"24 24 9 1",
" 	c None",
".	c #000100",
"+	c #CD0000",
"@	c #6B6014",
"#	c #B0A22C",
"$	c #D5B716",
"%	c #E9D235",
"&	c #F7E66C",
"*	c #FBF4BC",
"                        ",
"                        ",
"                        ",
"                        ",
"         ......         ",
"       ..#%%%%#..       ",
"      .@&&&%%%%%@.      ",
"     .@&**&%%%%%%@.     ",
"     .&***&%%%%%%%.     ",
"    .#&**&%%+%%%%%#.    ",
"    .%&&&%%++%%%$$%.    ",
"    .%%%%+++++$$$$$.    ",
"    .%%%%%+++++$$$$.    ",
"    .%%%%$$++$$$$$$.    ",
"    .#%$$$$+$$$$$$#.    ",
"     .%$$$$$$$$$$%.     ",
"     .@%$$$$$$$$$@.     ",
"      .@%$$$$$$%@.      ",
"       ..#$$$$#..       ",
"         ......         ",
"                        ",
"                        ",
"                        ",
"                        "
]

point_Clicked_Icon = [
"24 24 7 1",
" 	c None",
".	c #730000",
"+	c #9F0000",
"@	c #E90000",
"#	c #C39F03",
"$	c #ECD309",
"%	c #FBE851",
"                        ",
"         #####          ",
"        #%%%%%#         ",
"       #%%%%%%$#        ",
"      #%%%%%$$$$#       ",
"      #%%%%$$$$$#       ",
"      #%%%+.$$$$#       ",
"      #%%%++.$$$#       ",
"       #%%+@+.$#        ",
"       #%%+@@+.#        ",
"        ##+@@@+.        ",
"          +@@@@+.       ",
"          +@@@@@+.      ",
"          +@@@@@@+.     ",
"          +@@@@@@@..    ",
"          +@@@@@@@@..   ",
"          +@@@@@@@@@..  ",
"          +@@@@@@+....  ",
"          +@@@@@+       ",
"          +@@++@@.      ",
"          +@+. .@@.     ",
"          ++.   .@.     ",
"                .+..    ",
"                 ..     "
]

axis_X_Icon = [
"24 24 6 1",
" 	c None",
".	c #000000",
"+	c #A40000",
"@	c #EE2A2A",
"#	c #729FCF",
"$	c #B9BCB5",
"           $$   $$$$    ",
"          $$$$  $  $    ",
"         $$$$$$   $     ",
"         $$$$$$  $      ",
"        $$$$$$$$ $$$    ",
"          $$$$          ",
"          $$$$          ",
"          $$$$          ",
"          $$$$          ",
"          $$$$    $$  $$",
"         $$##$$   $$  $$",
" .  .    $####$     $$$ ",
"  ...    +####$     $$  ",
"  ..    +@####$$    $   ",
" . ... +@@@+$$$$$  $$   ",
"      +@@@+  $$$$$      ",
"     +@@@+    $$$$$     ",
"  +++@@@+      $$$$$$$  ",
"  +@@@@+        $$$$$$  ",
"  +@@@+          $$$$$  ",
"  +++++          $$$$$  ",
"                        ",
"                        ",
"                        "
]

axis_Y_Icon = [
"24 24 7 1",
" 	c None",
".	c #030303",
"+	c #4E9A06",
"@	c #729FCF",
"#	c #B9BCB5",
"$	c #BABDB6",
"%	c #8AE134",
"           $$   ####    ",
"          $$$$  #  #    ",
"         $$$$$$   #     ",
"         $$$$$$  #      ",
"        $$$$$$$$ ###    ",
"          $$$$          ",
"          $$$$          ",
"          $$$$          ",
"          $$$$          ",
"          $$$$    ..  ..",
"         $$@@$$   ..  ..",
" #  #    $@@@@$     ... ",
"  ###    $@@@@+     ..  ",
"  ##    $$@@@@%+    .   ",
" # ### $$$$$+%%%+  ..   ",
"      $$$$$  +%%%+      ",
"     $$$$$    +%%%+     ",
"  $$$$$$$      +%%%+++  ",
"  $$$$$$        +%%%%+  ",
"  $$$$$          +%%%+  ",
"  $$$$$          +++++  ",
"                        ",
"                        ",
"                        "
]

axis_Z_Icon = [
"24 24 6 1",
" 	c None",
".	c #000000",
"+	c #204A87",
"@	c #1D89B6",
"#	c #729FCF",
"$	c #B9BCB5",
"           ++    ...    ",
"          +@@+     .    ",
"         +@@@@+   .     ",
"         +@@@@+  .      ",
"        +++@@+++ ...    ",
"          +@@+          ",
"          +@@+          ",
"          +@@+          ",
"          +@@+          ",
"          +@@+    $$  $$",
"         ++##++   $$  $$",
" $  $    +####+     $$$ ",
"  $$$    $####$     $$  ",
"  $$    $$####$$    $   ",
" $ $$$ $$$$$$$$$$  $$   ",
"      $$$$$  $$$$$      ",
"     $$$$$    $$$$$     ",
"  $$$$$$$      $$$$$$$  ",
"  $$$$$$        $$$$$$  ",
"  $$$$$          $$$$$  ",
"  $$$$$          $$$$$  ",
"                        ",
"                        ",
"                        "
]

direction_Icon = [
"24 24 6 1",
" 	c None",
".	c #000000",
"+	c #A40000",
"@	c #EE2A2A",
"#	c #565854",
"$	c #729FCF",
"                        ",
"                        ",
"                 +++++  ",
"                  +@@+  ",
"                 +@@@+  ",
"                +@@@++  ",
"               +@@@+ +  ",
"              +@@@+     ",
"             +@@@+      ",
"            +@@@+       ",
"           +@@@+        ",
"          +@@@+         ",
"         +@@@+          ",
"        +@@@+           ",
"       +@@@+            ",
"      +@@@+             ",
"   + +@@@+              ",
"   ++@@@+               ",
"   +@@@+                ",
"   +@@+                 ",
"   +++++                ",
"                        ",
"                        ",
"                        "
]

point_Icon = [
"24 24 8 1",
" 	c None",
".	c #000100",
"+	c #B0A22C",
"@	c #E9D235",
"#	c #6B6014",
"$	c #F7E66C",
"%	c #FBF4BC",
"&	c #D5B716",
"                        ",
"                        ",
"                        ",
"                        ",
"         ......         ",
"       ..+@@@@+..       ",
"      .#$$$@@@@@#.      ",
"     .#$%%$@@@@@@#.     ",
"     .$%%%$@@@@@@@.     ",
"    .+$%%$@@@@@@@@+.    ",
"    .@$$$@@@@@&&&&&.    ",
"    .@@@@@@@&&&&&&&.    ",
"    .@@@@@&&&&&&&&&.    ",
"    .@@@@&&&&&&&&&&.    ",
"    .+@@&&&&&&&&&&+.    ",
"     .@&&&&&&&&&&&.     ",
"     .#&&&&&&&&&&#.     ",
"      .#&&&&&&&&#.      ",
"       ..+&&&&+..       ",
"         ......         ",
"                        ",
"                        ",
"                        ",
"                        "
]

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

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

save_Icon = [
"24 24 9 1",
" 	c None",
".	c #A30500",
"+	c #5D5F5C",
"@	c #3967A0",
"#	c #4B9A00",
"$	c #7E9BBD",
"%	c #A9ABA8",
"&	c #C7C9C6",
"*	c #DCDEDB",
"                        ",
"      @@@@@             ",
"    @@$$$$$@            ",
"    @$$$$$$$@           ",
"   @@@@@@$@$$@          ",
"         @$@@@          ",
"    +%&&&@$@@@@&%%%     ",
"    +*@@@$@@@@@@@@&%    ",
"   +%*@@@@@@@@@@@@*&+   ",
"   +***@@@@@@@@@@***+   ",
"  +%***&@@@@@@@@&****+  ",
"  +****&&@@@@@@&&****+  ",
"  +***&&&&@@@@&&&&***+  ",
" +%***&&&&&@@&&&&&****+ ",
" +***&&&&&&&&&&&&&&***+ ",
" %********************+ ",
" %********************+ ",
" %&&&&&&&&&&&&&&&&&&&&+ ",
" %&%%%%%%%%%%%%%%%%%%%+ ",
" %&%%%%%%%%%%%%%%%%%%%+ ",
" %&%&&&%%%%%%%@%%#%%.%+ ",
" %%%%%%%%%%%%%%%%%%%%%+ ",
" ++++++++++++++++++++++ ",
"                        "
]

clear_Icon = [
"24 24 9 1",
" 	c None",
".	c #000200",
"+	c #8B0606",
"@	c #875209",
"#	c #E3383A",
"$	c #C19916",
"%	c #C4A163",
"&	c #E2C928",
"*	c #E4D05A",
"   @@@                  ",
"  @%%%@                 ",
"  @%*@@                 ",
"  @%@*%@                ",
"   @%$$%@               ",
"   @%%$%%@              ",
"    @%$$$*@             ",
"     @$**+++            ",
"     @*%+##+.           ",
"      ++##+*$           ",
"      +#++****$         ",
"      ++****&**$        ",
"       &**&*&&&*$       ",
"       &*&&&*&$&*$      ",
"       $*&*&$&&$$*$     ",
"       $*&$&*$*&*$*$    ",
"        *&$$&&$&&&&*$   ",
"        $*&$&**$$**@    ",
"        $*&$&****&$     ",
"         $*$***$$@      ",
"         $***$@ @       ",
"          $@$@          ",
"            @           ",
"                        "
]

delete_Icon = [
"24 24 3 1",
" 	c None",
".	c #A40000",
"+	c #EE2A2A",
"                        ",
"                        ",
"       .         .      ",
"      .+.       .+.     ",
"     .+++.     .+++.    ",
"    .+++++.   .+++++.   ",
"   .+++++++. .+++++++.  ",
"    .+++++++.+++++++.   ",
"     .+++++++++++++.    ",
"      .+++++++++++.     ",
"       .+++++++++.      ",
"        .+++++++.       ",
"       .+++++++++.      ",
"      .+++++++++++.     ",
"     .+++++++++++++.    ",
"    .+++++++.+++++++.   ",
"   .+++++++. .+++++++.  ",
"    .+++++.   .+++++.   ",
"     .+++.     .+++.    ",
"      .+.       .+.     ",
"       .         .      ",
"                        ",
"                        ",
"                        "
]

memo_Allume_Icon = [
"24 24 9 1",
" 	c None",
".	c #4F514E",
"+	c #635D41",
"@	c #676966",
"#	c #848784",
"$	c #888A87",
"%	c #E9D312",
"&	c #FEEE4D",
"*	c #FDFFFC",
"                        ",
"                        ",
"                        ",
"                        ",
"         %%%%%%         ",
"        %%&&&&%%        ",
"       %%&&&&&&%%       ",
"      %%&&&**&&&%%      ",
"     %%&&&****&&&%%     ",
"     %&&&******&&&%     ",
"     %&&&******&&&%     ",
"     %&&&******&&&%     ",
"     %%&&&****&&&%%     ",
"      %%&&&**&&&%%      ",
"       %%&&&&&&%%       ",
"        %%%&&%%%        ",
"         .%%%%+         ",
"         @.....         ",
"         ..#$$@         ",
"         @@....         ",
"         ..$$$@         ",
"         @@....         ",
"          $$$$          ",
"                        "
]

memo_Eteint_Icon = [
"24 24 9 1",
" 	c None",
".	c #000000",
"+	c #204A87",
"@	c #555753",
"#	c #4F514E",
"$	c #635D41",
"%	c #676966",
"&	c #848784",
"*	c #888A87",
"                        ",
"                        ",
"                        ",
"                        ",
"         ......         ",
"        ........        ",
"       ..........       ",
"      ............      ",
"     ....+.+.+.+...     ",
"     ...+.+.+.++...     ",
"     ...@......@...     ",
"     ...@......@...     ",
"     ....@....@....     ",
"      ....@..@....      ",
"       ...@..@...       ",
"        ..@..@..        ",
"         #@..@$         ",
"         %#####         ",
"         ##&**%         ",
"         %%####         ",
"         ##***%         ",
"         %%####         ",
"          ****          ",
"                        "
]

origin_Icon = [
"24 24 14 1",
" 	c None",
".	c #EF2929",
"+	c #A40000",
"@	c #DDDFDC",
"#	c #888A85",
"$	c #DDDEDB",
"%	c #DCDEDB",
"&	c #DCDEDC",
"*	c #DBDDDA",
"=	c #BABDB6",
"-	c #555753",
";	c #729FCF",
">	c #3465A4",
",	c #8191AA",
"                        ",
"                        ",
"           .+           ",
"          ..++          ",
"         ....++         ",
"        .....+++        ",
"       ....@#++++       ",
"      ....@@@#++++      ",
"     ....@@@@@#++++     ",
"    ....@@@@$@@#++++    ",
"   ....@@@$@@%@@#++++   ",
"  ....@@@@@@@@%@@#++++  ",
"  ...@@@%%%%&%%*@@#+++  ",
"  ..@@@@@@@@@@@@@@@#++  ",
"   #@@=#---@@=====@#    ",
"   #@@=#---@@;>>>;@#    ",
"   #@@,#---@@;>>>;@#    ",
"   #@@,#---@@;>>>;@#    ",
"   #@@=#---@@-----@#    ",
"   #@@=#---@@@@@@@@#    ",
"   #@@=##--@@@@@@@@#    ",
"   #################    ",
"                        ",
"                        "
]

zero_Icon = [
"24 24 6 1",
" 	c None",
".	c #CC0000",
"+	c #000000",
"@	c #BABDB6",
"#	c #4E9A06",
"$	c #204A87",
"           ..           ",
"           ..           ",
"           ..           ",
"           ..           ",
"           ..           ",
"           ..           ",
"           ..           ",
"   ++@     ..@     ++@  ",
"  ++++@   +..+@   ++++@ ",
" ++@ ++@ ++..++@ ++@ ++@",
" +@   +@ +@.. +@ +@   +@",
"######+@###$$#+@######+@",
"######+@###$$#+@######+@",
" ++@ ++@ ++..++@ ++@ ++@",
"  ++++ +  ++++ +  ++++  ",
"   ++ ++   ++ ++   ++   ",
"      +    .. +         ",
"     ++    ..++         ",
"    ++     ..+          ",
"           ..           ",
"           ..           ",
"           ..           ",
"           ..           ",
"           ..           "
]

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

code_Python_Icon = [
"24 24 3 1",
" 	c None",
".	c #3B7AAC",
"+	c #EDD400",
"                        ",
"  ++++++++++++++++++++. ",
"  +                   . ",
"  +                   . ",
"  +     .....         . ",
"  +    . .....        . ",
"  +    ....... +      . ",
"  +        ... +++    . ",
"  +   ........ ++++   . ",
"  +  ......... +++++  . ",
"  + .........  ++++++ . ",
"  + .......   +++++++ . ",
"  + ......  +++++++++ . ",
"  +  ..... +++++++++  . ",
"  +   .... ++++++++   . ",
"  +    ... +++        . ",
"  +      . +++++++    . ",
"  +        +++++ +    . ",
"  +         +++++     . ",
"  +                   . ",
"  +                   . ",
"  +                   . ",
"  +.................... ",
"                        "
]

code_FC_Icon = [
"24 24 5 1",
" 	c None",
".	c #000000",
"+	c #CB0208",
"@	c #204A86",
"#	c #BABDB6",
"                        ",
"                        ",
"                        ",
"                        ",
"                        ",
"@@@    @@@    @@@    @@@",
"@        @    @        @",
"@   ++#  @    @   ++#  @",
"@  ++++# @    @  ++++# @",
"@ ++# ++#@    @ ++# ++#@",
"@ +#   +#@    @ +#   +#@",
"@ +#   +#@    @ +#   +#@",
"@ +#   +#@    @ +#   +#@",
"@ ++# ++#@    @ ++# ++#@",
"@  ++++  @    @  ++++  @",
"@   ++   @    @   ++   @",
"@        @    @        @",
"@        @    @        @",
"@@@    @@@  . @@@    @@@",
"           ..           ",
"           .            ",
"          ..            ",
"         ..             ",
"                        "
]

rotate_Icon = [
"24 24 4 1",
" 	c None",
".	c #000100",
"+	c #000201",
"@	c #6695BF",
"                        ",
"       ++++++++         ",
"      +@@@@@@@@+        ",
"     +@@......@@++      ",
"    +@@.@@@@@@.@@@+ ++  ",
"   +@@.@@++++@@.@@@+@+  ",
"  +@@.@@+    +@@.@@@@+  ",
" +@@.@@+      +@@.@@@+  ",
" +@.@@+        +@@.@@@+ ",
" +@.@+       ++@@@@@@@+ ",
" +@.@+        ++@@@@@@+ ",
" +@.@+          +++@@@+ ",
" +@.@+            +++++ ",
" +@.@+                  ",
" +@.@@+                 ",
" +@@.@@+      +++       ",
"  +@@.@@+     +@+       ",
"   +@@.@@+++++@@+       ",
"    +@@.@@@@@@@@+       ",
"     +@@.....@@+        ",
"      +@@@@@@@++        ",
"       +++++++          ",
"                        ",
"                        "
]

translate_Icon = [
"24 24 9 1",
" 	c None",
".	c #000100",
"+	c #000407",
"@	c #6694BF",
"#	c #6D92BE",
"$	c #6A93C5",
"%	c #6795C0",
"&	c #6F93C0",
"*	c #6896C1",
"                        ",
"                        ",
"          ..            ",
"          .@.           ",
"          .@@..         ",
"          .@@@@.        ",
"          .@@@@@.       ",
" ..........@@@@@@.      ",
"  +**&%%&@&@@@@@@@.     ",
" .............+@@@$..   ",
"  +@@@@@@@@@@@@@@@@@@.  ",
" ..........+@@@@@@@@@@. ",
"  +@@@@@@@@@@@@@@@@@@+  ",
" ........+@@@@@@@@@++   ",
"  +@@@@@@@@@@@@@@@.     ",
" ..........@@@@@@.      ",
"          .@@@@@.       ",
"          .@@@@.        ",
"          .@@..         ",
"          .@.           ",
"          ..            ",
"                        ",
"                        ",
"                        "
]

OnClickApply_Icon = [
"24 24 9 1",
" 	c None",
".	c #910000",
"+	c #F20001",
"@	c #54595E",
"#	c #4B9A00",
"$	c #8A8C89",
"%	c #B0B2AE",
"&	c #FED758",
"*	c #DFE1DC",
"                        ",
"        ..              ",
"        .......         ",
"         ....++         ",
"         .+.+++         ",
"      ....+++++         ",
"      $.+++++++%%%%     ",
"     **$.++++++***&&    ",
"    %***$.+++++&*&&&    ",
"    *****$.++++&&&&*    ",
"   %******$.+++&&&**%   ",
"   *******&$.++&&&&**   ",
"   ***&&&&&&$.+&&&&&&&  ",
"  %*******&&&$.&&&&**%  ",
"  *********&&&$&&&****  ",
"  ********&&&&&&&&&***% ",
" %*******&&&*&&&*&&&**% ",
" %%%%%%%%&&%%%&%%%&&%%$ ",
" %%%$%%%%%%%%%&%@%#%+%$ ",
" %%%$$%%%%%%%%&%%%%%%%$ ",
" %%%%%%%%%%%%%&%%%%%%%$ ",
" $%%%%%%%%%%%%%%%%%%%%$ ",
"  @@@@@@@@@@@@@@@@@@@@@ ",
"                        "
]

normalWork_Icon = [
"24 24 9 1",
" 	c None",
".	c #565854",
"+	c #555753",
"@	c #2E3436",
"#	c #FFFFFF",
"$	c #FCE94F",
"%	c #FEFEFE",
"&	c #EDD400",
"*	c #BABDB6",
"                        ",
" ...................... ",
" .                    . ",
" . +++++ +++++        . ",
" .                    . ",
" .                    . ",
" . +++++ +++++        . ",
" .                    . ",
" .                    . ",
" . +++++ +++++        . ",
" .                    . ",
" .                    . ",
" ...................... ",
"                        ",
"                        ",
"         @@@@@@@@@@@@@@@",
"         @#$$#########%@",
"         @#&&###@@@#@@%@",
"         @%&&%########%@",
"         @#**#########%@",
"         @@@@@@@@@@@@@@@",
"                        ",
"                        ",
"                        "
]

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s
        
class Ui_MainWindow(object):
    def __init__(self ):
        global path, path2
        self.window = MainWindow
        self.path = path

        self.vueActive = FreeCADGui.ActiveDocument.ActiveView
        self.click = self.vueActive.addEventCallback("SoMouseButtonEvent",self.souris)

    def souris(self,info):
        global sourisPass
        if (info["Button"] == "BUTTON1") and (info["State"] == "DOWN"):
            #time.sleep(0.02)
            sourisPass = 0
            #print("ok")

    def setupUi(self, MainWindow):
        self.window = MainWindow
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        global saveListView
#        MainWindow.resize(360, 300)
#        MainWindow.setMinimumSize(QtCore.QSize(330, 10))
#        MainWindow.setMaximumSize(QtCore.QSize(330, 330))
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))

        ####
        self.groupBox_Rotation = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_Rotation.setEnabled(False)

        self.RB_Bond_Box_Center = QtWidgets.QRadioButton()
        self.RB_Bond_Box_Center.setChecked(True)
        self.RB_Bond_Box_Center.setIcon(QtGui.QIcon(QtGui.QPixmap(boundBox_Center_Icon))) #icone dans une variable 
        self.RB_Bond_Box_Center.clicked.connect(self.on_RB_CenterRot)

        self.RB_Center_Mass = QtWidgets.QRadioButton()
        self.RB_Center_Mass.setIcon(QtGui.QIcon(QtGui.QPixmap(centerMass_Icon))) # icone dans une variable 
        self.RB_Center_Mass.clicked.connect(self.on_RB_CenterRot)

        self.RB_Point_Clicked = QtWidgets.QRadioButton()
        self.RB_Point_Clicked.setIcon(QtGui.QIcon(QtGui.QPixmap(point_Clicked_Icon))) # icone dans une variable 
        self.RB_Point_Clicked.clicked.connect(self.on_RB_CenterRot)

        ####
        self.groupBox_Axis = QtWidgets.QGroupBox()
        self.groupBox_Axis.setEnabled(False)

        self.RB_Rotation_0 = QtWidgets.QRadioButton()    # factice pour bouton invisible
        self.RB_Rotation_0.setVisible(False)
#        self.RB_Rotation_0.clicked.connect(self.on_RB_Rotation_0)

        self.RB_Rotation_X = QtWidgets.QRadioButton()
        self.RB_Rotation_X.setChecked(True)
        self.RB_Rotation_X.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Z_Icon))) # icone dans une variable 
        self.RB_Rotation_X.clicked.connect(self.on_RB_Rotation_X)

        self.RB_Rotation_Y = QtWidgets.QRadioButton()
        self.RB_Rotation_Y.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Y_Icon))) # icone dans une variable 
        self.RB_Rotation_Y.clicked.connect(self.on_RB_Rotation_Y)
#        self.RB_Angle_Y.setFont(QtGui.QFont(self.FontImpost,weight=QtGui.QFont.Bold))  # Bold
#        self.RB_Angle_Y.setStyleSheet("color : #008700")                         # Color text

        self.RB_Rotation_Z = QtWidgets.QRadioButton()
        self.RB_Rotation_Z.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_X_Icon))) # icone dans une variable 
        self.RB_Rotation_Z.clicked.connect(self.on_RB_Rotation_Z)

        self.RB_Direction_D = QtWidgets.QRadioButton()
        self.RB_Direction_D.setIcon(QtGui.QIcon(QtGui.QPixmap(direction_Icon))) # icone dans une variable 
        self.RB_Direction_D.clicked.connect(self.on_RB_Direction_D)
        ####

        self.groupBox_Pos_Mouse = QtWidgets.QGroupBox()
        self.groupBox_Pos_Mouse.setEnabled(False)

        self.DS_Pos_Mouse_X = QtWidgets.QDoubleSpinBox()
        self.DS_Pos_Mouse_X.setMinimum(-999999.9)
        self.DS_Pos_Mouse_X.setMaximum(99999999.9)
        self.DS_Pos_Mouse_X.setDecimals(6)
        self.DS_Pos_Mouse_X.setSuffix(" X")
#        self.DS_Pos_Mouse_X.setIcon(QtGui.QIcon(QtGui.QPixmap(CameraToFace))) # icone dans une variable 
        self.DS_Pos_Mouse_X.valueChanged.connect(self.on_DS_Pos_Mouse_X)

        self.DS_Pos_Mouse_Y = QtWidgets.QDoubleSpinBox()
        self.DS_Pos_Mouse_Y.setMinimum(-999999.9)
        self.DS_Pos_Mouse_Y.setMaximum(99999999.9)
        self.DS_Pos_Mouse_Y.setDecimals(6)
        self.DS_Pos_Mouse_Y.setSuffix(" Y")
#        self.PB_To_Face.setIcon(QtGui.QIcon(QtGui.QPixmap(CameraToFace))) # icone dans une variable 
        self.DS_Pos_Mouse_Y.valueChanged.connect(self.on_DS_Pos_Mouse_Y)

        self.DS_Pos_Mouse_Z = QtWidgets.QDoubleSpinBox()
        self.DS_Pos_Mouse_Z.setMinimum(-999999.9)
        self.DS_Pos_Mouse_Z.setMaximum(99999999.9)
        self.DS_Pos_Mouse_Z.setDecimals(6)
        self.DS_Pos_Mouse_Z.setSuffix(" Z")
#        self.PB_To_Face.setIcon(QtGui.QIcon(QtGui.QPixmap(CameraToFace))) # icone dans une variable 
        self.DS_Pos_Mouse_Z.valueChanged.connect(self.on_DS_Pos_Mouse_Z)

        ####
        self.groupBox_Work = QtWidgets.QGroupBox()
        self.groupBox_Work.setEnabled(False)

#        self.SC_Slider_Bar = QtWidgets.QSlider()
#        self.SC_Slider_Bar.setMinimum(0.0)
#        self.SC_Slider_Bar.setMaximum(359.0)
#        self.SC_Slider_Bar.setValue(0.0)
#        self.SC_Slider_Bar.setSliderPosition(0)
#        self.SC_Slider_Bar.setOrientation(QtCore.Qt.Horizontal)
#        self.SC_Slider_Bar.valueChanged.connect(self.on_SC_Slider_Bar)

        self.LE_Increment = QtWidgets.QLineEdit()
        self.LE_Increment.setReadOnly(True)
        self.LE_Increment.setText(str(0.0))
        #self.LE_Increment.returnPressed.connect(self.on_LE_Increment_Pressed)
        self.LE_Increment.textChanged.connect(self.on_LE_Increment_Pressed)

        self.DS_Scroll_Bar = QtWidgets.QDoubleSpinBox()
        self.DS_Scroll_Bar.setMinimum(-360.0)
        self.DS_Scroll_Bar.setMaximum(360.0)
        self.DS_Scroll_Bar.setSuffix(" Degrees")
        self.DS_Scroll_Bar.setDecimals(4)
        self.DS_Scroll_Bar.valueChanged.connect(self.on_DS_Scroll_Bar)

        self.PB_Apply = QtWidgets.QPushButton()
        self.PB_Apply.setAutoRepeat(True)
        self.PB_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(apply_Icon))) # icone dans une variable 
        self.PB_Apply.clicked.connect(self.on_PB_Apply_clicked)

        self.CB_Position = QtWidgets.QCheckBox()
        #self.CB_Position.setEnabled(False)
        self.CB_Position.setIcon(QtGui.QIcon(QtGui.QPixmap(translate_Icon))) #icone dans une variable 
        self.CB_Position.clicked.connect(self.on_CB_Position)

        # self.CB_Point = QtWidgets.QCheckBox()
        # self.CB_Point.setEnabled(False)
        # self.CB_Point.clicked.connect(self.on_CB_Point)
        self.PB_Point = QtWidgets.QPushButton()
        #self.PB_Point.setEnabled(False)
        self.PB_Point.setIcon(QtGui.QIcon(QtGui.QPixmap(point_Icon))) # icone dans une variable 
        self.PB_Point.clicked.connect(self.on_CB_Point)

#        self.CB_Free = QtWidgets.QCheckBox()
#        self.CB_Free.setEnabled(False)
##        self.CB_Free.clicked.connect(self.on_CB_Free)

        self.groupBox_Data = QtWidgets.QGroupBox()
        self.groupBox_Data.setEnabled(False)

        self.TE_Memorize = QtWidgets.QListView()
        saveListView = QtGui.QStandardItemModel()
        self.TE_Memorize.setModel(saveListView)
        self.TE_Memorize.setSelectionRectVisible(True)#
        self.TE_Memorize.setAlternatingRowColors(True)#
        self.TE_Memorize.setStyleSheet("alternate-background-color:#fdeeee;")
        self.TE_Memorize.clicked[QtCore.QModelIndex].connect(self.on_TE_Clicked)

        self.PB_Save_Memorize = QtWidgets.QPushButton()
        self.PB_Save_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(save_Icon))) # icone dans une variable 
        self.PB_Save_Memorize.clicked.connect(self.on_PB_Save_Memorize)

        self.PB_ClearMemo = QtWidgets.QPushButton()
        self.PB_ClearMemo.setIcon(QtGui.QIcon(QtGui.QPixmap(clear_Icon))) # icone dans une variable 
        self.PB_ClearMemo.clicked.connect(self.on_PB_ClearMemo)

        self.PB_Delete_Line_Memory = QtWidgets.QPushButton()
        self.PB_Delete_Line_Memory.setIcon(QtGui.QIcon(QtGui.QPixmap(delete_Icon))) # icone dans une variable 
        self.PB_Delete_Line_Memory.clicked.connect(self.on_PB_Delete_Line_Memory)

        self.PB_Memorize = QtWidgets.QPushButton()
        self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable 
        self.PB_Memorize.clicked.connect(self.on_PB_Memorize)

        self.CB_On_Click_Apply = QtWidgets.QCheckBox()
        self.CB_On_Click_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(OnClickApply_Icon))) # icone dans une variable 
        self.CB_On_Click_Apply.clicked.connect(self.on_CB_On_Click_Apply)

        self.CB_DataInMacro = QtWidgets.QCheckBox()
        self.CB_DataInMacro.setIcon(QtGui.QIcon(QtGui.QPixmap(code_Python_Icon))) # icone dans une variable 
        self.CB_DataInMacro.clicked.connect(self.On_CB_DataInMacro)

        self.label_00 = QtWidgets.QLabel()
        self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;")   # white red bold
        #self.label_00.setToolTip("Display the modification Axis and Rotation or Position")
        ####

        self.groupBox_Command = QtWidgets.QGroupBox()

        self.PB_Quit = QtWidgets.QPushButton()
        self.PB_Quit.setIcon(QtGui.QIcon(QtGui.QPixmap(quit_Icon))) # icone dans une variable 
        self.PB_Quit.clicked.connect(self.on_PB_Quit_clicked)

        self.PB_Original = QtWidgets.QPushButton()
        self.PB_Original.setIcon(QtGui.QIcon(QtGui.QPixmap(origin_Icon))) # icone dans une variable 
        self.PB_Original.clicked.connect(self.on_PB_Original_clicked)

        self.PB_Zero = QtWidgets.QPushButton()
        self.PB_Zero.setIcon(QtGui.QIcon(QtGui.QPixmap(zero_Icon))) # icone dans une variable 
        self.PB_Zero.clicked.connect(self.on_PB_Zero_clicked)

        self.PB_Reset = QtWidgets.QPushButton()
        self.PB_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(reset_Icon))) # icone dans une variable 
        self.PB_Reset.clicked.connect(self.on_PB_Reset_clicked)

        #### Gridlayout Header
        self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.gridLayout_00_00 = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout_00_00.setContentsMargins(10, 10, 10, 10)#Gauche Haut Droit Bas
        #### Gridlayout Header
        #### Gridlayout BEGIN
        self.grid_00_01 = QtWidgets.QGridLayout()
#        self.gridLayoutWidget_3 = QtWidgets.QWidget(self.groupBox_Rotation)
        self.grid_00_01.addWidget(self.groupBox_Rotation, 0, 0, 1, 1)
        self.grid_00_01.setContentsMargins(0, 0, 0, 0)                    #Gauche Haut Droite Bas
        self.grid_00_01_00 = QtWidgets.QGridLayout(self.groupBox_Rotation)
        self.grid_00_01_00.setContentsMargins(10, 10, 0, 10)
        self.grid_00_01_00.addWidget(self.RB_Bond_Box_Center, 0, 0, 1, 1)
        self.grid_00_01_00.addWidget(self.RB_Center_Mass, 1, 0, 1, 1)
        self.grid_00_01_00.addWidget(self.RB_Point_Clicked, 2, 0, 1, 1)
        self.gridLayout_00_00.addLayout(self.grid_00_01, 0, 0, 1, 1)
        ####
        self.grid_00_02 = QtWidgets.QGridLayout()
        self.grid_00_02.addWidget(self.groupBox_Axis, 0, 0, 1, 1)
        self.grid_00_02.setContentsMargins(0, 0, 0, 0)
        self.grid_00_02_00 = QtWidgets.QGridLayout(self.groupBox_Axis)
        self.grid_00_02_00.setContentsMargins(10, 10, 0, 10)
        self.grid_00_02_00.addWidget(self.RB_Rotation_X, 0, 0, 1, 1)
        self.grid_00_02_00.addWidget(self.RB_Rotation_Y, 1, 0, 1, 1)
        self.grid_00_02_00.addWidget(self.RB_Rotation_Z, 2, 0, 1, 1)
        self.grid_00_02_00.addWidget(self.RB_Direction_D, 3, 0, 1, 1)
        self.gridLayout_00_00.addLayout(self.grid_00_02, 0, 1, 1, 1)
        ####
        self.grid_00_03 = QtWidgets.QGridLayout()
        self.grid_00_03.addWidget(self.groupBox_Pos_Mouse, 1, 0, 1, 1)
        self.grid_00_03.setContentsMargins(0, 0, 0, 0)
        self.grid_00_03_00 = QtWidgets.QGridLayout(self.groupBox_Pos_Mouse)
        self.grid_00_03_00.setContentsMargins(10, 10, 10, 10)
        self.grid_00_03_00.addWidget(self.DS_Pos_Mouse_X, 0, 0, 1, 1)
        self.grid_00_03_00.addWidget(self.DS_Pos_Mouse_Y, 0, 1, 1, 1)
        self.grid_00_03_00.addWidget(self.DS_Pos_Mouse_Z, 0, 2, 1, 1)
        self.gridLayout_00_00.addLayout(self.grid_00_03, 1, 0, 1, 2)
        ####
        self.grid_00_044 = QtWidgets.QGridLayout()
        self.grid_00_044.addWidget(self.groupBox_Work, 2, 0, 1, 1)
        self.grid_00_044.setContentsMargins(0, 0, 0, 0)
        self.grid_00_044_00 = QtWidgets.QGridLayout(self.groupBox_Work)
        self.grid_00_044_00.addWidget(self.CB_Position, 0, 0, 1, 1)
        self.grid_00_044_00.addWidget(self.PB_Point, 0, 1, 1, 1)
#        self.grid_00_044_00.addWidget(self.CB_Free, 0, 2, 1, 1)
        self.grid_00_044_00.addWidget(self.LE_Increment, 1, 0, 1, 1)
        self.grid_00_044_00.addWidget(self.DS_Scroll_Bar, 1, 1, 1, 1)
        self.grid_00_044_00.addWidget(self.PB_Apply, 1, 2, 1, 1)
        self.grid_00_044_00.addWidget(self.label_00, 2, 0, 1, 3)
#        self.grid_00_044_00.addWidget(self.SC_Slider_Bar, 2, 0, 1, 3)
        self.gridLayout_00_00.addLayout(self.grid_00_044, 2, 0, 1, 2)
        ####
        self.grid_00_044b = QtWidgets.QGridLayout()
        self.grid_00_044b.addWidget(self.groupBox_Data, 3, 0, 1, 1)
        self.grid_00_044b.setContentsMargins(0, 0, 0, 0)
        self.grid_00_044b_00 = QtWidgets.QGridLayout(self.groupBox_Data)
        self.grid_00_044b_00.addWidget(self.TE_Memorize, 0, 0, 1, 4)
        self.grid_00_044b_00.addWidget(self.PB_Save_Memorize, 1, 0, 1, 1)
        self.grid_00_044b_00.addWidget(self.PB_ClearMemo, 1, 1, 1, 1)
        self.grid_00_044b_00.addWidget(self.PB_Delete_Line_Memory, 1, 2, 1, 1)
        self.grid_00_044b_00.addWidget(self.PB_Memorize, 1, 3, 1, 1)
        self.grid_00_044b_00.addWidget(self.CB_DataInMacro, 2, 0, 1, 1)
        self.grid_00_044b_00.addWidget(self.CB_On_Click_Apply, 2, 1, 1, 1)
        self.gridLayout_00_00.addLayout(self.grid_00_044b, 3, 0, 1, 2)
        ####
        self.grid_00_08 = QtWidgets.QGridLayout()
        self.grid_00_08.addWidget(self.groupBox_Command, 4, 0, 1, 1)
        self.grid_00_08.setContentsMargins(0, 0, 0, 0)
        self.grid_00_08_00 = QtWidgets.QGridLayout(self.groupBox_Command)
        self.grid_00_08_00.addWidget(self.PB_Quit, 0, 0, 1, 1)
        self.grid_00_08_00.addWidget(self.PB_Original, 0, 1, 1, 1)
        self.grid_00_08_00.addWidget(self.PB_Zero, 0, 2, 1, 1)
        self.grid_00_08_00.addWidget(self.PB_Reset, 0, 3, 1, 1)
        self.gridLayout_00_00.addLayout(self.grid_00_08, 4, 0, 1, 2)
        #### Gridlayout END

        MainWindow.setCentralWidget(self.centralwidget)

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

    def retranslateUi(self, MainWindow):
        global path

        MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint)        # this function turns the front window (stay to hint)
        MainWindow.setWindowIcon(QtGui.QIcon(self.path+"Macro_Rotate_To_Point.png")) # change l'icone de la fenetre principale
        MainWindow.setWindowTitle(__title__ + " (" + __version__ + " : " + __date__ + " (rmu)")

        _translate = QtCore.QCoreApplication.translate
        self.groupBox_Rotation.setTitle(_translate("MainWindow", "Point Rotation"))
        self.RB_Bond_Box_Center.setText(_translate("MainWindow", "Bounbox Center"))
        self.RB_Bond_Box_Center.setToolTip(_translate("MainWindow", "Point rotation on BoundBox Center"))
        self.RB_Center_Mass.setText(_translate("MainWindow", "Center of Mass"))
        self.RB_Center_Mass.setToolTip(_translate("MainWindow", "Point rotation on Center Mass"))
        self.RB_Point_Clicked.setText(_translate("MainWindow", "Point clicked"))
        self.RB_Point_Clicked.setToolTip(_translate("MainWindow", "Point rotation on Point Mouse clicked on the object"+"\n"
                                         "If twoo points are clicked, the second point is used for axis rotation"+"\n"
                                         "The point axis rotation Can be changed during the work as long as the object is selected"+"\n"
                                         "For this press the CTRL KEY and click the new point rotation"))
        ####
        self.groupBox_Axis.setTitle(_translate("MainWindow", "Axis Rotation"))
        self.RB_Rotation_X.setText(_translate("MainWindow", "Rotation(Z) Yaw"))
        self.RB_Rotation_X.setToolTip(_translate("MainWindow", "Rotation on Axis Yaw (Z)"))
        self.RB_Rotation_Y.setText(_translate("MainWindow", "Rotation(Y) Pitch"))
        self.RB_Rotation_Y.setToolTip(_translate("MainWindow", "Rotation on Axis Pitch (Y)"))
        self.RB_Rotation_Z.setText(_translate("MainWindow", "Rotation(X) Roll"))
        self.RB_Rotation_Z.setToolTip(_translate("MainWindow", "Rotation on Axis Roll (X)"))
        self.RB_Direction_D.setText(_translate("MainWindow", "Direction"))
        self.RB_Direction_D.setToolTip(_translate("MainWindow", "Rotation or Translation on Direction" + "\n"
                                                                "For use the Direction option:" + "\n"
                                                                "Select First: the object to Rotate/Translate" + "\n"
                                                                "Second: the path: Line, Wire or Edge"))
        ####
        self.groupBox_Work.setTitle(_translate("MainWindow", "Work"))
        self.groupBox_Pos_Mouse.setTitle(_translate("MainWindow", "Coordinates Point clicked"))
        self.groupBox_Pos_Mouse.setToolTip(_translate("MainWindow", "Position click mouse modification possible only with mode Point clicked"))
        self.DS_Pos_Mouse_X.setToolTip(_translate("MainWindow", "Position click mouse X" + "\n" +
                                       "modification only with mode Point clicked"))
        self.DS_Pos_Mouse_Y.setToolTip(_translate("MainWindow", "Position click mouse Y" + "\n" +
                                       "modification only with mode Point clicked"))
        self.DS_Pos_Mouse_Z.setToolTip(_translate("MainWindow", "Position click mouse Z" + "\n" +
                                       "modification only with mode Point clicked"))
        self.CB_Position.setText(_translate("MainWindow", "Translation"))
        self.CB_Position.setToolTip(_translate("MainWindow", "Check for move the object to axis choice X, Y or Z"))
        #self.CB_Point.setText(_translate("MainWindow", "Point"))
        #self.CB_Point.setToolTip(_translate("MainWindow", "If checked, create one point to visualise the point rotation"))
        self.PB_Point.setText(_translate("MainWindow", "Point"))
        self.PB_Point.setToolTip(_translate("MainWindow", "Create one point to visualise the point rotation"))
        #self.CB_Free.setText(_translate("MainWindow", "Free"))
        #self.CB_Free.setToolTip(_translate("MainWindow", "This checkBox switch the Application button"))
        self.LE_Increment.setToolTip(_translate("MainWindow", "Display the original Data + the modification"))
        self.DS_Scroll_Bar.setToolTip(_translate("MainWindow", "Enter the modification"))
        self.PB_Apply.setToolTip(_translate("MainWindow", "Apply the modification"))
        self.PB_Apply.setText(_translate("MainWindow", "Apply"))
        self.label_00.setText(_translate("MainWindow", " Select one Object or give one value Angle/Dimension"))
        ####
        self.groupBox_Data.setTitle(_translate("MainWindow", "Data"))
        self.PB_Save_Memorize.setText(_translate("MainWindow", "Save"))
        self.PB_Save_Memorize.setToolTip(_translate("MainWindow", "Save the memorized placement" + "\n"
                                                    "Format to save : [Placement.Base], [Placement.Rotation.toEuler]" + "\n"
                                                    "Ex: [0.0,0.0,0.0],[0.0,0.0,0.0] with the ext: .CoorInfo" + "\n"
                                                    "If the file exist, the data is saved in Append (adding) mode" + "\n"
                                                    "If the CheckBox is checked for a Macro the file is saved in Write mode"))
        self.PB_ClearMemo.setText(_translate("MainWindow", "Clear"))
        self.PB_ClearMemo.setToolTip(_translate("MainWindow", "Clear the memo data" + "\n"
                                                              "The Reset button is not actif for this option"))
        self.PB_Delete_Line_Memory.setText(_translate("MainWindow", "Delete"))
        self.PB_Delete_Line_Memory.setToolTip(_translate("MainWindow", "Delete the line selected"))
        self.PB_Memorize.setText(_translate("MainWindow", "Memorize"))
        self.PB_Memorize.setToolTip(_translate("MainWindow", "Memorize the placement displayed"))
        self.CB_DataInMacro.setText(_translate("MainWindow", "Macro"))
        self.CB_DataInMacro.setToolTip(_translate("MainWindow", "If checked, the coordinate is saved in Python code (complete macro) in your Macro directory" + "\n"
                                                                "Actual : " + path + "\n"
                                                                "Select the object and run the macro" + "\n"
                                                                "\t" + "The macro saved has various options :" + "\n"
                                                                "\t" + " (Q)uit, (D)ecrease, (I)ncrease, (P)ause, (S)tep, (M)emo" + "\n"
                                                                "If this is not checked, the data hare saved in coordinate mode" + "\n"
                                                                "\t" + "Ex: [0.0,0.0,0.0],[0.0,0.0,0.0] with the ext: .CoorInfo" + "\n"))
        self.CB_On_Click_Apply.setText(_translate("MainWindow", "Memo on click"))
        self.CB_On_Click_Apply.setToolTip(_translate("MainWindow", "Memorize the coordinates on all Click Apply button"))
        ####
        self.groupBox_Command.setTitle(_translate("MainWindow", "Command"))
        self.PB_Quit.setText(_translate("MainWindow", "Quit"))
        self.PB_Quit.setToolTip(_translate("MainWindow", "Quite the macro"))
        self.PB_Original.setText(_translate("MainWindow", "Original"))
        self.PB_Original.setToolTip(_translate("MainWindow", "Move the object to the original position"))
        self.PB_Reset.setText(_translate("MainWindow", "Reset"))
        self.PB_Reset.setToolTip(_translate("MainWindow", "Reset the complete data macro"))
        self.PB_Zero.setText(_translate("MainWindow", "0,0,0"))
        self.PB_Zero.setToolTip(_translate("MainWindow", "Move the object to the base coordinates 0, 0, 0"))


    def on_DS_Pos_Mouse_X(self,val):
        global positionMouse
        global axisX

        positionMouse = [val, positionMouse[1], positionMouse[2]]
        axisX = positionMouse[0]
        self.DS_Pos_Mouse_X.setValue(axisX)
#        print("on_DS_Pos_Mouse_X ", val)

    def on_DS_Pos_Mouse_Y(self,val):
        global positionMouse
        global axisY

        positionMouse = [positionMouse[0], val, positionMouse[2]]
        axisY = positionMouse[1]
        self.DS_Pos_Mouse_Y.setValue(axisY)
#        print("on_DS_Pos_Mouse_Y ", val)

    def on_DS_Pos_Mouse_Z(self,val):
        global positionMouse
        global axisZ

        positionMouse = [positionMouse[0], positionMouse[1], val]
        axisZ = positionMouse[2]
        self.DS_Pos_Mouse_Z.setValue(axisZ)
#        print("on_DS_Pos_Mouse_Z ", val)

#    def on_SC_Slider_Bar(self,val):
#        global ui
#        global valeur
#        global myObject
#
#        if (myObject != "") and (self.CB_Free.isChecked()):
#            valeur = val
#            self.DS_Scroll_Bar.setValue(1)
#            self.SC_Slider_Bar.setValue(valeur)
#            ui.on_PB_Apply_clicked()
#
##            if self.CB_Free.isChecked():
##                ui.on_PB_Apply_clicked()
##        else:
##            self.DS_Scroll_Bar.setValue(0.0)
##            self.SC_Slider_Bar.setValue(0.0)

#        print("on_SC_Scroll_Bar ", valeur)

    def on_PB_Delete_Line_Memory(self):    #self.TE_Memorize    #QListView
        global countMemory
        global saveOnDisk

        self.model = model = QtGui.QStandardItemModel()
        try:
            self.PB_Delete_Line_Memory.setStyleSheet("Base")
            lineSelected = self.TE_Memorize.selectionModel().selectedRows()[0].row()
            #textLigne = self.TE_Memorize.selectionModel().currentIndex().data() # affiche la ligne selectionnee
            self.TE_Memorize.model().removeRow(lineSelected)
            del saveOnDisk[lineSelected]
            countMemory -= 1
            self.PB_Memorize.setText("Memo (" + str(countMemory) + ")")
        except Exception:
            self.PB_Delete_Line_Memory.setStyleSheet("background-color: rgb(255, 0, 0)")
#        print("on_PB_Delete_Line_Memory ")

    def on_TE_Clicked(self, index):    # click dans la fenetre 
        global saveOnDisk
        global saveListView
        global memorySelected        

####ori colore la ligne######
#        item = saveListView.itemFromIndex(index)
#        item.setBackground(QtGui.QBrush(QtGui.QColor("#ef1919")))
#        if (item.index().row()) in memorySelected:
##            memorySelected.remove(item.index().row())
#            baseBackground = self.TE_Memorize.palette().color(QPalette.Window)
#            item.setBackground(QtGui.QBrush(QtGui.QColor(baseBackground)))
#        else:
#            memorySelected.append(item.index().row())
##        print(memorySelected)
####ori colore la ligne######

        item = saveListView.itemFromIndex(index)
        memorySelected = []
        memorySelected.append(item.index().row())
#        print("on_TE_Clicked ",memorySelected[0])    #self.TE_Memorize

    def on_PB_Memorize(self):
        global myObject
        global saveOnDisk
        global saveListView
        global countMemory
        global valeur

#        if (valeur != 0):
        self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable 
        countMemory += 1
        xPB = str(myObject.Placement.Base[0])
        yPB = str(myObject.Placement.Base[1])
        zPB = str(myObject.Placement.Base[2])
        xPR = str(myObject.Placement.Rotation.toEuler()[0])
        yPR = str(myObject.Placement.Rotation.toEuler()[1])
        zPR = str(myObject.Placement.Rotation.toEuler()[2])
                  #[(3.7,0.0,41.8),          (0.0,3.0,0.0)],
                  #Placement.Base           Placement.Rotation.toEuler()
        dummy = "[("+xPB+","+yPB+","+zPB+"),("+xPR+","+yPR+","+zPR+")],"
        saveOnDisk.append(dummy)
        self.PB_Memorize.setText("Memo (" + str(countMemory) + ")")
        self.PB_Memorize.setStyleSheet("background-color: rgb(188, 245, 169)"); # bouton
        self.PB_Delete_Line_Memory.setStyleSheet("Base")
        item = QtGui.QStandardItem(dummy)
        saveListView.appendRow(item)
#        else:
#            self.PB_Memorize.setStyleSheet("background-color: #ff0000;")
#            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable 
#        print("on_PB_Memorize ",saveListView,"  ",str(countMemory))

    def on_PB_Save_Memorize(self):
        global pathFile
        global saveOnDisk
        global countMemory
        global path

        if countMemory != 0:
            if self.CB_DataInMacro.isChecked():
#                SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a file FCMacro", path, "FCMacro (*.FCMacro);;Python (*.py)")                   # PySide2
                nomMacro = FreeCAD.ActiveDocument.Name
                SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a file FCMacro", path + nomMacro, "(*.FCMacro);;Python (*.py)") # PySide2
            else:
                SaveName, Filter = PySide2.QtWidgets.QFileDialog.getSaveFileName(None, "Save a file CoorInfo", pathFile, "CoorInfo (*.CoorInfo);;Ascii (*.asc);;TXT (*.txt)")   # PySide2

            if SaveName == "":                                                            # if the name file are not selected then Abord process
                App.Console.PrintMessage("Process aborted"+"\n")
            else:                                                                         # if the name file are selected or created then 
                ####new2
                pathFile      = os.path.dirname(SaveName) + "/"  #= C:/Provisoire400/
                formatFichier = os.path.splitext(SaveName)[1]    #= .png
                SaveName      = os.path.splitext(SaveName)[0]    #= /home/kubuntu/.FreeCAD/Macro/Texture_007_H #= C:/Provisoire400/image3D
                SaveNameformatFichier = SaveName + formatFichier #= C:/Provisoire400/image3D.png
                ####new2
                
                ######## sauve le dernier chemin utilise si n'est pas une macro########
                if self.CB_DataInMacro.isChecked():
                    None
                else:
                    FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __title__).SetString("setLastPath",pathFile)
                ######## sauve le dernier chemin utilise si n'est pas une macro########

                App.Console.PrintMessage("Registration of "+SaveNameformatFichier+"\n")
                try:
                    if self.CB_DataInMacro.isChecked():
                        file = open(SaveNameformatFichier, 'w') #'w'write
                    else:
                        file = open(SaveNameformatFichier, 'a') #'a'append
                    try:
                        #### macro first section begin
                        if self.CB_DataInMacro.isChecked():
                            file.write("##" + "\n")
                            try:
                                file.write("##Created by : " + __title__ + " : " + __version__ + ":" + __date__ + "  : " + __author__ + "\n")
                                file.write("##Document   : " + FreeCAD.ActiveDocument.Name + "\n")
                                file.write("##Date       : " + str(QDate.currentDate().toString()) + "\n")
                                file.write("##Object     : " + str(FreeCADGui.Selection.getSelection()[0].Name) + "\n")
                            except Exception: None
                            file.write("import Draft, Part" + "\n")
                            file.write("import PySide2" + "\n")
                            file.write("from pivy import coin" + "\n")
                            file.write("import time, os" + "\n")
                            file.write("" + "\n")
                            file.write("import FreeCAD, FreeCADGui" + "\n")
                            file.write("App = FreeCAD" + "\n")
                            file.write("Gui = FreeCADGui" + "\n")
                            file.write("" + "\n")
                            file.write("global Document; Document = " + chr(34) + FreeCAD.ActiveDocument.Name + chr(34) + "\n")
                            file.write("global xxData  ; xxData   = [] " + "\n")
                            file.write("global xxKey   ; xxKey    = " + chr(34) + chr(34) + "\n")
                            file.write("global v, o, c" + "\n")
                            file.write("global vitesse ; vitesse  = 0.02" + "\n")
                            file.write("" + "\n")
                            file.write("def help():" + "\n")
                            file.write("    global xxData" + "\n")
                            file.write("    global Document" + "\n")
                            file.write('    App.Console.PrintMessage("__' + FreeCAD.ActiveDocument.Name + '__"+"' + chr(92) + 'n")' + "\n")
                            file.write('    App.Console.PrintMessage("__" + str(len(xxData)) + " Coordinates__"+"' + chr(92) + 'n")' + "\n")
                            file.write('    App.Console.PrintMessage("Type Key Q to Quit"+"' + chr(92) + 'n")' +  "\n")
                            file.write('    App.Console.PrintMessage("Type Key D to Decrease speed"+"' + chr(92) + 'n")' +  "\n")
                            file.write('    App.Console.PrintMessage("Type Key I to Increase speed"+"' + chr(92) + 'n")' +  "\n")
                            file.write('    App.Console.PrintMessage("Type Key P to Pause/Continue or key RETURN or ESCAPE"+"' + chr(92) + 'n")' +  "\n")
                            file.write('    App.Console.PrintMessage("Type Key S to Step by Step (key RETURN or ESCAPE to continue)"+"' + chr(92) + 'n")' +  "\n")
                            file.write('    App.Console.PrintMessage("Type Key M for this message"+"' + chr(92) + 'n")' +  "\n")
                            file.write('    App.Console.PrintMessage("____________________________"+"' + chr(92) + 'n")' +  "\n")
                            file.write('\n')
                            file.write('class ViewObserver:' +  "\n")
                            file.write('    def logPosition(self, info):' +  "\n")
                            file.write('        global xxKey' +  "\n")
                            file.write('        global v, o, c' +  "\n")
                            file.write('        global vitesse' +  "\n")
                            file.write('' +  "\n")
                            file.write('        xxKey = info["Key"].upper()' +  "\n")
                            file.write('        if xxKey in "QIDPSM" or xxKey == "RETURN" or xxKey == "PAD_ENTER" or xxKey == "ESCAPE":' +  "\n")
                            file.write('            if (xxKey == "Q"):                        # Quit' +  "\n")
                            file.write('                v.removeEventCallback("SoKeyboardEvent",c)' +  "\n")
                            file.write('                FreeCAD.Console.PrintMessage("End " + Document + "' + chr(92) + 'n")' +  "\n")
                            file.write('' +  "\n")
                            file.write('            if (xxKey == "I"):                        # Increase' +  "\n")
                            file.write('                vitesse -= 0.01' +  "\n")
                            file.write('                if vitesse <= 0:' +  "\n")
                            file.write('                    vitesse = 0' +  "\n")
                            file.write('                    App.Console.PrintMessage("Speed maximum"+"' + chr(92) + 'n")' +  "\n")
                            file.write('                else:' +  "\n")
                            file.write('                    App.Console.PrintMessage(str(vitesse)+"' + chr(92) + 'n")' +  "\n")
                            file.write('' +  "\n")
                            file.write('            if (xxKey == "D"):                        # Decrease' +  "\n")
                            file.write('                vitesse += 0.01' +  "\n")
                            file.write('                App.Console.PrintMessage(str(vitesse)+"' + chr(92) + 'n")' +  "\n")
                            file.write('' +  "\n")
                            file.write('            if (xxKey == "M"):                        # Help memo' +  "\n")
                            file.write('                help()' +  "\n")
                            file.write('##Begin of file' + "\n")
                            file.write('xxData = [' + "\n")
                        #### save data
                        for i in saveOnDisk:
                            file.write(i + "\n")
                        #### save data
                        #### macro second section begin
                        if self.CB_DataInMacro.isChecked():
                            file.write(']' + "\n")
                            file.write('##End of file' + "\n")
                            file.write('' + "\n")
                            file.write('createPoint = 0    # 0=not point 1=create point #used by "S" :Step to Step' + "\n")
                            file.write('try:' + "\n")
                            file.write('    v = Gui.activeDocument().activeView()' + "\n")
                            file.write('    o = ViewObserver()' + "\n")
                            file.write('    c = v.addEventCallback("SoKeyboardEvent",o.logPosition)' + "\n")
                            file.write('' + "\n")
                            file.write('    ##Select the object' + "\n")
                            file.write('    myObject = FreeCADGui.Selection.getSelection()[0]    #select the object' + "\n")
                            file.write('    help()    #help message' + "\n")
                            file.write('' + "\n")
                            file.write('    ##Loop' + "\n")
                            file.write('    while xxKey != "Q":' + "\n")
                            file.write('            comptCoordinate = -1          # coordinte 0 to ...x' + "\n")
                            file.write('            for p in xxData:' + "\n")
                            file.write('                #if (xxKey == "Q"): break # Quit the loop after finish the complete loop (commented by default: if used quit the loop as is)' + "\n")
                            file.write('                comptCoordinate += 1' + "\n")
                            file.write('                ##         p[0]=Coordinate x,y,z;  p[1]=Rotation angle x (Roll), y (Pitch), z (Yaw)' + "\n")
                            file.write('                px = float(p[0][0]);    rx = float(p[1][0])' + "\n")
                            file.write('                py = float(p[0][1]);    ry = float(p[1][1])' + "\n")
                            file.write('                pz = float(p[0][2]);    rz = float(p[1][2])' + "\n")
                            file.write('                myObject.Placement=App.Placement(App.Vector(px,py,pz), App.Rotation(rx,ry,rz), App.Vector(0,0,0))' + "\n")
                            file.write('                Gui.updateGui()                                            # rafraichi l''ecran' + "\n")
                            file.write('                time.sleep(vitesse)' + "\n")
                            file.write('' + "\n")
                            file.write('                if xxKey == "P":                                           # Pause' + "\n")
                            file.write('                    xxKey = ""' + "\n")
                            file.write('                    comptLoop = 0' + "\n")
                            file.write('                    while xxKey != "P":' + "\n")
                            file.write('                        if xxKey == "RETURN" or xxKey == "PAD_ENTER" or xxKey == "ESCAPE": break' + "\n")
                            file.write('                        comptLoop += 1' + "\n")
                            file.write('                        if comptLoop > 50000:' + "\n")
                            file.write('                            comptLoop = 0' + "\n")
                            file.write('                            App.Console.PrintError("You is in mode Pause : Type P or RETURN or ESCAPE to continue" + "' + chr(92) + 'n")' + "\n")
                            file.write('                        Gui.updateGui()                                    # rafraichi l''ecran' + "\n")
                            file.write('                    xxKey = ""' + "\n")
                            file.write('' + "\n")
                            file.write('                if xxKey == "S":                                           # Step by Step' + "\n")
                            file.write('                    App.Console.PrintMessage(str(myObject.Placement) + " #(" + str(comptCoordinate) + ")" + "' + chr(92) + 'n")' + "\n")
                            file.write('                    ####' + "\n")
                            file.write('                    if createPoint == 1:' + "\n")
                            file.write('                        point = Draft.makePoint(myObject.Placement.Base)   # create point to Placement.Base' + "\n")
                            file.write('                        Draft.autogroup(point)                             #' + "\n")
                            file.write('                        FreeCAD.ActiveDocument.recompute()                 #' + "\n")
                            file.write('                    ####' + "\n")
                            file.write('                    xxKey = ""' + "\n")
                            file.write('                    while xxKey != "S":' + "\n")
                            file.write('                        if xxKey == "RETURN" or xxKey == "PAD_ENTER" or xxKey == "ESCAPE": break' + "\n")
                            file.write('                        xxKey = ""' + "\n")
                            file.write('                        Gui.updateGui()                                    # rafraichi l''ecran' + "\n")
                            file.write('' + "\n")
                            file.write('except Exception:' + "\n")
                            file.write('    FreeCAD.Console.PrintError("' + chr(92) + 'n"+"Not document open, or not object selected" + "' + chr(92) + 'n")' + "\n")
                            file.write('    try:' + "\n")
                            file.write('         v.removeEventCallback("SoKeyboardEvent",c)' + "\n")
                            file.write('    except Exception:' + "\n")
                            file.write('        None' + "\n")
                            file.write('' + "\n")
                        #### macro second section end

                    except Exception:
                        App.Console.PrintError("Error write file "+"\n")
                    finally:
                        file.close()
                except Exception:
                    App.Console.PrintError("Error Write file "+SaveName+"\n")
#        print("on_PB_Save_Memorize")

    def on_PB_ClearMemo(self):
        global saveOnDisk
        global saveListView
        global countMemory
        global memorySelected

        try:
            model = saveListView = QtGui.QStandardItemModel()
            self.TE_Memorize.model().removeRows(0, countMemory)# model.rowCount()
            saveOnDisk     = []
            self.TE_Memorize.setModel(saveListView)
            countMemory    = 0
            memorySelected = []
            self.PB_Memorize.setText("Memo")
            self.PB_Memorize.setStyleSheet("Base")
            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable 
        except Exception:
            None
#        print("on_PB_ClearMemo")

    def on_CB_On_Click_Apply(self):

        if self.CB_On_Click_Apply.isChecked():
            self.CB_On_Click_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(normalWork_Icon))) # icone dans une variable 
            self.CB_On_Click_Apply.setText(u"Memo on demand")
            self.CB_On_Click_Apply.setToolTip(u"Memorize the coordinates on demand")
            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable 
            self.groupBox_Data.setEnabled(True)
        else:
            self.CB_On_Click_Apply.setIcon(QtGui.QIcon(QtGui.QPixmap(OnClickApply_Icon))) # icone dans une variable 
            self.CB_On_Click_Apply.setText(u"Memo on click")
            self.CB_On_Click_Apply.setToolTip(u"Memorize the coordinates on all Click Apply button")
#        print("on_CB_On_Click_Apply")

    def On_CB_DataInMacro(self):

        if self.CB_DataInMacro.isChecked():
            self.CB_DataInMacro.setIcon(QtGui.QIcon(QtGui.QPixmap(code_FC_Icon))) # icone dans une variable 
            self.CB_DataInMacro.setText(u"Coordinate")
            self.PB_Save_Memorize.setText("Save (wr)")
            self.PB_Save_Memorize.setToolTip("The file is open in mode Write" + "\n"
                                             "If the file exist, the file is crushed" + "\n"
                                             "")
        else:
            self.CB_DataInMacro.setIcon(QtGui.QIcon(QtGui.QPixmap(code_Python_Icon))) # icone dans une variable 
            self.CB_DataInMacro.setText(u"Macro")
            self.PB_Save_Memorize.setText("Save (ap)")
            self.PB_Save_Memorize.setToolTip("The file is open in mode Append" + "\n"
                                             "If the file exist, the the data hare adding in the file" + "\n"
                                             "")
#        print("On_CB_DataInMacro")

    def on_DS_Scroll_Bar(self,val):
        global valeur
        global myObject
        global axisX, axisY, axisZ
        global posX, posY, posZ
        global rotAngleX, rotAngleY, rotAngleZ

        valeur = val
        if (myObject == "") or (valeur == 0):
            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable 
            self.DS_Scroll_Bar.setValue(0.0)
            self.DS_Scroll_Bar.setStyleSheet("background-color: rgb(250, 88, 88)")
#            self.SC_Slider_Bar.setValue(0.0)
            None
        else:
            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable 
            self.DS_Scroll_Bar.setStyleSheet("Base")
            self.PB_Memorize.setStyleSheet("Base")
#            self.SC_Slider_Bar.setValue(valeur)
            if self.CB_Position.isChecked():                 # translate

                if self.RB_Rotation_X.isChecked():
                    posX = valeur
                    posY = posZ = 0.0
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[0],4) + valeur))
                elif self.RB_Rotation_Y.isChecked():
                    posY = valeur
                    posX = posZ = 0.0
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[1],4) + valeur))
                elif self.RB_Rotation_Z.isChecked():
                    posZ = valeur
                    posX = posY = 0.0
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4) + valeur))
                elif self.RB_Direction_D.isChecked():
                    posZ = valeur
                    posX = posY = 0.0
                    xD = str(round(myObject.Placement.Base[0],4))
                    yD = str(round(myObject.Placement.Base[1],4))
                    zD = str(round(myObject.Placement.Base[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")

                self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2))+" , " + 
                                                 str(round(myObject.Placement.Base[1],2))+" , " + 
                                                 str(round(myObject.Placement.Base[2],2))+")] " +
                                      "[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")

            else:                                            # rotation

                if self.RB_Rotation_X.isChecked():
                    rotAngleX = valeur
                    rotAngleY = rotAngleZ = 0.0
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4) + valeur))
                elif self.RB_Rotation_Y.isChecked():
                    rotAngleY = valeur
                    rotAngleZ = rotAngleX = 0.0
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4) + valeur))
                elif self.RB_Rotation_Z.isChecked():
                    rotAngleZ = valeur
                    rotAngleX = rotAngleY = 0.0
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4) + valeur))
                elif self.RB_Direction_D.isChecked():
                    rotAngleZ = valeur
                    rotAngleX = rotAngleY = 0.0
                    xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
                    yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
                    zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")

                self.label_00.setText("[Rot=(" + str(round(rotAngleX,2)) + " , " + str(round(rotAngleY,2)) + " , " + str(round(rotAngleZ,2)) + ")] " +
                                      "[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
#        print("on_DS_Scroll_Bar ", valeur)

    def on_LE_Increment_Pressed(self,text):
        None
#        print("on_lineEdit_1_Pressed")

    def on_PB_Apply_clicked(self):
        global valeur
        global myObject

        global axisX, axisY, axisZ
        global posX, posY, posZ
        global rotAngleX, rotAngleY, rotAngleZ

        if (myObject == "") or (valeur == 0):
            self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;")   # white red bold
            self.label_00.setText(" Select one Object or give one value Angle/Dimension")
            FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Eteint_Icon))) # icone dans une variable 
            if valeur == 0:
                self.DS_Scroll_Bar.setStyleSheet("background-color: rgb(250, 88, 88)")
        else:
            self.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable 
            if self.CB_Position.isChecked():                 # translate

                if self.RB_Direction_D.isChecked():          # direction
                    try:
                        selectedEdge = FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0]         # select one element and axis second object (2 selections)
                    except Exception:
                        try:
                            selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[1]     # select one element and axis same object   (2 selections)
                        except Exception:
                            try:
                                selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0] # select one element and axis same object   (1 selection)
                            except Exception:
                                None
                    #print(selectedEdge)
                    pointsTrajet = []
                    try:
                        pointsTrajet  = selectedEdge.discretize(Distance = 1.0)                         # discretize the element
                    except Exception:
                        direction = myObject.Shape.Vertexes[0].Point
                        pointsTrajet = direction
                        None
                    
                    try:
                        direction = pointsTrajet[1].sub(pointsTrajet[0])                                # search the direction line or sub
                    except Exception:
                        try:
                            direction = myObject.Shape.Vertexes[0].Point                                # direction point
                        except Exception:
                            direction = App.Vector(0.0,0.0,0.0)
                    
                    myObject.Placement.Base = myObject.Placement.Base + App.Vector(direction).scale(valeur, valeur, valeur)
                else:
                    myObject.Placement = App.Placement(App.Vector(posX, posY, posZ), App.Rotation(0.0,0.0,0.0), App.Vector(0.0,0.0,0.0)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)

                if self.RB_Rotation_X.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[0],4)))
                elif self.RB_Rotation_Y.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[1],4)))
                elif self.RB_Rotation_Z.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))
                elif self.RB_Direction_D.isChecked():
                    xD = str(round(myObject.Placement.Base[0],4))
                    yD = str(round(myObject.Placement.Base[1],4))
                    zD = str(round(myObject.Placement.Base[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")

                self.label_00.setText("[Pos=(" + str(round(myObject.Placement.Base[0],2))+" , " + 
                                                 str(round(myObject.Placement.Base[1],2))+" , " + 
                                                 str(round(myObject.Placement.Base[2],2))+")] " +
                                      "[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")

            else:                                            # rotation
                if self.RB_Direction_D.isChecked():          # direction
                    try:
                        selectedEdge = FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0]         # select one element and axis second object (2 selections)
                    except Exception:
                        try:
                            selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[1]     # select one element and axis same object   (2 selections)
                        except Exception:
                            try:
                                selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0] # select one element and axis same object   (1 selection)
                            except Exception:
                                None
                    try:
                        direction = selectedEdge.Vertexes[1].Point.sub(selectedEdge.Vertexes[0].Point)# search the direction line or sub
                    except Exception:
                        try:
                            direction = objectRotation.Vertexes[0].Point
                        except Exception:
                            direction = App.Vector(0.0,0.0,0.0)
#####
#                    if (self.CB_Free.isChecked()):#            valeur = valvaleur = 1.0
#                        myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(direction), 1), App.Vector(axisX, axisY, axisZ))#.multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
#                    else:
#                        myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(direction), valeur), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
#####
                    myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(direction), valeur), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement)
                else:
                    myObject.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(rotAngleX, rotAngleY, rotAngleZ), App.Vector(axisX, axisY, axisZ)).multiply(App.ActiveDocument.getObject(myObject.Name).Placement) # other method

                if self.RB_Rotation_X.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4)))
                elif self.RB_Rotation_Y.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4)))
                elif self.RB_Rotation_Z.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
                elif self.RB_Direction_D.isChecked():
                    xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
                    yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
                    zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")

                self.label_00.setText("[Rot=(" + str(round(myObject.Placement.Rotation.toEuler()[0],2)) + " , " +
                                                 str(round(myObject.Placement.Rotation.toEuler()[1],2)) + " , " + 
                                                 str(round(myObject.Placement.Rotation.toEuler()[2],2)) + ")] " +
                                      "[Axis=("+ str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
            if self.CB_On_Click_Apply.isChecked():
                self.on_PB_Memorize()

#            FreeCAD.ActiveDocument.recompute()
#        print("on_PB_Apply_clicked")

    def on_RB_Rotation_0(self):
        None
#        print("on_RB_Rotation_0")

    def on_RB_Rotation_X(self):
        global myObject

        if self.CB_Position.isChecked():              
            self.LE_Increment.setText(str(round(myObject.Placement.Base[0],4)))                  # pos X
        else:
            self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4)))    # yaw = Z
        self.DS_Scroll_Bar.setValue(0.0)
#        print("on_RB_Rotation_X")

    def on_RB_Rotation_Y(self):
        global myObject

        if self.CB_Position.isChecked():              
            self.LE_Increment.setText(str(round(myObject.Placement.Base[1],4)))                  # pos Y
        else:
            self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4)))    # pitch= Y
        self.DS_Scroll_Bar.setValue(0.0)
#        print("on_RB_Rotation_Y")

    def on_RB_Rotation_Z(self):
        global myObject

        if self.CB_Position.isChecked():              
            self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))                  #  pos Z
        else:
            self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))    # roll = X
        self.DS_Scroll_Bar.setValue(0.0)
#        print("on_RB_Rotation_Z")

    def on_RB_Direction_D(self):
        global myObject

        if self.CB_Position.isChecked():              
            xD = str(round(myObject.Placement.Base[0],4))
            yD = str(round(myObject.Placement.Base[1],4))
            zD = str(round(myObject.Placement.Base[2],4))
        else:
            xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
            yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
            zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
        self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
        self.DS_Scroll_Bar.setValue(0.0)
#        print("on_RB_Direction_D")

    def on_RB_CenterRot(self):                                # zero
        global myObject
        global positionMouse
        global axisX, axisY, axisZ
        
        try:
            self.groupBox_Pos_Mouse.setEnabled(False)
            if self.RB_Bond_Box_Center.isChecked():           # axis
                axisX = myObject.Shape.BoundBox.Center.x 
                axisY = myObject.Shape.BoundBox.Center.y
                axisZ = myObject.Shape.BoundBox.Center.z
                self.label_00.setToolTip("Axis BoundBox.Center")
            elif self.RB_Center_Mass.isChecked():
                axisX = myObject.Shape.CenterOfMass.x
                axisY = myObject.Shape.CenterOfMass.y
                axisZ = myObject.Shape.CenterOfMass.z
                self.label_00.setToolTip("Axis Center Of Mass")
            elif self.RB_Point_Clicked.isChecked():
                axisX = positionMouse[0]
                axisY = positionMouse[1]
                axisZ = positionMouse[2]
                self.groupBox_Pos_Mouse.setEnabled(True)
                self.label_00.setToolTip("Point Mouse")
            
        except Exception:
            self.label_00.setText("Error CenterRot_0")
            FreeCAD.Console.PrintError("Error CenterRot_0" + "\n" + "or Bad selection" + "\n")
#        print("on_RB_CenterRot")

    def on_CB_Position(self):
        global myObject
        global posX, posY, posZ
        global axisX, axisY, axisZ

        if self.CB_Position.isChecked():              
            self.RB_Rotation_Z.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Z_Icon))) # icone dans une variable 
            self.RB_Rotation_X.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_X_Icon))) # icone dans une variable 
            self.CB_Position.setIcon(QtGui.QIcon(QtGui.QPixmap(rotate_Icon))) #icone dans une variable 
            self.CB_Position.setToolTip(u"UnCheck for rotate the object in axis selected")
            self.CB_Position.setText(u"Rotation")
            self.CB_Position.setToolTip(u"Rotate the object to axis choice X, Y, Z or D")
            self.groupBox_Rotation.setEnabled(False)
            self.RB_Bond_Box_Center.setChecked(True)
            
#            self.SC_Slider_Bar.setMinimum(-1000)
#            self.SC_Slider_Bar.setMaximum(1000)
#            self.DS_Scroll_Bar.setMinimum(-1000)
#            self.DS_Scroll_Bar.setMaximum(1000)

            self.groupBox_Axis.setTitle("Axis Translation")
            self.RB_Rotation_Z.setText("Translation Z ")          # translate
            self.RB_Rotation_Y.setText("Translation Y ")
            self.RB_Rotation_X.setText("Translation X ")
            self.RB_Direction_D.setText("Translation D ")
            self.DS_Scroll_Bar.setSuffix(" mm")

            try:
                self.label_00.setText("[Pl.Base=(" + str(round(myObject.Placement.Base[0],2)) + " , " + 
                                                 str(round(myObject.Placement.Base[1],2)) + " , " + 
                                                 str(round(myObject.Placement.Base[2],2)) + ")] " +
                                      "[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
                if self.RB_Rotation_X.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[0],4)))
                elif self.RB_Rotation_Y.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[1],4)))
                elif self.RB_Rotation_Z.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Base[2],4)))
                elif self.RB_Direction_D.isChecked():
                    xD = str(round(myObject.Placement.Base[0],4))
                    yD = str(round(myObject.Placement.Base[1],4))
                    zD = str(round(myObject.Placement.Base[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
            except Exception:
                self.label_00.setText("Error Position_0")
                FreeCAD.Console.PrintError("Error Position_0" + "\n" + "or Bad selection" + "\n")
        else:
            self.RB_Rotation_Z.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_X_Icon))) # icone dans une variable 
            self.RB_Rotation_X.setIcon(QtGui.QIcon(QtGui.QPixmap(axis_Z_Icon))) # icone dans une variable 
            self.CB_Position.setIcon(QtGui.QIcon(QtGui.QPixmap(translate_Icon))) #icone dans une variable 
            self.CB_Position.setText(u"Translation")
            self.CB_Position.setToolTip(u"Check for move the object to axis choice X, Y, Z or D")
            self.groupBox_Rotation.setEnabled(True)
#            self.SC_Slider_Bar.setMinimum(0.0)
#            self.SC_Slider_Bar.setMaximum(359.0)
#            self.DS_Scroll_Bar.setMinimum(0.0)
#            self.DS_Scroll_Bar.setMaximum(359.0)

            self.groupBox_Axis.setTitle("Axis Rotation")
            self.RB_Rotation_Z.setText("Rotation(X) Roll")      # rotation
            self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
            self.RB_Rotation_X.setText("Rotation(Z) Yaw")
            self.RB_Direction_D.setText("Rotation(D)")
            self.DS_Scroll_Bar.setSuffix(" Degrees")

            try:
                self.label_00.setText("[Rot=(" + str(round(myObject.Placement.Rotation.toEuler()[0],2)) + " , " +
                                                 str(round(myObject.Placement.Rotation.toEuler()[1],2)) + " , " + 
                                                 str(round(myObject.Placement.Rotation.toEuler()[2],2)) + ")] " +
                                      "[Axis=("+str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
                if self.RB_Rotation_X.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4)))
                elif self.RB_Rotation_Y.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4)))
                elif self.RB_Rotation_Z.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
                elif self.RB_Direction_D.isChecked():
                    xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
                    yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
                    zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
            except Exception:
                self.label_00.setText("Error Position_1")
                FreeCAD.Console.PrintError("Error Position_0" + "\n" + "or Bad selection" + "\n")

        self.DS_Scroll_Bar.setValue(0.0)
#        print("on_CB_Position")

    def on_CB_Point(self):
        global ui
        global myObject
        global positionMouse
        
        if self.RB_Bond_Box_Center.isChecked():           # axis
        # if self.CB_Point.isChecked():
            point = Draft.makePoint(myObject.Shape.BoundBox.Center.x, myObject.Shape.BoundBox.Center.y, myObject.Shape.BoundBox.Center.z)
            point.ViewObject.PointColor = (1.0,0.0,0.0)
            point.Label = "Point_BoundBox_Center"
        elif self.RB_Center_Mass.isChecked():
        # if self.CB_Point.isChecked():
            point = Draft.makePoint(myObject.Shape.CenterOfMass.x, myObject.Shape.CenterOfMass.y, myObject.Shape.CenterOfMass.z)
            point.ViewObject.PointColor = (0.0,1.0,0.0)
            point.Label = "Point_CenterOfMass"
        elif self.RB_Point_Clicked.isChecked():
        # if self.CB_Point.isChecked():
            point = Draft.makePoint(positionMouse[0], positionMouse[1], positionMouse[2])
            point.ViewObject.PointColor = (0.0,0.0,1.0)
            point.Label = "Point_positionMouse"
        Gui.Selection.addSelection(App.ActiveDocument.getObject(myObject.Name))
        FreeCAD.ActiveDocument.recompute()
#        ui.on_RB_CenterRot()
#        print("on_CB_Point")

    def on_PB_Zero_clicked(self):
        global myObject

        if (myObject != ""):
            try:
                pl = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(0.0, 0.0, 0.0), App.Vector(0.0, 0.0, 0.0))
        
                myObject.Placement = pl
                #FreeCAD.ActiveDocument.recompute()
            
                if self.RB_Rotation_X.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4)))
                elif self.RB_Rotation_Y.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4)))
                elif self.RB_Rotation_Z.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))
                elif self.RB_Direction_D.isChecked():
                    xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
                    yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
                    zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
            
                self.label_00.setText("[Rot=(" +str(round(myObject.Placement.Rotation.toEuler()[0],2))+" , "+str(round(myObject.Placement.Rotation.toEuler()[1],2))+" , "+ str(round(myObject.Placement.Rotation.toEuler()[2],2))+")] "+
                                      "[Axis=("+str(round(myObject.Placement.Base.x,2))+" , "+ str(round(myObject.Placement.Base.y,2))+" , "+ str(round(myObject.Placement.Base.z,2))+")]")
                
                self.DS_Scroll_Bar.setValue(0.0)
                self.LE_Increment.setText(str(0.0))
            
                #FreeCAD.ActiveDocument.recompute()
                Gui.activeDocument().activeView().viewTop()
                Gui.SendMsgToActiveView("ViewFit")
    
            except Exception:
                self.label_00.setText("Error Zero_0")
                FreeCAD.Console.PrintError("Error Zero_0" + "\n" + "or Bad selection" + "\n")
        else:
            self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;")   # white red bold
            self.label_00.setText(" Select one Object or give one value Angle/Dimension")
            FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
#        print("on_PB_Zero_clicked")

    def on_PB_Original_clicked(self):
        global ui
        global myObject
        global originalPlacement
        global axisX, axisY, axisZ
        global rotAngleX, rotAngleY, rotAngleZ

        if (myObject != ""):
            try:
                rotAngleX  = rotAngleY = rotAngleZ = 0.0
                myObject.Placement     = originalPlacement
                self.DS_Scroll_Bar.setValue(0.0)
            
                if self.RB_Rotation_X.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[0],4)))    # yaw Z
                elif self.RB_Rotation_Y.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[1],4)))    # pitch Y
                elif self.RB_Rotation_Z.isChecked():
                    self.LE_Increment.setText(str(round(myObject.Placement.Rotation.toEuler()[2],4)))    # roll Z
                elif self.RB_Direction_D.isChecked():
                    xD = str(round(myObject.Placement.Rotation.toEuler()[0],4))
                    yD = str(round(myObject.Placement.Rotation.toEuler()[1],4))
                    zD = str(round(myObject.Placement.Rotation.toEuler()[2],4))
                    self.LE_Increment.setText("(" + xD + ", " + yD + ", " + zD + ")")
            
                ui.on_RB_CenterRot()
            
                self.label_00.setText("[Rot=(" +str(round(myObject.Placement.Rotation.toEuler()[0],2))+" , "+str(round(myObject.Placement.Rotation.toEuler()[1],2))+" , "+ str(round(myObject.Placement.Rotation.toEuler()[2],2))+")] "+
                                      "[Axis=("+str(round(axisX,2))+" , "+ str(round(axisY,2))+" , "+ str(round(axisZ,2))+")]")
                #FreeCAD.ActiveDocument.recompute()
            except Exception:
                self.label_00.setText("Error Original_0")
                FreeCAD.Console.PrintError("Error Original_0" + "\n" + "or Bad selection" + "\n")
        else:
            self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;")   # white red bold
            self.label_00.setText(" Select one Object or give one value Angle/Dimension")
            FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
#        print("on_PB_Original_clicked")

    def on_PB_Reset_clicked(self):
        global ui
        global originalObject
        global myObject
        
        global valeur
        global posX, posY, posZ
        global rotAngleX, rotAngleY, rotAngleZ
        global axisX, axisY, axisZ
        global countMemory

        try:
            for obj in FreeCAD.ActiveDocument.Objects:         # deslectionne
                FreeCADGui.Selection.removeSelection(obj)
        except Exception:
            None

        if countMemory == 0:
            ui.on_PB_ClearMemo

        originalObject = myObject = ""
        posX = posY = posZ = rotAngleX = rotAngleY = rotAngleZ = 0.0
        axisX = axisY = axisZ = 0.0
        valeur  = 0.0

        self.DS_Scroll_Bar.setStyleSheet("Base")
        self.DS_Scroll_Bar.setValue(valeur)
        self.DS_Scroll_Bar.setSuffix(" Degrees")
        self.LE_Increment.setText(str(0.0))

        self.groupBox_Axis.setTitle("Axis Rotation")
        self.RB_Rotation_Z.setText("Rotation(X) Roll")
        self.RB_Rotation_Y.setText("Rotation(Y) Pitch")
        self.RB_Rotation_X.setText("Rotation(Z) Yaw")
        self.RB_Direction_D.setText("Rotation(D) Direction")

        self.groupBox_Rotation.setEnabled(False)
        self.groupBox_Axis.setEnabled(False)
        self.groupBox_Pos_Mouse.setEnabled(False)
        self.groupBox_Work.setEnabled(False)
        self.groupBox_Data.setEnabled(False)

        self.DS_Pos_Mouse_X.setValue(0.0)
        self.DS_Pos_Mouse_Y.setValue(0.0)
        self.DS_Pos_Mouse_Z.setValue(0.0)

#        self.CB_Position.setEnabled(False)
#        self.CB_Position.setChecked(False)
        self.CB_Position.setText(u"Translation")
        self.CB_Position.setToolTip(u"Move the object to axis choice X, Y or Z")
        # self.CB_Point.setEnabled(False)
        # self.CB_Point.setChecked(False)
        self.PB_Point.setEnabled(False)
#        self.CB_Free.setEnabled(False)
#        self.CB_Free.setChecked(False)

        self.label_00.setStyleSheet("color : #ffffff; background-color: red; font: bold 10px;")   # white red bold
        self.label_00.setText(" Select one Object or give one value Angle/Dimension")

        FreeCAD.Console.PrintError("Select one Object or give one value Angle/Dimension" + "\n")
        FreeCAD.Console.PrintMessage("Reset" + "\n")
#        print("on_PB_Reset_clicked")

    def on_PB_Quit_clicked(self):
        self.vueActive.removeEventCallback("SoMouseButtonEvent",self.click) # desinstalle la fonction souris
        FreeCADGui.Selection.removeObserver(s)                              # desinstalle la fonction residente
        #FreeCAD.Console.PrintMessage("Quit xxxxx" + "\n")
        try:
            FreeCADGui.Selection.removeObserver(s)   # Uninstalls resident function (desactivated for read after LeftDock RightDock)
            self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)      # destroy
            self.window.deleteLater()                                       # destroy
            self.window.destroy()                                           # destroy
        except Exception:
            self.window.hide()                                              # hide the window and close the macro
        FreeCAD.Console.PrintMessage("Quit Rotate_To_Point" + "\n")

###################################################################################################
class SelObserver:
    def addSelection(self, document, object, element, position):  # Selection
        global ui
        global sourisPass
        
        global valeur
        global positionMouse
        global originalObject
        global myObject
        global originalPlacement

        global posX, posY, posZ
        global rotAngleX, rotAngleY, rotAngleZ
        global axisX, axisY, axisZ

        if sourisPass == 0:                                                                  # pour un seul passage
            sourisPass == 1

            sel = FreeCADGui.Selection.getSelection()[0]                                     # select object with getSelection()
            
            positionMouse     = position
            originalObject    = myObject = sel   
            originalPlacement = sel.Shape.Placement

            #longueur = (myObject.Shape.BoundBox.XLength * 0.5)                              # pour Axis
            positionBase = originalObject.Shape.Placement.Base                               # Placement Vector XYZ
    
            posX = positionBase.x
            posY = positionBase.y
            posZ = positionBase.z
    
            Yaw   = originalObject.Shape.Placement.Rotation.toEuler()[0]                     # decode angle Euler Yaw
            Pitch = originalObject.Shape.Placement.Rotation.toEuler()[1]                     # decode angle Euler Pitch
            Roll  = originalObject.Shape.Placement.Rotation.toEuler()[2]                     # decode angle Euler Roll
            
            rotAngleX = Yaw
            rotAngleY = Pitch
            rotAngleZ = Roll
            axisX = axisY = axisZ = 0.0

            valeur = 0.0
            ui.DS_Scroll_Bar.setValue(valeur)
            ui.DS_Scroll_Bar.setStyleSheet("background-color: rgb(250, 88, 88)")

            ui.DS_Pos_Mouse_X.setValue(positionMouse[0])
            ui.DS_Pos_Mouse_Y.setValue(positionMouse[1])
            ui.DS_Pos_Mouse_Z.setValue(positionMouse[2])

            ui.on_RB_CenterRot()
            if ui.CB_Position.isChecked():
                ui.groupBox_Rotation.setEnabled(False)
            else:
                ui.groupBox_Rotation.setEnabled(True)
            ui.groupBox_Axis.setEnabled(True)
            ui.groupBox_Work.setEnabled(True)
            ui.groupBox_Data.setEnabled(True)
            ui.PB_Memorize.setIcon(QtGui.QIcon(QtGui.QPixmap(memo_Allume_Icon))) # icone dans une variable 
            #ui.groupBox_Pos_Mouse.setEnabled(True)
            ui.label_00.setStyleSheet("Base")                                                # origin system
            ui.label_00.setText("[Rot =(" + str(round(rotAngleX,2))+ " , " + str(round(rotAngleY,2)) + " , " + str(round(rotAngleZ,2)) + ")] " +
                                "[Axis=("+ str(round(axisX,2)) + " , " + str(round(axisY,2)) + " , " + str(round(axisZ,2)) + ")]")
            ui.PB_Memorize.setStyleSheet("Base")

    def clearSelection(self,doc):                                                            # Si clic sur l'ecran, effacer la selection
        global ui
        ui.on_PB_Reset_clicked

###################################################################################################

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

try:
    for obj in FreeCAD.ActiveDocument.Objects:         # deselectionne
        FreeCADGui.Selection.removeSelection(obj)
except Exception:
    None

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

if __name__ == "__main__":
    MainWindow = QtWidgets.QMainWindow()
    MainWindow.setObjectName("__title__")              # macro internal Name
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()

Example:

Links

The forum feature req: placement - rotate part around its midpoint My macro to Gist mario52a

Version

2021/01/12 ver 00.06 : adding the Data section and more options

2020/03/07 ver 00.05.2 : correct the bug translation delete "direction = myObject.Placement.Rotation.multVec(direction)"

2020/03/01 ver 00.05.1 : correct the position of the test "FreeCAD version"

2020/02/29 ver 00.05 : convert to Hdpi (Layout) and add Direction

06/04/2019 ver 00.04 : Python 3

29/03/2018 ver 00.03 : comment the "FreeCAD.ActiveDocument.recompute()" the change value are too slow with complex element in FreeCAD 0.17.... see FC0.17 recompute strange behaviour (regression)

27/03/2017 ver 00.02 : modify the spinbox "Pos" now accept the negative values

05/03/2017 ver 00.01 : add 3 spinbox for displayed the coordinates X Y Z on click mouse

04/03/2017 ver 00.00