"""
This macro is a container, including 38 helper tools to improve the appearance
of drawings created in the TechDraw workbench. There are tools to:
- create circle and bolt cicle center lines
- draw cosmetic threads in ground and side view
- create vertexes at intersection of elements
- change attributes of center lines and cosmetic lines
- change the number of decimal places of the dimension value
- append special characters ahead of dimension values
- create chain- and coordinate dimensions
- position and cascade dimensions
- create dimension/development of arches
- create cosmetic circumferences
- create a line cosmetic perpendicular
- create a line cosmetic parallel
- create a hole table
- extend and shorten cosmetic lines
- create a cosmetic line arch
- position section view orthogonal to ancestor view
- create an annotation showing the area

All written user informations appear in English/German/Italian/French/Spanish
depending on the selected FreeCAD language.

Workflow:
- Start the macro
- Select the desired line attributes and cascade spacing
- Select any helper tool
"""

__Name__ = 'TechDrawTools'
__Author__ = 'edi and domad'
__Version__ = '0.4.5'
__Comment__ = 'A container, including 38 helper tools to improve the appearance of drawings'
__License__ = 'LGPL v2'
__Web__ = 'https://forum.freecadweb.org/viewtopic.php?f=35&t=59334'
__Communication__ = 'https://github.com/FreeCAD/FreeCAD-macros/blob/master/TechDraw/TechDrawTools.FCMacro'
__Files__ = 'TechDrawTools.svg'
__Help__ = 'Start the macro. Select one of the 38 helper tools.'
__Status__ = 'stable'
__Requires__ = 'e.g. FreeCAD >= v0.19'
__Date__ = '2022-03-26'


from functools import partial
import math

from PySide import QtCore, QtGui  # FreeCAD's special PySide!
import FreeCAD as app
import FreeCADGui as gui
import TechDraw


class LineAttributes:
    '''Operate all line attributes'''
    Colors = {
        'black':   ((0.0, 0.0, 0.0, 0.0), '000000'),
        'grey':    ((0.7, 0.7, 0.7, 0.0), 'b6b6b6'),
        'red':     ((1.0, 0.0, 0.0, 0.0), 'ff0000'),
        'green':   ((0.0, 1.0, 0.0, 0.0), '00ff00'),
        'blue':    ((0.0, 0.0, 1.0, 0.0), '0000ff'),
        'magenta': ((1.0, 0.0, 1.0, 0.0), 'ff00ff'),
        'cyan':    ((0.0, 1.0, 1.0, 0.0), '00ffff'),
        'yellow':  ((1.0, 1.0, 0.0, 0.0), 'ffff00'),
    }
    Styles = {'solid': 1, 'dashed':2, 'dotted':3,'dashdot':4}
    Width = {'thick 0,70': 0.70, 'middle 0,35': 0.35, 'thin 0,18': 0.18}

    def __init__(self):
        self.LineColor =  self.Colors['black']
        self.LineStyle = self.Styles['dashdot']
        self.LineWidth = self.Width['middle 0,35']

    def setColor(self,Color):
        self.LineColor = self.Colors[Color]

    def getColorTuple(self):
        return self.LineColor[0]

    def getColorHex(color):
        return LineAttributes.Colors[color][1]

    def setStyle(self,Style):
        self.LineStyle = self.Styles[Style]

    def getStyle(self):
        return self.LineStyle

    def setWidth(self,Width):
        self.LineWidth = self.Width[Width]

    def getWidth(self):
        return self.LineWidth

class translate:
    '''do all translations'''
    def __init__(self):
        self.langKey = self.getLanguage()

    def getLanguage(self):
        '''get local language key'''
        langDict = {}
        langDict["English"] = 'English'
        langDict["German"] = 'German'
        langDict["Italian"] = 'Italian'
        langDict["French"] = 'French'
        langDict["Spanish"] = 'Spanish'
        self.langKey = 'English'
        if gui.getLocale() in langDict.keys():
            self.langKey = langDict[gui.getLocale()]
        return self.langKey

    def tr(self,textEnglish):
        if self.langKey == 'English':
            return self.englishDict(textEnglish)
        elif self.langKey == 'German':
            return self.germanDict(textEnglish)
        elif self.langKey == 'Italian':
            return self.italianDict(textEnglish)
        elif self.langKey == 'French':
            return self.frenchDict(textEnglish)
        elif self.langKey == 'Spanish':
            return self.spanishDict(textEnglish)

    def englishDict(self,textEnglish):
        return textEnglish

    def germanDict(self,textEnglish):
        dict_ = {"Attributes and Modifications":"Eigenschaften und Änderungen",\
                "Centerlines and Threading":"Mittellinien und Gewinde",\
                "Dimensions":"Bemaßungen",\
                "Line attributes:":"Eigenschaften:",\
                "Cascade spacing:":"Abstand Kaskadierung",\
                "Quit":"Fertig",\
                "set lines to ":"setze Linie auf ",\
                "solid":"Vollinie",\
                "dashed":"strichliert",\
                "dotted":"punktiert",\
                "dashdot":"strich-punkt",\
                "set lines width to ":"setze Linienbreite auf ",\
                "thick 0,70":"breit 0,70",\
                "middle 0,35":"mittel 0,35",\
                "thin 0,18":"schmal 0,18",\
                "set lines color to ":"setze Linienfarbe auf ",\
                "black":"schwarz",\
                "grey":"grau",\
                "red":"rot",\
                "green":"grün",\
                "blue":"blau",\
                "magenta":"magenta",\
                "cyan":"cyan",\
                "yellow":"gelb"}
        return dict_.get(textEnglish,textEnglish)

    def italianDict(self,textEnglish):
        dict_ = {"Attributes and Modifications":"Strumenti di editing",\
                "Centerlines and Threading":"Mezzerie e filettature",\
                "Dimensions":"Quotature",\
                "Line attributes:":"Attributi:",\
                "Cascade spacing:":"Valore distanziamento:",\
                "Quit":"Chiudi",\
                "set lines to ":"tipo di linea ",\
                "solid":"solida",\
                "dashed":"tratteggiata",\
                "dotted":"a punti",\
                "dashdot":"tratto e punto",\
                "set lines width to ":"spessore linea ",\
                "thick 0,70":"spessa 0,70",\
                "middle 0,35":"media 0,35",\
                "thin 0,18":"sottile 0,18",\
                "set lines color to ":"colore linea ",\
                "black":"nero",\
                "grey":"grigio",\
                "red":"rosso",\
                "green":"verde",\
                "blue":"azzurro",\
                "magenta":"magenta",\
                "cyan":"ciano",\
                "yellow":"giallo"}
        return dict_.get(textEnglish,textEnglish)

    def frenchDict(self,textEnglish):
        dict_ = {"Attributes and Modifications":"Outils d'édition",\
                "Centerlines and Threading":"Lignes médianes et filettage",\
                "Dimensions":"Dimensionnement",\
                "Line attributes:":"Les attributs:",\
                "Cascade spacing:":"Valeur d'espacement:",\
                "Quit":"Fermez",\
                "set lines to ":"type de ligne ",\
                "solid":"solide",\
                "dashed":"pointillè",\
                "dotted":"en points",\
                "dashdot":"trait et point",\
                "set lines width to ":"épaisseur de ligne ",\
                "thick 0,70":"épais 0,70",\
                "middle 0,35":"moyen 0,35",\
                "thin 0,18":"mince 0,18",\
                "set lines color to ":"couleur de la ligne ",\
                "black":"noir",\
                "grey":"gris",\
                "red":"rouge",\
                "green":"vert",\
                "blue":"bleu",\
                "magenta":"magenta",\
                "cyan":"cyan",\
                "yellow":"Jaune"}
        return dict_.get(textEnglish,textEnglish)

    def spanishDict(self,textEnglish):
        dict_ = {"Attributes and Modifications":"Herramientas de edición",\
                "Centerlines and Threading":"Líneas centrales y roscado",\
                "Dimensions":"Dimensionamiento",\
                "Line attributes:":"Atributos:",\
                "Cascade spacing:":"Valor de espaciado:",\
                "Quit":"Cerrar",\
                "set lines to ":"tipo de línea ",\
                "solid":"sólido",\
                "dashed":"punteado",\
                "dotted":"en puntos",\
                "dashdot":"trazo y punto",\
                "set lines width to ":"grosor de la línea ",\
                "thick 0,70":"más grueso 0,70",\
                "middle 0,35":"promedio 0,35",\
                "thin 0,18":"delgada 0,18",\
                "set lines color to ":"color de linea ",\
                "black":"negro",\
                "grey":"gris",\
                "red":"rojo",\
                "green":"verde",\
                "blue":"azul",\
                "magenta":"magenta",\
                "cyan":"cian",\
                "yellow":"amarillo"}
        return dict_.get(textEnglish,textEnglish)

class DimensionAttributes:
    '''Operate all dimension attributes'''
    def __init__(self):
        self.DimLineDistance = 7

    def getDimLineDistance(self):
        return self.DimLineDistance

class commandWidget(QtGui.QWidget):
    '''Widget containing the command buttons'''
    def __init__(self):
        super().__init__()

    def oneCommandButton(self,cmd,win):
        '''Create a command push button'''
        Button = QtGui.QPushButton()
        Text = cmd.textEnglish()
        if Lang.langKey == 'German'  and hasattr(cmd,"textGerman"):
            Text = cmd.textGerman()
        elif Lang.langKey == 'Italian' and hasattr(cmd,"textItalian"):
            Text = cmd.textItalian()
        elif Lang.langKey == 'French' and hasattr(cmd,"textFrench"):
            Text = cmd.textFrench()
        elif Lang.langKey == 'Spanish' and hasattr(cmd,"textSpanish"):
            Text = cmd.textSpanish()
        Button.setText(Text[0])
        Button.setToolTip(Text[1])
        if hasattr(cmd,"Icon"):
            Button.setIcon(QtGui.QIcon(cmd.Icon))
        Button.clicked.connect(partial(win.on_PB_clicked,cmd))
        self.layout.addWidget(Button)

class DialogContainer(QtGui.QDialog):

    def __init__(self, parent=gui.getMainWindow()):
        ''' constructor creating a permanent opened dialog window'''
        super().__init__(parent, QtCore.Qt.Tool)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
        self.setAttribute(QtCore.Qt.WA_WindowPropagation, True)
        self.setObjectName("DialogContainer")
        self.initUI()

    def radioButton(self,Box,Slot,Tip,Text,Color='black',Checked = False,Row=-1,Column=-1):
        ''' create a radio button '''
        Button = QtGui.QRadioButton(Box)
        if Checked:
            Button.setMouseTracking(True)
            Button.setChecked(True)
        Button.setText(Lang.tr(Text))
        Button.setStyleSheet("color : #"+LineAttributes.getColorHex(Color))
        Button.setToolTip(Lang.tr(Tip)+Lang.tr(Text))
        Button.clicked.connect(partial(Slot,Text))
        if Row == -1:
            Box.layout.addWidget(Button)
        else:
            Box.layout.addWidget(Button,Row,Column)

    def initUI(self):
        """Specifically handles the UI initialization"""
        self.setWindowTitle("TechDrawTools V- "+__Version__+"-multilanguage")
        self.layout = QtGui.QVBoxLayout(self)
        # Initialize tab screen
        self.tabs = QtGui.QTabWidget()
        self.tabs.setTabPosition(QtGui.QTabWidget.East)
        self.tabs.setTabShape(QtGui.QTabWidget.Triangular)
        self.tab1 = QtGui.QWidget()
        self.tabs.addTab(self.tab1,Lang.tr("Attributes and Modifications"))
        self.tab2 = commandWidget()
        self.tabs.addTab(self.tab2,Lang.tr("Centerlines and Threading"))
        self.tab3 = commandWidget()
        self.tabs.addTab(self.tab3,Lang.tr("Dimensions"))
        # Create layouts of tab1
        self.tab1.layout = QtGui.QVBoxLayout()
        self.topBox1 = commandWidget()
        self.topBox1.layout =QtGui.QVBoxLayout()
        self.bottomBox = QtGui.QWidget()
        self.bottomBox.layout =QtGui.QHBoxLayout()
        self.bottomBoxLeftTop = QtGui.QGroupBox(Lang.tr("Line attributes:"))
        self.bottomBoxLeftTop.layout =QtGui.QVBoxLayout()
        self.bottomBoxLeftBottom = QtGui.QGroupBox()
        self.bottomBoxLeftBottom.layout =QtGui.QVBoxLayout()
        self.bottomBoxRight = QtGui.QGroupBox()
        self.bottomBoxRight.layout =QtGui.QGridLayout()
        # Create layouts of tab2
        self.tab2.layout = QtGui.QVBoxLayout()
        self.topBox2 = commandWidget()
        self.topBox2.layout =QtGui.QVBoxLayout()
        self.bottomBox2 = QtGui.QWidget()
        self.bottomBox2.layout =QtGui.QHBoxLayout()
        self.spinContainerBox = QtGui.QWidget()
        self.spinContainerBox.layout =QtGui.QHBoxLayout()
        # Create layouts of tab3
        self.tab3.layout = QtGui.QVBoxLayout()
        self.topBox3 = commandWidget()
        self.topBox3.layout =QtGui.QVBoxLayout()

        # Radio buttons for line attributes --------------------------------------------

        self.radioButton(self.bottomBoxLeftTop,self.on_RB_ChangeStyle_Clicked,"set lines to ","solid")
        self.radioButton(self.bottomBoxLeftTop,self.on_RB_ChangeStyle_Clicked,"set lines to ","dashed")
        self.radioButton(self.bottomBoxLeftTop,self.on_RB_ChangeStyle_Clicked,"set lines to ","dotted")
        self.radioButton(self.bottomBoxLeftTop,self.on_RB_ChangeStyle_Clicked,"set lines to ","dashdot","black",True)

        self.radioButton(self.bottomBoxLeftBottom,self.on_RB_ChangeWidth_Clicked,"set lines width to ","thick 0,70")
        self.radioButton(self.bottomBoxLeftBottom,self.on_RB_ChangeWidth_Clicked,"set lines width to ","middle 0,35","black",True)
        self.radioButton(self.bottomBoxLeftBottom,self.on_RB_ChangeWidth_Clicked,"set lines width to ","thin 0,18")

        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","black","black",True,0,0)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","grey","grey",False,1,0)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","red","red",False,2,0)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","green","green",False,3,0)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","blue","blue",False,0,1)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","magenta","magenta",False,1,1)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","cyan","cyan",False,2,1)
        self.radioButton(self.bottomBoxRight,self.on_RB_ChangeColor_Clicked,"set lines color to ","yellow","yellow",False,3,1)

        # Button: Quit in  centralWidget -------------------------------------------------------------
        self.PB_Quit = QtGui.QPushButton(self)
        self.PB_Quit.setText(Lang.tr("Quit"))
        self.PB_Quit.clicked.connect(self.on_PB_Quit_clicked)
        # insert buttons into tab 1
        self.topBox1.oneCommandButton(extendLine(),self)
        self.topBox1.oneCommandButton(shortenLine(),self)
        self.topBox1.oneCommandButton(changeLockPosition(),self)
        self.topBox1.oneCommandButton(positionSectionView(),self)
        self.topBox1.oneCommandButton(positionHorizDimChain(),self)
        self.topBox1.oneCommandButton(positionVertDimChain(),self)
        self.topBox1.oneCommandButton(positionObliqueDimChain(),self)
        self.topBox1.oneCommandButton(cascadeHorizDimensions(),self)
        self.topBox1.oneCommandButton(cascadeVertDimensions(),self)
        self.topBox1.oneCommandButton(cascadeObliqueDimension(),self)
        self.topBox1.oneCommandButton(ChangeLineStyle(),self)
        self.topBox1.setLayout(self.topBox1.layout)
        self.bottomBoxLeftTop.setLayout(self.bottomBoxLeftTop.layout)
        self.bottomBoxRight.setLayout(self.bottomBoxRight.layout)
        self.bottomBoxLeftBottom.setLayout(self.bottomBoxLeftBottom.layout)
        self.bottomBox.layout.addWidget(self.bottomBoxLeftTop)
        self.bottomBox.layout.addWidget(self.bottomBoxLeftBottom)
        self.bottomBox.layout.addWidget(self.bottomBoxRight)
        self.bottomBox.setLayout(self.bottomBox.layout)
        # create spin label to define cascade spacing
        self.spinLabel = QtGui.QLabel(Lang.tr("Cascade spacing:"))
        self.SpinBox = QtGui.QSpinBox()
        self.SpinBox.setValue(7)
        self.SpinBox.valueChanged.connect(self.on_SB_clicked)
        self.spinContainerBox.layout.addWidget(self.spinLabel)
        self.spinContainerBox.layout.addWidget(self.SpinBox)
        self.spinContainerBox.setLayout(self.spinContainerBox.layout)
        self.tab1.layout.addWidget(self.topBox1)
        self.tab1.layout.addWidget(self.bottomBox)
        self.tab1.layout.addWidget(self.spinContainerBox)
        self.tab1.layout.addWidget(self.PB_Quit)
        self.tab1.setLayout(self.tab1.layout)
        # insert buttons into tab 2
        self.topBox2.oneCommandButton(CircleCenterLines(),self)
        self.topBox2.oneCommandButton(DrawHoleCircle(),self)
        self.topBox2.oneCommandButton(IntersectionVertex(),self)
        self.topBox2.oneCommandButton(drawArc(),self)
        self.topBox2.oneCommandButton(drawCirc(),self)
        self.topBox2.oneCommandButton(drawPerpendicular(),self)
        self.topBox2.oneCommandButton(drawParallel(),self)
        self.topBox2.oneCommandButton(CenterLine(),self)
        self.topBox2.oneCommandButton(DrawCosmeticThreadHole(),self)
        self.topBox2.oneCommandButton(DrawCosmeticThreadBolt(),self)
        self.topBox2.oneCommandButton(DrawCosmeticThreadSideHole(),self)
        self.topBox2.oneCommandButton(DrawCosmeticThreadSideBolt(),self)
        self.topBox2.setLayout(self.topBox2.layout)
        self.tab2.layout.addWidget(self.topBox2)
        self.tab2.setLayout(self.tab2.layout)
        # insert buttons into tab 3
        self.topBox3.oneCommandButton(drawDiameterSign(),self)
        self.topBox3.oneCommandButton(drawRectangleSign(),self)
        self.topBox3.oneCommandButton(createHorizDimChain(),self)
        self.topBox3.oneCommandButton(createVertDimChain(),self)
        self.topBox3.oneCommandButton(createObliqueDimChain(),self)
        self.topBox3.oneCommandButton(createHorizCoordDim(),self)
        self.topBox3.oneCommandButton(createVertCoordDim(),self)
        self.topBox3.oneCommandButton(createObliqueCoordDim(),self)
        self.topBox3.oneCommandButton(createHorizChamferDim(),self)
        self.topBox3.oneCommandButton(createVertChamferDim(),self)
        self.topBox3.oneCommandButton(createArcLengthDim(),self)
        self.topBox3.oneCommandButton(holeTable(),self)
        self.topBox3.oneCommandButton(increaseComma(),self)
        self.topBox3.oneCommandButton(decreaseComma(),self)
        self.topBox3.oneCommandButton(areaAnnot(),self)
        self.topBox3.setLayout(self.topBox3.layout)
        self.tab3.layout.addWidget(self.topBox3)
        self.tab3.setLayout(self.tab3.layout)
        # Add tabs to widget
        self.layout.addWidget(self.tabs)

# slots --------------------------------------------------------------------------------------------------

    def on_SB_clicked(self):
        ''' Spinbox value changed'''
        DimAttrib.DimLineDistance = self.SpinBox.value()

    def on_PB_clicked(self,cmd):
        ''' Command Push Button clicked  '''
        cmd.activated()

    def on_RB_ChangeStyle_Clicked(self,style):
        Attrib.setStyle(style)

    def on_RB_ChangeWidth_Clicked(self,width):
        Attrib.setWidth(width)

    def on_RB_ChangeColor_Clicked(self,color):
        Attrib.setColor(color)

    def on_PB_Quit_clicked(self):
        app.Console.PrintMessage("End of TechDraw Tools" + "\n")
        super().accept()

# define all commands: each command an own class ---------------------------------

class commonTools:
    ''' common tools used by command buttons'''

    def selectionOK():
        ''' check selection of View and ObjectList '''
        OK, ObjectList, View = False, [], []
        if gui.Selection.getCompleteSelection():
            View = gui.Selection.getCompleteSelection()[0]
            ObjectList = gui.Selection.getSelectionEx()[0].SubElementNames
            if len(ObjectList) > 0:
                OK = True
        return (OK,ObjectList,View)

    def getPoints(View,ObjectList):
        '''sort startpoints and endpoints of two lines belonging together'''
        def circulation(A,B,C):
            '''returns True if circulation ABC is positive'''
            M = app.Matrix(A.x, A.y, 1, 0,
                           B.x, B.y, 1, 0,
                           C.x, C.y, 1, 0,
                           0, 0, 0, 1)
            if M.determinant() > 0.0: return True

        if len(ObjectList) > 1:
            Edge1 = View.getEdgeBySelection(ObjectList[0])
            Edge2 = View.getEdgeBySelection(ObjectList[1])
            if Edge1.Curve.TypeId == 'Part::GeomLine' and Edge2.Curve.TypeId == 'Part::GeomLine':
                Start1, Start2 = Edge1.Vertexes[0].Point, Edge2.Vertexes[0].Point
                End1, End2 = Edge1.Vertexes[1].Point, Edge2.Vertexes[1].Point
                if circulation(Start1,End1,Start2) != circulation(End1,End2,Start2):
                    Help1, Help2 = Start1, End1
                    Start1, End1 = Help2, Help1
            return (Start1,End1,Start2,End2)

    def drawCosmeticThreadLines(View,ObjectList,Hole):
        '''draw lines at cosmetic thread side view hole or bolt'''
        (Start1,End1,Start2,End2) = commonTools.getPoints(View,ObjectList)
        KernelDiam = Start2.sub(Start1).Length
        if Hole:
            Factor = (KernelDiam/0.85-KernelDiam)/2
        else:
            Factor = (KernelDiam*0.85-KernelDiam)/2
        Delta =Start2.sub(Start1).normalize()*Factor
        Style, Width, Color = Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple()
        View.makeCosmeticLine(Start1-Delta,End1-Delta, Style, Width, Color)
        View.makeCosmeticLine(Start2+Delta,End2+Delta, Style, Width, Color)

    def drawCosmeticThreadArcs(View,ObjectList,Hole):
        '''draw arcs at cosmetic thread ground view hole or bolt'''
        for ObjectString in ObjectList:
            if ObjectString[0:4] == 'Edge':
                Edge = View.getEdgeBySelection(ObjectString)
                if Edge.Curve.TypeId == 'Part::GeomCircle':
                    Object = Edge.Curve
                    Center = Object.Center
                    if Hole:
                        Radius = Object.Radius/0.85
                    else:
                        Radius = Object.Radius*0.85
                    View.makeCosmeticCircleArc(Center, Radius, 255, 165, Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple())

    def extendShortenLine(View,ObjectList,Extend):
        '''extend or shorten one cosmetic or centerline'''
        try:
            OldFormat = View.getCosmeticEdgeBySelection(ObjectList[0]).Format
            Edge = View.getEdgeBySelection(ObjectList[0])
        except (IndexError, AttributeError):
            app.Console.PrintWarning('Selection error\n')
            return
        # TODO: Check that the selection is a line.
        #       A DrawProjGroupItem has an edge and is thus translated.
        StartPt, EndPt = Edge.Vertexes[0].Point, Edge.Vertexes[1].Point
        Direction = (EndPt-StartPt).normalize()
        gui.runCommand('TechDraw_CosmeticEraser',0)
        Delta = Direction*2/View.Scale
        if Extend:
            StartPt, EndPt = StartPt - Delta, EndPt + Delta
        else:
            StartPt, EndPt = StartPt + Delta, EndPt - Delta
        View.makeCosmeticLine(StartPt,EndPt,OldFormat[0],OldFormat[1],OldFormat[2])

    def getViewCoords(View):
        ''' position of View in Template coordinates'''
        XView, YView = View.X, View.Y
        if View.TypeId == 'TechDraw::DrawProjGroupItem':
            XView = XView+View.InList[0].X
            YView = YView+View.InList[0].Y
        return (XView,YView)

    def createAnnot(Name,Text,XPos,YPos):
        '''Create an annotation'''
        Doc = app.activeDocument()
        Annot = Doc.addObject('TechDraw::DrawViewAnnotation',Name)
        Doc.Page.addView(Annot)
        Annot.Text = Text
        Annot.TextSize = 4
        Annot.X = XPos
        Annot.Y = YPos

class CircleCenterLines:
    '''Draw a center line cross at  circles'''
    Icon = QtGui.QPixmap([  \
        "64 64 215 2",\
        "  	c None",\
        ". 	c #FF0000",\
        "+ 	c #2C2100",\
        "@ 	c #2B2200",\
        "# 	c #2A2200",\
        "$ 	c #2A2300",\
        "% 	c #362D00",\
        "& 	c #635C00",\
        "* 	c #878300",\
        "= 	c #B3B000",\
        "- 	c #ADAA00",\
        "; 	c #888300",\
        "> 	c #605900",\
        ", 	c #342C00",\
        "' 	c #2C2200",\
        ") 	c #4B4400",\
        "! 	c #9F9B00",\
        "~ 	c #E0DF00",\
        "{ 	c #FEFE00",\
        "] 	c #FFFF00",\
        "^ 	c #E2E100",\
        "/ 	c #999400",\
        "( 	c #4A4200",\
        "_ 	c #2B2300",\
        ": 	c #2B2400",\
        "< 	c #2B2100",\
        "[ 	c #2E2500",\
        "} 	c #7B7600",\
        "| 	c #E1DF00",\
        "1 	c #777100",\
        "2 	c #2D2500",\
        "3 	c #817C00",\
        "4 	c #F0EF00",\
        "5 	c #F2F200",\
        "6 	c #807A00",\
        "7 	c #2D2400",\
        "8 	c #554E00",\
        "9 	c #E4E300",\
        "0 	c #E6E500",\
        "a 	c #5A5300",\
        "b 	c #A3A000",\
        "c 	c #E7E600",\
        "d 	c #B5B200",\
        "e 	c #898400",\
        "f 	c #8A8500",\
        "g 	c #B6B400",\
        "h 	c #E9E800",\
        "i 	c #A09C00",\
        "j 	c #3D3500",\
        "k 	c #D9D700",\
        "l 	c #DBDA00",\
        "m 	c #7A7500",\
        "n 	c #352C00",\
        "o 	c #372E00",\
        "p 	c #807B00",\
        "q 	c #DAD900",\
        "r 	c #DFDE00",\
        "s 	c #3C3400",\
        "t 	c #4B4300",\
        "u 	c #F3F300",\
        "v 	c #C0BE00",\
        "w 	c #474000",\
        "x 	c #BDBA00",\
        "y 	c #F2F100",\
        "z 	c #4C4400",\
        "A 	c #2A2100",\
        "B 	c #514900",\
        "C 	c #F8F800",\
        "D 	c #DCDB00",\
        "E 	c #494100",\
        "F 	c #D7D600",\
        "G 	c #F9F900",\
        "H 	c #4E4700",\
        "I 	c #2C2300",\
        "J 	c #484100",\
        "K 	c #FDFD00",\
        "L 	c #827E00",\
        "M 	c #847F00",\
        "N 	c #FCFC00",\
        "O 	c #F8F600",\
        "P 	c #473F00",\
        "Q 	c #3B3200",\
        "R 	c #F1F000",\
        "S 	c #514800",\
        "T 	c #372F00",\
        "U 	c #DAD800",\
        "V 	c #E8E700",\
        "W 	c #3C3300",\
        "X 	c #E7E500",\
        "Y 	c #CECD00",\
        "Z 	c #928D00",\
        "` 	c #E6E600",\
        " .	c #292100",\
        "..	c #3A3200",\
        "+.	c #EAE900",\
        "@.	c #928F00",\
        "#.	c #4C4500",\
        "$.	c #3F3700",\
        "%.	c #F4F400",\
        "&.	c #463F00",\
        "*.	c #D8D700",\
        "=.	c #514A00",\
        "-.	c #2C2400",\
        ";.	c #5B5400",\
        ">.	c #D5D400",\
        ",.	c #2C1F00",\
        "'.	c #6A6400",\
        ").	c #928E00",\
        "!.	c #938F00",\
        "~.	c #656000",\
        "{.	c #5D5500",\
        "].	c #5C5500",\
        "^.	c #5E5700",\
        "/.	c #CECB00",\
        "(.	c #D0CF00",\
        "_.	c #D6D500",\
        ":.	c #C8C500",\
        "<.	c #332B00",\
        "[.	c #625B00",\
        "}.	c #615B00",\
        "|.	c #FDFC00",\
        "1.	c #787200",\
        "2.	c #ECEC00",\
        "3.	c #797400",\
        "4.	c #C7C600",\
        "5.	c #9E9A00",\
        "6.	c #9C9800",\
        "7.	c #C3C000",\
        "8.	c #544C00",\
        "9.	c #564F00",\
        "0.	c #3E3600",\
        "a.	c #FAFA00",\
        "b.	c #D6D400",\
        "c.	c #292200",\
        "d.	c #5F5800",\
        "e.	c #898300",\
        "f.	c #AFAC00",\
        "g.	c #B1AE00",\
        "h.	c #AAA600",\
        "i.	c #888200",\
        "j.	c #571B00",\
        "k.	c #A76E00",\
        "l.	c #C17100",\
        "m.	c #641900",\
        "n.	c #8D8800",\
        "o.	c #837F00",\
        "p.	c #D4D200",\
        "q.	c #2B2000",\
        "r.	c #615A00",\
        "s.	c #FBFB00",\
        "t.	c #F5F400",\
        "u.	c #575000",\
        "v.	c #C7C500",\
        "w.	c #9B9700",\
        "x.	c #C6C400",\
        "y.	c #7D7700",\
        "z.	c #EEED00",\
        "A.	c #EFEE00",\
        "B.	c #736D00",\
        "C.	c #605A00",\
        "D.	c #686200",\
        "E.	c #322A00",\
        "F.	c #C9C700",\
        "G.	c #585100",\
        "H.	c #E3E100",\
        "I.	c #696100",\
        "J.	c #928C00",\
        "K.	c #989200",\
        "L.	c #645D00",\
        "M.	c #E1E000",\
        "N.	c #2D2000",\
        "O.	c #D6D300",\
        "P.	c #524C00",\
        "Q.	c #292000",\
        "R.	c #413900",\
        "S.	c #F6F500",\
        "T.	c #989400",\
        "U.	c #DDDC00",\
        "V.	c #D5D300",\
        "W.	c #4D4600",\
        "X.	c #524B00",\
        "Y.	c #EDEC00",\
        "Z.	c #483F00",\
        "`.	c #868100",\
        " +	c #837E00",\
        ".+	c #4D4400",\
        "++	c #DEDD00",\
        "@+	c #4D4700",\
        "#+	c #BEBB00",\
        "$+	c #484000",\
        "%+	c #C5C200",\
        "&+	c #827D00",\
        "*+	c #383000",\
        "=+	c #7F7900",\
        "-+	c #DFDD00",\
        ";+	c #9E9B00",\
        ">+	c #ECEB00",\
        ",+	c #B9B700",\
        "'+	c #8C8700",\
        ")+	c #B9B600",\
        "!+	c #2A2000",\
        "~+	c #595200",\
        "{+	c #E5E400",\
        "]+	c #544D00",\
        "^+	c #7C7700",\
        "/+	c #F1F100",\
        "(+	c #EEEE00",\
        "_+	c #746F00",\
        ":+	c #797300",\
        "<+	c #E0DE00",\
        "[+	c #9A9400",\
        "}+	c #AAA700",\
        "|+	c #AFAB00",\
        "1+	c #847E00",\
        "2+	c #5F5900",\
        "                                                          . . . . . .                                                           ",\
        "                                                          . . . . . .                                                           ",\
        "                                                + @ @ @ @ . . . . . . @ @ @ # +                                                 ",\
        "                                          $ @ @ @ % & * = . . . . . . - ; > , @ @ @ '                                           ",\
        "                                      @ @ @ ) ! ~ { ] ] ] . . . . . . ] ] ] { ^ / ( @ @ _ :                                     ",\
        "                                  < @ [ } | ] ] ] ] ] ] ] . . . . . . ] ] ] ] ] ] ] ^ 1 [ @ #                                   ",\
        "                              ' @ 2 3 4 ] ] ] ] ] ] ] ] ] . . . . . . ] ] ] ] ] ] ] ] ] 5 6 7 @ @                               ",\
        "                            @ @ 8 9 ] ] ] ] ] ] ] ] ] ] ] . . . . . . ] ] ] ] ] ] ] ] ] ] ] 0 a @ @                             ",\
        "                        @ _ 2 b { ] ] ] ] ] ] ] ] { c d e . . . . . . f g h { ] ] ] ] ] ] ] ] { i [ @ 7                         ",\
        "                      @ @ j k ] ] ] ] ] ] ] ] l m n @ @ @ . . . . . . @ @ @ o p q ] ] ] ] ] ] ] ] r s @ <                       ",\
        "                    _ @ t u ] ] ] ] ] ] { v w @ @ @ $ +   . . . . . .   ' $ ' @ @ ( x { ] ] ] ] ] ] y z @ +                     ",\
        "                  A @ B C ] ] ] ] ] ] D E @ @ <           . . . . . .           $ < @ z F ] ] ] ] ] ] G H @ I                   ",\
        "                @ @ J G ] ] ] ] ] K L @ @ _               . . . . . .               @ @ @ M N ] ] ] ] ] O P @ I                 ",\
        "                @ Q R ] ] ] ] ] R S @ '                   . . . . . .                   < @ z 5 ] ] ] ] ] R T @                 ",\
        "              @ I U ] ] ] ] ] V W @ $                     . . . . . .                     ' @ j X ] ] ] ] ] Y I @               ",\
        "            @ @ Z ] ] ] ] ] ` T @  .                      . . . . . .                       $ @ ..+.] ] ] ] ] @.@ $             ",\
        "            @ #.{ ] ] ] ] u $.@ '                         . . . . . .                         @ @ $.%.] ] ] ] K &.@             ",\
        "          ' @ *.] ] ] ] K =.@ -.                          . . . . . .                           -.@ ;.{ ] ] ] ] >.@ #           ",\
        "        ,.@ '.] ] ] ] ] ).@ <                             . . . . . .                             ' @ !.] ] ] ] ] ~.@           ",\
        "        _ @ ` ] ] ] ] 9 7 @                               . . . . . .                               < [ c ] ] ] ] ~ @ _         ",\
        "        @ {.] ] ] ] ] ].@                                                                             @ ].] ] ] ] ] ^.@         ",\
        "      ' @ /.] ] ] ] (.@ I                                                                             # @ _.] ] ] ] :.@ @       ",\
        "      @ <.K ] ] ] ] [.@                                                                                 @ }.] ] ] ] |., @       ",\
        "      @ 1.] ] ] ] 2.@ <                                                                                 $ I 4 ] ] ] ] 3.@       ",\
        "    + @ 4.] ] ] ] 5.@                                                                                     @ 6.] ] ] ] 7.@ @     ",\
        "    # @ u ] ] ] ] 8.@                                                                                     @ 9.] ] ] ] %.@ @     ",\
        "    @ 0.] ] ] ] a.7 $                                                                                     @ 2 G ] ] ] ] s @     ",\
        "    @ & ] ] ] ] b.@ c.                                                                                    $ @ _.] ] ] ] d.@     ",\
        "    @ e.] ] ] ] f.@                                                                                         @ g.] ] ] ] f @     ",\
        ". . . . . . . . . . . . . . . . . . . .                   . . . . . .                   . . . . . . . . . . . . . . . . . . . . ",\
        ". . . . . . . . . . . . . . . . . . . .                   . . . . . .                   . . . . . . . . . . . . . . . . . . . . ",\
        ". . . . . . . . . . . . . . . . . . . .                   . . . . . .                   . . . . . . . . . . . . . . . . . . . . ",\
        ". . . . . . . . . . . . . . . . . . . .                   . . . . . .                   . . . . . . . . . . . . . . . . . . . . ",\
        ". . . . . . . . . . . . . . . . . . . .                   . . . . . .                   . . . . . . . . . . . . . . . . . . . . ",\
        "  @ @ h.] ] ] ] i.@                                                                                         j.k.] ] ] ] l.m.    ",\
        "    @ n.] ] ] ] - @                                                                                         @ g.] ] ] ] o.@     ",\
        "    @ & ] ] ] ] p.@ q.                                                                                    < @ F ] ] ] ] r.@     ",\
        "    < $.] ] ] ] C 7 $                                                                                     @ 2 s.] ] ] ] W '     ",\
        "    @ @ t.] ] ] ] 8.@                                                                                     @ u.] ] ] ] 5 @ @     ",\
        "    # @ v.] ] ] ] w.@                                                                                     @ b ] ] ] ] x.@ @     ",\
        "      @ y.] ] ] ] z.I $                                                                                 @ I A.] ] ] ] B.@       ",\
        "      @ n K ] ] ] ] C.@                                                                                 @ D.] ] ] ] |.E._       ",\
        "      < @ F.] ] ] ] _.@ @                                                                             _ @ _.] ] ] ] F.@ <       ",\
        "        @ d.] ] ] ] ] ;.@                                                                             @ r.] ] ] ] ] G.@         ",\
        "        _ @ ^ ] ] ] ] c [ '                               . . . . . .                               @ 2 0 ] ] ] ] H.@ @         ",\
        "          @ I.] ] ] ] ] J.@ $                             . . . . . .                             < @ K.] ] ] ] ] L.@           ",\
        "          ' @ M.] ] ] ] { ;.@ N.                          . . . . . .                           + @ 9.{ ] ] ] ] O.@ '           ",\
        "            @ P.{ ] ] ] ] %.0.@ <                         . . . . . .                         Q.@ R.S.] ] ] ] K t @             ",\
        "            < @ T.] ] ] ] ] +...@ $                       . . . . . .                       $ @ ..V ] ] ] ] ] n.@ <             ",\
        "              @ 2 U.] ] ] ] ] X j @ '                     . . . . . .                     ' @ j +.] ] ] ] ] V.I <               ",\
        "                @ R.R ] ] ] ] ] u W.@ @                   . . . . . .                   < @ X.5 ] ] ] ] ] Y.T @                 ",\
        "                I @ Z.S.] ] ] ] ] N `.@ @ +               . . . . . .               + @ I  +K ] ] ] ] ] C P @ <                 ",\
        "                  @ @ W.G ] ] ] ] ] ] *..+@ @ @           . . . . . .           @ @ @ z ++] ] ] ] ] ] S.@+@ '                   ",\
        "                    + @ ) R ] ] ] ] ] ] { #+t @ @ @ ' <   . . . . . .   $ @ @ @ @ $+%+{ ] ] ] ] ] ] 5 E @ @                     ",\
        "                      A @ W ++] ] ] ] ] ] ] ] l &+*+@ @ @ . . . . . . @ @ @ *+=+-+] ] ] ] ] ] ] ] _.W @ <                       ",\
        "                        Q.@ [ ;+{ ] ] ] ] ] ] ] ] { >+,+'+. . . . . . '+)+h ] ] ] ] ] ] ] ] ] { b 2 @ !+                        ",\
        "                            @ @ ~+{+] ] ] ] ] ] ] ] ] ] ] . . . . . . ] ] ] ] ] ] ] ] ] ] ] ^ ]+@ '                             ",\
        "                              $ @ 7 ^+/+] ] ] ] ] ] ] ] ] . . . . . . ] ] ] ] ] ] ] ] ] (+^+7 @ <                               ",\
        "                                  < @ [ _+~ ] ] ] ] ] ] ] . . . . . . ] ] ] ] ] ] ] U.:+2 @ _                                   ",\
        "                                      ' @ @ P !.<+K ] ] ] . . . . . . ] ] ] K U.[+E @ @ _                                       ",\
        "                                          I @ @ @ E.^.* }+. . . . . . |+1+2+n @ @ < '                                           ",\
        "                                                @ @ ' @ @ . . . . . . @ @ @ _ @                                                 ",\
        "                                                          . . . . . .                                                           ",\
        "                                                          . . . . . .                                                           "])

    def textEnglish(self):
        buttonText = "Draw circle centerLines"
        helpText = "Draw a center line cross at circles:"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select many circles or arcs"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Zeichne Kreis Mittellinien"
        helpText = "Zeichne ein Linienkreuz bei einem Kreis:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle mehrere Kreise und/oder Kreibögen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Mezzerie circonferenza"
        helpText = "Disegna una croce con la linea centrale sulla circonferenza:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare i cerchi o gli archi"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Axes de la circonférence"
        helpText = "Tracez une croix avec la ligne centrale sur la circonférence:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionnez des cercles ou des arcs"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Ejes de la circunferencia"
        helpText = "Dibuja una cruz con la línea central en la circunferencia:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccionar círculos o arcos"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            for ObjectString in ObjectList:
                if ObjectString[0:4] == 'Edge':
                    Edge = View.getEdgeBySelection(ObjectString)
                    if Edge.Curve.TypeId == 'Part::GeomCircle':
                        Object = Edge.Curve
                        Center = Object.Center
                        Radius = Object.Radius+2/View.Scale
                        Right = app.Vector(Center.x+Radius,Center.y,0)
                        Left = app.Vector(Center.x-Radius,Center.y,0)
                        Top = app.Vector(Center.x,Center.y+Radius,0)
                        Bottom = app.Vector(Center.x,Center.y-Radius,0)
                        Style, Width, Color = Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple()
                        View.makeCosmeticLine(Left,Right,Style, Width, Color)
                        View.makeCosmeticLine(Top,Bottom,Style, Width, Color)
            gui.Selection.clearSelection()

class DrawHoleCircle:
    '''Draw a center circle and center cross at a bolt circle'''
    Icon = QtGui.QPixmap([  \
        "64 64 222 2",\
        "  	c None",\
        ". 	c #FF0000",\
        "+ 	c #2B2200",\
        "@ 	c #2A2200",\
        "# 	c #2B2100",\
        "$ 	c #2B2300",\
        "% 	c #2C2300",\
        "& 	c #5C5500",\
        "* 	c #2D2400",\
        "= 	c #2C2100",\
        "- 	c #423900",\
        "; 	c #EAE900",\
        "> 	c #FFFF00",\
        ", 	c #E9E800",\
        "' 	c #443B00",\
        ") 	c #A5A100",\
        "! 	c #A7A400",\
        "~ 	c #BBB800",\
        "{ 	c #FEFE00",\
        "] 	c #B4B100",\
        "^ 	c #2A2300",\
        "/ 	c #746E00",\
        "( 	c #FDFD00",\
        "_ 	c #878200",\
        ": 	c #302700",\
        "< 	c #959100",\
        "[ 	c #686100",\
        "} 	c #2C2200",\
        "| 	c #FAF900",\
        "1 	c #FBFB00",\
        "2 	c #382F00",\
        "3 	c #471D00",\
        "4 	c #B20E00",\
        "5 	c #2F2600",\
        "6 	c #423B00",\
        "7 	c #F9F900",\
        "8 	c #615B00",\
        "9 	c #504900",\
        "0 	c #665F00",\
        "a 	c #534C00",\
        "b 	c #CECB00",\
        "c 	c #F0F000",\
        "d 	c #F3F200",\
        "e 	c #C3BF00",\
        "f 	c #FD0B00",\
        "g 	c #433C00",\
        "h 	c #DFDD00",\
        "i 	c #E2E100",\
        "j 	c #4C4500",\
        "k 	c #ECEB00",\
        "l 	c #524B00",\
        "m 	c #F4F400",\
        "n 	c #3D3500",\
        "o 	c #DAD700",\
        "p 	c #D5D300",\
        "q 	c #CECC00",\
        "r 	c #2E2600",\
        "s 	c #342C00",\
        "t 	c #F2F100",\
        "u 	c #F3F300",\
        "v 	c #E5E400",\
        "w 	c #BBB900",\
        "x 	c #C0BE00",\
        "y 	c #C4C100",\
        "z 	c #2A2400",\
        "A 	c #EBEA00",\
        "B 	c #FCFC00",\
        "C 	c #999400",\
        "D 	c #DDDC00",\
        "E 	c #3B3200",\
        "F 	c #352D00",\
        "G 	c #FAFA00",\
        "H 	c #4E4800",\
        "I 	c #AFAC00",\
        "J 	c #302900",\
        "K 	c #332B00",\
        "L 	c #645D00",\
        "M 	c #4E4600",\
        "N 	c #3C3300",\
        "O 	c #E4E300",\
        "P 	c #322900",\
        "Q 	c #3C1F00",\
        "R 	c #575100",\
        "S 	c #393000",\
        "T 	c #E1E000",\
        "U 	c #DAD900",\
        "V 	c #2E2500",\
        "W 	c #938E00",\
        "X 	c #BDBA00",\
        "Y 	c #858000",\
        "Z 	c #705300",\
        "` 	c #2F2700",\
        " .	c #CCCA00",\
        "..	c #534B00",\
        "+.	c #C8C600",\
        "@.	c #C1BE00",\
        "#.	c #423A00",\
        "$.	c #431E00",\
        "%.	c #422700",\
        "&.	c #FFEE00",\
        "*.	c #3E2100",\
        "=.	c #2C2500",\
        "-.	c #322000",\
        ";.	c #4C2300",\
        ">.	c #FFDD00",\
        ",.	c #572D00",\
        "'.	c #561A00",\
        ").	c #574F00",\
        "!.	c #EAE800",\
        "~.	c #FFF000",\
        "{.	c #FFFE00",\
        "].	c #B0AD00",\
        "^.	c #2A2100",\
        "/.	c #5E1A00",\
        "(.	c #BEBB00",\
        "_.	c #FFF100",\
        ":.	c #B3B000",\
        "<.	c #471E00",\
        "[.	c #D1D000",\
        "}.	c #E5D400",\
        "|.	c #FC0A00",\
        "1.	c #2D2300",\
        "2.	c #908A00",\
        "3.	c #CFCE00",\
        "4.	c #393100",\
        "5.	c #B7B400",\
        "6.	c #332C00",\
        "7.	c #E4E200",\
        "8.	c #ADAA00",\
        "9.	c #2C1F00",\
        "0.	c #312700",\
        "a.	c #DBD700",\
        "b.	c #6B6500",\
        "c.	c #EDEC00",\
        "d.	c #8A8400",\
        "e.	c #5A5500",\
        "f.	c #817B00",\
        "g.	c #F5F400",\
        "h.	c #EEEE00",\
        "i.	c #5D5500",\
        "j.	c #2A2000",\
        "k.	c #D1CE00",\
        "l.	c #9E9A00",\
        "m.	c #502B00",\
        "n.	c #372B00",\
        "o.	c #D2D000",\
        "p.	c #FFE300",\
        "q.	c #2D2500",\
        "r.	c #FFB000",\
        "s.	c #FF0200",\
        "t.	c #2D2000",\
        "u.	c #CAC800",\
        "v.	c #FF2600",\
        "w.	c #CDCB00",\
        "x.	c #FF2B00",\
        "y.	c #FF0900",\
        "z.	c #4E4500",\
        "A.	c #D9D800",\
        "B.	c #DBDA00",\
        "C.	c #4C4400",\
        "D.	c #E2DF00",\
        "E.	c #726D00",\
        "F.	c #E8E700",\
        "G.	c #686200",\
        "H.	c #292000",\
        "I.	c #A29E00",\
        "J.	c #3C3400",\
        "K.	c #342A00",\
        "L.	c #403800",\
        "M.	c #6A6200",\
        "N.	c #352C00",\
        "O.	c #E3E100",\
        "P.	c #8F8A00",\
        "Q.	c #E8D600",\
        "R.	c #3D1F00",\
        "S.	c #4F4700",\
        "T.	c #322A00",\
        "U.	c #F8F800",\
        "V.	c #A6A300",\
        "W.	c #3F3700",\
        "X.	c #F6F600",\
        "Y.	c #FF0100",\
        "Z.	c #B7B600",\
        "`.	c #BFBC00",\
        " +	c #6F6800",\
        ".+	c #342B00",\
        "++	c #4D4600",\
        "@+	c #696300",\
        "#+	c #FC0100",\
        "$+	c #2B2000",\
        "%+	c #FE0000",\
        "&+	c #FF0D00",\
        "*+	c #5E5700",\
        "=+	c #BAB800",\
        "-+	c #F0EF00",\
        ";+	c #FF1F00",\
        ">+	c #494000",\
        ",+	c #716B00",\
        "'+	c #FF2000",\
        ")+	c #D1D100",\
        "!+	c #EFEE00",\
        "~+	c #DFDE00",\
        "{+	c #969100",\
        "]+	c #D4D100",\
        "^+	c #846600",\
        "/+	c #521A00",\
        "(+	c #2E2200",\
        "_+	c #BDBB00",\
        ":+	c #797200",\
        "<+	c #4D4500",\
        "[+	c #342000",\
        "}+	c #5F1A00",\
        "|+	c #7D7700",\
        "1+	c #827D00",\
        "2+	c #FBFA00",\
        "3+	c #E0DF00",\
        "4+	c #E8E600",\
        "5+	c #484100",\
        "6+	c #C6C400",\
        "7+	c #E7E600",\
        "8+	c #C1BF00",\
        "9+	c #D7D600",\
        "                                                          . . .                                                                 ",\
        "                                                      + @ . . . + # $                                                           ",\
        "                                                  # + + % . . . & * + + =                                                       ",\
        "                                                + + - ; > . . . > > , ' + $                                                     ",\
        "                                              + + ) > > > . . . > > > > ! + @                                                   ",\
        "                                            $ + ~ > > > > . . . { > > > > ] + ^                                                 ",\
        "                                            + / > > > ( _ . . . : < ( > > > [ +                                                 ",\
        "                                          } + | > > 1 2 + 3 4   } 5 6 1 > > 7 + @                       . . .                   ",\
        "                                          } 8 > > > 9 +             5 0 > > > a +                       . . .                   ",\
        "                                          + b > > c + =             + + d > > e +                       . . .                   ",\
        "                                    . . . . . . . . .     . . . > > > . . . . . . . .               $ ^ . . . + $               ",\
        "                                    . . . . . . . f .     . . . > > > . . . . . . . . >         = + + + . . . + + + #           ",\
        "                                    . . . . . . . . .     . . . > > > . . . . . . . . > >     + + g h { . . . > i j + $         ",\
        "                                        > k > > > > i %   > > >     l j ( > > i m > > > >   + n b > > > . . . > > > o % +       ",\
        "                                        > > > > > > p + #         + + q > > > r s > > >   # : ( > > > > . . . > > > > t * +     ",\
        "                  . . .           >       u ; v > > > w % + + $ + + x > > > y + #       z + A > > > B C . . . C 1 > > > D + $   ",\
        "                  . . .         > > >       E F G > > > 1 . . . ~ G > > > 7 * #         + H > > > > > I J # } + K v > > > L +   ",\
        "                  . . .       > > > > >       * M 1 > > > . . . > > > > G N +           + O > > { > > > >       = P G > > , + # ",\
        "            ^ } Q . . . + R > > > > >           * S T > > . . . > > > U V +           # + { > > W X > >           + Y > > { % = ",\
        "        = + + : Z . . . `  .> > > >               + + ..+.. . . u @.#.+ +             $.%.&.&.&.*.=.>     .       -.;.>.>.>.,.'.",\
        "      # + ).!.> ~.. . . {.> > ( ].                  + + + . . . + + + ^.          . . . . . . . . #     . . . >   /.. . . . . . ",\
        "    + + (.> > > _.. . . > > > :.+ $                       . . . z                 . . . . . . . . +     . . . > > <.. . . . . . ",\
        "  + + [.> > > { }.|.. . > > > > & + 1.                    . . .                   . . . . . . . . +     . . . > { 2 . . . . . . ",\
        "1.+ 2.> > > 3.4.+ + 5.> > { > > ( 6.$                     . . .                         + 7.> > 1 : $       > > > 8.G > > v + 9.",\
        "^ 0.( > > 5.+ + $ a.> > { b.7 > > X + %                   . . .                         + R > > > c.: + $ + d.> > > > > > e.*   ",\
        "+ f.> > g.% }     > > > h.+ i.> > ( % #                                                 j.+ k.> > > B l.m.3 n.T > > > > o.+ =   ",\
        ". . . . . +     p.. . .   % . . . . . . . .                                               + q.A > > > > . . . > > > > A % +     ",\
        ". . . . . $     r.. s..   t.. . . . . . . .                                                 } q.u.> > > v.. . > > > w.+ }       ",\
        ". . . . . }     x.s.y..     . . . . . . . .                                                   # + z.A.( . . . B B.C.+ +         ",\
        "+ D.> > E.+               + + F.> > G.#                                                         z + + + . . . + + } H.          ",\
        "+ I.> > A.+ ^             + J.> > > K.@                                                               $ . . . +                 ",\
        "+ L.> > > M.N.g.{ >     } + D > > O.+ ^.                                                                . . .                   ",\
        "$ +  .> > { P.> > Q.R.+ : 3.> > > S.+                                                                   . . .                   ",\
        "  + T.U.> > > > > . . . B > > > V.+ }                                                                   . . .                   ",\
        "  9.+ W.X.> > > > Y.. . > > > Z.+ +                                                                                             ",\
        "    $ + 5 `.> > > s.. . > 7  ++ +                                                                                               ",\
        "        + +  .> > s.. . & + + ^                                                                                                 ",\
        "          ^..+++@+#+. . $ +                                                                                                     ",\
        "                $+%+. .                                                                                                         ",\
        "                  . . .                                                                                                         ",\
        "            > > > &+. .                                                                                                         ",\
        "            > > > >                                                                                                             ",\
        "            > > > >     . . .                                                                                                   ",\
        "              > > > n ^ . . . + $                                                                                               ",\
        "              > > > *++ . . . + + + #                                                                                           ",\
        "              =+> > -+{ ;+. . { h >++ $                                                                                         ",\
        "            + ,+> > > > '+. . > > > )+% +                                                                                       ",\
        "          # + !+> > > > . . . > > > > c % +                                                                                     ",\
        "        z + o.> > > > ~+. . . {+G > > > ]++ $                                                                                   ",\
        "        + H > > > > > ( ^+/+(++ K v > > > S.+                                                                                   ",\
        "        + O > > U._+> > >       = P G > > 7.+ #                                                                                 ",\
        "      # + { > > :+<+> > > >       + Y > > { + =                                                                                 ",\
        "  . . . . . . . . ^ > > . . .     [+. . . . . . . .                                                                             ",\
        "  . . . . . . . . #   > y.. .     }+. . . . . . . .                                                                             ",\
        "  . . . . . . . . +   > . . .     <.. . . . . . . .                                                                             ",\
        "      = + { > > |++               + 1+> > { + ^.                                                                                ",\
        "        + 7.> > 2+V }           + % G > > 3++ 9.                                                                                ",\
        "        + R > > > , 5 + $ + @ + * 4+> > > 5++                                                                                   ",\
        "        j.+ k.> > > B {+. . . < B > > > 6++ =                                                                                   ",\
        "          + q.A > > > > . . . > > > > 7++ +                                                                                     ",\
        "            } q.u.> > > . . . > > > 8++ }                                                                                       ",\
        "              # + z.9+B . . . B p #.+ +                                                                                         ",\
        "                z + + + . . . + + } H.                                                                                          ",\
        "                      $ . . . +                                                                                                 "])

    def textEnglish(self):
        buttonText = "Draw bolt circle centerlines"
        helpText = "Draw the center lines of a bolt circle:"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select at least 3 circles of the bolt circle"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Zeichne Lochkreis Mittellinien"
        helpText = "Zeichne die Mittellinien eines Lochkreises:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle mindestens 3 Kreise des Lochkreises"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Mezzerie bulloni/viti/fori disposti in cerchio"
        helpText = "Disegna gli assi di bulloni/viti/fori disposti in cerchio:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare almeno 3 circonferenze aventi asse circonferenziale comune"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Axe des boulons/vis/trou disposés en cercle"
        helpText = "Dessinez les axes des boulons/vis/trou disposés en cercle:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionner au moins 3 cercles ayant un axe circonférentiel commun"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Ejes de pernos/tornillos/agujero dispuestos en círculo"
        helpText = "Dibuja los ejes de los pernos/tornillos/agujero dispuestos en círculo:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccione al menos 3 círculos que tengan un eje circunferencial común"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if len(ObjectList) < 3: return
            Style, Width, Color = Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple()
            Rot90 = app.Rotation(app.Vector(0,0,1),90)
            Circles = []
            for ObjectString in ObjectList:
                if ObjectString[0:4] == 'Edge':
                    Edge = View.getEdgeBySelection(ObjectString)
                    if Edge.Curve.TypeId == 'Part::GeomCircle':
                        Circles.append((Edge.Curve.Center,Edge.Curve.Radius))
            Edge1,Edge2 = Circles[1][0]-Circles[0][0],Circles[2][0]-Circles[0][0]
            Mid1,Mid2 =Circles[0][0]+Edge1/2,Circles[0][0]+Edge2/2
            Pnt1,Pnt2 = Rot90.multVec(Edge1)+Mid1,Rot90.multVec(Edge2)+Mid2
            Line1,Line2 = Part.Line(Mid1,Pnt1),Part.Line(Mid2,Pnt2)
            IP = Line1.intersect(Line2)[0]
            BigCenter = app.Vector(IP.X,IP.Y,IP.Z)
            for Circle in Circles:
                RadVec = Circle[0].sub(BigCenter)
                Radius = RadVec.Length
                RadVec1 =RadVec.normalize()
                StartDist = Radius-Circle[1]-2/View.Scale
                EndDist = Radius+Circle[1]+2/View.Scale
                EndPt = BigCenter+RadVec1.scale(EndDist,EndDist,EndDist)
                RadVec1.normalize()
                StartPt = BigCenter+RadVec1.scale(StartDist,StartDist,StartDist)
                View.makeCosmeticLine(StartPt,EndPt,Style, Width, Color)
            BigRadius =Circles[0][0].sub(BigCenter).Length
            View.makeCosmeticCircle(BigCenter, BigRadius, Style, Width, Color)
            gui.Selection.clearSelection()

class CenterLine:
    '''Draw center line between two lines'''
    Icon = QtGui.QPixmap([  \
        "64 64 12 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #2A2400",\
        "@	c #2A2100",\
        "#	c #2C2300",\
        "$	c #2C2200",\
        "%	c #2B2200",\
        "&	c #2B2300",\
        "*	c #FFFF00",\
        "=	c #2C2100",\
        "-	c #2A2300",\
        ";	c #292400",\
        "                             ......                             ",\
        "                             ......                             ",\
        "         +@@@@@@#            ......            #@@@@@@+         ",\
        "        $%%%%%%%%$           ......           $%%%%%%%%$        ",\
        "        %%%%%%%%%&           ......           &%%%%%%%%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&                            &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%*****%%&           ......           &%%*****%%        ",\
        "        %%%%%%%%%=           ......           =%%%%%%%%%        ",\
        "        -%%%%%%%%;           ......           ;%%%%%%%%-        ",\
        "                             ......                             ",\
        "                             ......                             ",\
        "                             ......                             "])

    def textEnglish(self):
        buttonText = "Draw one center line"
        helpText = "Draw a center line between two lines:"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select two lines"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Zeichne einzelne Mittellinie"
        helpText = "Zeichne eine Mittellinie zwischen zwei Linien:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle zwei Linien"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Linea centrale"
        helpText = "Disegna una mezzeria tra due linee:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare due linee"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Ligne centrale"
        helpText = "Tracez une ligne centrale entre deux lignes:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionnez deux lignes"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Línea central"
        helpText = "Dibuja una línea central entre dos líneas:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccione dos líneas"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            (Start1,End1,Start2,End2) = commonTools.getPoints(View,ObjectList)
            Mid1, Mid2 = (Start1+Start2)/2, (End1+End2)/2
            Protrusion = Mid2.sub(Mid1).normalize()*2
            StartPt, EndPt = Mid1-Protrusion, Mid2+Protrusion
            View.makeCosmeticLine(StartPt,EndPt,Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple())
            gui.Selection.clearSelection()

class DrawCosmeticThreadHole:
    '''Draw a cosmetic hole thread at selected circles'''
    Icon = QtGui.QPixmap([  \
        "64 64 147 2",\
        "  	c None",\
        ". 	c #2B2200",\
        "+ 	c #FFFF00",\
        "@ 	c #FF0000",\
        "# 	c #2C1F00",\
        "$ 	c #2B2300",\
        "% 	c #2B2100",\
        "& 	c #2A2300",\
        "* 	c #292400",\
        "= 	c #2D2400",\
        "- 	c #554D00",\
        "; 	c #8F8A00",\
        "> 	c #928D00",\
        ", 	c #504A00",\
        "' 	c #2C2200",\
        ") 	c #2B2000",\
        "! 	c #2C2300",\
        "~ 	c #625C00",\
        "{ 	c #E1E000",\
        "] 	c #DBDA00",\
        "^ 	c #645C00",\
        "/ 	c #2A2200",\
        "( 	c #292000",\
        "_ 	c #777100",\
        ": 	c #F8F800",\
        "< 	c #746F00",\
        "[ 	c #3F3700",\
        "} 	c #EAE900",\
        "| 	c #FDFD00",\
        "1 	c #EAEA00",\
        "2 	c #3C3400",\
        "3 	c #7C7600",\
        "4 	c #F6F500",\
        "5 	c #AAA700",\
        "6 	c #595200",\
        "7 	c #2F2600",\
        "8 	c #322900",\
        "9 	c #645D00",\
        "0 	c #B4B100",\
        "a 	c #787200",\
        "b 	c #2C2100",\
        "c 	c #A6A200",\
        "d 	c #FAFA00",\
        "e 	c #948F00",\
        "f 	c #2F2700",\
        "g 	c #989400",\
        "h 	c #F9F900",\
        "i 	c #A39F00",\
        "j 	c #A9A500",\
        "k 	c #C1BD00",\
        "l 	c #372E00",\
        "m 	c #292200",\
        "n 	c #352C00",\
        "o 	c #C8C500",\
        "p 	c #A3A000",\
        "q 	c #847E00",\
        "r 	c #969200",\
        "s 	c #292300",\
        "t 	c #979400",\
        "u 	c #7D7800",\
        "v 	c #453D00",\
        "w 	c #767100",\
        "x 	c #797300",\
        "y 	c #433B00",\
        "z 	c #2D2300",\
        "A 	c #EDED00",\
        "B 	c #979200",\
        "C 	c #878200",\
        "D 	c #C4C200",\
        "E 	c #C1BF00",\
        "F 	c #837D00",\
        "G 	c #F8F700",\
        "H 	c #312800",\
        "I 	c #8B8600",\
        "J 	c #8D8800",\
        "K 	c #736D00",\
        "L 	c #E4E300",\
        "M 	c #F5F500",\
        "N 	c #2E2600",\
        "O 	c #2B2400",\
        "P 	c #2A2400",\
        "Q 	c #2D2500",\
        "R 	c #382F00",\
        "S 	c #A09C00",\
        "T 	c #696200",\
        "U 	c #4B4300",\
        "V 	c #4F4600",\
        "W 	c #686100",\
        "X 	c #FDFC00",\
        "Y 	c #FEFE00",\
        "Z 	c #A19E00",\
        "` 	c #2A2100",\
        " .	c #A5A100",\
        "..	c #A4A100",\
        "+.	c #6B6500",\
        "@.	c #524A00",\
        "#.	c #4E4700",\
        "$.	c #656000",\
        "%.	c #362E00",\
        "&.	c #ADAA00",\
        "*.	c #362D00",\
        "=.	c #E7E500",\
        "-.	c #F7F600",\
        ";.	c #E2E000",\
        ">.	c #777000",\
        ",.	c #878300",\
        "'.	c #8E8900",\
        ").	c #2E2500",\
        "!.	c #332A00",\
        "~.	c #888300",\
        "{.	c #BDBB00",\
        "].	c #2A2000",\
        "^.	c #C5C300",\
        "/.	c #827E00",\
        "(.	c #ECEC00",\
        "_.	c #938E00",\
        ":.	c #463E00",\
        "<.	c #746D00",\
        "[.	c #756F00",\
        "}.	c #423A00",\
        "|.	c #827D00",\
        "1.	c #928E00",\
        "2.	c #2D2000",\
        "3.	c #807A00",\
        "4.	c #A9A400",\
        "5.	c #C7C500",\
        "6.	c #342B00",\
        "7.	c #C2BE00",\
        "8.	c #A9A600",\
        "9.	c #959100",\
        "0.	c #A4A000",\
        "a.	c #7D7700",\
        "b.	c #565000",\
        "c.	c #302600",\
        "d.	c #EDEC00",\
        "e.	c #E9E800",\
        "f.	c #3E3700",\
        "g.	c #766F00",\
        "h.	c #655F00",\
        "i.	c #DEDD00",\
        "j.	c #E0DF00",\
        "k.	c #635D00",\
        "l.	c #949000",\
        "m.	c #908B00",\
        "n.	c #FFEA00",\
        "o.	c #FFE600",\
        "p.	c #FFE100",\
        "                                                          . . . . . .                                                           ",\
        "                                                          . + + + + .                                                           ",\
        "                                                @ @ @ @ @ @ @ @ @ @ @                                                           ",\
        "                                          @ @ @ @ @ @ @ @ @ @ @ @ @ @                                                           ",\
        "                                      @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                                           ",\
        "                                  @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                                           ",\
        "                              @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                                           ",\
        "                            @ @ @ @ @ @ @ @ @ @ @ @       . + + + + .                                                           ",\
        "                          @ @ @ @ @ @ @ @ @ @             . + + + + .                                                           ",\
        "                        @ @ @ @ @ @ @ @ @                 . + + + + .                                                           ",\
        "                    @ @ @ @ @ @ @ @ @               # $ $ . + + + + . . % #                                                     ",\
        "                    @ @ @ @ @ @ @               & . . . . . + + + + . . . . . .                                                 ",\
        "                  @ @ @ @ @ @ @           * . . . . = - ; . + + + + . > , = . . . ' )                                           ",\
        "                @ @ @ @ @ @ @           % . . ! ~ { + + + . + + + + . + + + ] ^ . . . /                                         ",\
        "              @ @ @ @ @ @ @         ( . . . _ : + + + + + . + + + + . + + + + + : < . . . (                                     ",\
        "            @ @ @ @ @ @ @         $ . . [ } + + + + + + | . + + + + . | + + + + + + 1 2 . . .                                   ",\
        "            @ @ @ @ @ @         % . . 3 + + + + + 4 5 6 7 . + + + + . 8 9 0 4 + + + + + a . . .                                 ",\
        "          @ @ @ @ @ @         b . . c + + + + d e f . . . . + + + + . . . . 8 g h + + + + i . . b                               ",\
        "          @ @ @ @ @ @       . . . j + + + + k l . . ' m   . + + + + .   % & . . n o + + + + p . . .                             ",\
        "        @ @ @ @ @ @         . . q + + + + r . . ' #       . + + + + .       s ' . ! t + + + + u . .                             ",\
        "        @ @ @ @ @         $ . v + + + + w . . !           . . . . . .           / . . x + + + + y . .                           ",\
        "      @ @ @ @ @ @       z . ' A + + + > . . =                                     % . . B + + + } ! . )                         ",\
        "      @ @ @ @ @ @       . . C + + + D . . z                                         $ . . E + + + F . '                         ",\
        "      @ @ @ @ @       # . ! d + + G H . $                                             b . n d + + : ! .                         ",\
        "    @ @ @ @ @ @       & . _ + + + I . .                                                 % . J + + + K . .                       ",\
        "    @ @ @ @ @ @       . . L + + M N . O                   . . . . . .                   P . Q 4 + + L . .                       ",\
        "    @ @ @ @ @       P . R + + + S . .                     . + + + + .                     . . p + + + n .                       ",\
        "    @ @ @ @ @       & . T + + + U . m                     . + + + + .                     $ . V + + + W . %                     ",\
        "    @ @ @ @ @       / . j + + X = .                       . + + + + .                       . Q Y + + Z . `                     ",\
        ". . @ @ @ @ @ . . . . . . . . . . . . . .         . . . . . + + + + . . . . .           . . . . . . . . . . . . . @ @ @ @ @ . . ",\
        "+ + @ @ @ @ @ + + + + + + + + + + + + + .         . + + + + + + + + + + + + .           . + + + + + + + + + + + + @ @ @ @ @ + . ",\
        "+ + @ @ @ @ @ + + + + + + + + + + + + + .         . + + + + + + + + + + + + .           . + + + + + + + + + + + + @ @ @ @ @ + . ",\
        "+ + @ @ @ @ @ + + + + + + + + + + + + + .         . + + + + + + + + + + + + .           . + + + + + + + + + + + + @ @ @ @ @ + . ",\
        "+ + @ @ @ @ @ + + + + + + + + + + + + + .         . + + + + + + + + + + + + .           . + + + + + + + + + + + + @ @ @ @ @ + . ",\
        ". . @ @ @ @ @ . . . . . . . . . . . . . .         . . . . . + + + + . . . . .           . . . . . . . . . . . . . @ @ @ @ @ . . ",\
        "    @ @ @ @ @       . .  .+ + | = .                       . + + + + .                       . Q | + + ... $       @ @ @ @ @     ",\
        "    @ @ @ @ @       ' . +.+ + + @.. .                     . + + + + .                     ) . #.+ + + $.. %       @ @ @ @ @     ",\
        "    @ @ @ @ @       s . %.+ + + &.. .                     . + + + + .                     . . p + + + *..         @ @ @ @ @     ",\
        "    @ @ @ @ @ @       . . =.+ + -.Q .                     . . . . . .                   s . N 4 + + ;.. .       @ @ @ @ @ @     ",\
        "      @ @ @ @ @       . . >.+ + + ,.. .                                                 ' . '.+ + + >.. .       @ @ @ @ @       ",\
        "      @ @ @ @ @       O . ).d + + h !.. `                                             $ . 8 : + + h = .         @ @ @ @ @       ",\
        "      @ @ @ @ @ @       . . ~.+ + + {.. . ].                                        ' . . ^.+ + + /.. '       @ @ @ @ @ @       ",\
        "      @ @ @ @ @ @       * . ! (.+ + + > . . *             . . . . . .             = . . _.+ + + (.! . %       @ @ @ @ @ @       ",\
        "        @ @ @ @ @ @       % . :.+ + + + <.. . $           . + + + + .           . . . [.+ + + + }.. /       @ @ @ @ @ @         ",\
        "        @ @ @ @ @ @         . . |.+ + + + 1.. . . O       . + + + + .       2.. . . B + + + + 3.. .         @ @ @ @ @ @         ",\
        "          @ @ @ @ @ @       = . . 4.+ + + + 5.6.. . . b   . + + + + .   m / . . l 7.+ + + + j . . =       @ @ @ @ @ @           ",\
        "          @ @ @ @ @ @         $ . . 8.+ + + + : 9.H . . . . + + + + . . . . f e d + + + + 0.. . /         @ @ @ @ @ @           ",\
        "            @ @ @ @ @ @         ! . . a.+ + + + + M 5 b.c.. + + + + . ).6 5 M + + + + + a . . &         @ @ @ @ @ @             ",\
        "            @ @ @ @ @ @ @         $ . . [ d.+ + + + + + X . + + + + . | + + + + + + e.f.. . $         @ @ @ @ @ @ @             ",\
        "              @ @ @ @ @ @ @         $ . . % _ h + + + + + . + + + + . + + + + + : g.% . . %         @ @ @ @ @ @ @               ",\
        "                @ @ @ @ @ @ @           $ . . $ h.i.+ + + . + + + + . + + + j.k.! . . .           @ @ @ @ @ @ @                 ",\
        "                  @ @ @ @ @ @ @           * . . . . N @.l.. + + + + . m.- = . . . % )           @ @ @ @ @ @ @                   ",\
        "                    @ @ @ @ @ @ @             # % . . . . . + + + + . . . . . .               @ @ @ @ @ @ @                     ",\
        "                    @ @ @ @ @ @ @ @ @               O & . . + + + + . . & #               @ @ @ @ @ @ @ @ @                     ",\
        "                        @ @ @ @ @ @ @ @ @                 . + + + + .                 @ @ @ @ @ @ @ @ @                         ",\
        "                          @ @ @ @ @ @ @ @ @ @             . + + + + .             @ @ @ @ @ @ @ @ @ @                           ",\
        "                            @ @ @ @ @ @ @ @ @ @ @ @       . + + + + .       @ @ @ @ @ @ @ @ @ @ @ @                             ",\
        "                              @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                               ",\
        "                                  @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                   ",\
        "                                      @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                       ",\
        "                                          @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                           ",\
        "                                                @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @                                                 ",\
        "                                                          . n.o.p.+ .                                                           ",\
        "                                                          . . . . . .                                                           "])

    def textEnglish(self):
        buttonText = "Cosmetic hole thread ground view"
        helpText = "Draw cosmetic hole threads ground view:"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select many circles"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Grundriß kosmetisches Bohrungsgewinde"
        helpText = "Zeichne ein kosmetisches Bohrungsgewinde im Grundriß:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle mehrere Kreise"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Filettatura foro in pianta"
        helpText = "Disegna il simbolo tecnico della filettatura in pianta di un foro:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare la/e circonferenza/e che rappresentano i fori filettati"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Filetage du trou en plan"
        helpText = "Dessinez le symbole technique du filetage dans le plan d'un trou:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionnez la (les) circonférence (s) qui représentent les trous filetés"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Rosca de agujero en planta"
        helpText = "Dibujar el símbolo técnico de la rosca de un agujero en planta:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccione la (s) circunferencia (s) que representan los orificios roscados"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            commonTools.drawCosmeticThreadArcs(View,ObjectList,True)
            gui.Selection.clearSelection()

class DrawCosmeticThreadBolt:
    '''Draw a cosmetic bolt thread at selected circles'''
    Icon = QtGui.QPixmap([  \
        "64 64 202 2",\
        "  	c None",\
        ". 	c #2B2200",\
        "+ 	c #FFFF00",\
        "@ 	c #2A2300",\
        "# 	c #2C2200",\
        "$ 	c #2B2300",\
        "% 	c #2A2200",\
        "& 	c #2F2600",\
        "* 	c #4C4500",\
        "= 	c #3F3700",\
        "- 	c #777100",\
        "; 	c #B4B100",\
        "> 	c #E9E800",\
        ", 	c #FDFD00",\
        "' 	c #FCFC00",\
        ") 	c #E7E700",\
        "! 	c #767000",\
        "~ 	c #3E3600",\
        "{ 	c #2D2000",\
        "] 	c #2B2100",\
        "^ 	c #322900",\
        "/ 	c #D1CF00",\
        "( 	c #FEFE00",\
        "_ 	c #756F00",\
        ": 	c #342C00",\
        "< 	c #8B8600",\
        "[ 	c #F3F300",\
        "} 	c #F6F500",\
        "| 	c #918D00",\
        "1 	c #332B00",\
        "2 	c #2C2300",\
        "3 	c #7C7600",\
        "4 	c #F7F600",\
        "5 	c #F0F000",\
        "6 	c #F5F500",\
        "7 	c #7A7400",\
        "8 	c #463F00",\
        "9 	c #D6D400",\
        "0 	c #D8D600",\
        "a 	c #827D00",\
        "b 	c #362E00",\
        "c 	c #858000",\
        "d 	c #D9D800",\
        "e 	c #D7D600",\
        "f 	c #463E00",\
        "g 	c #2A2100",\
        "h 	c #6F6900",\
        "i 	c #FBFB00",\
        "j 	c #898300",\
        "k 	c #2E2600",\
        "l 	c #8A8600",\
        "m 	c #F6F600",\
        "n 	c #FAFA00",\
        "o 	c #6C6700",\
        "p 	c #A19E00",\
        "q 	c #F8F800",\
        "r 	c #756E00",\
        "s 	c #787300",\
        "t 	c #9E9A00",\
        "u 	c #B5B200",\
        "v 	c #ADAA00",\
        "w 	c #2E2500",\
        "x 	c #2C2100",\
        "y 	c #B2AE00",\
        "z 	c #B4B000",\
        "A 	c #BDBA00",\
        "B 	c #F9F900",\
        "C 	c #595200",\
        "D 	c #5C5500",\
        "E 	c #BDB900",\
        "F 	c #A6A100",\
        "G 	c #E9E900",\
        "H 	c #383000",\
        "I 	c #393100",\
        "J 	c #ECEC00",\
        "K 	c #817C00",\
        "L 	c #E0DE00",\
        "M 	c #FF0000",\
        "N 	c #332C00",\
        "O 	c #E2E100",\
        "P 	c #7D7700",\
        "Q 	c #4A4200",\
        "R 	c #E6E500",\
        "S 	c #302700",\
        "T 	c #E4E400",\
        "U 	c #484100",\
        "V 	c #2D2500",\
        "W 	c #EFED00",\
        "X 	c #F2F200",\
        "Y 	c #383100",\
        "Z 	c #2B2000",\
        "` 	c #393200",\
        " .	c #EDEC00",\
        "..	c #9A9600",\
        "+.	c #544B00",\
        "@.	c #292300",\
        "#.	c #504900",\
        "$.	c #969200",\
        "%.	c #3D3500",\
        "&.	c #8B8700",\
        "*.	c #8F8A00",\
        "=.	c #3C3300",\
        "-.	c #C2C000",\
        ";.	c #E7E500",\
        ">.	c #2D2400",\
        ",.	c #E5E400",\
        "'.	c #C0BD00",\
        ").	c #574F00",\
        "!.	c #D0CE00",\
        "~.	c #D0CF00",\
        "{.	c #B1AE00",\
        "].	c #5B5400",\
        "^.	c #595300",\
        "/.	c #615B00",\
        "(.	c #E7E600",\
        "_.	c #605800",\
        ":.	c #C9C600",\
        "<.	c #C6C300",\
        "[.	c #433B00",\
        "}.	c #453D00",\
        "|.	c #372F00",\
        "1.	c #EDED00",\
        "2.	c #EEED00",\
        "3.	c #372E00",\
        "4.	c #716B00",\
        "5.	c #B6B200",\
        "6.	c #B7B400",\
        "7.	c #6F6A00",\
        "8.	c #2C2400",\
        "9.	c #A39F00",\
        "0.	c #888300",\
        "a.	c #A09B00",\
        "b.	c #D0CD00",\
        "c.	c #645E00",\
        "d.	c #666000",\
        "e.	c #CDCC00",\
        "f.	c #CFCD00",\
        "g.	c #676000",\
        "h.	c #CDCB00",\
        "i.	c #868100",\
        "j.	c #B8B500",\
        "k.	c #292100",\
        "l.	c #EFEE00",\
        "m.	c #443C00",\
        "n.	c #C7C600",\
        "o.	c #8F8B00",\
        "p.	c #C5C200",\
        "q.	c #605A00",\
        "r.	c #5E5700",\
        "s.	c #5A5400",\
        "t.	c #B0AC00",\
        "u.	c #D2D000",\
        "v.	c #AEAC00",\
        "w.	c #C1BE00",\
        "x.	c #E6E600",\
        "y.	c #3C3400",\
        "z.	c #8E8A00",\
        "A.	c #908B00",\
        "B.	c #3B3200",\
        "C.	c #989300",\
        "D.	c #544C00",\
        "E.	c #514900",\
        "F.	c #949000",\
        "G.	c #3A3300",\
        "H.	c #3A3200",\
        "I.	c #F4F400",\
        "J.	c #ECEB00",\
        "K.	c #EAE900",\
        "L.	c #484000",\
        "M.	c #7B7600",\
        "N.	c #A09C00",\
        "O.	c #BBB800",\
        "P.	c #B3AF00",\
        "Q.	c #B4B200",\
        "R.	c #9C9700",\
        "S.	c #797500",\
        "T.	c #2C1F00",\
        "U.	c #9B9600",\
        "V.	c #6B6500",\
        "W.	c #8C8700",\
        "X.	c #302800",\
        "Y.	c #8C8800",\
        "Z.	c #6B6400",\
        "`.	c #D3D100",\
        " +	c #DCDB00",\
        ".+	c #878200",\
        "++	c #898500",\
        "@+	c #292200",\
        "#+	c #797300",\
        "$+	c #F1F100",\
        "%+	c #766F00",\
        "&+	c #312800",\
        "*+	c #837D00",\
        "=+	c #918C00",\
        "-+	c #322A00",\
        ";+	c #726D00",\
        ">+	c #CECB00",\
        ",+	c #736D00",\
        "'+	c #B2AF00",\
        ")+	c #FDFC00",\
        "!+	c #B1AD00",\
        "~+	c #4B4300",\
        "                                                          . + + + + .                                                           ",\
        "                                                    @ # . . + + + + . . # $                                                     ",\
        "                                            % . . . . & * . + + + + . * & . . . . %                                             ",\
        "                                        . . . = - ; > , + . + + + + . + ' ) ; ! ~ . . .                                         ",\
        "                                  { ] . ^ ! / ( + + + + + . + + + + . + + + + + ( / _ ^ . .                                     ",\
        "                                . . : < [ + + + + + + + + . + + + + . + + + + + + + + } | 1 . .                                 ",\
        "                            ] $ 2 3 4 + + + + + + + + ( 5 . + + + + . 5 ( + + + + + + + + 6 7 . . #                             ",\
        "                          # . 8 9 + + + + + + + 0 a b . . . + + + + . . . b c d + + + + + + + e f . g                           ",\
        "                        . . h i + + + + + 6 j k . . . . # . + + + + . . . . . . & l m + + + + + n o . .                         ",\
        "                      . . p + + + + + q r . . . # ]       . + + + + .       @ # . . . s q + + + + + t . .                       ",\
        "                    . 2 u + + + + + v w . . x             . . . . . .             $ . . & y + + + + + z 2 .                     ",\
        "                  $ . A + + + + B C . . x                                             x . . D n + + + + E . .                   ",\
        "                ] . F + + + + G H . #                                                     . . I J + + + + p . .                 ",\
        "              . . K + + + + L 1 . x                       M M M M M M                       % . N O + + + + P . 2               ",\
        "            ] . Q , + + + R ^ . ]                 M M M M M M M M M M                         2 . S T + + + , U . #             ",\
        "            $ V W + + + X Y . x               M M M M M M M M M M M M                           Z . ` [ + + +  .V .             ",\
        "          . . ..+ + + ( +.. g             M M M M M M M M M M M M M M                             @.. #.( + + + $.. 2           ",\
        "          . %., + + + &.. $             M M M M M M M M M M M M M M M                               % . *.+ + + , =..           ",\
        "        ] . -.+ + + ;.>..             M M M M M M M M M M . + + + + .                                 . >.,.+ + + '.. #         ",\
        "        . Y ( + + + )..             M M M M M M M M       . + + + + .                                   . C + + + ( H .         ",\
        "      . . y + + + !.. x           M M M M M M M           . + + + + .                                   $ . ~.+ + + {.. #       ",\
        "      . . n + + + ].]           M M M M M M M M           . . . . . .                                     . ^.+ + + n . .       ",\
        "    x . /.+ + + R . $           M M M M M M                                                               $ . (.+ + + _.. $     ",\
        "    . . :.+ + + *..           M M M M M M M                                                                 . | + + + <.. .     ",\
        "    . . q + + + [.#           M M M M M                                                                     $ }.+ + + m . ]     ",\
        "    . |.+ + + 1.. $         M M M M M M                   . . . . . .                                       # . 2.+ + + 3..     ",\
        "  @ . 4.+ + + 5..           M M M M M                     . + + + + .                                         . 6.+ + + 7.. 8.  ",\
        "  . . 9.+ + + c .           M M M M M                     . + + + + .                                         . 0.+ + + a.. $   ",\
        "  . . b.+ + + c.#           M M M M                       . + + + + .                                         . d.+ + + e.. .   ",\
        ". . . . . . . . . . . .   M M M M M . . . .       . . . . . + + + + . . . . .       . . . . M M M M M   . . . . . . . . . . . . ",\
        ". + + + + + + + + + + .   M M M M M + + + .       . + + + + + + + + + + + + .       . + + + M M M M M   . + + + + + + + + + + . ",\
        ". + + + + + + + + + + .   M M M M M + + + .       . + + + + + + + + + + + + .       . + + + M M M M M   . + + + + + + + + + + . ",\
        ". + + + + + + + + + + .   M M M M M + + + .       . + + + + + + + + + + + + .       . + + + M M M M M   . + + + + + + + + + + . ",\
        ". + + + + + + + + + + .   M M M M M + + + .       . + + + + + + + + + + + + .       . + + + M M M M M   . + + + + + + + + + + . ",\
        ". . . . . . . . . . . .   M M M M M . . . .       . . . . . + + + + . . . . .       . . . . M M M M M   . . . . . . . . . . . . ",\
        "  . . f.+ + + c.#           M M M M M                     . + + + + .                     M M M M M           ] g.+ + + h.. .   ",\
        "  # . 9.+ + + i..           M M M M M                     . + + + + .                     M M M M M           ] 0.+ + + a.. $   ",\
        "  $ . 4.+ + + 6..           M M M M M                     . . . . . .                     M M M M M         { . j.+ + + h . k.  ",\
        "    . b + + + 1.. $         M M M M M M                                                 M M M M M           ] . l.+ + + 3..     ",\
        "    . . q + + + m..           M M M M M                                               M M M M M M           . }.+ + + m . .     ",\
        "    . . n.+ + + o..           M M M M M M                                             M M M M M             . | + + + p.. @     ",\
        "    % . q.+ + + (.. $           M M M M M M                                         M M M M M M           % . (.+ + + r.. 8.    ",\
        "      . . B + + + D ]             M M M M M M             . . . . . .             M M M M M M             . s.+ + + n . .       ",\
        "      . . t.+ + + / . $           M M M M M M M           . + + + + .         M M M M M M M M           ] . u.+ + + v.. @       ",\
        "        . H ( + + + C .             M M M M M M M M       . + + + + .       M M M M M M M M             . ^.+ + + ( H .         ",\
        "        . . w.+ + + (.>..             M M M M M M M M M M . + + + + . M M M M M M M M M M             # >.x.+ + + A . .         ",\
        "          . y., + + + z.. %             M M M M M M M M M M M M M M M M M M M M M M M M             @ . A.+ + + , B..           ",\
        "          . . C.+ + + ( D.. x               M M M M M M M M M M M M M M M M M M M M               . . E.( + + + F.. .           ",\
        "            . >. .+ + + [ G.. Z               M M M M M M M M M M M M M M M M M M               @ . H.I.+ + + J.>..             ",\
        "            # . m., + + + K.1 . $                 M M M M M M M M M M M M M M                 . . ^ > + + + , L.. @             ",\
        "              2 . P + + + + O N . #                       M M M M M M                       ] . N O + + + + M.. .               ",\
        "                . . p + + + + J I . .                                                     $ . B. .+ + + + N.. $                 ",\
        "                  . . O.+ + + + i D . . .                                             # . . r.i + + + + O.. #                   ",\
        "                    . 2 P.+ + + + + P.& . ] .             . . . . . .             % . . S Q.+ + + + + y 2 .                     ",\
        "                      . . R.+ + + + + B S.. . . $ #       . + + + + .     T.. . . . . P B + + + + + U.. #                       ",\
        "                        . . V.n + + + + + m W.X.. . . . . . + + + + . . ] . . . X.Y.q + + + + + n Z.. ]                         ",\
        "                          # . }.`.+ + + + + + +  +.+|.. . . + + + + . . . Y ++ ++ + + + + + + 9 m.. g                           ",\
        "                            @+. . #+I.+ + + + + + + + ( $+. + + + + . $+( + + + + + + + + [ %+. . @                             ",\
        "                                @ . &+*+X + + + + + + + + . + + + + . + + + + + + + + m =+-+. ]                                 ",\
        "                                    % . &+;+>+( + + + + + . + + + + . + + + + + ( >+;+&+. .                                     ",\
        "                                        @ . . y.,+'+(.)++ . + + + + . + )+(.!+,+y.. . @                                         ",\
        "                                            8.@ # . . w ~+. + + + + . Q w . . # 2 {                                             ",\
        "                                                    { $ 2 . + + + + . 2 $ 8.                                                    ",\
        "                                                          . . . . . .                                                           "])

    def textEnglish(self):
        buttonText = "Screw/pin/shaft thread in plan"
        helpText = "Draw the technical symbol of the thread in the screw/pin/shaft plant :"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select the circumference (s) that represent screw/pin/shaft"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Schraube/Stift/ Wellengewinde im Grundriss"
        helpText = "Zeichne das technische Symbol  Schraube/Stift/ Wellengewinde im Grundriss:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle die Umrisse von Schraube/Stift/Wellengewinde"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Filettatura vite/perno/albero in pianta"
        helpText = "Disegna il simbolo tecnico della filettatura vite/perno/albero in pianta:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare la/e circonferenza/e che rappresentano vite/perno/albero"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Filetage vis/goupille/arbre en plan"
        helpText = "Dessinez le symbole technique du filetage vis/pivot/axe en plan:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionnez la (les) circonférence (s) représentant la vis/la broche/l'axe"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Rosca de tornillo/pasador/eje en planta"
        helpText = "Dibujar en plano el símbolo técnico de la rosca de tornillo/pivote/árbol en planta:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccione la (s) circunferencia (s) que representan tornillo/pasador/eje"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            commonTools.drawCosmeticThreadArcs(View,ObjectList,False)
            gui.Selection.clearSelection()

class DrawCosmeticThreadSideHole:
    '''Draw cosmetic hole thread side view'''
    Icon = QtGui.QPixmap([  \
        "64 64 13 1",\
        " 	c None",\
        ".	c #2B2200",\
        "+	c #FFFF00",\
        "@	c #FF0000",\
        "#	c #FAFA00",\
        "$	c #2D2300",\
        "%	c #292400",\
        "&	c #2C2300",\
        "*	c #2C1F00",\
        "=	c #322900",\
        "-	c #2B2100",\
        ";	c #2D2200",\
        ">	c #2B2400",\
        "                              ....                              ",\
        "                              .++.                              ",\
        "  @@@@@@                      .#+.            $$$$$%            ",\
        "  @@@@@@   ........           .#+.           ........   @@@@@@  ",\
        "  @@@@@@   ........           .#+.           ........   @@@@@@  ",\
        "  @@@@@@   ..++++..           .#+.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .#+.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .#+.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .#+.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .#+.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .#+.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           &...           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           ....           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           ....           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           ....           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           ....           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           ....*          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++=-          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++=-          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           &...;          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..                          ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           ....           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ..++++..   @@@@@@  ",\
        "  @@@@@@   ..++++..           .++.           ........   @@@@@@  ",\
        "  @@@@@@   ........           .++.           ........   @@@@@@  ",\
        "           ........           .++.            >$$$$%            ",\
        "                              .++.                              ",\
        "                              ....                              "])

    def textEnglish(self):
        buttonText = "Cosmetic thread side view"
        helpText = "Draw a cosmetic thread:"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select two parallel lines"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Seitenriß kosmetisches Bohrungsgewinde"
        helpText = "Zeiche ein symbolisches Bohrungsgewinde von der Seite:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle zwei parallele Linien"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Filettatura foro vista laterale/sezione"
        helpText = "Disegna il simbolo tecnico della filettatura di un foro in vista laterale o sezione:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare due linee parallele che rappresentano il foro da filettare"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Filetage du trou vue côté/section"
        helpText = "Dessine le symbole technique du filetage d'un trou en vue de côté ou en coupe:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionner deux lignes parallèles représentant le trou à tarauder"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Rosca del orificio vista lateralde/ sección"
        helpText = "Dibuja el símbolo técnico de la rosca de un agujero en la vista lateral o en sección:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccione dos líneas paralelas que representen el agujero que se va a roscar"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            commonTools.drawCosmeticThreadLines(View,ObjectList,True)
            gui.Selection.clearSelection()

class DrawCosmeticThreadSideBolt:
    '''Draw cosmetic bolt thread side view'''
    Icon = QtGui.QPixmap([  \
        "64 64 10 1",\
        " 	c None",\
        ".	c #2B2200",\
        "+	c #FFFF00",\
        "@	c #FF0000",\
        "#	c #2D2300",\
        "$	c #2C2300",\
        "%	c #2B2300",\
        "&	c #292100",\
        "*	c #2A2100",\
        "=	c #F1F000",\
        "                             .....                              ",\
        "                             .+++.                              ",\
        "  .......   @@@@@@           .+++.                     ######   ",\
        "  .......   @@@@@@           .+++.            @@@@@@   .......  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   .......  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           $%%%$            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           &%%%*            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+=+.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@                            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .....            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  ..+++..   @@@@@@           .+++.            @@@@@@   ..+++..  ",\
        "  .......   @@@@@@           .+++.            @@@@@@   .......  ",\
        "  .......   @@@@@@           .+++.            @@@@@@   .......  ",\
        "                             .+++.                      #####   ",\
        "                             .+++.                              ",\
        "                             .....                              "])

    def textEnglish(self):
        buttonText = "Thread Screw/pin/shaft side view/section"
        helpText = "Draw the technical symbol of the screw/pin/shaft thread in side or section view :"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select two parallel lines representing the screw/pin/shaft thread"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Schraube Gewinde/Stift/Welle Seitenansicht/Abschnitt"
        helpText = "Zeiche ein symbolisches Schraubengewinde von der Seite:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- Wählen Sie zwei parallele Linien, welche Schraube/Stift/Baum repräsentieren"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Filettatura vite/perno/albero vista laterale/sezione"
        helpText = "Disegna il simbolo tecnico della filettatura vite/perno/albero in vista laterale o sezione:"+ "\n"\
                   "- scegliere gli attributi linea"+ "\n"\
                   "- selezionare due linee parallele che rappresentano vite/perno/albero da filettare"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Filetage vis/goupille/arbre côté/section"
        helpText = "Dessinez le symbole technique de la vis/goupille/arbre filetage en vue latérale ou en coupe:"+ "\n"\
                   "- choisir les attributs de ligne"+ "\n"\
                   "- sélectionner deux lignes parallèles représentant la vis/goupille/arbre à fileter"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Rosca tornillo/pasador/eje vista lateral/secció"
        helpText = "Dibuje el símbolo técnico del rosca tornillo/pasador/eje en la vista lateral o en sección:"+ "\n"\
                   "- elegir atributos de línea"+ "\n"\
                   "- seleccione dos líneas paralelas que representen tornillo/pasador/eje a roscar"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)


    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            commonTools.drawCosmeticThreadLines(View,ObjectList,False)
            gui.Selection.clearSelection()

class IntersectionVertex:
    '''Create  vertexes at intersection of two edges (lines and/or circles)'''
    Icon = QtGui.QPixmap([  \
        "64 64 38 1",\
        " 	c None",\
        ".	c #2B2200",\
        "+	c #2D2400",\
        "@	c #FFFF00",\
        "#	c #FBFB00",\
        "$	c #F9F900",\
        "%	c #FAFA00",\
        "&	c #F8F800",\
        "*	c #F6F500",\
        "=	c #F5F500",\
        "-	c #F4F400",\
        ";	c #F3F300",\
        ">	c #F1F000",\
        ",	c #F0EF00",\
        "'	c #EFEF00",\
        ")	c #EEEE00",\
        "!	c #EBEA00",\
        "~	c #EAE900",\
        "{	c #FF0000",\
        "]	c #E9E800",\
        "^	c #FF0200",\
        "/	c #FF0100",\
        "(	c #FF0C00",\
        "_	c #FF0600",\
        ":	c #FD0000",\
        "<	c #FDFD00",\
        "[	c #302700",\
        "}	c #FEFE00",\
        "|	c #FDFC00",\
        "1	c #2D2500",\
        "2	c #3A2900",\
        "3	c #F8F700",\
        "4	c #FF0A00",\
        "5	c #FF1C00",\
        "6	c #FAED00",\
        "7	c #FF1300",\
        "8	c #2B2400",\
        "9	c #2F2700",\
        "                                                                ",\
        "                                                                ",\
        "                                                         ..     ",\
        "                       .....                            .+.     ",\
        "                       .@@@.                           ..@.     ",\
        "                       .@@@.                          ..#@.     ",\
        "                       .@@@.                         ..$@@.     ",\
        "                       ..@@..                       ..%@@@.     ",\
        "                        .@@@.                      ..$@@@..     ",\
        "                        ..@@.                     ..&@@@..      ",\
        "                         .@@..                   ..*@@@..       ",\
        "                         .@@@.                  ..=@@@..        ",\
        "                         ..@@.                 ..=@@@..         ",\
        "                          .@@.                ..-@@@..          ",\
        "                         ..@@.               ..;@@@..           ",\
        "                          ..@.              ..>@@@..            ",\
        "                           .@..            ..,@@@..             ",\
        "                           .@@.           ..'@@@..              ",\
        "                           .@@.          ..)@@@..               ",\
        "                           .@@..        ..!@@@..                ",\
        "                           ..@@.       ..~@@@..                 ",\
        "                           ..{{{{{{   ..]@@@..                  ",\
        "                           {{^{{{{{{{{.]@@@..                   ",\
        "                          {{{{{{{{{{{{{@@@..                    ",\
        "                         {{{{{{{{{{{{{/{@..                     ",\
        "                         {{{{{{{{{{{{{{(..                      ",\
        "                 .......{{{{{{{{{{{{{{{{{                       ",\
        "              ....@@@@@@_{{{{{{{{{{{{{{{:                       ",\
        "            ...@@@@@@@@@{{{{{{{{{{{{{{{{{{                      ",\
        "          ...$@@@......{{{{{{{{{{{{{{{{{{{.                     ",\
        "         ..@@<@...     {{{{{{{{{{{{{{{{{{{[.                    ",\
        "        ..}@@..        {{{{{{{{{{{{{{{{{{{@..                   ",\
        "       ..@|..          {{{{{{{{{{{{{{{{{{{@@..                  ",\
        "      ..@*.1            {{{{{{{{{{{{{{{{{2@@@..                 ",\
        "     ..@@..             {{{{{{{{{{{{{{{{{...@@..                ",\
        "    ..3<..               {{{{{{{{{{{{{{{   ..@@..               ",\
        "    .@@..               ..4{{{{{{{{{{{{{    ..@@..              ",\
        "   ..@@.               ..@{5{{{{{{{{{{{      ..@@..             ",\
        "   .@@..              ..@@@6{{{{{{{7{.        ..@@..            ",\
        "   .3@.              ..@@@%.. {{{{{@@.         ..@@.            ",\
        "  ..@..             ..@@@#..    ..@@@.          ..@@.           ",\
        "  .@@.             ..@@@|..      ..@@..          .@@..          ",\
        "  .@@.            ..@@@|..        .@@@.          ..@@.8         ",\
        "  .@@.           ..@@@|..         .@@@.           .@@..         ",\
        "  ....          ..@@@<..          .@@@.           ..@@9         ",\
        "               ..@@@}..           ..@@..           .@@+         ",\
        "              ..@@@@..             .@@@.           .@@..        ",\
        "             ..*@@@..              .@@@.           ..@@.        ",\
        "            ..@@@}..               ..@@.            .@@.        ",\
        "           ..@@@@..                 .@@..           .@@.        ",\
        "          ..@@@@..                  .@@@.           .@@.        ",\
        "         ..@@@@..                   .@@@.           ....        ",\
        "        ..@@@@..                    ..@@..                      ",\
        "       ..@@@@..                      .@@@.                      ",\
        "      ..@@@@..                       .@@@.                      ",\
        "     ..@@@@..                        .....                      ",\
        "     .}@@@..                                                    ",\
        "     .@@@..                                                     ",\
        "     .@@..                                                      ",\
        "     .@..                                                       ",\
        "     ...                                                        ",\
        "     ..                                                         ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create Vertex(es) at Intersection"
        helpText = "Create the vertexes at intersection of lines:"+ "\n"\
                   "- select two lines/circles/arcs"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge Fangpunkt(e) im Schnittpunkt"
        helpText = "Erzeuge Fangpunkte im Schnitt von Linien:"+ "\n"\
                   "- wähle zwei Linien/Kreise/Kreisbögen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Vertice/i nell'intersezione"
        helpText = "Inserisce vertice/i cosmetico/i nel/i punto/i di intersezione:"+ "\n"\
                   "- selezionare linee/circonferenze/archi che intersecano"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Sommet (s) à l'intersection"
        helpText = "Insérer des sommets cosmétiques au (x) point (s) d'intersection:"+ "\n"\
                   "- sélectionner des lignes/cercles/arcs qui se croisent "+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Vértice (s) en la intersección"
        helpText = "Insertar vértices cosméticos en los puntos de intersección:"+ "\n"\
                   "- seleccionar líneas/círculos/arcos que se cruzan"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if len(ObjectList) < 2: return
            Edges = []
            for ObjectString in ObjectList:
                if ObjectString[0:4] == 'Edge':
                    Edges.append(View.getEdgeBySelection(ObjectString))
            if Edges[0].Curve.TypeId == 'Part::GeomCircle':
                Line1 = Part.Circle(Edges[0].Curve.Center,app.Vector(0,0,1),Edges[0].Curve.Radius)
            else:
                Line1 = Part.Line(Edges[0].Vertexes[0].Point,Edges[0].Vertexes[1].Point)
            if Edges[1].Curve.TypeId == 'Part::GeomCircle':
                Line2 = Part.Circle(Edges[1].Curve.Center,app.Vector(0,0,1),Edges[1].Curve.Radius)
            else:
                Line2 = Part.Line(Edges[1].Vertexes[0].Point,Edges[1].Vertexes[1].Point)
            InterPnts = Line1.intersect(Line2)
            for Ip in InterPnts[:2]:
                View.makeCosmeticVertex(app.Vector(Ip.X,Ip.Y,Ip.Z))
                Vertex = View.CosmeticVertexes[-1]
                Vertex.Size = View.CosmeticVertexes[0].Size
                View.recompute()
            gui.Selection.clearSelection()

class ChangeLineStyle:
    '''Change style/ thickness/color of selected lines'''
    Icon = QtGui.QPixmap([  \
        "64 64 31 1",\
        " 	c None",\
        ".	c #2B2200",\
        "+	c #2B2300",\
        "@	c #322900",\
        "#	c #393100",\
        "$	c #302700",\
        "%	c #FF0000",\
        "&	c #FFFF00",\
        "*	c #2C2200",\
        "=	c #FF0100",\
        "-	c #FF0200",\
        ";	c #FF0300",\
        ">	c #FF0400",\
        ",	c #FF0500",\
        "'	c #2F2100",\
        ")	c #312100",\
        "!	c #FF3500",\
        "~	c #FFF600",\
        "{	c #FFF500",\
        "]	c #FFF400",\
        "^	c #FF2400",\
        "/	c #FFF200",\
        "(	c #FF0900",\
        "_	c #FFF300",\
        ":	c #FFF700",\
        "<	c #FF0600",\
        "[	c #FF0F00",\
        "}	c #FF1D00",\
        "|	c #FFFD00",\
        "1	c #FFFE00",\
        "2	c #2C2100",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "   ...........................................                  ",\
        "  +............................................                 ",\
        " ...............................................                ",\
        " ....@#####################################$....      %%%%      ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....     %%%%%%     ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....    %%%%%%%%    ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....   %%%%%%%%%%   ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....  %%%%%%%%%%%%  ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.... %%%%%%%%%%%%%% ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....%%%%%%%%%%%%%%% ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...%%%%%%%%%%%%%%%% ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.*%%%%%%%%%%%%%%%%% ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*%%%%%%%%%%%%%%%%%  ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%   ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%    ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%     ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%      ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%       ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%        ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%         ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%=%%%%%%%%%%%%%%%          ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%=%%%%%%%%%%%%%%%           ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-%%%%%%%%%%%%%%%            ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-%%%%%%%%%%%%%%%             ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&%;%%%%%%%%%%%%%%%              ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&%>%%%%%%%%%%%%%%%               ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&%>%%%%%%%%%%%%%%%                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&%,%%%%%%%%%%%%%%%.                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%..                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%'..                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&%&&%%%%%%%%%%%%%)...                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&=%%&&%%%%%%%%%%%&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&!%%%%&&%%%%%%%%%~&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&%%%%%%&&%%%%%%%{&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&%%%%%%%&&%%%%%]&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&^%%%%%%%%&&%%%/&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&%%%%%%%%%(&_&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&:<%%%%%%[&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&}%%%%%&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&|%%%%&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&%%&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&1&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....                ",\
        " ..............................................                 ",\
        "  2...........................................*                 ",\
        "    ..........................................                  ",\
        "     ........................................                   "])

    def textEnglish(self):
        buttonText = "Change the line attributes"
        helpText = "Change the attributes of selected lines:"+ "\n"\
                   "- pick favoured line attributes"+ "\n"\
                   "- select many cosmetic or center lines"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Linienart ändern"
        helpText = "Ändern der Eigenschaften von ausgewählten Linien:"+ "\n"\
                   "- wähle die gewünschten Eigenschaften der Linien"+ "\n"\
                   "- wähle mehrere kosmetische oder Mittellinien"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Modifica attributi cosmetiche: linee, archi, circonferenze"
        helpText = "Modifica gli attributi di elementi cosmetici:"+ "\n"\
                   "- scegliere gli attributi"+ "\n"\
                   "- selezionare gli elementi cosmetici da modificare"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Modifier les attributs cosmétiques: lignes, arcs, cercles"
        helpText = "Modifier les attributs des objets cosmétiques:"+ "\n"\
                   "- choisir des attributs"+ "\n"\
                   "- sélectionner les éléments cosmétiques à modifier"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Cambiar atributos cosméticos: líneas, arcos, círculos"
        helpText = "Cambiar los atributos de los artículos cosméticos:"+ "\n"\
                   "- elegir atributos"+ "\n"\
                   "- seleccionar los elementos cosméticos a modificar"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            for ObjectString in ObjectList:
                if ObjectString[0:4] == 'Edge':
                    Edge = View.getCenterLineBySelection(ObjectString)
                    if Edge == None:
                        Edge = View.getCosmeticEdgeBySelection(ObjectString)
                    if Edge != None:
                            newFormat = (Attrib.getStyle(),Attrib.getWidth(),Attrib.getColorTuple(),True)
                            Edge.Format = newFormat
                            View.requestPaint()
            gui.Selection.clearSelection()

class drawDiameterSign:
    '''Inserta  a '⌀' sign in a measure'''
    Icon = QtGui.QPixmap([  \
        "64 64 10 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #2B2200",\
        "@	c #2C2300",\
        "#	c #FFFF00",\
        "$	c #2C2200",\
        "%	c #342B00",\
        "&	c #FEFE00",\
        "*	c #2D2400",\
        "=	c #FDFD00",\
        "                                     ....                       ",\
        "                                    ......                      ",\
        "                                    ......                      ",\
        "                                    ......                      ",\
        "                                   ......                       ",\
        "                           ..............                       ",\
        "                        .................                       ",\
        "                      ....................                      ",\
        "                    .......................                     ",\
        "                   ..........................                   ",\
        "                  ............................                  ",\
        "                 .........       ..............                 ",\
        "                ........         ...... ........                ",\
        "               ........          .....   ........               ",\
        "               .......          ......    .......               ",\
        "              .......           ......     .......              ",\
        "              ......            .....       ......              ",\
        "             ......            ......        ......             ",\
        "             ......            ......        ......             ",\
        "             .....             .....          .....             ",\
        "            ......            ......          ......            ",\
        "            ......            ......          ......            ",\
        "            ......            .....            .....            ",\
        "            .....            ......            .....            ",\
        "            .....            ......            .....            ",\
        "            .....            ......            .....            ",\
        "            .....            .....             .....            ",\
        "            .....           ......             .....            ",\
        "            ......          ......             .....            ",\
        "            ......          .....             ......            ",\
        "            ......         ......             ......            ",\
        "             ......        ......             .....             ",\
        "             ......        .....             ......             ",\
        "             .......      ......            .......             ",\
        "              ......      ......            ......              ",\
        "              .......     .....            .......              ",\
        "               .......   ......           .......               ",\
        "                ........ ......         ........                ",\
        "                ..............         .........                ",\
        "                 .............      ...........                 ",\
        "                  ............................                  ",\
        "                   ..........................                   ",\
        "                     ......................                     ",\
        "                       ..................                       ",\
        "                       ................                         ",\
        "             +++       ............                             ",\
        "            ++@+      ......                     +++            ",\
        "           +++++      ......                     ++++           ",\
        "          +++#++      .....                      +++++          ",\
        "         +++##++       ....                      ++#+++         ",\
        "        +++###++                                 ++##+++        ",\
        "      ++++####+$+++++++++++++++++++++++++++++++++++###+@+       ",\
        "   +++++%#&###+++++++++++++++++++++++++++++++++++++####*+++     ",\
        "+++++####################################################+++++  ",\
        "+++##=######################################################++++",\
        "+++++######################################################=##++",\
        "   +++++####################################################++++",\
        "      +++*####+++++++++++++++++++++++++++++++++++++###&#%+++++  ",\
        "        +@+###+++++++++++++++++++++++++++++++++++$+####++++     ",\
        "         +++##++                                 ++###+++       ",\
        "          +++#++                                 ++##+++        ",\
        "           +++++                                 ++#+++         ",\
        "            ++++                                 +++++          ",\
        "             +++                                 ++++           "])

    def textEnglish(self):
        buttonText = "Insert a 'Ø' sign"
        helpText = "Insert a 'Ø' sign in a measure:"+ "\n"\
                   "- select many measures"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText ="Einfügen eines  'Ø' Zeichens"
        helpText = "Füge ein 'Ø' Zeichen vor der Maßzahl ein:"+ "\n"\
                   "- wähle ein Maß"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Inserisci il simbolo 'Ø ' nella dimensione"
        helpText = "Inserisce il simbolo 'Ø' (diametro) in una dimensione:"+ "\n"\
                   "- selezionare le dimensioni"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Entrez le symbole 'Ø' dans la cote"
        helpText = "Insère le symbole 'Ø' (diamètre) dans une cote:"+ "\n"\
                   "- sélectionnez les taille"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Ingrese el símbolo 'Ø' en la dimensión"
        helpText = "Inserta el símbolo 'Ø' (diámetro) en una dimensión:"+ "\n"\
                   "- seleccione los tamaño"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        DiamSign ='⌀'
        Sel = gui.Selection.getSelectionEx()
        for Elem in Sel:
            if Elem.Object.TypeId == 'TechDraw::DrawViewDimension':
                OldFormat = Elem.Object.FormatSpec
                Elem.Object.FormatSpec = DiamSign+OldFormat

class drawRectangleSign:
    '''Inserta  a '〼' sign in a measure'''
    Icon = QtGui.QPixmap([  \
        "64 64 11 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #2B2200",\
        "@	c #2B2000",\
        "#	c #2C2300",\
        "$	c #2C2200",\
        "%	c #FFFF00",\
        "&	c #342B00",\
        "*	c #FEFE00",\
        "=	c #2D2400",\
        "-	c #FDFD00",\
        "                                     ....                       ",\
        "                                     .....                      ",\
        "                                    ......                      ",\
        "                                    ......                      ",\
        "                                    .....                       ",\
        "                                   ......                       ",\
        "              ....................................              ",\
        "             ......................................             ",\
        "            ........................................            ",\
        "            ........................................            ",\
        "            ........................................            ",\
        "            ......               ......       ......            ",\
        "            ......               ......       ......            ",\
        "            ......               ......       ......            ",\
        "            ......              ......        ......            ",\
        "            ......              ......        ......            ",\
        "            ......              ......        ......            ",\
        "            ......              .....         ......            ",\
        "            ......             ......         ......            ",\
        "            ......             ......         ......            ",\
        "            ......             .....          ......            ",\
        "            ......            ......          ......            ",\
        "            ......            ......          ......            ",\
        "            ......            .....           ......            ",\
        "            ......           ......           ......            ",\
        "            ......           ......           ......            ",\
        "            ......           .....            ......            ",\
        "            ......          ......            ......            ",\
        "            ......          ......            ......            ",\
        "            ......          .....             ......            ",\
        "            ......         ......             ......            ",\
        "            ......         ......             ......            ",\
        "            ......         ......             ......            ",\
        "            ......         .....              ......            ",\
        "            ......        ......              ......            ",\
        "            ......        ......              ......            ",\
        "            ......        .....               ......            ",\
        "            ......       ......               ......            ",\
        "            ......       ......               ......            ",\
        "            ......       .....                ......            ",\
        "            ......      ......                ......            ",\
        "            ........................................            ",\
        "            ........................................            ",\
        "            ........................................            ",\
        "             ......................................             ",\
        "              ....................................              ",\
        "             +++.................................@              ",\
        "            ++#+      ......                    $+++            ",\
        "           +++++      ......                     ++++           ",\
        "          +++%++       ....                      +++++          ",\
        "         +++%%++                                 ++%+++         ",\
        "        +++%%%++                                 ++%%+++        ",\
        "      ++++%%%%+$+++++++++++++++++++++++++++++++++++%%%+#+       ",\
        "   +++++&%*%%%+++++++++++++++++++++++++++++++++++++%%%%=+++     ",\
        "+++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++  ",\
        "+++%%-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++++",\
        "+++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-%%++",\
        "   +++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++++",\
        "      +++=%%%%+++++++++++++++++++++++++++++++++++++%%%*%&+++++  ",\
        "        +#+%%%+++++++++++++++++++++++++++++++++++$+%%%%++++     ",\
        "         +++%%++                                 ++%%%+++       ",\
        "          +++%++                                 ++%%+++        ",\
        "           +++++                                 ++%+++         ",\
        "            ++++                                 +++++          "])

    def textEnglish(self):
        buttonText = "Insert a '〼' sign"
        helpText = "Insert a '〼' sign in a measure:"+ "\n"\
                   "- select many measures"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Einfügen eines '〼' Zeichens"
        helpText = "Füge ein'〼' Zeichen vor der Maßzahl ein:"+ "\n"\
                   "- wähle ein Maß"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Inserisci il simbolo '〼' nella dimensione (tubolare)"
        helpText = "Inserisce il segno a '〼' (dimensione tubolare) in una dimensione:"+ "\n"\
                   "- selezionare le dimensioni"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Insérez le symbole '〼' dans la dimension (tubulaire)"
        helpText = "Insère la marque '〼' (tubulaire) dans une dimension:"+ "\n"\
                   "- sélectionnez les taille"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Inserte el símbolo '〼' en la dimensión (tubular)"
        helpText = "Inserta la marca '〼' (tubular) en una dimensión:"+ "\n"\
                   "- selecciona los tamaño"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        RectSign ='〼'
        Sel = gui.Selection.getSelectionEx()
        for Elem in Sel:
            if Elem.Object.TypeId == 'TechDraw::DrawViewDimension':
                OldFormat = Elem.Object.FormatSpec
                Elem.Object.FormatSpec = RectSign+OldFormat

class positionSectionView:
    ''' Position a section view at same x or y as its base view'''
    Icon = QtGui.QPixmap([  \
        "64 64 4 1",\
        " 	c None",\
        ".	c #141000",\
        "+	c #FFFF00",\
        "@	c #FF0000",\
        "...............................                                 ",\
        "...............................                                 ",\
        ".. +++++++  +++++++  +++++++ ..                                 ",\
        ".. +++++++  +++++++  +++++++ ..                                 ",\
        ".. +++++++  +++++++  +++++++ ..                                 ",\
        ".. +++++++  +++++++  +++++++ ..                                 ",\
        "..++++...................++++..                                 ",\
        "..++++...................++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..    ..               ..    ..                                 ",\
        "..    ..               ..    ..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..++++..               ..++++..                                 ",\
        "..    ..               ..    ..                                 ",\
        "..    ..               ..    ..                                 ",\
        "..++++..               ..++++..  @@@@@@@@@   @@@@@@@   @@@@@@@@@",\
        "..++++..               ..++++..  @@@@@@@@@   @@@@@@@   @@@@@@@@@",\
        "..++++..               ..++++..  @@@@@@@@@   @@@@@@@   @@@@@@@@@",\
        "..++++..               ..++++..  @@@@@@@@@   @@@@@@@   @@@@@@@@@",\
        "..++++..               ..++++..  @@@@@@@@    @@@@@@@    @@@@@@@@",\
        "..++++..               ..++++..  @@@@                       @@@@",\
        "..++++..               ..++++..  @@@@                       @@@@",\
        "..    ..               ..    ..  @@@@                       @@@@",\
        "..    ..               ..    ..  @@@@           @           @@@@",\
        "..    ..               ..++++..                @@@          @@@@",\
        "..++++...................++++..                @@@              ",\
        "..++++...................++++..               @@@@@             ",\
        "..++++  ++++++   ++++++  ++++..  @@@@         @@@@@             ",\
        "..++++  ++++++   ++++++  ++++..  @@@@        @@@@@@         @@@@",\
        "..++++  ++++++   ++++++  ++++..  @@@@        @@@@@@@        @@@@",\
        "..++++  ++++++   ++++++  ++++..  @@@@        @@@@@@@        @@@@",\
        "...............................  @@@@       @@@@@@@@        @@@@",\
        "...............................  @@@@       @@@@@@@@@       @@@@",\
        "                                            @@@@@@@@@       @@@@",\
        "                                           @@@@@@@@@@@      @@@@",\
        "                                           @@@@@@@@@@@          ",\
        "                                 @@@@      @@@@@@@@@@@          ",\
        "                                 @@@@     @@@@@@@@@@@@@     @@@@",\
        "                                 @@@@     @@@@@@@@@@@@@     @@@@",\
        "                                 @@@@    @@@@@@@@@@@@@@@    @@@@",\
        "                                 @@@@    @@@@@@@@@@@@@@@    @@@@",\
        "                                 @@@@    @@@@@@@@@@@@@@@    @@@@",\
        "                                          @@@@@@@@@@@@@     @@@@",\
        "                                               @@@              ",\
        "                                               @@@              ",\
        "                                 @@@@          @@@              ",\
        "                                 @@@@                       @@@@",\
        "                                 @@@@                       @@@@",\
        "                                 @@@@          @@@          @@@@",\
        "                                 @@@@          @@@          @@@@",\
        "                                 @@@@                       @@@@",\
        "                                                            @@@@",\
        "                                    @@@@@@@  @@@@@@@  @@@@@@@@@@",\
        "                                    @@@@@@@  @@@@@@@  @@@@@@@@@@",\
        "                                    @@@@@@@  @@@@@@@  @@@@@@@@@@"])

    def textEnglish(self):
        buttonText = "Orthogonal projection group: section view positioning"
        helpText = "Position a section view at same x or y as its base view"+ "\n"\
                   "- select a section view"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Orthogonale Projektionsgruppe: Schnittansichtspositionierung"
        helpText = "Positioniere eine Schnittansicht bei der gleichen x oder y Koordinate wie die Basisansicht"+ "\n"\
                   "- wähle eine Schnittansicht"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Gruppo proiezioni ortog.: posizionamento vista in sezione"
        helpText = "Posiziona una vista in sezione alla coordinata 'x' o 'y' della sua vista di base"+ "\n"\
                   "- selezionare una vista in sezione"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Groupe de projection orthograp.: positionnement de la vue en coupe"
        helpText = "Place une vue en coupe à la coordonnée «x» ou «y» de sa vue de base"+ "\n"\
                   "- sélectionnez une vue en coupe"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Grupo de proyección ortográfica: posicionamiento de vista en sección"
        helpText = "Coloca una vista de sección en la coordenada 'x' o 'y' de su vista base"+ "\n"\
                   "- seleccionar una vista de sección"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        if gui.Selection.getCompleteSelection():
            Section = gui.Selection.getCompleteSelection()[0]
            if Section.TypeId == 'TechDraw::DrawViewSection':
                BaseView = Section.BaseView
                if BaseView.TypeId == "TechDraw::DrawProjGroupItem":
                    Base = BaseView.InList[0]
                else:
                    Base = BaseView
                if abs(Section.Direction.x) == 1:
                    Section.Y=Base.Y
                if abs(Section.Direction.y) == 1:
                    Section.X=Base.X

class changeLockPosition:
    '''change the LockPosition of the selected view'''
    Icon = QtGui.QPixmap([  \
        "64 64 17 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "#	c #FCFC00",\
        "$	c #FDFD00",\
        "%	c #F9F900",\
        "&	c #FBFB00",\
        "*	c #231F1B",\
        "=	c #FFF800",\
        "-	c #FF2000",\
        ";	c #2C1F0C",\
        ">	c #FCFB00",\
        ",	c #FF0100",\
        "'	c #FEFE00",\
        ")	c #F9F901",\
        "!	c #FDFC00",\
        "                    .....                        +++++++        ",\
        "                    .......                    +++++++++++      ",\
        "                    ..........                ++@@@@@@#@+++     ",\
        "                    ............             +++@@@@@@@@@+++    ",\
        "                  ................          +++@@$@@@@@@@@+++   ",\
        "              ......................       +++@@@@++++@@@@@++   ",\
        "           ..........................     +++@@%@++++++@@@@@++  ",\
        "         ............................     ++@@@@+++  +++@@@@++  ",\
        "        ............................     ++@@@@+++    ++@@@@@+  ",\
        "       .........    .............        ++@@@@++     +++@@@@++ ",\
        "      .......       ...........          ++@@@+++      ++@@@@++ ",\
        "     ......         ........            ++@@@@++       ++@@@@@+ ",\
        "    ......          ......              ++&@@@++       ++@@@@@+ ",\
        "   ......             ..               +++@@@+++       ++@@@@@+ ",\
        "   .....                               ++@@@@++        +++@@@@++",\
        "  .....                                ++@@@@++         ++@@@@++",\
        "  .....                                ++@@@@++         ++@@@@++",\
        "  ....                        ++++++++ ++@@@@+          ++++++++",\
        " .....                   *++++++++++++++++++++          ++++++++",\
        " .....                   ++++++++++++++++++++++                 ",\
        " ....                   +++@@@@@@@@@@@@@@@@@@++                 ",\
        " ....                   +++@@@@@@@@@@@@@@@@@@+++                ",\
        " ....                   +++@@@@@@@@@@@@@@@@@@+++                ",\
        " ....                   +++@@@@@@@@@@@@@@@@@@+++                ",\
        " .....                  +++@@@@@@@@@@@@@@@@@@+++                ",\
        " .....                  +++@@@@@@@@@@@@@@@@@@+++                ",\
        "  ....                  +++@@@@@@@@@@@@@@@@@@+++                ",\
        "  .....                 +++@@@@@@@@@@@@@@@@@@+++                ",\
        "  .....                 +++@@@@@@@...=@@@@@@@+++                ",\
        "   ...  ......          +++@@@@@@.-...@@@@@@@+++                ",\
        "      ..........        +++@@@@@@.....@@@@@@@+++                ",\
        "     .............      +++@@@@@@.....@@@@@@@+++         ++++   ",\
        "    ...............     +++@@@@@@.....@@@@@@@+++        +++++;  ",\
        "   .................    +++@@@@@@.....@@@@@@@+++       +++++++  ",\
        "  .......     ......    +++@@@@@@.....@@@@@@@+++       ++@@@++  ",\
        "  ......       ......   +++@@@@@@.....@@@@@@@+++       ++@@@@++ ",\
        " ......         .....   +++@@@@@@.....@@@@@@@+++       ++@@@@++ ",\
        " ......         ......  +++@@@@@@.....@@@@@@@+++       ++@@@@++ ",\
        " .....           .....  +++@@@@@@@...@@@@@@@@+++       ++@@@@++ ",\
        " .....           .....  +++@@@@@@@@@@@@@@@@@@+++       ++@@@@++ ",\
        ".....             ..... +++@@@@@@@@@@@@@@@@@@+++       ++@@@@++ ",\
        ".....   .......   .....  ++++++++++++++++++++++        ++@@@@++ ",\
        ".......................   ++++++++++++++++++++         ++@@@@++ ",\
        ".......................     +++++++++++++++++          ++@@@@++ ",\
        ".......................                                ++>@@+++ ",\
        ".......................                               ++@@@@+++ ",\
        ".......................                               ++@@@@+++ ",\
        ".......................                              +++@@@@++  ",\
        ".......................               ++++          +++@@@#+++  ",\
        ".......................              ++++++        +++@@@@+++   ",\
        ".......................            ++++@@++       +++@@@@@++    ",\
        "..........@@@,.........          ++++@@'@++      +++@@@@)++     ",\
        ".........@@@@@.........        ++++@@@@@@++++++++++@@@@$+++     ",\
        ".........@@@@@.........      ++++@@@@@@@@+++++++++@@@@)+++      ",\
        ".........@@@@@.........    +++@@@@@@@@@@@++@@@@@@@@@@@@++       ",\
        ".........@@@@@.........   +++@@@@@@@@@@@@++@@@@@@@@@@+++        ",\
        ".........@@@@@.........    +++@!@@@@@@@@@++@@@@@@@@++++         ",\
        ".........@@@@@.........      ++++@@@@@@@@++@@@@@+++++           ",\
        ".........@@@@@.........        ++++@@@@@@+++++++++              ",\
        ".........@@@@@.........          ++++@@@@+++++++                ",\
        ".........@@@@@.........            ++++@@++                     ",\
        " .........@@@..........              ++++++                     ",\
        "  ...................                 ++++                      ",\
        "   .................                                            "])

    def textEnglish(self):
        buttonText = "Lock/Unlock a view"
        helpText = "Lock/Unlock a view"+ "\n"\
                   "- select a view"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Ansichtverschiebung sperren/öffnen"
        helpText ="Ansichtverschiebung sperren/öffnen"+ "\n"\
                  "- wähle eine Ansicht"+ "\n"\
                  "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Blocca/Sblocca una vista"
        helpText = "Blocca/sblocca una vista (non modificabile/modificabile):"+ "\n"\
                   "- selezionare una vista"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Verrouiller/déverrouiller une vue"
        helpText = "Verrouiller/déverrouiller une vue (non modifiable / modifiable):"+ "\n"\
                   "- sélectionnez une vue"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Bloquear/desbloquear una vista"
        helpText = "Bloquear/desbloquear una vista (no editable/editable):"+ "\n"\
                   "- seleccionar una vista"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        if gui.Selection.getCompleteSelection():
            Select = gui.Selection.getCompleteSelection()[0]
            if hasattr(Select,'LockPosition'):
                Select.LockPosition = not Select.LockPosition

class createVertDimChain:
    '''create a vertical chain dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                  ....                          ",\
        "                                 .......                        ",\
        "                                ........                        ",\
        "        ...................................                     ",\
        "        ...................................                     ",\
        "        ...................................                     ",\
        "                                ........                        ",\
        "                                 .......                        ",\
        "                                  .....                         ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                  .....                         ",\
        "                                 .......                        ",\
        "                                ...........                     ",\
        "        ...................................                     ",\
        "        ...................................                     ",\
        "        ...................................                     ",\
        "                                 ........                       ",\
        "                                 .......                        ",\
        "                                   ....                         ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                 .......                        ",\
        "                                ........                        ",\
        "         ..................................                     ",\
        "         ..................................                     ",\
        "         ..................................                     ",\
        "                                .........                       ",\
        "                                 .......                        ",\
        "                                  .....                         ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          ",\
        "                                   ...                          "])

    def textEnglish(self):
        buttonText = "Create a vertical chain dimension"
        helpText = "Select three or more vertexes"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge senkrechte Kettenbemaßung"
        helpText = "wähle drei oder mehr Kontrollpunkte"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensioni verticali in serie continue"
        helpText = "Seleziona tre o più vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimensions verticales en série continue"
        helpText = "Sélectionnez trois sommets ou plus"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Dimensiones verticales en serie continua"
        helpText = "Seleccione tres o más vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        def sortVertex(Vertex):
            return Vertex.Point.y

        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            scale = View.Scale
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            Vertexes.sort(key=sortVertex)
            if len(Vertexes) > 1:
                XPos = (Vertexes[0].X) * scale
                for i  in range(len(Vertexes)-1):
                    DistanceDim=TechDraw.makeDistanceDim(View,'DistanceY',Vertexes[i].Point, Vertexes[i+1].Point)
                    DistanceDim.X = XPos
                    DistanceDim.Y = Y = ((Vertexes[i].Point.y+Vertexes[i+1].Point.y)/2) * scale
            gui.Selection.clearSelection()

class createHorizDimChain:
    '''create a horicontal chain dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                    ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                   ....                  ...         ",\
        "        ...                   ....                  ...         ",\
        "        ...                   ....                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "       .....                  ....                 .....        ",\
        "      .......                ......               .......       ",\
        "     .........              ........             .........      ",\
        "................................................................",\
        "................................................................",\
        "................................................................",\
        "     .........              ........             .........      ",\
        "      .......               ........              .......       ",\
        "       .....                 ......                .....        ",\
        "        ...                    ...                  ...         ",\
        "        ...                    ...                  ...         ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create a horizontal chain dimension"
        helpText = "Select three or more vertexes"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge waagrechte Kettenbemaßung"
        helpText = "wähle drei oder mehr Kontrollpunkte"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensioni orizzontali in serie continue"
        helpText = "Seleziona tre o più vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimensions horizontales en série continue"
        helpText = "Sélectionnez trois sommets ou plus"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Dimensiones horizontales en serie continua"
        helpText = "Seleccione tres o más vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        def sortVertex(Vertex):
            return Vertex.Point.x

        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            scale = View.Scale
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            Vertexes.sort(key=sortVertex)
            if len(Vertexes) > 1:
                YPos = Vertexes[0].Y * scale
                for i  in range(len(Vertexes)-1):
                    DistanceDim=TechDraw.makeDistanceDim(View,'DistanceX',Vertexes[i].Point,Vertexes[i+1].Point)
                    DistanceDim.X = X = ((Vertexes[i].Point.x+Vertexes[i+1].Point.x)/2) * scale
                    DistanceDim.Y = YPos
            gui.Selection.clearSelection()

class positionVertDimChain:
    '''position a vertical chain dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 6 1",\
        " 	c None",\
        ".	c #000000",\
        "+	c #FF0000",\
        "@	c #FFFF00",\
        "#	c #F7F700",\
        "$	c #F8F800",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                       .....                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "        +++                            .@@@.                    ",\
        "       +++++                           .@@@..           .....   ",\
        "      +++++++                         ..@@@@..        ...@@@..  ",\
        "     +++++++++                       ..@@@@@@.       ..#@@@@@.  ",\
        "    +++++++++++                 ......@@@@@@@.........@@@@@@@.. ",\
        "  +++++++++++++++++++++++       .@@@@@$@@@@@@@@@@@@@@@@@@@@@@@. ",\
        "  +++++++++++++++++++++++       .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@. ",\
        "  +++++++++++++++++++++++       .@@@@@@@@@@@@@@@@@@@@@@@@@@@@.. ",\
        "    +++++++++++                 .......@@@@@@..........@@@@@@.  ",\
        "     +++++++++                        ..@@@@..        ..@@@@..  ",\
        "      +++++++                          ......          ..@@@.   ",\
        "       +++++                                            .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "        +++                                             .@@@.   ",\
        "                                                        .....   ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Position a vertical chain dimension"
        helpText = "Arranges the selected vertical dimensions on the same line:"+ "\n"\
                   "- select two or more dimensions"+"\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Positioniere senkrechte Kettenbemaßung"
        helpText = "Ordnet die ausgewählten vertikalen Abmessungen in derselben Linie an:"+ "\n"\
                   "- wähle zwei oder mehr Maße"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Allinea dimensioni verticali"
        helpText = "Dispone sulla stessa linea le dimensioni verticali selezionate:"+ "\n"\
                   "- seleziona due o più dimensioni"+"\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Aligner les dimensions verticales"
        helpText = "Réorganise les dimensions verticales sélectionnées sur la même ligne:"+ "\n"\
                   "- sélectionnez deux ou plusieurs dimensions"+"\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Alinear dimensiones verticales"
        helpText = "Organiza las dimensiones verticales seleccionadas en la misma línea:"+ "\n"\
                   "- seleccione dos o más dimensiones"+"\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        Selected = gui.Selection.getSelectionEx()
        VertictalDimList = [Select.Object for Select in Selected if Select.Object.Type == 'DistanceY']
        if len(VertictalDimList) > 1:
            XPos = VertictalDimList[0].X
            for Dimension in VertictalDimList:
                Dimension.X = XPos

class positionHorizDimChain:
    '''position a horizontal chain dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 6 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #000000",\
        "@	c #FFFF00",\
        "#	c #F8F800",\
        "$	c #F7F700",\
        "                                                                ",\
        "                                                                ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                             .....                              ",\
        "                            .......                             ",\
        "                           .........                            ",\
        "                          ...........                           ",\
        "   .........................................................    ",\
        "   .........................................................    ",\
        "   .........................................................    ",\
        "                          ...........                           ",\
        "                           .........                            ",\
        "                            .......                             ",\
        "                             .....                              ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                              ...                               ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                             +++++                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@++                             ",\
        "                            ++@@#@++                            ",\
        "                           ++@@@@@@++++++++++++++++++++++++++   ",\
        "                           +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+   ",\
        "                           +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+   ",\
        "                           +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+   ",\
        "                           +@@@@@@@@+++++++++++++++++++++++++   ",\
        "                           ++@@@@@@++                           ",\
        "                            ++@@@+++                            ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@+                              ",\
        "                             +@@@++                             ",\
        "                            ++@@@@++                            ",\
        "                           ++@@@@@$+                            ",\
        "  ++++++++++++++++++++++++++@@@@@@@++                           ",\
        "  +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+                           ",\
        "  +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+                           ",\
        "  +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+                           ",\
        "  +++++++++++++++++++++++++++@@@@@@++                           ",\
        "                            +++@@+++                            ",\
        "                              ++++                              ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Position a horizontal chain dimension"
        helpText = "Arranges the selected horizontal dimensions on the same line:"+ "\n"\
                   "- select two or more measures"+"\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Positioniere waagrechte Kettenbemaßung"
        helpText = "Ordnet die ausgewählten horizontalen Abmessungen in derselben Linie an:"+ "\n"\
                   "- wähle zwei oder mehr Maße"+"\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Allinea dimensioni orizzontali"
        helpText = "Dispone sulla stessa linea le dimensioni orizzontali selezionate:"+ "\n"\
                   "- seleziona due o più dimensioni"+"\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Aligner les dimensions horizontales"
        helpText = "Réorganise les dimensions horizontales sélectionnées sur la même ligne:"+ "\n"\
                   "- sélectionnez deux ou plusieurs dimensions"+"\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Alinear dimensiones horizontales"
        helpText = "Organiza las dimensiones horizontales seleccionadas en la misma línea:"+ "\n"\
                   "- seleccione dos o más dimensiones"+"\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        Selected = gui.Selection.getSelectionEx()
        HorizontalDimList = [Select.Object for Select in Selected if Select.Object.Type == 'DistanceX']
        if len(HorizontalDimList) > 1:
            YPos = HorizontalDimList[0].Y
            for Dimension in HorizontalDimList:
                Dimension.Y = YPos

class cascadeVertDimensions:
    '''cascade vertical dimensions'''
    Icon = QtGui.QPixmap([  \
        "64 64 14 1",\
        " 	c None",\
        ".	c #000000",\
        "+	c #FFFF00",\
        "@	c #FBFB00",\
        "#	c #FFFB00",\
        "$	c #FFFD00",\
        "%	c #FF0000",\
        "&	c #FF1F00",\
        "*	c #FF0100",\
        "=	c #FF2900",\
        "-	c #FF0A00",\
        ";	c #FF1000",\
        ">	c #FD0300",\
        ",	c #FD0000",\
        "                                                      ......    ",\
        "                                                     ..++++..   ",\
        "                                                    ..++++++..  ",\
        ".....................................................+@++++++.. ",\
        ".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. ",\
        ".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. ",\
        ".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. ",\
        ".....................................................++++++++.. ",\
        "                                                    ..@++++++.  ",\
        "                                                     ..+++++..  ",\
        "                                                      ..+++..   ",\
        "                                                       .+++.    ",\
        "                                                       .+++.    ",\
        "                                 .......               .+++.    ",\
        "                                ..+++++..              .+++.    ",\
        "                               ..+++++++..             .+++.    ",\
        "................................+++++++++..            .+++.    ",\
        ".+++++++++++++++++++++++++++++++++++++++++.            .+++.    ",\
        ".+++++++++++++++++++++++++++++++++++++++++.            .+++.    ",\
        ".+++++++++++++++++++++++++++++++++++++++++.            .+++.    ",\
        "................................+++++++++..            .+++.    ",\
        "                               .+++++++++.             .+++.    ",\
        "                               ..+++++++..             .+++.    ",\
        "                                ..+++++..              .+++.    ",\
        "                                 ..+++..               .+++.    ",\
        "                                  .+++.                .+++.    ",\
        "                                  .+++.                .+++.    ",\
        "             .......              .+++.                .+++.    ",\
        "            ..+++++..             .+++.                .+++.    ",\
        "           ..+++++++..            .+++.                .+++.    ",\
        "............+++++++++...          .+++.                .+++.    ",\
        ".++++++++++++++++++++++.          .+++.                .+++.    ",\
        ".++++++++++++++++++++++.          .+++.                .+++.    ",\
        ".++++++++++++++++++++++.          .+++.                .+++.    ",\
        "............+++++++++...          .+++.                .+++.    ",\
        "           ..+++++++..            .+++.                .+++.    ",\
        "            ..+++++.....          .+++.                .+++.    ",\
        "             ..+++..              .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+++.                .+++.    ",\
        "              .+++.               .+#+.                .$$+.    ",\
        "              .%%%.               .&*=.                .-;%.    ",\
        "              %%%%>             %%%%%%%%%            %%%%%%,    ",\
        "            %%%%%%%%            %%%%%%%%%           %%%%%%%%%   ",\
        "           %%%%%%%%%%          %%%%%%%%%%%         %%%%%%%%%%%  ",\
        "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",\
        "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",\
        "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",\
        "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",\
        "            %%%%%%%%%          %%%%%%%%%%           %%%%%%%%%   ",\
        "            %%%%%%%%            %%%%%%%%             %%%%%%%    ",\
        "             %%%%%%              %%%%%%               %%%%%     ",\
        "              %%%%                %%%%                 %%%      ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Cascade vertical dimensions"
        helpText = "Spaces (horizontally), at the set value, the selected vertical dimensions:"+ "\n"\
                   "- set the cascade value"+ "\n"\
                   "- select two or more vertical dimensions"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Kaskadiere senkrechte Bemaßungen"
        helpText = "Stelle den gewünschten Abstand zwischen den Maßen ein:"+ "\n"\
                   "- Stellen Sie den Abstand Kaskadierung ein"+ "\n"\
                   "- wähle zwei oder mehr senkrechte Bemaßungen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Distanziamento dimensioni verticali"
        helpText = "Distanzia (orizzontalmente), al valore impostato, le quote verticali selezionate:"+ "\n"\
                   "- impostare Valore distanziamento"+ "\n"\
                   "- selezionare due o più quote verticali"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Espacement des dimensions verticales"
        helpText = "Espaces (horizontalement), à la valeur définie, les dimensions verticales sélectionnées:"+ "\n"\
                   "- définir Valeur d'espacement"+ "\n"\
                   "- sélectionnez au moins deux dimensions verticales"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Espaciado de dimensión vertical"
        helpText = "Espacios (horizontalmente), en el valor establecido, las dimensiones verticales seleccionadas:"+ "\n"\
                   "- establecer Valor de espaciado"+ "\n"\
                   "- seleccione dos o más dimensiones verticales"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        Selected = gui.Selection.getSelectionEx()
        HorizontalDimList = [Select.Object for Select in Selected if Select.Object.Type == 'DistanceY']
        if len(HorizontalDimList) > 1:
            XPos = float(HorizontalDimList[0].X)
            Sign = XPos/abs(XPos)
            for Dimension in HorizontalDimList:
                Dimension.X = XPos
                XPos = XPos + DimAttrib.getDimLineDistance()*Sign

class cascadeHorizDimensions:
    '''cascade horizontal dimensions'''
    Icon = QtGui.QPixmap([  \
        "64 64 14 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #000000",\
        "@	c #FFFF00",\
        "#	c #FD0300",\
        "$	c #FF1F00",\
        "%	c #FF0100",\
        "&	c #FFFB00",\
        "*	c #FF2900",\
        "=	c #FBFB00",\
        "-	c #FF0A00",\
        ";	c #FFFD00",\
        ">	c #FF1000",\
        ",	c #FD0000",\
        "      ....                   +++++         +++++        +++++   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      ....                   +@@@+         +@@@+        +@@@+   ",\
        "      .....                 ++@@@++        +@@@+        +@@@+   ",\
        "    ........               ++@@@@@++       +@@@+        +@@@+   ",\
        "   .........              ++@@@@@@@++      +@@@+        +@@@+   ",\
        "  ...........++++++++++++++@@@@@@@@@+      +@@@+        +@@@+   ",\
        "  ............@@@@@@@@@@@@@@@@@@@@@@+      +@@@+        +@@@+   ",\
        "  ............@@@@@@@@@@@@@@@@@@@@@@+      +@@@+        +@@@+   ",\
        "  ............@@@@@@@@@@@@@@@@@@@@@@+      +@@@+        +@@@+   ",\
        "   .........#++++++++++++++@@@@@@@@@+      +@@@+        +@@@+   ",\
        "    ........              ++@@@@@@@++      +@@@+        +@@@+   ",\
        "     ......                ++@@@@@++       +@@@+        +@@@+   ",\
        "      ....                 +++@@@++        +@@@+        +@@@+   ",\
        "      ....                 + +@@@+         +@@@+        +@@@+   ",\
        "      ....                 + +++++         +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "      ....                                 +@@@+        +@@@+   ",\
        "     ......                              +++@@@++       +@@@+   ",\
        "    .........                           ++@@@@@@++      +@@@+   ",\
        "   ..........                          ++@@@@@@@@++     +@@@+   ",\
        "  ...........+++++++++++++++++++++++++++@@@@@@@@@@+     +@@@+   ",\
        "  ...........$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+     +@@@+   ",\
        "  ...........%&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+     +@@@+   ",\
        "  ...........*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+     +@@@+   ",\
        "   ..........+++++++++++++++++++++++++++@@@@@@@@@@+     +@@@+   ",\
        "    .........                          ++@@@@@@@@++     +@@@+   ",\
        "     ........                           ++@@@@@@++      +@@@+   ",\
        "      .....                              +++@@@++       +@@@+   ",\
        "      ....                                 +++++        +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      ....                                              +@@@+   ",\
        "      .....                                             +@@@+   ",\
        "     .......                                           ++@@@++  ",\
        "    .........                                         ++@@@@@++ ",\
        "   ..........                                        ++=@@@@=@++",\
        "  ...........+++++++++++++++++++++++++++++++++++++++++@@@@@@@@@+",\
        "  ...........-;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+",\
        "  ...........>;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+",\
        "   ...........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+",\
        "    ........,+++++++++++++++++++++++++++++++++++++++++@@@@@@@@++",\
        "     .......                                         ++@@@@@@++ ",\
        "      .....                                           +++@@@++  ",\
        "      ....                                              +++++   ",\
        "      ....                                                      "])

    def textEnglish(self):
        buttonText = "Cascade horizontal dimensions"
        helpText = "Spaces (vertically), at the set value, the selected horizontal dimensions::"+ "\n"\
                   "- set the cascade value"+ "\n"\
                   "- select two or more horizontal dimensions"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Kaskadiere waagrechte Bemaßungen"
        helpText = "Stelle den gewünschten Abstand zwischen den Maßen ein:"+ "\n"\
                   "- Stellen Sie den Abstand Kaskadierung ein"+ "\n"\
                   "- wähle zwei oder mehr waagrechte Bemaßungen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Distanziamento dimensioni orizzontali"
        helpText = "Distanzia (verticalmente), al valore impostato, le quote orizzontali selezionate:"+ "\n"\
                   "- impostare Valore distanziamento"+ "\n"\
                   "- selezionare due o più quote orizzontali"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Espacement des dimensions horizontale"
        helpText = "Espaces (verticalement), à la valeur définie, les dimensions horizontales sélectionnées:"+ "\n"\
                   "- définir Valeur d'espacement"+ "\n"\
                   "- sélectionnez au moins deux dimensions horizontales"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Espaciado de dimensión horizontal"
        helpText = "Espacios (verticalmente), en el valor establecido, las dimensiones horizontales seleccionadas:"+ "\n"\
                   "- establecer Valor de espaciado"+ "\n"\
                   "- seleccione dos o más dimensiones horizontales"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # cascadeHorizDimensions
        Selected = gui.Selection.getSelectionEx()
        HorizontalDimList = [Select.Object for Select in Selected if Select.Object.Type == 'DistanceX']
        if len(HorizontalDimList) > 1:
            YPos = float(HorizontalDimList[0].Y)
            Sign = YPos/abs(YPos)
            for Dimension in HorizontalDimList:
                Dimension.Y = YPos
                YPos = YPos + DimAttrib.getDimLineDistance()*Sign

class increaseComma:
    '''increase the comma of the dimension value (max 9)'''
    Icon = QtGui.QPixmap([  \
        "64 64 7 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "#	c #FDFD00",\
        "$	c #F9F901",\
        "%	c #FEFE00",\
        "                                                                ",\
        "                                                                ",\
        "                                            ....                ",\
        "                                           .......              ",\
        "                                           .........            ",\
        "                                           ...........          ",\
        "                                           .............        ",\
        "                                           ................     ",\
        "                                            ................... ",\
        "                  ..............................................",\
        "                  ..............................................",\
        "                  ..............................................",\
        "                  ............................................. ",\
        "                                            ................    ",\
        "      ++++++                               ..............       ",\
        "     ++@@@@++                 ....         ...........          ",\
        "    ++@@@@@@++               .......       .........            ",\
        "   ++@@@@@@@@+              ........       .......              ",\
        "   +@@@@@@@@@++             .........      ......               ",\
        "  ++@@@@@@@@@@+            ..........       ...                 ",\
        "  +@@@@@@@@@@@++           ...........                          ",\
        "  +@@@++++++@@@+          ............                          ",\
        " ++@@@+    +@@@+          ............                          ",\
        " +@@@@+    +@@@++         .....  ......                         ",\
        " +@@@++    +@@@@+         .....   .....                         ",\
        " +@@@+     +@@@@+        .....    .....                         ",\
        " +@@@+     +@@@@+        .....    .....                         ",\
        "++@@@+     ++#@@+        .....     ....                         ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@@@+      +@@@+        .....     .....                        ",\
        "+@@#@+      +$@@+        .....     .....                        ",\
        "++@@@+     ++@@@+        .....     .....                        ",\
        " +@@@+     +@@@@+        .....    .....                         ",\
        " +@@%++    +@#@@+  ++++++.....    .....   .....   .....    .....",\
        " +@@@@+    +@@@++  +@@@@+......   .....   .....   .....    .....",\
        " ++@@@+    +@@@+   +@@@@+ ......  .....   .....   .....    .....",\
        "  +@@@++++++@@@+   +@@@@+ ...... ......   .....   .....    .....",\
        "  +@@@@@@@@@@@@+   +@@@@+ ............    .....   .....    .....",\
        "  +@@@@@@@@@@@++   +@@@@+ ............    .....   .....    .....",\
        "  ++@@@@@@@@@@+    +@@@@+  ...........    .....   .....    .....",\
        "   ++@@@@@@@@++   ++@@@++  ..........     .....   .....    .....",\
        "    +++@@@@@++    +@@@@+    .........     .....   .....    .....",\
        "      +@@@@++     +@@@@+    ........      .....   .....    .....",\
        "      ++++++      +@@@@+     ......       .....   .....    .....",\
        "                  +@@@++       ...                              ",\
        "                  +@@@+                                         ",\
        "                  +@@++                                         ",\
        "                  +@@+                                          ",\
        "                  ++++                                          "])

    def textEnglish(self):
        buttonText = "Increase decimal places (max 9)"
        helpText = "Increase decimal places of a measure:"+ "\n"\
                   "- select many  measures"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erhöht die Kommastellen (max 9)"
        helpText = "erhöht die Kommastellen der Dimensionen"+ "\n"\
                   "- wähle mehrere Maßzahlen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Incrementa le cifre decimali (max 9)"
        helpText = "Incrementa le cifre decimali di una dimensione:"+ "\n"\
                   "- selezionare le dimensioni"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Augmenter les décimales (max 9)"
        helpText = "Incrémente les décimales d'une dimension:"+ "\n"\
                   "- sélectionnez les dimensiones"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Aumentar los lugares decimales (máximo 9)"
        helpText = "Incrementa los lugares decimales en una dimensión:"+ "\n"\
                   "- selecciona los dimensiones"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        Sel = gui.Selection.getSelectionEx()
        for Elem in Sel:
            if Elem.Object.TypeId == 'TechDraw::DrawViewDimension':
                OldFormat = Elem.Object.FormatSpec
                NumDig = OldFormat.find("%.")
                if NumDig != -1:
                    NumDig = NumDig+2
                    CharList = list(OldFormat)
                    Digit = int(CharList[NumDig])
                    if Digit < 9:
                        Digit = Digit+1
                    NewFormat = OldFormat[0:NumDig]+str(Digit)+OldFormat[NumDig+1:]
                    Elem.Object.FormatSpec = NewFormat

class decreaseComma:
    '''decrease the comma of the dimension value'''
    Icon = QtGui.QPixmap([  \
        "64 64 7 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "#	c #FDFD00",\
        "$	c #F9F901",\
        "%	c #FEFE00",\
        "                                 ...                            ",\
        "                               .....                            ",\
        "                              ......                            ",\
        "                            ........                            ",\
        "                          ..........                            ",\
        "                         ...........                            ",\
        "                      ..............                            ",\
        "                   ...........................................  ",\
        "                 .............................................  ",\
        "                ..............................................  ",\
        "                 .............................................  ",\
        "                   .................                            ",\
        "                      ..............                            ",\
        "                         ...........                 ....       ",\
        "      ++++++               .........                .......     ",\
        "     ++@@@@++               ........               ........     ",\
        "    ++@@@@@@++                ......               .........    ",\
        "   ++@@@@@@@@+                  ....              ..........    ",\
        "   +@@@@@@@@@++                   ..              ...........   ",\
        "  ++@@@@@@@@@@+                                  ............   ",\
        "  +@@@@@@@@@@@++                                 ............   ",\
        "  +@@@++++++@@@+                                 .....  ......  ",\
        " ++@@@+    +@@@+                                 .....   .....  ",\
        " +@@@@+    +@@@++                               .....    .....  ",\
        " +@@@++    +@@@@+                               .....    .....  ",\
        " +@@@+     +@@@@+                               .....     ....  ",\
        " +@@@+     +@@@@+                               ....      ....  ",\
        "++@@@+     ++#@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                               ....      ....  ",\
        "+@@@@+      +@@@+                                ...      ....  ",\
        "+@@@@+      +@@@+                                ....     ....  ",\
        "+@@#@+      +$@@+                                ....     ....  ",\
        "++@@@+     ++@@@+                                ....    .....  ",\
        " +@@@+     +@@@@+                                .....   .....  ",\
        " +@@%++    +@#@@+  ++++++                        .....   .....  ",\
        " +@@@@+    +@@@++  +@@@@+ ....    ....    ....   ...... ......  ",\
        " ++@@@+    +@@@+   +@@@@+ ....    ....    ....   ............   ",\
        "  +@@@++++++@@@+   +@@@@+ ....    ....    ....    ...........   ",\
        "  +@@@@@@@@@@@@+   +@@@@+ ....    ....    ....    ...........   ",\
        "  +@@@@@@@@@@@++   +@@@@+ ....    ....    ....    ..........    ",\
        "  ++@@@@@@@@@@+    +@@@@+ ....    ....    ....     .........    ",\
        "   ++@@@@@@@@++   ++@@@++ ....    ....    ....      .......     ",\
        "    +++@@@@@++    +@@@@+  ....    ....    ....      ......      ",\
        "      +@@@@++     +@@@@+  ....    ....    ....        ..        ",\
        "      ++++++      +@@@@+                                        ",\
        "                  +@@@++                                        ",\
        "                  +@@@+                                         ",\
        "                  +@@++                                         ",\
        "                  +@@+                                          ",\
        "                  ++++                                          "])

    def textEnglish(self):
        buttonText = "Decrease decimal places"
        helpText = "Increase decimal places of a measure:"+ "\n"\
                   "- select many  measures"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Verkleinere die Anzahl der Kommastellen"
        helpText = "Verkleinere die Anzahl der Kommastellen"+ "\n"\
                   "- wähle mehrere Maßzahlen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Decrementa le cifre decimali"
        helpText = "Decrementa le cifre decimali di una dimensione:"+ "\n"\
                   "- selezionare le dimensioni"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Diminue les décimales"
        helpText = "Diminue les décimales d'une dimension:"+ "\n"\
                   "- sélectionnez les dimensiones"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Disminuye los lugares decimales"
        helpText = "Disminuye los lugares decimales en una dimensión:"+ "\n"\
                   "- selecciona los dimensiones"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        Sel = gui.Selection.getSelectionEx()
        for Elem in Sel:
            if Elem.Object.TypeId == 'TechDraw::DrawViewDimension':
                OldFormat = Elem.Object.FormatSpec
                NumDig = OldFormat.find("%.")
                if NumDig != -1:
                    NumDig = NumDig+2
                    CharList = list(OldFormat)
                    Digit = int(CharList[NumDig])
                    if Digit > 0:
                        Digit = Digit-1
                    NewFormat = OldFormat[0:NumDig]+str(Digit)+OldFormat[NumDig+1:]
                    Elem.Object.FormatSpec = NewFormat

class createHorizCoordDim:
    '''Create horizontal coordinate dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                     .....        ...           ...   ",\
        "     .......                  .......       ...           ...   ",\
        "    ........                 ........       ...           ...   ",\
        " ......................................     ...           ...   ",\
        " ......................................     ...           ...   ",\
        " ......................................     ...           ...   ",\
        "    .........                .........      ...           ...   ",\
        "     .......                  .......       ...           ...   ",\
        "      .....                     ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                      ...         ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ....                                .....          ...   ",\
        "     .......                              .......         ...   ",\
        "    .........                            ........         ...   ",\
        " ..................................................       ...   ",\
        " ..................................................       ...   ",\
        " ..................................................       ...   ",\
        "    .........                            ........         ...   ",\
        "     .......                              ......          ...   ",\
        "      .....                                ....           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                  ...           ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "       ...                                               ....   ",\
        "     .......                                            ....... ",\
        "    ........                                           ........ ",\
        " ...............................................................",\
        " ...............................................................",\
        " ...............................................................",\
        "  .............................                        .........",\
        "     .......                                            ....... ",\
        "      .....                                              .....  ",\
        "       ...                                                ...   ",\
        "       ...                                                ...   ",\
        "        ..                                                      "])

    def textEnglish(self):
        buttonText = "Create horizontal coordinate dimensions"
        helpText = "- adjust the desired cascade spacing"+ "\n"\
                   "- select three or more vertexes"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge waagrechte Koordinatenbemaßung"
        helpText = "- stelle den gewünschten Abstand Kaskadierung den Maßen ein"+ "\n"\
                   "- wähle drei oder mehr Kontrollpunkte"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensioni parallele/coordinate orizzontali"
        helpText = "- impostare Valore distanziamento"+ "\n"\
                   "- selezionare tre o più vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimensions parallèles/coordonnées horizontales"
        helpText = "- définir Valeur d'espacement"+ "\n"\
                   "- sélectionnez trois sommets ou plus"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Dimensiones paralelas/coordenadas horizontales"
        helpText = "- establecer Valor de espaciado"+ "\n"\
                   "- seleccione tres o más vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # createHorizCoordDim
        def sortVertex(Vertex):
            return Vertex.Point.x

        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            Vertexes.sort(key=sortVertex)
            if len(Vertexes) > 1:
                XPos = float(Vertexes[0].X)
                YPos = float(Vertexes[0].Y)
                Sign = YPos/abs(YPos)
                for i  in range(len(Vertexes)-1):
                    DistanceDim=TechDraw.makeDistanceDim(View,'DistanceX',Vertexes[0].Point,Vertexes[i+1].Point)
                    DistanceDim.X = (XPos+Vertexes[i+1].Point.x)/2
                    YPos = YPos + DimAttrib.getDimLineDistance()*Sign
                    DistanceDim.Y = YPos
            gui.Selection.clearSelection()

class createVertCoordDim:
    '''Create vertical coordinate dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "                                                       ....     ",\
        "                                                     .......    ",\
        "                                                     ........   ",\
        "............................................................... ",\
        "............................................................... ",\
        "............................................................... ",\
        "                                                    .........   ",\
        "                                                     .......    ",\
        "                                                      .....     ",\
        "                                                       ...      ",\
        "                                                       ...      ",\
        "                                                       ...      ",\
        "                                                       ...      ",\
        "                                   ...                 ...      ",\
        "                                   ...                 ...      ",\
        "                                 ......                ...      ",\
        "                                ........               ...      ",\
        "...........................................            ...      ",\
        "...........................................            ...      ",\
        "...........................................            ...      ",\
        "                                .........              ...      ",\
        "                                 .......               ...      ",\
        "                                  .....                ...      ",\
        "                                   ...                 ...      ",\
        "                                   ...                 ...      ",\
        "               ...                 ...                 ...      ",\
        "               ....                ...                 ...      ",\
        "             .......               ...                 ...      ",\
        "            ........               ...                 ...      ",\
        ".......................            ...                 ...      ",\
        ".......................            ...                 ...      ",\
        ".......................            ...                 ...      ",\
        "            ........               ...                 ...      ",\
        "             .......               ...                 ....     ",\
        "              .....                ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ....               .....                ....     ",\
        "             .......             .......             .......    ",\
        "             ........           .........            ........   ",\
        "................................................................",\
        "................................................................",\
        "............................................................... ",\
        "             ........            ........            ........   ",\
        "             .......             .......             .......    ",\
        "              .....               .....               .....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ....     ",\
        "               ...                 ...                 ...      ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create vertical coordinate dimensions"
        helpText = "- adjust the desired cascade spacing"+ "\n"\
                   "- select three or more vertexes"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge senkrechte Koordinatenbemaßung"
        helpText = "- stelle den gewünschten Abstand Kaskadierung den Maßen ein"+ "\n"\
                   "- wähle drei oder mehr Kontrollpunkte"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensioni parallele/coordinate verticali"
        helpText = "- impostare Valore distanziamento"+ "\n"\
                   "- selezionare tre o più vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimensions parallèles/coordonnées verticales"
        helpText = "- définir Valeur d'espacement"+ "\n"\
                          "- sélectionnez trois sommets ou plus"+ "\n"\
                          "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Dimensiones paralelas/coordenadas verticales"
        helpText = "- establecer Valor de espaciado"+ "\n"\
                   "- seleccione tres o más vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        def sortVertex(Vertex):
            return Vertex.Point.y

        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            Vertexes.sort(key=sortVertex)
            Vertexes.reverse()
            if len(Vertexes) > 1:
                XPos = float(Vertexes[0].X)
                YPos = float(Vertexes[0].Y)
                Sign = XPos/abs(XPos)
                for i  in range(len(Vertexes)-1):
                    DistanceDim=TechDraw.makeDistanceDim(View,'DistanceY',Vertexes[0].Point,Vertexes[i+1].Point)
                    DistanceDim.Y = (YPos+Vertexes[i+1].Point.y)/2
                    XPos = XPos + DimAttrib.getDimLineDistance()*Sign
                    DistanceDim.X = XPos
            gui.Selection.clearSelection()

class createHorizChamferDim:
    '''Create horizontal chamfer dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 11 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "#	c #F8F700",\
        "$	c #FDFD00",\
        "%	c #FDFC00",\
        "&	c #F9F900",\
        "*	c #FEFE00",\
        "=	c #2D2000",\
        "-	c #2A2400",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                         ......            .....                ",\
        "                        ........          .......               ",\
        "                       ..........        .........              ",\
        "                       ..........       ...........             ",\
        ".....................................................           ",\
        ".....................................................           ",\
        ".....................................................           ",\
        "                       ..........       ...........             ",\
        "                        .........        .........              ",\
        "                         .......          .......               ",\
        "                          ....             .....                ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....             ....                 ",\
        "                          ....                                  ",\
        "                          ....                                  ",\
        "                          ....             +++++++++++++++++++++",\
        "                          ....           +++++++++++++++++++++++",\
        "                          ....          +++@@@@@@@@@@@@@@@@@@@@@",\
        "                          ....         +++@@@@@@@@@@@@@@@@@@@@@@",\
        "                          ....        +++@@@@#@@@@@@@@@@@@@@@@@@",\
        "                          ....       +++@@@@++++++++++++++++++++",\
        "                          ....      +++@@@@+++++++++++++++++++++",\
        "                          ....     +++@$@@+++                   ",\
        "                          ....    +++@@@@+++                    ",\
        "                          ....   +++@@@@+++                     ",\
        "                          ....  +++@@@@+++                      ",\
        "                          .... +++@@@%+++                       ",\
        "                              +++@@@&+++                        ",\
        "                             +++@@@@+++                         ",\
        "                            +++*@@@+++                          ",\
        "                           +++@@@@+++                           ",\
        "                           ++@@@++++                            ",\
        "                           ++@@++++                             ",\
        "                           ++@@+++                              ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                           ++@@++                               ",\
        "                          =++@@++                               ",\
        "                          -++@@++                               "])

    def textEnglish(self):
        buttonText = "Create a horizontal chamfer dimension"
        helpText = "- select two vertexes"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge waagrechte Fasenbemaßung"
        helpText = "- wähle zwei Kontrollpunkte"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensione orizzontale smusso"
        helpText = "- Selezionare due vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Chanfrein de dimension horizontale"
        helpText = "- Sélectionnez deux sommets"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "dimensión horizontal de chaflán"
        helpText = "- Seleccione dos vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            if len(Vertexes) > 1:
                ChamferDim=TechDraw.makeDistanceDim(View,'DistanceX',Vertexes[0].Point,Vertexes[1].Point)
                ChamferDim.X = (Vertexes[0].Point.x+Vertexes[1].Point.x)/2
                MaxY = max(Vertexes[0].Point.y,Vertexes[1].Point.y)
                Sign = MaxY/abs(MaxY)
                ChamferDim.Y = MaxY + 7.0*Sign
                Dx, Dy  = Vertexes[0].Point.x-Vertexes[1].Point.x, Vertexes[0].Point.y-Vertexes[1].Point.y
                Alpha = str(int(math.degrees(abs(math.atan(Dx/Dy)))))
                ChamferDim.FormatSpec = ChamferDim.FormatSpec+'x'+Alpha+'°'
            gui.Selection.clearSelection()

class createVertChamferDim:
    '''Create vertical chamfer dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 6 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "#	c #FDFD00",\
        "$	c #F8F700",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "      ....                                                      ",\
        "      ....                                                      ",\
        "      ....                                                      ",\
        "      ....                                                      ",\
        "      ....                                                      ",\
        "      ....                                                      ",\
        "      ....                                                      ",\
        "     ......                                                     ",\
        "    ........                                                    ",\
        "   ..........                                                   ",\
        " .....................................                          ",\
        " .....................................    ++++++++++++++++++++++",\
        " .....................................  ++++++++++++++++++++++++",\
        " ..................................... +++@@@@@@@@@@@@@@@@@@@@@@",\
        "   ..........                         +++@@@@@@@@@@@@@@@@@@@@@@@",\
        "    ........                         +++@@@@@#@@@@@@@@@@@@@@@@@@",\
        "     ......                         +++@@@@@++++++++++++++++++++",\
        "      ....                         +++@@@@@+++++++++++++++++++++",\
        "      ....                        +++@@@@@+++                   ",\
        "      ....                       +++@@@@@+++                    ",\
        "      ....                      +++@@@@@+++                     ",\
        "      ....                     +++@@@@@+++                      ",\
        "     ......                   +++@@@@@+++                       ",\
        "    ........                 +++@@@@@+++                        ",\
        "   ..........               +++@@@@@+++                         ",\
        " .......................   +++@@@@@+++                          ",\
        " .......................  +++@@@@@+++                           ",\
        " .......................  ++@@@@@+++                            ",\
        " .......................  ++@@$@+++                             ",\
        "   ..........             ++@@@+++                              ",\
        "    ........              ++@@@++                               ",\
        "     ......               ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               ",\
        "      ....                ++@@@++                               "])

    def textEnglish(self):
        buttonText = "Create a vertical chamfer dimension"
        helpText = "- select two vertexes"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge senkrechte Fasenbemaßung"
        helpText = "- wähle zwei Kontrollpunkte"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensione verticale smusso"
        helpText = "- Selezionare due vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimension verticales de chanfrein"
        helpText = "- Sélectionnez deux sommets"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "dimensión verticales de chaflán"
        helpText = "- Seleccione dos vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            if len(Vertexes) > 1:
                ChamferDim=TechDraw.makeDistanceDim(View,'DistanceY',Vertexes[0].Point,Vertexes[1].Point)
                ChamferDim.Y = (Vertexes[0].Point.y+Vertexes[1].Point.y)/2
                MaxX = max(Vertexes[0].Point.x,Vertexes[1].Point.x)
                Sign = MaxX/abs(MaxX)
                ChamferDim.X = MaxX + 7.0*Sign
                Dx, Dy  = Vertexes[0].Point.x-Vertexes[1].Point.x, Vertexes[0].Point.y-Vertexes[1].Point.y
                Alpha = str(round(math.degrees(abs(math.atan(Dy/Dx)))))
                ChamferDim.FormatSpec = ChamferDim.FormatSpec+'x'+Alpha+'°'
            gui.Selection.clearSelection()

class holeTable:
    '''Create a hole table'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "                                                                ",\
        "................................................................",\
        "................................................................",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        ".. ...........  .. ..      ... .. ...      .....     ...  ..  ..",\
        ".. ...........  .. ..      ..  .. ...      .....    ........  ..",\
        "..     ...      ..  ...   ...  ..  ...    ... ..   ..   ...   ..",\
        "..     ...      ..  ...   ..   ..   ...  ...  ..  ..    ...   ..",\
        "..     ...      ..   ... ...   ..   ...  ..   ..  ..   ....   ..",\
        "..     ...      ..    ....     ..    ......   .. ..    .. ..  ..",\
        "..     ...      ..    ....     ..    ......   .. ..   ..  ..  ..",\
        "..     ...      ..    ....     ..     ....    .. ..  ...  ..  ..",\
        "..     ...      ..   ......    ..     ...     .. ..  ..   ..  ..",\
        "..     ...      ..   ... ...   ..     ...     .. .. ..    ..  ..",\
        "..     ...      ..  ...   ...  ..     ...     .. .....    ..  ..",\
        "..     ...      .. ...    .... ..     ...     ..  ...    ..   ..",\
        "..     ...      .. ...     ... ..     ...     ..  ...   ...   ..",\
        "..     ...      .. ..       .. ..     ...     ..  ........    ..",\
        "..              ..             ..             .. ..  ...      ..",\
        "..              ..             ..             .. ..           ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "................................................................",\
        "................................................................",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "................................................................",\
        "................................................................",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "................................................................",\
        "................................................................",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..              ..",\
        "..              ..             ..             ..                ",\
        "..              ..                                              ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create hole table"
        helpText = "- select one vertex as origin"+ "\n"\
                   "- select many hole circles"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge eine Bohrungstabelle"
        helpText = "- wähle einen Kontrollpunkt als Koordinatenursprung"+ "\n"\
                   "- wähle mehrere Bohrungskreise"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Genera tabella fori"
        helpText = "- Selezionare un vertice come riferimento/origine"+ "\n"\
                   "- selezionare le circonferenze dei fori"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Générer une table de trous"
        helpText = "- Sélectionnez un sommet comme référence/origine"+ "\n"\
                   "- sélectionner les circonférences des trous"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Generar tabla de agujeros"
        helpText = "- Seleccione un vértice como referencia/origen"+ "\n"\
                   "- seleccione las circunferencias de los agujeros"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):

        def drawArrow(Origin,P1,P2,P3,P4,P5):
            '''Draw arrows at origin'''
            View.makeCosmeticLine(Origin,P1,1)
            View.makeCosmeticLine(P2,P3,1)
            View.makeCosmeticLine(P3,P4,1)
            View.makeCosmeticLine(P3,P5,1)

        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            Doc = app.activeDocument()
            XView,YView = commonTools.getViewCoords(View)
            if ObjectList[0][0:6] == 'Vertex':
                Origin = View.getVertexBySelection(ObjectList[0]).Point
                P1X, P1Y = Origin + app.Vector(0,-10,0), Origin + app.Vector(-10,0,0)
                P2X, P2Y = Origin + app.Vector(0,-5,0), Origin + app.Vector(-5,0,0)
                P3X, P3Y = Origin + app.Vector(10,-5,0), Origin + app.Vector(-5,10,0)
                P4X, P4Y = Origin + app.Vector(7,-4,0), Origin + app.Vector(-4,7,0)
                P5X, P5Y = Origin + app.Vector(7,-6,0), Origin + app.Vector(-6,7,0)
                drawArrow(Origin,P1X,P2X,P3X,P4X,P5X)
                drawArrow(Origin,P1Y,P2Y,P3Y,P4Y,P5Y)
                commonTools.createAnnot('OriginX','X',float(XView)+Origin.x+12,float(YView)+Origin.y-7)
                commonTools.createAnnot('OriginY','Y',float(XView)+Origin.x-5,float(YView)+Origin.y+12)
                Spread =Doc.addObject('Spreadsheet::Sheet','Spreadsheet')
                HoleTable = Doc.addObject('TechDraw::DrawViewSpreadsheet','HoleTable')
                HoleTable.Source = Doc.Spreadsheet
                Spread.set('A1','Tag')
                Spread.set('B1','XLoc')
                Spread.set('C1','YLoc')
                Spread.set('D1','SIZE Ø')
                Num = 2
                for ObjectString in ObjectList:
                    if ObjectString[0:4] == 'Edge':
                        Edge = View.getEdgeBySelection(ObjectString)
                        if Edge.Curve.TypeId == 'Part::GeomCircle':
                            Object = Edge.Curve
                            Center, Radius = Object.Center, Object.Radius
                            Spread.set('A'+str(Num),'A'+str(Num-1))
                            Spread.set('B'+str(Num),str(Center.x-Origin.x))
                            Spread.set('C'+str(Num),str(Center.y-Origin.y))
                            Spread.set('D'+str(Num),str(2*Radius))
                            commonTools.createAnnot('A'+str(Num-1),'A'+str(Num-1),float(XView)+Center.x+Radius,float(YView)+Center.y+Radius)
                            Num +=1
                HoleTable.CellEnd = 'D'+str(Num-1)
                Doc.recompute()
                Doc.Page.addView(HoleTable)
            Doc.recompute()

class drawCirc:
    '''Draw a Circle'''
    Icon = QtGui.QPixmap([  \
        "64 64 16 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #FFFF00",\
        "@	c #2B2200",\
        "#	c #FFFD00",\
        "$	c #FFF700",\
        "%	c #FF1500",\
        "&	c #FFFE00",\
        "*	c #FFF300",\
        "=	c #FF1400",\
        "-	c #FFF600",\
        ";	c #FFFB00",\
        ">	c #DFDF00",\
        ",	c #FBFB00",\
        "'	c #C5C400",\
        ")	c #EAEA00",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                         .........                              ",\
        "                       ..............                           ",\
        "                     ................                           ",\
        "                   ..................     ..    ++++            ",\
        "                   .........     ...     .... +++@@+++          ",\
        "                   ......               .....++@@@@@@++         ",\
        "                    ..                    .+++@@++++@@++        ",\
        "                                           ++@@++..+#@@++       ",\
        "            ..                            ++@@++....+$@@+       ",\
        "           ....                          ++@@++......++@@+      ",\
        "          ......                         ++@++.......%&+@++     ",\
        "         .....                           ++@++........*+@++     ",\
        "        ......                           ++@++.......=++@++     ",\
        "       ......                            ++@@++......++@@+      ",\
        "       .....                              ++@+++....+-@@+       ",\
        "      .....                                +@@+++..+;@@++.      ",\
        "      .....                                ++@@@+++++@++...     ",\
        "      ....                                +++++@@@@@@@++...     ",\
        "     .....                                +++ +++@@@+++....     ",\
        "     ....                              ++  ++   +++++  ...      ",\
        "    .....                      ++++   ++++              .       ",\
        "    .....                    +++@@+++ ++++                      ",\
        "      ..                    ++@@@@@@++ ++                       ",\
        "                          +++@@++++@@++                         ",\
        "                          ++@@++..+#@@++                  ...   ",\
        "                         ++@@++....+$@@+                 ....   ",\
        "                         +@@++......++@@+                .....  ",\
        "                        ++@++.......%&+@++               .....  ",\
        "                        ++@++........*+@++               .....  ",\
        "     ...                ++@++.......=++@++               .....  ",\
        "    ....                 +@@++......++@@+                .....  ",\
        "    ....                 ++@+++....+-@@+                 .....  ",\
        "   .....                  +@@+++..+;@@++                 ....   ",\
        "   .....                  >,@@@+++++@++                  ....   ",\
        "   .....                   '++@@@@@@@++                 .....   ",\
        "    ....                     )++@@@+++                  ....    ",\
        "    .....                      +++++                    ....    ",\
        "     ....                                              .....    ",\
        "     ....                                              ....     ",\
        "     .....                                            .....     ",\
        "      ....                                             ....     ",\
        "      .....                                              .      ",\
        "       .....                                                    ",\
        "       .....                                                    ",\
        "        ...                                        .            ",\
        "         .                                        ...           ",\
        "                                                 .....          ",\
        "                                                ......          ",\
        "               ...                            .......           ",\
        "               ....                          .......            ",\
        "               .....                        .......             ",\
        "               .......                    ........              ",\
        "                .........               ........                ",\
        "                 .............          .......                 ",\
        "                   ...........          ......                  ",\
        "                     .........          ....                    ",\
        "                         .....                                  ",\
        "                           ...                                  ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Draw an cosmetic circumference (center and 1 vertex)"
        helpText = "Draw a cosmetic circumference using two vertices:"+ "\n"\
                   "- choose the line attributes:"+ "\n"\
                   "- select the first vertex (center) -> in sequence the second (radius)"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Kosmetischer Umfang (Zentrum und 1 Scheitelpunkt)"
        helpText = "Zeichnen Sie einen kosmetischen Kreis mit zwei Scheitelpunkt:"+ "\n"\
                   "- Wählen Sie die Linienattribute:"+ "\n"\
                   "- Wählen Sie den ersten Scheitelpunkt (Mitte) -> nacheinander den zweiten (Radius)"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Circonferenza cosmetica (centro e 1 vertice)"
        helpText = "Disegna una circonferenza cosmetica utilizzando due vertici:"+ "\n"\
                   "- scegliere gli attributi linea"+"\n"\
                   "- selezionare il primo vertice (centro) -->in sequenza il secondo (raggio)"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Circonférence cosmétique (centre et 1 sommet)"
        helpText = "Dessinez une circonférence cosmétique en utilisant deux sommets:"+ "\n"\
                   "- choisir des attributs"+ "\n"\
                   "- sélectionner le premier sommet (centre) --> en séquence le second (rayon)"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Circunferencia cosmética (centro y 1 vértice)"
        helpText = "Dibuja un círculo cosmético usando dos vértices:"+ "\n"\
                   "- elegir atributos"+ "\n"\
                   "- seleccione el primer vértice (centro) --> en secuencia el segundo (radio)"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # drawCirc

        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if len(ObjectList) == 2:
                if ObjectList[0][0:6] == 'Vertex' and ObjectList[1][0:6] == 'Vertex':
                    Center =  View.getVertexBySelection(ObjectList[0]).Point
                    Point =  View.getVertexBySelection(ObjectList[1]).Point
                    Radius = (Point-Center).Length
                    View.makeCosmeticCircle(Center, Radius,Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple())
            gui.Selection.clearSelection()

class drawArc:
    '''Draw an arc rotating math. positive'''
    Icon = QtGui.QPixmap([  \
        "64 64 155 2",\
        "  	c None",\
        ". 	c #2A2100",\
        "+ 	c #141000",\
        "@ 	c #2C2100",\
        "# 	c #2A2300",\
        "$ 	c #726E00",\
        "% 	c #FFFF00",\
        "& 	c #2D2400",\
        "* 	c #2B2200",\
        "= 	c #5E5700",\
        "- 	c #EFEF00",\
        "; 	c #2F2800",\
        "> 	c #DDDD00",\
        ", 	c #2A2200",\
        "' 	c #D0CC00",\
        ") 	c #3D3500",\
        "! 	c #FFB700",\
        "~ 	c #FF6000",\
        "{ 	c #FF4400",\
        "] 	c #FF6200",\
        "^ 	c #FFC000",\
        "/ 	c #2C2300",\
        "( 	c #726800",\
        "_ 	c #FFFD00",\
        ": 	c #FF0000",\
        "< 	c #FF7300",\
        "[ 	c #2B2300",\
        "} 	c #463C00",\
        "| 	c #FFFA00",\
        "1 	c #FFD300",\
        "2 	c #FF9100",\
        "3 	c #FFA500",\
        "4 	c #2F2400",\
        "5 	c #FF3C00",\
        "6 	c #FF0B00",\
        "7 	c #FF0800",\
        "8 	c #FFF700",\
        "9 	c #FF2000",\
        "0 	c #FF3500",\
        "a 	c #2B2100",\
        "b 	c #CDC800",\
        "c 	c #FFB800",\
        "d 	c #FF0700",\
        "e 	c #352D00",\
        "f 	c #FF0E00",\
        "g 	c #FF4D00",\
        "h 	c #FF0400",\
        "i 	c #FF1300",\
        "j 	c #A29B00",\
        "k 	c #FFB600",\
        "l 	c #FFFB00",\
        "m 	c #FF4A00",\
        "n 	c #FF5D00",\
        "o 	c #F7F700",\
        "p 	c #FFD200",\
        "q 	c #FF1200",\
        "r 	c #FFDE00",\
        "s 	c #FFC700",\
        "t 	c #FF2800",\
        "u 	c #FF3100",\
        "v 	c #FFD100",\
        "w 	c #2D2000",\
        "x 	c #302400",\
        "y 	c #FFCD00",\
        "z 	c #FFB300",\
        "A 	c #FFD000",\
        "B 	c #413C00",\
        "C 	c #342B00",\
        "D 	c #312900",\
        "E 	c #C9C900",\
        "F 	c #2C2200",\
        "G 	c #B3AD00",\
        "H 	c #F2F200",\
        "I 	c #C4C400",\
        "J 	c #807A00",\
        "K 	c #2D2500",\
        "L 	c #635E00",\
        "M 	c #292000",\
        "N 	c #2D2200",\
        "O 	c #FCFC00",\
        "P 	c #A8A800",\
        "Q 	c #C5C000",\
        "R 	c #494100",\
        "S 	c #F5F500",\
        "T 	c #382D00",\
        "U 	c #352E00",\
        "V 	c #2D2300",\
        "W 	c #292200",\
        "X 	c #2F2700",\
        "Y 	c #342A00",\
        "Z 	c #E9E600",\
        "` 	c #443C00",\
        " .	c #BDBD00",\
        "..	c #6B6300",\
        "+.	c #2A2000",\
        "@.	c #646000",\
        "#.	c #5F5800",\
        "$.	c #FDFD00",\
        "%.	c #FAF800",\
        "&.	c #322A00",\
        "*.	c #E5E100",\
        "=.	c #6A6500",\
        "-.	c #D6D300",\
        ";.	c #E3E300",\
        ">.	c #F4F400",\
        ",.	c #FFF800",\
        "'.	c #FF0A00",\
        ").	c #FFC300",\
        "!.	c #FF4E00",\
        "~.	c #FF8900",\
        "{.	c #FF8E00",\
        "].	c #FFE400",\
        "^.	c #FFA300",\
        "/.	c #FF7D00",\
        "(.	c #FFD700",\
        "_.	c #A7A300",\
        ":.	c #FFDB00",\
        "<.	c #FF4900",\
        "[.	c #FF0200",\
        "}.	c #FF5200",\
        "|.	c #C6C300",\
        "1.	c #FFE000",\
        "2.	c #FF1600",\
        "3.	c #FFEB00",\
        "4.	c #FFBF00",\
        "5.	c #FF2A00",\
        "6.	c #FF1C00",\
        "7.	c #FFA400",\
        "8.	c #FF5700",\
        "9.	c #FF6B00",\
        "0.	c #FFDC00",\
        "a.	c #FF0300",\
        "b.	c #FF0100",\
        "c.	c #FFBC00",\
        "d.	c #FFFC00",\
        "e.	c #FF0900",\
        "f.	c #FF1A00",\
        "g.	c #FFEE00",\
        "h.	c #FF1700",\
        "i.	c #FF2C00",\
        "j.	c #FBFB00",\
        "k.	c #FFBE00",\
        "l.	c #FF9200",\
        "m.	c #FF2B00",\
        "n.	c #FF1D00",\
        "o.	c #FFA600",\
        "p.	c #FF4300",\
        "q.	c #FF5400",\
        "r.	c #FF9300",\
        "s.	c #FF3B00",\
        "t.	c #FF2200",\
        "u.	c #FF4100",\
        "v.	c #FF9F00",\
        "w.	c #EEED00",\
        "x.	c #2A2400",\
        "                                                                                                                                ",\
        "                                                                                  . + + + + + +                                 ",\
        "                                                                          @ # + + + + + + + $ %         % % % % %               ",\
        "                                                                    & * + + + + @ = - % % % % % %   % % % % % % % % %           ",\
        "                                                                * + + + + ; > % % % % % % % % % % % % % % % % % % % % %         ",\
        "                                                            * + + + , ' % % % % % % % % % % % % % % % % % % % % % % % % %       ",\
        "                                                        * + + + ) % % % % % % % % % % %       % % % % % ! ~ { ] ^ % % % % %     ",\
        "                                                    / + + + ( % % % % % % % % %             % % % % _ ~ : : : : : < % % % %     ",\
        "                                                [ + + + } % % % % % % % %                   % | 1 % 2 : : : : : : : 3 % % % %   ",\
        "                                              * + + 4 % % % % % % % %                     : 5 6 7 8 9 : : : : : : : 0 % % % %   ",\
        "                                          a + + + b % % % % % % %                   : : : : : : : c : : : : : : : : d % % % %   ",\
        "                                        a + + e % % % % % % %                     : : : : : : f g ^ h : : : : : : : i % % % %   ",\
        "                                      * + + j % % % % % %                 : :     : : : : : k l % % m : : : : : : : n % % % %   ",\
        "                                    + + + o % % % % %                 : : : :       : :     % % % % p 6 : : : : : q r % % % %   ",\
        "                                  + + . % % % % % %               : : : : : : :               % % % % s t : : : u v % % % %     ",\
        "                              w + + x % % % % %                   : : : : : :                 % % % % % _ y z A % % % % % %     ",\
        "                              + + } % % % % %               :       : : :                   %   % % % % % % % % % % % % %       ",\
        "                            + + B % % % % %             : : : :                         % % %     % % % % % % % % % % %         ",\
        "                          + + C % % % % %             : : : : :                     % % % % % %       % % % % % % %             ",\
        "                        + + D % % % % %             : : : : : :                 % % % % % % % %           % % % %               ",\
        "                      + + @ % % % % %             : : : : :                 % % % % % % % E + +           % % % %               ",\
        "                    F + * % % % % %             : : : : :                 % % % % % % G + + + +           % % %                 ",\
        "                    + + H % % % %           : : : : : :               % % % % % % I + + + + a                                   ",\
        "                  + + J % % % %           : : : : :                 % % % % % % K + + a @                                       ",\
        "                * + / % % % %             : : : :               % % % % % % L + + + M                     % % %                 ",\
        "              N + + % % % %             : : : :               % % % % % O F + + a                         % % %                 ",\
        "              + + P % % % %             : : :               % % % % % Q * + +                             % % %                 ",\
        "            + + * % % % %                 :               % % % % % R + + +                                                     ",\
        "            + * S % % %           : :                   % % % % % & + + [                                                       ",\
        "          a + T % % % %           : : :               % % % % % @ + +                                                           ",\
        "          + + % % % %           : : : :             % % % % % F + +                                       % % %                 ",\
        "        a + U % % % %         : : : :             % % % % % * + +                                         % % %                 ",\
        "        + + O % % %           : : : :           % % % % % V + +                                           % % %                 ",\
        "      W + X % % % %           : : :             % % % % Y + +                                                                   ",\
        "      + + Z % % %                             % % % % ` + +                                                                     ",\
        "      + @ % % % %         :                 % % % %  .+ +                                                 % % %                 ",\
        "    a + ..% % %         : : : :             % % % % + + +.                                                % % %                 ",\
        "    + + % % % %         : : : :           % % % % / + +                                                   % % %                 ",\
        "    + * % % % %       : : : :           % % % % @.+ +                                                     % % %                 ",\
        "  / + #.% % %         : : : :           % % % $.+ +                                                                             ",\
        "  + + %.% % %         : : :           % % % % &.+                                                                               ",\
        "  + * % % % %       : : : :           % % % *.+ +                                                         % % %                 ",\
        "  + & % % %         : : : :         % % % % a + *                                                         % % %                 ",\
        "F + =.% % %         : : :           % % % -.+ +                                                           % % %                 ",\
        "* + ;.% % %       : : : :         % % % % + + a                                                                                 ",\
        "[ , % % % %       : : : :         % % % >.+ +                                                                                   ",\
        "    % % % % % % ,.6 : '.8       % % % % &.+ W                                                             + + +                 ",\
        "    % % % % % % ).: : !.% % %     % % % + +                                                           + + + + + + a             ",\
        "      % % % % % ~.: : {.% % % %                                                                     + + + % % % + + +           ",\
        "    % % % % % % ].^./.(.% % % % %                                                                 + + % % % % % O _.+ +         ",\
        "    % % % % :.<.[.: [.}.].% % % %                                                               + + % % % % l % % % |.+ a       ",\
        "  % % % % 1.2.: : : : : 9 3.% % % %                                                           a + + % % 4.5.: 6.7.% % + +       ",\
        "  % % % % 8.: : : : : : : 9.% % % %                                                           + + - % 0.d a.: b.b.c.% % + +     ",\
        "  % % % d.e.: : : : : : : f.% % % % % % %       % % %     % % % %     % % %       % % %       + + % % : h : : : h : % % + +     ",\
        "  % % % g.: : : : : : : : d % % % % % % %       % % %     % % % %     % % %       % % %       + + % % : a.: : : h : % % + +     ",\
        "  % % % _ h.: : : : : : : i.% % % % % % %       % % %     % % % %     % % %       % % %       + + j.% 0.7 a.: b.b.k.% % + +     ",\
        "  % % % % /.: : : : : : : l.% % % % % % %       % % %       % %       % % %       % % %       + + % % % 4.m.b.n.o.% % % + +     ",\
        "  % % % % 8 p.: : : : : q.d.% % %                                                               + + >.% % % | % % % % + +       ",\
        "    % % % % l r.s.t.u.v._ % % % %                                                               # + + w.% % % % % % + + V       ",\
        "      % % % % % % % % % % % % %                                                                     + + % % % % + + + [         ",\
        "      % % % % % % % % % % % %                                                                       x.+ + + + + + *             ",\
        "          % % % % % % % % %                                                                               + + +                 ",\
        "              % % % % %                                                                                                         ",\
        "                                                                                                                                "])

    def textEnglish(self):
        buttonText = "Draw an cosmetic arc (center and two vertexes)"
        helpText = "Draw an arc rotating math. positive:"+ "\n"\
                   "- Choose the line attributes"+ "\n"\
                   "- select three vertexes:"+ "\n"\
                   "- center, start, end"+ "\n"\
                   "- start defines the radius"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Kosmetischer Bogen (Mitte und 2 Punkte)"
        helpText = "Zeichnet einen math. positiv rotierenden Kreisbogen:"+ "\n"\
                   "- Wählen Sie die Linienattribute"+ "\n"\
                   "- wähle drei Kontrollpunkte:"+ "\n"\
                   "- Mittelpunkt, Startpunkt , Endpunkt"+ "\n"\
                   "- der Startpunkt legt den Radius fest"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Arco cosmetico (centro e 2 vertici)"
        helpText = "Disegna un arco cosmetico utilizzando un centro e 2 vertici:"+ "\n"\
                   "- scegliere gli attributi linea"+"\n"\
                   "- selezionare i vertici in sequenza: centro--> inizio--> fine"+ "\n"\
                   "N.B. centro--->inizio definisce il raggio, fine il posizionamento"+ "\n"\
                   "invertire selezione (inizio-fine) per cambiare posizionamento"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Arc cosmétique (centre et 2 sommets)"
        helpText = "Dessinez un arc cosmétique en utilisant un centre et 2 sommets:"+ "\n"\
                   "- choisir des attributs"+ "\n"\
                   "- sélectionnez les sommets dans l'ordre: centre --> début --> fin"+ "\n"\
                   "Noter: Center --> start définit le rayon, terminer le positionnement"+ "\n"\
                   "- inverser la sélection (début-fin) pour modifier le positionnement"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Arco cosmético (centro y 2 vértices)"
        helpText = "Dibuja un arco cosmético usando un centro y 2 vértices:"+ "\n"\
                   "- elegir atributos"+ "\n"\
                   "- seleccione los vértices en secuencia: centro --> inicio --> final"+ "\n"\
                   "Nota: centro --> inicio define el radio, el final el posicionamiento"+ "\n"\
                   "- invertir selección (inicio-fin) para cambiar el posicionamiento"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # drawArc

        def returnAngle(Center,Point):
            X= app.Vector(1,0,0)
            VecPC = Point - Center
            Dy = VecPC.y
            Sign = -1.0
            if Dy < 0.0:
                Sign = -Sign
            Angle = math.degrees(X.getAngle(VecPC))*Sign
            if Angle < 0:
                Angle = 360 + Angle
            return Angle

        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if len(ObjectList) >= 3:
                ThreeVertex = True
                for ObjectString in ObjectList:
                    if ObjectString[0:6] != 'Vertex':
                        ThreeVertex = False
                if ThreeVertex:
                    Center =  View.getVertexBySelection(ObjectList[0]).Point
                    End =  View.getVertexBySelection(ObjectList[1]).Point
                    Start = View.getVertexBySelection(ObjectList[2]).Point
                    Radius = (End-Center).Length
                    AStart = returnAngle(Center,Start)
                    AEnd = returnAngle(Center,End)
                    View.makeCosmeticCircleArc(Center, Radius, AStart, AEnd, Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple())
            gui.Selection.clearSelection()

class extendLine:
    '''Extend an attached cosmetic or center line at both ends'''
    Icon = QtGui.QPixmap([  \
        "64 64 4 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                 ...                        ..                  ",\
        "               .....                        ....                ",\
        "              ......                        ......              ",\
        "            ........                        ........            ",\
        "          ..........                        .........           ",\
        "         ...........                        ...........         ",\
        "      ..............                        ..............      ",\
        "   .................                        .................   ",\
        " ...................                        ................... ",\
        "....................                        ....................",\
        " ...................                        ................... ",\
        "   .................                        .................   ",\
        "      ..............                        ..............      ",\
        "         ...........                        ...........         ",\
        "           .........                        ..........          ",\
        "            ........                        ........            ",\
        "              ......                        ......              ",\
        "                ....                        .....               ",\
        "                  ..                        ...                 ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Extend a line"
        helpText = "Extend a line at both ends:"+ "\n"\
                   "- select one cosmetic or centerline"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Verlängern einer Linie"
        helpText = "Verlängert eine Linie an beiden Enden:"+ "\n"\
                   "- wähle eine kosmetische oder Mittellinie"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Estendi linea cosmetica"
        helpText = "Estende una linea cosmetica da entrambe le estremità:"+ "\n"\
                   "- selezionare la linea cosmetica o linea centrale o di mezzeria"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Extension de ligne cosmétique"
        helpText = "Prolonge une ligne cosmétique des deux extrémités:"+ "\n"\
                   "- sélectionnez la ligne cosmétique ou la ligne médiane"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Extensión de línea cosmética"
        helpText = "Extiende una línea cosmética desde ambos extremos:"+ "\n"\
                   "- seleccione la línea cosmética o la línea central"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if ObjectList[0][0:4] == 'Edge':
                commonTools.extendShortenLine(View,ObjectList,True)
        gui.Selection.clearSelection()

class shortenLine:
    '''Shorten an attached cosmetic or center line at both ends'''
    Icon = QtGui.QPixmap([  \
        "64 64 4 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "   ..                                                    ...    ",\
        "   ....                                                .....    ",\
        "   ......                                             ......    ",\
        "   ........                                         ........    ",\
        "   .........                                      ..........    ",\
        "   ...........                                   ...........    ",\
        "   ..............                             ..............    ",\
        "   .................                       .................    ",\
        "   ...................                   ...................    ",\
        "   ....................                 ....................    ",\
        "   ...................                   ...................    ",\
        "   .................                       .................    ",\
        "   ..............                             ..............    ",\
        "   ...........                                   ...........    ",\
        "   ..........                                      .........    ",\
        "   ........                                         ........    ",\
        "   ......                                             ......    ",\
        "   .....                                                ....    ",\
        "   ...                                                    ..    ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  ++@@@@@@@@@@@@@@@@@@@@@@@@@++  ....  ...  ..  .",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        ".  .. ...  ....  +++++++++++++++++++++++++++++  ....  ...  ..  .",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Shorten a line"
        helpText = "Shorten a line at both ends:"+ "\n"\
                   "- select one cosmetic or centerline"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Verkürzen einer Linie"
        helpText = "Verkürzt eine Linie an beiden Enden:"+ "\n"\
                   "- wähle eine kosmetische oder Mittellinie"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Accorcia linea cosmetica"
        helpText = "Accorcia una linea cosmetica da entrambe le estremità:"+ "\n"\
                   "- selezionare la linea cosmetica o linea centrale o di mezzeria"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Raccourcir ligne cosmétique"
        helpText = "Raccourcir une ligne cosmétique des deux extrémités:"+ "\n"\
                   "- sélectionnez la ligne cosmétique ou la ligne médiane"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
       buttonText = "Acortar línea cosmética"
       helpText = "Acortar una línea cosmética de ambos extremos:"+ "\n"\
                  "- seleccione la línea cosmética o la línea central"+ "\n"\
                  "- haga clic en este botón"
       return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if ObjectList[0][0:4] == 'Edge':
                commonTools.extendShortenLine(View,ObjectList,False)
            gui.Selection.clearSelection()

class createArcLengthDim:
    '''Create an arc length dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 16 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #141000",\
        "@	c #FFFF00",\
        "#	c #2B2200",\
        "$	c #2A2000",\
        "%	c #2C2100",\
        "&	c #FDFD00",\
        "*	c #2C2200",\
        "=	c #FEFE00",\
        "-	c #2D2300",\
        ";	c #F8F700",\
        ">	c #FCFC00",\
        ",	c #2D2200",\
        "'	c #FDFC00",\
        ")	c #2A2300",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                            ........                      ...   ",\
        "   ....                    ..........                    ....   ",\
        "   ....                  ..............                  ....   ",\
        "   ....                 ................                 ....   ",\
        "   ....                ........  ........                ....   ",\
        "   ....               .....         ......               ....   ",\
        "   ....              .....            .....              ....   ",\
        "   ....             .....              .....             ....   ",\
        "   ....             ....                ....             ....   ",\
        "   ....            ....                 .....            ....   ",\
        "   ....            ....                  ....            ....   ",\
        "   ....            ....                  .....           ....   ",\
        "   ....           ....                    ....           ....   ",\
        "   ....           ....                    ....           .....  ",\
        "  ......          ....                                 ........ ",\
        " ........                                              .........",\
        ".........                                             ..........",\
        "................................................................",\
        "................................................................",\
        "................................................................",\
        "..........                                             .........",\
        " ........                                              ........ ",\
        " .......                                                 .....  ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                                                    ...   ",\
        "   ...                   +++++++++++++++                  ...   ",\
        "   ...                 +++@@@@@@@@@@@@+++                 ...   ",\
        "   ...              +++++@@@@@@@@@@@@@@+++++              ...   ",\
        "   ...            +++@@@@@@@@@@@@@@@@@@@@@@+++            ...   ",\
        "   ...          +++@@@@@@@@@@@@@@@@@@@@@@@@@@++           ...   ",\
        "   ...        +++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++#        ...   ",\
        "   ...       ++@@@@@@@@@@++++++++++++@@@@@@@@@@@+++       ...   ",\
        "   ...      ++@@@@@@@@+++++        +++++++@@@@@@@@++      ...   ",\
        "   ...     ++@@@@@@@+++  $             % +++@&@@@@@++     ...   ",\
        "   ...    ++@@@@@@+++                      +++@@@@@@++*   ...   ",\
        "   ...   ++@@@@@+++                          ++@@@@@@++   ...   ",\
        "   ...  ++@@@@@@+                             +++@@@@@++  ...   ",\
        "       ++&@@@@+++                               ++@@@@@++ ...   ",\
        "      ++@@@@@++                                  ++@@@@+++      ",\
        "      +@@@@@++                                    ++@@@@@+      ",\
        "     ++@@@=++                                      ++@@@@++-    ",\
        "     +@@@@@+                                        ++&@@@++    ",\
        "    ++@@@@++                                         +@@@@@+    ",\
        "    +@@@@@+                                          ++;@@@+    ",\
        "   ++>@@@++                                           +@@@@++   ",\
        "   +@@@@@+                                            ++@@@@+   ",\
        "  ,+@@@@++                                             +@@@@++  ",\
        "  ++@@@@+                                              +@@@'++  ",\
        "  ++@@@@+)                                             +@@@@++  ",\
        "  ++@@@@+                                              +@@@@++  ",\
        "  +++++++                                              +++++++  ",\
        "  +++++++                                              +++++++  ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create Development/length arc"
        helpText = "Enter the development/length of the arc with the symbol '∩':"+ "\n"\
                   "- select one arc"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Bogenentwicklung/Länge "
        helpText = "Geben Sie die Entwicklung/Länge des Bogens mit dem Symbol '∩' ein:"+ "\n"\
                   "- wähle einen Kreisbogen"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Sviluppo/lunghezza dell'arco"
        helpText = "Inserisce lo sviluppo/lunghezza dell'arco con il simbolo '∩':"+ "\n"\
                   "- selezionare l'arco"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Développement/longueur d'arc"
        helpText = "Entrez la développement/longueur de l'arc avec le symbole '∩':"+ "\n"\
                   "- select one arc"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Desarrollo/longitud del arco"
        helpText = "Ingrese el desarrollo/longitud del arco con el símbolo '∩':"+ "\n"\
                   "- seleccione el arco"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            Edge = View.getEdgeBySelection(ObjectList[0])
            if hasattr(Edge.Curve,'Center'):
                if len(Edge.Vertexes) > 1:
                    ArcDim = TechDraw.makeDistanceDim(View, 'Distance',Edge.Vertexes[0].Point,Edge.Vertexes[1].Point)
                    ArcDim.X = (Edge.Vertexes[0].Point.x+Edge.Vertexes[1].Point.x)/2
                    ArcDim.Y = (Edge.Vertexes[0].Point.y+Edge.Vertexes[1].Point.y)/2
                    ArcDim.Arbitrary = True
                    FormatStr = "∩ "+str(round(Edge.Length,2))
                    ArcDim.FormatSpec = FormatStr.replace(".",",")
            gui.Selection.clearSelection()

class drawPerpendicular:
    '''draw a line perpendicular to another line'''
    Icon = QtGui.QPixmap([  \
        "64 64 12 1",\
        " 	c None",\
        ".	c #2B2200",\
        "+	c #2D2400",\
        "@	c #FFFF00",\
        "#	c #2F2600",\
        "$	c #F9F900",\
        "%	c #FF0000",\
        "&	c #2C2300",\
        "*	c #393100",\
        "=	c #F8F800",\
        "-	c #342C00",\
        ";	c #2A2200",\
        "                                                                ",\
        "                             ......                             ",\
        "                           ..........                           ",\
        "                          ...+@@@@#...                          ",\
        "                         ...@@@@@@@@...                         ",\
        "                         ..@@@@@@@@$@..                         ",\
        "                        ...@@%%%%%%@@&..                        ",\
        "                        ..@@@%%%%%%@@@..                        ",\
        "                        ..@@@%%%%%%@@@..                        ",\
        "                        ..@@@%%%%%%@@@..                        ",\
        "                        ..*=@%%%%%%@@-..                        ",\
        "                         ..@@%%%%%%@@..                         ",\
        "                         ..#@@@@@@@@+..                         ",\
        "                          ..&.@@@@....                          ",\
        "                           ..........                           ",\
        "                            .%%%%%%.                            ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                             %%%%%%                             ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        "                            %%%%%%%                             ",\
        " .............................................................; ",\
        " .............................................................; ",\
        " ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.; ",\
        " ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.; ",\
        " ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.; ",\
        " ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.; ",\
        " ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.; ",\
        " ...............................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ",\
        " ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create a line perpendicular to another line"
        helpText = "Create a line perpendicular to another line through a vertex"+ "\n"\
                   "- choose the line attributes"+ "\n"\
                   "- select one line"+ "\n"\
                   "- select one vertex"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge eine Linie im rechten Winkel"
        helpText = "Erzeuge eine Linie im rechten Winkel zu einer Linie durch einen Punkt"+ "\n"\
                   "- Wählen Sie die Linienattribute"+ "\n"\
                   "- wähle eine Linie"+ "\n"\
                   "- wähle einen Punkt"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Perpendicolare cosmetica"
        helpText = "Crea una perpendicolare cosmetica ad una linea da un vertice:"+ "\n"\
                   "- scegliere gli attributi"+"\n"\
                   "- selezionare una linea"+ "\n"\
                   "- selezionare un vertice"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Cosmétique perpendiculaire"
        helpText = "Créer une ligne cosmétique perpendiculaire à une ligne à partir d'un sommet:"+ "\n"\
                   "- choisir des attributs"+"\n"\
                   "- sélectionnez une ligne"+ "\n"\
                   "- sélectionnez un sommet"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Cosmética perpendicular"
        helpText = "Crea una línea cosmética perpendicular a una línea desde un vértice:"+ "\n"\
                   "- elegir atributos"+"\n"\
                   "- seleccionar una línea"+ "\n"\
                   "- seleccionar un vértice"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # drawPerpendicular
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if len(ObjectList) == 2:
                if ObjectList[0][0:4] == "Edge" and ObjectList[1][0:6] == "Vertex":
                    Edge = View.getEdgeBySelection(ObjectList[0])
                    if Edge.Curve.TypeId == 'Part::GeomLine':
                        StartPt, EndPt = Edge.Vertexes[0].Point, Edge.Vertexes[1].Point
                        MidPt = View.getVertexBySelection(ObjectList[1]).Point
                        HalfVec = (StartPt.sub(EndPt)/2).cross(app.Vector(0,0,1))
                        View.makeCosmeticLine(MidPt.add(HalfVec),MidPt.sub(HalfVec),Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple())

class drawParallel:
    '''draw a line parallel to another line'''
    Icon = QtGui.QPixmap([  \
        "64 64 26 1",\
        " 	c None",\
        ".	c #FF0000",\
        "+	c #2B2200",\
        "@	c #2B2100",\
        "#	c #2C2400",\
        "$	c #FFFF00",\
        "%	c #F8F800",\
        "&	c #FF0D00",\
        "*	c #FFFE00",\
        "=	c #FB0200",\
        "-	c #FF0200",\
        ";	c #2C2300",\
        ">	c #F9F900",\
        ",	c #342100",\
        "'	c #FD0000",\
        ")	c #FCFC00",\
        "!	c #F8F700",\
        "~	c #2F2600",\
        "{	c #FDFC00",\
        "]	c #FBFB00",\
        "^	c #F5F500",\
        "/	c #332B00",\
        "(	c #F7F600",\
        "_	c #FDFD00",\
        ":	c #FEFE00",\
        "<	c #F6F500",\
        "                                              .                 ",\
        "                                             ...                ",\
        "                                            .....               ",\
        "                                           .......              ",\
        "                                          .........             ",\
        "                                           .........            ",\
        "                                            .......             ",\
        "                                      .      .....              ",\
        "                                     ...      ...               ",\
        "                                    .....      .                ",\
        "                                   .......                      ",\
        "                                  .........                     ",\
        "                                 ...........                    ",\
        "                                ...........                     ",\
        "                               ...........                      ",\
        "                         ++++ ...........                       ",\
        "                      +++++++...........                        ",\
        "                     ++@++++...........                         ",\
        "                     ++#++$...........                  +       ",\
        "                    +++++$$..........                  +++      ",\
        "                    +++%$$$$........                  +++++     ",\
        "                   ++++$$$$$$......                  +++++++    ",\
        "                   ++.$$$$$$$$.&..+                 ++++$++++   ",\
        "                   +...*$$$$$$$.=++                ++++$$$++++  ",\
        "                   ..=..$$$$$$$$+++               ++++$$$$$++++ ",\
        "                  .....-.$$$$$$$;++              ++++$$$$$$$++++",\
        "                 .........$$$$$+++              ++++$$$$$$$++++ ",\
        "                ...........$$+++++             ++++$$$$$$>++++  ",\
        "               ...........+++++++             ++++$$$$$$$++++   ",\
        "              ...........+,+++++             ++++$$$$$$$++++    ",\
        "             ..........'  +++               ++++$$$$$$$++++     ",\
        "            ...........                    ++++$$$$$$$++++      ",\
        "           ...........                    ++++$$$$$$$++++       ",\
        "          ...........                    ++++$$$$$)$++++        ",\
        "           .........                    ++++$$$$$$$++++         ",\
        "            .......                    ++++$$$$$$$++++          ",\
        "      .      .....                    ++++$$$$$$$++++           ",\
        "     ...      ...                    ++++$$$$$$$++;+            ",\
        "    .....      .                    ++++$$$$!$$++++             ",\
        "   .......                         ++++$$$$$$$++++              ",\
        "  .........                       ++++$$$$$$$++++               ",\
        " ...........                     ++++$$$$$$$++++                ",\
        "...........                     ++++$$$$$$$+~++                 ",\
        " .........                     ++++$$$$$${++++                  ",\
        "  .......                     ++++$$$]$$^++++                   ",\
        "   .....                     ++++$$$$$$$++++                    ",\
        "    ...                     ++++$$$$$$$++++                     ",\
        "     .                     ++++$$$$$$$/+++                      ",\
        "                          ++++$$$$$$$++++                       ",\
        "                         ++++$$($$>$++++                        ",\
        "                        ++++$$_$$$>++++                         ",\
        "                       ++++$$$$$$$++++                          ",\
        "                      ++++$$$$$$$++++                           ",\
        "                     ++++$$$$$$$++++                            ",\
        "                    ++++$$$$:$$++++                             ",\
        "                   ++++$$$$<$$++++                              ",\
        "                  ++++$$$$$$$++++                               ",\
        "                 ++++$$$$$$$++++                                ",\
        "                  ++++$$$$$++++                                 ",\
        "                   ++++$$$++++                                  ",\
        "                    ++++$++++                                   ",\
        "                     +++++++                                    ",\
        "                      +++++                                     ",\
        "                       +++                                      "])

    def textEnglish(self):
        buttonText = "Create a line parallel to another line"
        helpText = "Create a line parallel to another line through a vertex"+ "\n"\
                   "- choose the line attributes"+ "\n"\
                   "- select one line"+ "\n"\
                   "- select one vertex"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge eine parallele Liniel"
        helpText = "Erzeuge eine parallele zu einer Linie durch einen Punkt"+ "\n"\
                   "- Wählen Sie die Linienattribute"+ "\n"\
                   "- wähle eine Linie"+ "\n"\
                   "- wähle einen Punkt"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Parallela cosmetica"
        helpText = "Crea una parallela cosmetica ad una linea da un vertice:"+ "\n"\
                   "- scegliere gli attributi"+"\n"\
                   "- selezionare una linea"+ "\n"\
                   "- selezionare un vertice"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Parallèle cosmétique"
        helpText = "Créer une ligne cosmétique parallèle à une ligne à partir d'un sommet:"+ "\n"\
                   "- choisir des attributs"+"\n"\
                   "- sélectionnez une ligne"+ "\n"\
                   "- sélectionnez un sommet"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Cosmética paralela"
        helpText = "Crea una línea cosmética paralela a una línea desde un vértice:"+ "\n"\
                   "- elegir atributos"+"\n"\
                   "- seleccionar una línea"+ "\n"\
                   "- seleccionar un vértice"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # drawParallel
        (OK,ObjectList,View) = commonTools.selectionOK()
        if OK:
            if len(ObjectList) == 2:
                if ObjectList[0][0:4] == "Edge" and ObjectList[1][0:6] == "Vertex":
                    Edge = View.getEdgeBySelection(ObjectList[0])
                    if Edge.Curve.TypeId == 'Part::GeomLine':
                        StartPt, EndPt = Edge.Vertexes[0].Point, Edge.Vertexes[1].Point
                        MidPt = View.getVertexBySelection(ObjectList[1]).Point
                        HalfVec = StartPt.sub(EndPt)/2
                        View.makeCosmeticLine(MidPt.add(HalfVec),MidPt.sub(HalfVec),Attrib.getStyle(), Attrib.getWidth(), Attrib.getColorTuple())

class areaAnnot:
    ''' create an annotation showing the area of a closed polygon'''
    Icon = QtGui.QPixmap([  \
        "64 64 15 1",\
        " 	c None",\
        ".	c #2B2200",\
        "+	c #FFFF00",\
        "@	c #2F2600",\
        "#	c #2D2400",\
        "$	c #FDFC00",\
        "%	c #FDFD00",\
        "&	c #FAFA00",\
        "*	c #F8F800",\
        "=	c #2E2500",\
        "-	c #2D2300",\
        ";	c #FF0000",\
        ">	c #FFAEAE",\
        ",	c #2C2300",\
        "'	c #F7F600",\
        "    .......                                          .......    ",\
        "   .........                                        .........   ",\
        "  ...+++++@..                                      ...+++++...  ",\
        " ..#+$+++++...                                    ...+++++%+... ",\
        "...+++++++++........................................+%+++++++...",\
        "..+++++++++++......................................+++++++++++..",\
        "..+++++++++++..++++++++++++++++++++++++++++++++++..+++++++++++..",\
        "..+++++++++++#.++++++++++++++++++++++++++++++++++..++++++++++$#.",\
        "..+++++++++++..++++++++++++++++++++++++++++++++++..+++++++++++..",\
        "...+++++++++.......................................+++++++++++..",\
        " ...+++++++.........................................++++++++&...",\
        "  .#.+++++...                                     ...++++++*... ",\
        "   .......@.                                       ..=+++++...  ",\
        "    .......                                         .........   ",\
        "    ..+++..                                          ......-    ",\
        "    ..+++..                                          ..+++..    ",\
        "    ..+++..                              ;;;;;;      ..+++..    ",\
        "    ..+++..                             ;;;;;;;;     ..+++..    ",\
        "    ..+++..                            ;;;;;;;;;;    ..+++..    ",\
        "    ..+++..            ;;;;;;;;        ;;;   ;;;;    ..+++..    ",\
        "    ..+++..           ;;;;;;;;;        ;;;   ;;;;    ..+++..    ",\
        "    ..+++..           ;;;;;;;;;;             ;;;;    ..+++..    ",\
        "    ..+++..           ;;;;;;;;;;            ;;;;;    ..+++..    ",\
        "    ..+++..          ;;;;;;;;;;;           ;;;;;     ..+++..    ",\
        "    ..+++..          ;;;;;;;;;;;;         ;;;;;      ..+++..    ",\
        "    ..+++..          ;;;;;;;;;;;;        ;;;;;       ..+++..    ",\
        "    ..+++..         ;;;;;;;;;;;;;;      ;;;;;        ..+++..    ",\
        "    ..+++..         ;;;;;;;;;;;;;;      ;;;;         ..+++..    ",\
        "    ..+++..         ;;;;;;  ;;;;;;     ;;;;;;;;;;    ..+++..    ",\
        "    ..+++..        ;;;;;;;  ;;;;;;;    ;;;;;;;;;;    ..+++..    ",\
        "    ..+++..        ;;;;;;;  ;;;;;;;    ;;;;;;;;;;    ..+++..    ",\
        "    ..+++..       ;;;;;;;    ;;;;;;>                 ..+++..    ",\
        "    ..+++..       ;;;;;;;    ;;;;;;;                 ..+++..    ",\
        "    ..+++..       ;;;;;;      ;;;;;;                 ..+++..    ",\
        "    ..+++..      ;;;;;;;      ;;;;;;;                ..+++..    ",\
        "    ..+++..      ;;;;;;;      ;;;;;;;                ..+++..    ",\
        "    ..+++..      ;;;;;;;;;;;;;;;;;;;;                ..+++..    ",\
        "    ..+++..     ;;;;;;;;;;;;;;;;;;;;;;               ..+++..    ",\
        "    ..+++..     ;;;;;;;;;;;;;;;;;;;;;;               ..+++..    ",\
        "    ..+++..     ;;;;;;;;;;;;;;;;;;;;;;               ..+++..    ",\
        "    ..+++..    ;;;;;;;;;;;;;;;;;;;;;;;;              ..+++..    ",\
        "    ..+++..    ;;;;;;;          ;;;;;;;              ..+++..    ",\
        "    ..+++..   ;;;;;;;;          ;;;;;;;;             ..+++..    ",\
        "    ..+++..   ;;;;;;;            ;;;;;;;             ..+++..    ",\
        "    ..+++..   ;;;;;;;            ;;;;;;;             ..+++..    ",\
        "    ..+++..  ;;;;;;;              ;;;;;;;            ..+++..    ",\
        "    ..+++..  ;;;;;;;              ;;;;;;;            ..+++..    ",\
        "    ..+++..  ;;;;;;;              ;;;;;;;            ..+++..    ",\
        "    ..+++..                                          ..+++..    ",\
        "    ..+++..                                          ..+++..    ",\
        "    ........                                         .......    ",\
        "   .........                                        .........   ",\
        "  ...+++++.,.                                      ...+++++...  ",\
        " ...+++++++.,......................................#.+++++++.#. ",\
        "...+++++++++..,.....................................+++++++++...",\
        "..+++++++++++..++++++++++++++++++++++++++++++++++..+++++++++++..",\
        "..+++++++++++..++++++++++++++++++++++++++++++++++..+++++++++++..",\
        "..+++++++++++..++++++++++++++++++++++++++++++++++..+++++++++++..",\
        "..+++++++++++......................................+++++++++++..",\
        "..,+++++++++.......................................#+++++++++...",\
        " ...+++++++.#.                                    ...+++++++... ",\
        "  ...+'+++.#.                                      ...+++++...  ",\
        "   .........                                        .........   ",\
        "    .......                                          .......    "])

    def textEnglish(self):
        buttonText = "Create an annotation showing the area"
        helpText = "Creates an annotation of the area value, the unit"+ "\n"\
                   "of which is determined by the preferences "+"\n"\
                   "- select a closed closed polygon of lines"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge eine Anmerkung mit dem Flächeninhalt"
        helpText = "Erstellen Sie eine Anmerkung zum Flächenwert, deren Einheit"+ "\n"\
                   "aus den Einstellungen entnommen wird "+"\n"\
                   "- Wählen Sie Linien die ein geschlossenes Polygon bilden"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Annotazione valore area poligono"
        helpText = "Crea un'annotazione del valore dell'area, la cui "+ "\n"\
                   "unità viene rilevata dalle preferenze"+"\n"\
                   "- selezionare le linee che formano il poligono chiuso"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Annotation de valeur de surface de polygone"
        helpText = "Crée une annotation de la valeur de surface, dont "+ "\n"\
                   "l'unité est extraite des préférences"+"\n"\
                   "- sélectionnez les lignes qui forment le polygone fermé"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Anotación de valor de área de polígono"
        helpText = "Cree una anotación del valor del área, cuya "+ "\n"\
                   "unidad se toma de las preferencias "+"\n"\
                   "- seleccione las líneas que forman el polígono cerrado"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self):
        Sel = gui.Selection.getSelectionEx()[0]
        ObjectList = Sel.SubElementNames
        View = gui.Selection.getCompleteSelection()[0]
        XView,YView = commonTools.getViewCoords(View)
        selEdges = []
        for Obj in ObjectList:
            selEdges.append(View.getEdgeBySelection(Obj))
        wire = TechDraw.findOuterWire(selEdges)
        sumArea, sumLength, sumProduct = 0, 0, app.Vector()
        for Edge in wire.Edges:
            sumArea = sumArea + Edge.Vertexes[0].Point.x*Edge.Vertexes[1].Point.y-Edge.Vertexes[0].Point.y*Edge.Vertexes[1].Point.x
            sumLength = sumLength + Edge.Length
            sumProduct = sumProduct+Edge.Vertexes[0].Point.add(Edge.Vertexes[1].Point)/2*Edge.Length
        center = app.Vector(sumProduct.x/sumLength,sumProduct.y/sumLength,0)
        factor = app.Units.Quantity('m').getUserPreferred()[1]
        sumArea = abs(int(sumArea/(2*factor*factor)))
        commonTools.createAnnot('Area',str(sumArea)+app.Units.Quantity('m').getUserPreferred()[2]+'2',float(XView)+center.x,float(YView)+center.y-2)

class createObliqueDimChain:
    '''create an oblique chain dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "                                 ..                             ",\
        "                                 ...                            ",\
        "                                .....                           ",\
        "                                 .....                          ",\
        "                                  .....                         ",\
        "                                   .....                        ",\
        "                                    .....                       ",\
        "                                     .....                      ",\
        "                                      .....                     ",\
        "                                       .....                    ",\
        "                                        .....                   ",\
        "                                         .....                  ",\
        "                                          .....            .    ",\
        "                                           .....          ...   ",\
        "                                            .....        .....  ",\
        "                   .                         .....      .....   ",\
        "                  ...                         ..............    ",\
        "                 .....                         ............     ",\
        "                  .....                         ..........      ",\
        "                   .....                        ..........      ",\
        "                    .....                       ..........      ",\
        "                     .....                      ..........      ",\
        "                      .....                     .........       ",\
        "                       .....                    ..........      ",\
        "                        .....                  ............     ",\
        "                         .....                ............      ",\
        "                          .....              .....      .       ",\
        "                           .....            .....               ",\
        "                            .....          .....                ",\
        "                             .....        .....                 ",\
        "                              .....      .....                  ",\
        "                               .....    .....                   ",\
        "  ...                           ............                    ",\
        " .....                           ..........                     ",\
        "  .....                          .........                      ",\
        "   .....                         ..........                     ",\
        "    .....                        ..........                     ",\
        "     .....                       ..........                     ",\
        "      .....                      ..........                     ",\
        "       .....                    ............                    ",\
        "        .....                  ............                     ",\
        "         .....                .....      .                      ",\
        "          .....              .....                              ",\
        "           .....            .....                               ",\
        "            .....          .....                                ",\
        "             .....        .....                                 ",\
        "              .....      .....                                  ",\
        "               ..... .. .....                                   ",\
        "                ............                                    ",\
        "                 ..........                                     ",\
        "                 .........                                      ",\
        "                 ..........                                     ",\
        "                 ..........                                     ",\
        "                 .........                                      ",\
        "                 ..........                                     ",\
        "                ............                                    ",\
        "               ............                                     ",\
        "              .....      .                                      ",\
        "              ....                                              ",\
        "               ..                                               ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                ",\
        "                                                                "])

    def textEnglish(self):
        buttonText = "Create an oblique dimension chain"
        helpText = "Create an oblique dimension chain"+ "\n"\
                   "- select three or more  vertexes"+ "\n"\
                   "- the first two define the direction"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge eine schräge Kettenbemaßung"
        helpText = "Erzeuge ein schräges Kettenmaß"+ "\n"\
                   "- wähle drei oder mehr Konstruktionspunkte"+ "\n"\
                   "- die beiden Ersten bestimmen die Richtung"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensioni oblique in serie continue"
        helpText = "Seleziona tre o più vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimensions obliques en série continue"
        helpText = "Sélectionnez trois sommets ou plus"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Dimensiones oblicuas en serie continua"
        helpText = "Seleccione tres o más vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)


    def activated(self): # createObliqueDimChain
        def sortPoints(Point):
            return Point.x

        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            if len(Vertexes) > 2:
                DimPoints = [Vertexes[0].Point,Vertexes[1].Point]
                Direction = Vertexes[0].Point.sub(Vertexes[1].Point).normalize()
                Normal = app.Vector(Direction.y,-Direction.x,0)
                Carrier = Part.Line(Vertexes[0].Point,Vertexes[1].Point)
                DistLine = Part.Line(app.Vector(),Normal)
                Ip = Carrier.intersect(DistLine)
                Delta = app.Vector(Ip[0].X,Ip[0].Y,Ip[0].Z).normalize()*7
                for Num in range(2,len(Vertexes)):
                    Pt = Vertexes[Num].Point
                    Extension = Part.Line(Pt,Pt.add(Normal))
                    Ip = Carrier.intersect(Extension)
                    IpVec = app.Vector(Ip[0].X,Ip[0].Y,Ip[0].Z)
                    if not IpVec.isEqual(Pt,0.01):
                        DimPoints.append(IpVec)
                        View.makeCosmeticLine(Pt,IpVec,1, 0.15, (0,0,0,0))
                    else:
                        DimPoints.append(Pt)
                DimPoints.sort(key=sortPoints)
                for i  in range(len(DimPoints)-1):
                    DistanceDim=TechDraw.makeDistanceDim(View,'Distance',DimPoints[i],DimPoints[i+1])
                    DistanceDim.X = (DimPoints[i].x+DimPoints[i+1].x)/2+Delta.x
                    DistanceDim.Y = (DimPoints[i].y+DimPoints[i+1].y)/2+Delta.y

class createObliqueCoordDim:
    '''Create oblique coordinate dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 2 1",\
        " 	c None",\
        ".	c #FF0000",\
        "                   .......           ......                     ",\
        "         ...        ......           .......                    ",\
        "         ...         ......            ......                   ",\
        "        .....         ......            .....                   ",\
        "         .....         ......           ......                  ",\
        "         ......         ......           ......                 ",\
        "          ......         ......           ......                ",\
        "           ......         ......           ......               ",\
        "            .......        ......           ......              ",\
        "             ...........    ......           ......             ",\
        "              ..........     ......           ......            ",\
        "               .........     ......            ......           ",\
        "               .........      ......            .....           ",\
        "               .........       ......            .....          ",\
        "               .........        ...........       .....         ",\
        "               .........         ...........      ......        ",\
        "              ...........         ..........       ......       ",\
        "             ............         ..........        ......      ",\
        "            ............          ..........         .........  ",\
        "           ......                 ..........          ..........",\
        "          ......                  ..........           .........",\
        "         .......                  ..........           .........",\
        "         ......                  ............           ........",\
        ".       ......                  ............           .........",\
        "..     .....                    .....                   ........",\
        "...   ......                  ......                   .........",\
        "...........                  .......                  ..........",\
        "..........                   ......                  ...........",\
        ".........                   ......                  .......   ..",\
        ".........                  ......                  ......       ",\
        ".........                 ......                  .......       ",\
        ".........                ......                  .......        ",\
        ".........               ......                   ......         ",\
        "..........             ......                   ......          ",\
        "...........           ......                   ......           ",\
        "............         ......                   ......            ",\
        "..     ......        .....                   ......             ",\
        "        ......      ......                  ......              ",\
        "        .......   .......                  ......               ",\
        "         ...............                  ......                ",\
        "          .............                  .......                ",\
        "           ...........                  .......                 ",\
        "            .........                   ......                  ",\
        "            .........                  ......                   ",\
        "            .........                 ......                    ",\
        "            .........                ......                     ",\
        "           ...........              ......                      ",\
        "           ............            ......                       ",\
        "           .............          ......                        ",\
        "           ....    .....         ......                         ",\
        "            ..      .....       .......                         ",\
        "                     .....     .......                          ",\
        "                      .....   .......                           ",\
        "                       .............                            ",\
        "                       ............                             ",\
        "                        ..........                              ",\
        "                        ..........                              ",\
        "                        ..........                              ",\
        "                        ..........                              ",\
        "                        ..........                              ",\
        "                       ...........                              ",\
        "                       ...........                              ",\
        "                       ...........                              ",\
        "                        ...                                     "])

    def textEnglish(self):
        buttonText = "Create an oblique coordinate dimension"
        helpText = "Create an oblique coordinate dimension"+ "\n"\
                   "- select three or more  vertexes"+ "\n"\
                   "- the first two define the direction"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Erzeuge eine schräge Koordinatenbemaßung"
        helpText = "Erzeuge ein schräges Koordinatenmaß"+ "\n"\
                   "- wähle drei oder mehr Konstruktionspunkte"+ "\n"\
                   "- die beiden Ersten bestimmen die Richtung"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Dimensioni parallele/coordinate oblique"
        helpText = "- impostare Valore distanziamento"+ "\n"\
                   "- selezionare tre o più vertici"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Dimensions parallèles/coordonnées oblique"
        helpText = "- définir Valeur d'espacement"+ "\n"\
                          "- sélectionnez trois sommets ou plus"+ "\n"\
                          "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Dimensiones paralelas/coordenadas oblicuas"
        helpText = "- establecer Valor de espaciado"+ "\n"\
                   "- seleccione tres o más vértices"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # createObliqueCoordDim
        def sortPoints(Point):
            return Point.x

        (OK,ElementNames,View) = commonTools.selectionOK()
        if OK:
            VertexNames = [VertexName for VertexName in ElementNames if VertexName[:6]=='Vertex']
            Vertexes = [View.getVertexBySelection(VertexName) for VertexName in VertexNames]
            if len(Vertexes) > 2:
                DimPoints = [Vertexes[0].Point,Vertexes[1].Point]
                Direction = Vertexes[0].Point.sub(Vertexes[1].Point).normalize()
                Normal = app.Vector(Direction.y,-Direction.x,0)
                Carrier = Part.Line(Vertexes[0].Point,Vertexes[1].Point)
                DistLine = Part.Line(app.Vector(),Normal)
                Ip = Carrier.intersect(DistLine)
                Delta = app.Vector(Ip[0].X,Ip[0].Y,Ip[0].Z).normalize()*DimAttrib.getDimLineDistance()
                for Num in range(2,len(Vertexes)):
                    Pt = Vertexes[Num].Point
                    Extension = Part.Line(Pt,Pt.add(Normal))
                    Ip = Carrier.intersect(Extension)
                    IpVec = app.Vector(Ip[0].X,Ip[0].Y,Ip[0].Z)
                    if not IpVec.isEqual(Pt,0.01):
                        DimPoints.append(IpVec)
                        View.makeCosmeticLine(Pt,IpVec,1, 0.15, (0,0,0,0))
                    else:
                        DimPoints.append(Pt)
                DimPoints.sort(key=sortPoints)
                for i  in range(len(DimPoints)-1):
                    DistanceDim=TechDraw.makeDistanceDim(View,'Distance',DimPoints[0],DimPoints[i+1])
                    DistanceDim.X = (DimPoints[0].x+DimPoints[i+1].x)/2+Delta.x*(i+1)
                    DistanceDim.Y = (DimPoints[0].y+DimPoints[i+1].y)/2+Delta.y*(i+1)

class positionObliqueDimChain:
    '''Position oblique dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 240 2",\
        "  	c None",\
        ". 	c #FF0000",\
        "+ 	c #262600",\
        "@ 	c #323200",\
        "# 	c #4F5000",\
        "$ 	c #7B7B00",\
        "% 	c #848400",\
        "& 	c #4E4E00",\
        "* 	c #464600",\
        "= 	c #939400",\
        "- 	c #CCCD00",\
        "; 	c #D8D800",\
        "> 	c #9A9A00",\
        ", 	c #373700",\
        "' 	c #919100",\
        ") 	c #D5D500",\
        "! 	c #FBFC00",\
        "~ 	c #FCFD00",\
        "{ 	c #DBDC00",\
        "] 	c #151500",\
        "^ 	c #8E8E00",\
        "/ 	c #D9D900",\
        "( 	c #FBFB00",\
        "_ 	c #FFFF00",\
        ": 	c #F8F800",\
        "< 	c #D4D400",\
        "[ 	c #000000",\
        "} 	c #898900",\
        "| 	c #DDDE00",\
        "1 	c #FCFC00",\
        "2 	c #D0D000",\
        "3 	c #737400",\
        "4 	c #8A8A00",\
        "5 	c #E1E100",\
        "6 	c #F7F800",\
        "7 	c #CBCB00",\
        "8 	c #7A7A00",\
        "9 	c #141400",\
        "0 	c #E2E300",\
        "a 	c #F6F700",\
        "b 	c #C7C700",\
        "c 	c #808000",\
        "d 	c #212100",\
        "e 	c #3D3D00",\
        "f 	c #929200",\
        "g 	c #E3E300",\
        "h 	c #F6F600",\
        "i 	c #C4C400",\
        "j 	c #838300",\
        "k 	c #353500",\
        "l 	c #4F4F00",\
        "m 	c #FDFD00",\
        "n 	c #C2C200",\
        "o 	c #838400",\
        "p 	c #595900",\
        "q 	c #9FA000",\
        "r 	c #DFDF00",\
        "s 	c #C1C100",\
        "t 	c #828200",\
        "u 	c #404000",\
        "v 	c #5F5F00",\
        "w 	c #A4A400",\
        "x 	c #C0C100",\
        "y 	c #7D7E00",\
        "z 	c #3C3C00",\
        "A 	c #616100",\
        "B 	c #A7A700",\
        "C 	c #DDDD00",\
        "D 	c #F3F400",\
        "E 	c #767600",\
        "F 	c #303000",\
        "G 	c #606000",\
        "H 	c #A8A800",\
        "I 	c #DEDE00",\
        "J 	c #F1F100",\
        "K 	c #C3C400",\
        "L 	c #6C6C00",\
        "M 	c #090900",\
        "N 	c #5C5C00",\
        "O 	c #DFE000",\
        "P 	c #FEFE00",\
        "Q 	c #F0F000",\
        "R 	c #C4C500",\
        "S 	c #242400",\
        "T 	c #555500",\
        "U 	c #E2E200",\
        "V 	c #EFEF00",\
        "W 	c #6D6D00",\
        "X 	c #444400",\
        "Y 	c #6F7000",\
        "Z 	c #545400",\
        "` 	c #494900",\
        " .	c #E5E600",\
        "..	c #2F2F00",\
        "+.	c #969700",\
        "@.	c #D3D300",\
        "#.	c #A3A300",\
        "$.	c #646500",\
        "%.	c #030300",\
        "&.	c #A0A000",\
        "*.	c #EAEA00",\
        "=.	c #EFF000",\
        "-.	c #BEBF00",\
        ";.	c #6A6A00",\
        ">.	c #848500",\
        ",.	c #EAEB00",\
        "'.	c #EDEE00",\
        ").	c #AAAB00",\
        "!.	c #5E5E00",\
        "~.	c #161600",\
        "{.	c #070700",\
        "].	c #0A0A00",\
        "^.	c #3F3F00",\
        "/.	c #9B9B00",\
        "(.	c #EEEF00",\
        "_.	c #B9B900",\
        ":.	c #666600",\
        "<.	c #9C9C00",\
        "[.	c #F5F600",\
        "}.	c #EEEE00",\
        "|.	c #ACAC00",\
        "1.	c #363600",\
        "2.	c #1E1E00",\
        "3.	c #4A4A00",\
        "4.	c #F4F400",\
        "5.	c #F3F300",\
        "6.	c #B2B300",\
        "7.	c #A9A900",\
        "8.	c #DADA00",\
        "9.	c #F2F200",\
        "0.	c #AEAF00",\
        "a.	c #474700",\
        "b.	c #ABAB00",\
        "c.	c #FAFA00",\
        "d.	c #FAFB00",\
        "e.	c #AAAA00",\
        "f.	c #656500",\
        "g.	c #1B1B00",\
        "h.	c #565600",\
        "i.	c #ACAD00",\
        "j.	c #E7E700",\
        "k.	c #FEFF00",\
        "l.	c #F5F500",\
        "m.	c #8D8D00",\
        "n.	c #414100",\
        "o.	c #5A5A00",\
        "p.	c #C6C600",\
        "q.	c #F0F100",\
        "r.	c #343400",\
        "s.	c #BCBC00",\
        "t.	c #F2F300",\
        "u.	c #E9E900",\
        "v.	c #7E7E00",\
        "w.	c #010100",\
        "x.	c #3B3B00",\
        "y.	c #BEBE00",\
        "z.	c #626200",\
        "A.	c #1D1E00",\
        "B.	c #313100",\
        "C.	c #A8A900",\
        "D.	c #E4E400",\
        "E.	c #C2C300",\
        "F.	c #6F6F00",\
        "G.	c #272700",\
        "H.	c #686800",\
        "I.	c #B3B300",\
        "J.	c #E5E500",\
        "K.	c #F9F900",\
        "L.	c #F1F200",\
        "M.	c #BBBB00",\
        "N.	c #7B7C00",\
        "O.	c #CBCC00",\
        "P.	c #C8C800",\
        "Q.	c #CECE00",\
        "R.	c #E3E400",\
        "S.	c #FDFE00",\
        "T.	c #7E7F00",\
        "U.	c #414200",\
        "V.	c #525200",\
        "W.	c #9D9E00",\
        "X.	c #E6E600",\
        "Y.	c #333300",\
        "Z.	c #999900",\
        "`.	c #C0C000",\
        " +	c #7C7C00",\
        ".+	c #141500",\
        "++	c #E4E500",\
        "@+	c #727200",\
        "#+	c #404100",\
        "$+	c #505000",\
        "%+	c #979700",\
        "&+	c #BABA00",\
        "*+	c #959600",\
        "=+	c #E1E000",\
        "-+	c #DBDB00",\
        ";+	c #FDFC00",\
        ">+	c #393900",
        ",+	c #9E9E00",\
        "'+	c #B4B400",\
        ")+	c #020200",\
        "!+	c #969600",\
        "~+	c #E0E000",\
        "{+	c #6A6B00",\
        "]+	c #959500",\
        "^+	c #939300",\
        "/+	c #4A4B00",\
        "(+	c #D7D700",\
        "_+	c #797A00",\
        ":+	c #EBEB00",\
        "<+	c #E6E700",\
        "[+	c #646400",\
        "}+	c #B0B000",\
        "|+	c #D1D100",\
        "1+	c #D2D200",\
        "2+	c #9C9D00",\
        "3+	c #3A3B00",\
        "4+	c #AFB000",\
        "5+	c #BDBD00",\
        "6+	c #787800",\
        "7+	c #202000",\
        "8+	c #ADAE00",\
        "9+	c #E8E800",\
        "0+	c #BCBD00",\
        "a+	c #696900",\
        "b+	c #1F1F00",\
        "c+	c #585800",\
        "d+	c #A6A600",\
        "e+	c #ECEC00",\
        "f+	c #B6B600",\
        "g+	c #676700",\
        "h+	c #B0B100",\
        "i+	c #5D5D00",\
        "j+	c #A9AA00",\
        "k+	c #AFAF00",
        "l+	c #A2A300",\
        "m+	c #B5B600",\
        "n+	c #545500",\
        "o+	c #ECED00",\
        "p+	c #505100",\
        "q+	c #121200",\
        "                                                      . . . . . .                                                               ",\
        "                                                    . . . . . .                                                                 ",\
        "                                                  . . . . . .                                                                   ",\
        "                                                . . . . . .                                                                     ",\
        "                                              . . . . . .                                                                       ",\
        "                                            . . . . . .                                                                         ",\
        "                                          . . . . . .                                                                           ",\
        "                    . .                 . . . . . .                                                                             ",\
        "                  . . . . . . . . . . . . . . . .                                                                               ",\
        "                  . . . . . . . . . . . . . . .                                                                                 ",\
        "                  . . . . . . . . . . . . . .                                                                                   ",\
        "                    . . . . . . . . . . . .                                                                                     ",\
        "                    . . . . . . . . . . . .                                                                                     ",\
        "                    . . . . . . . . . . . .                                                                                     ",\
        "                    . . . . . . . . . . . .                                                                               + @   ",\
        "                    . . . . . . . . . . . .                                                                             # $ % & ",\
        "                    . . . . . . . . . . . .                                                                           * = - ; > ",\
        "                  . . . . . . . . . . . . . .                                                                       , ' ) ! ~ { ",\
        "                . . . . . . . . . . . . . . . .                                                                   ] ^ / ( _ : < ",\
        "              . . . . . . . . . . . . . . . . . .                                                               [ } | 1 _ : 2 3 ",\
        "            . . . . . .                 . . . . . .                                                           [ 4 5 ( _ 6 7 8 [ ",\
        "          . . . . . . .                   . . . . . .                                                       9 4 0 ( _ a b c d   ",\
        "        . . . . . . .                       . . . . . .                                                   e f g ( _ h i j k     ",\
        "      . . . . . . .                           . . . . . .                                             [ l > 5 m _ h n o e       ",\
        "    . . . . . . .                               . . . . . .                                         [ p q r ~ _ h s t u         ",\
        "  . . . . . . .                                   . . . .                                         [ v w | 1 _ h x y z           ",\
        ". . . . . . .                                       . . .                                       [ A B C 1 _ D s E F             ",\
        ". . . . . .                                                                                   [ G H I 1 _ J K L M               ",\
        ". . . . .                                                                                   [ N H O 1 P Q R L [                 ",\
        ". . . .                                                               S [                 [ T B U m P V i W [                   ",\
        ". . .                                                               X Y Z d               ` w  .m _ V n L [                     ",\
        ".                                                                 ..+.@.#.$.%.          , &.*.P _ =.-.;.[                       ",\
        "                                                                F >.,._ '.).!.[ ~.{.].^./.(.P _ J _.:.[                         ",\
        "                                                              [ e <.[._ _ }.|.Z 1.2.3.<.4._ _ 5.6.A [                           ",\
        "                                                                ] ..7.V P _ V 5 I 8.r J _ _ 9.0.:.[                             ",\
        "                                                                  [ a.b.,.P 1 c.d.( 1 P _ [.e.f.g.                              ",\
        "                                                                    [ h.i.j.m k._ _ _ _ _ l.m.n.[                               ",\
        "                                                                      [ o.p.l._ _ _ _ _ _ q.c r.                                ",\
        "                                                                      [ d s.t._ _ _ _ _ _ u.v.1.                                ",\
        "                                                                      w.x.s l._ _ _ _ _ 1 y.z.A.                                ",\
        "                                                                        B.C.D.m _ _ _ _ ~ E.F.G.                                ",\
        "                                                                        [ H.I.J.K.: K.m _ L.M.N.1.                              ",\
        "                                                                          [ :.b.O.P.Q.R.S._ L.s.T.,                             ",\
        "                                                                            [ U.V.u N W.X.1 _ 9.y.T.@                           ",\
        "                                                                              [ [ [ [ Y.Z. .( _ t.`. +S [ [ .+                  ",\
        "                                                                                        [ Z.++( _ D K @+#+X $+w.+               ",\
        "                                                                                          [ %+0 1 _ l.; s.M.&+p o.F [           ",\
        "                                                                                            [ *+r m _ _ S.m m =+X.w h.[         ",\
        "                                                                                              F %+-+~ _ _ _ _ ;+_ L.b.v [       ",\
        "                                                                                                >+,+5 P _ _ _ _ _ ( '+G [       ",\
        "                                                                                                )+!+~+_ _ _ _ _ _ _ s.{+[       ",
        "                                                                                                w.]+O _ _ _ _ _ _ U ^+/+        ",\
        "                                                                                                [ ^ -+k._ _ _ _ _ (+_+~.        ",\
        "                                                                                              [ !.I.:+_ _ m m g <+6.H.[         ",\
        "                                                                                            [ [+}+g ~ S.V |+1+> 2+Y 3+          ",\
        "                                                                                          [ G 4+J.m S.:+5+6+v.%.7+[             ",\
        "                                                                                        [ o.8+9+m P :+0+a+[ %.                  ",\
        "                                                                                      w.$+e.:+P P :+&+;.[                       ",\
        "                                                                                    b+c+d+V _ P e+f+g+[                         ",\
        "                                                                                  ~.N B 4._ _ '.h+z.[                           ",\
        "                                                                                [ i+e.4._ _ Q j+o.[                             ",\
        "                                                                              [ v k+D _ _ 9.l+Z [                               ",\
        "                                                                            [ H.m+q._ _ L.q n+[                                 ",\
        "                                                                          [ W M.V _ P o+,+p+q+                                  "])

    def textEnglish(self):
        buttonText = "Position an oblique dimension chain"
        helpText = "Position an oblique dimension chain"+ "\n"\
                   "- select some  parallel oblique measures"+ "\n"\
                   "- the first selected maesure defines the position"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Positioniere eine schräge Kettenbemaßung"
        helpText = "Positioniere eine schräge Kettenbemaßung"+ "\n"\
                   "- wähle mehrere parallele schräge Maße"+ "\n"\
                   "- das Erste bestimmt die Position"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Allinea dimensioni oblique"
        helpText = "Dispone sulla stessa linea le dimensioni oblique selezionate:"+ "\n"\
                   "- seleziona due o più dimensioni"+"\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Aligner les dimensions obliques"
        helpText = "Réorganise les dimensions obliques sélectionnées sur la même ligne:"+ "\n"\
                   "- sélectionnez deux ou plusieurs dimensions"+"\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Alinear dimensiones oblicuas"
        helpText = "Organiza las dimensiones oblicuas seleccionadas en la misma línea:"+ "\n"\
                   "- seleccione dos o más dimensiones"+"\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # positionObliqueDimChain
        Selected = gui.Selection.getSelectionEx()
        ObliqueDimList = [Select.Object for Select in Selected if Select.Object.Type == 'Distance']
        if len(ObliqueDimList) > 1:
            DimPoints = ObliqueDimList[0].getArrowPositions()
            DimPos = app.Vector(ObliqueDimList[0].X,ObliqueDimList[0].Y,0)
            Direction = DimPoints[0].sub(DimPoints[1])
            Normal = app.Vector(Direction.y,-Direction.x,0)
            CarrierLine = Part.Line(DimPos,DimPos.add(Direction))
            for Dimension in ObliqueDimList:
                DimPos = app.Vector(Dimension.X,Dimension.Y,0)
                NormalLine = Part.Line(DimPos,DimPos.add(Normal))
                Ip = CarrierLine.intersect(NormalLine)
                Dimension.X, Dimension.Y = Ip[0].X,Ip[0].Y

class cascadeObliqueDimension:
    '''Cascade oblique dimension'''
    Icon = QtGui.QPixmap([  \
        "64 64 356 2",\
        "  	c None",\
        ". 	c #1C1C00",\
        "+ 	c #949400",\
        "@ 	c #D6D600",\
        "# 	c #F6F600",\
        "$ 	c #F5F500",\
        "% 	c #CACA00",\
        "& 	c #919100",\
        "* 	c #585800",\
        "= 	c #000000",\
        "- 	c #707100",\
        "; 	c #CBCB00",\
        "> 	c #F3F300",\
        ", 	c #FCFC00",\
        "' 	c #DBDB00",\
        ") 	c #9A9A00",\
        "! 	c #515100",\
        "~ 	c #1D1D00",\
        "{ 	c #9F9F00",\
        "] 	c #F7F800",\
        "^ 	c #F2F200",\
        "/ 	c #C1C100",\
        "( 	c #888800",\
        "_ 	c #767600",\
        ": 	c #D0D000",\
        "< 	c #FBFB00",\
        "[ 	c #D3D300",\
        "} 	c #8B8B00",\
        "| 	c #474700",\
        "1 	c #3F3F00",\
        "2 	c #3A3A00",\
        "3 	c #535300",\
        "4 	c #A7A700",\
        "5 	c #E1E100",\
        "6 	c #FAFA00",\
        "7 	c #BDBD00",\
        "8 	c #7C7C00",\
        "9 	c #424200",\
        "0 	c #878700",\
        "a 	c #D5D500",\
        "b 	c #F9F900",\
        "c 	c #CFCF00",\
        "d 	c #7E7E00",\
        "e 	c #2A2A00",\
        "f 	c #6F6F00",\
        "g 	c #6C6C00",\
        "h 	c #5E5E00",\
        "i 	c #ACAD00",\
        "j 	c #E9E900",\
        "k 	c #FDFD00",\
        "l 	c #F1F100",\
        "m 	c #B7B700",\
        "n 	c #676700",\
        "o 	c #303000",\
        "p 	c #8D8D00",\
        "q 	c #DDDD00",\
        "r 	c #FEFE00",\
        "s 	c #CDCD00",\
        "t 	c #696900",\
        "u 	c #838300",\
        "v 	c #CECE00",\
        "w 	c #D1D100",\
        "x 	c #414100",\
        "y 	c #B5B500",\
        "z 	c #EBEB00",\
        "A 	c #ADAD00",\
        "B 	c #5F5F00",\
        "C 	c #969600",\
        "D 	c #E7E700",\
        "E 	c #FFFF00",\
        "F 	c #C5C500",\
        "G 	c #606000",\
        "H 	c #505000",\
        "I 	c #B8B800",\
        "J 	c #EFEF00",\
        "K 	c #F4F400",\
        "L 	c #8E8E00",\
        "M 	c #494900",\
        "N 	c #BEBE00",\
        "O 	c #E3E300",\
        "P 	c #A0A000",\
        "Q 	c #5A5A00",\
        "R 	c #555500",\
        "S 	c #A2A200",\
        "T 	c #F0F000",\
        "U 	c #F0F100",\
        "V 	c #B7B800",\
        "W 	c #5B5B00",\
        "X 	c #DEDE00",\
        "Y 	c #EFEE00",\
        "Z 	c #C4C400",\
        "` 	c #8A8A00",\
        " .	c #4A4A00",\
        "..	c #171700",\
        "+.	c #7F7F00",\
        "@.	c #C9C900",\
        "#.	c #D9D900",\
        "$.	c #545400",\
        "%.	c #B3B300",\
        "&.	c #EEEE00",\
        "*.	c #E8E800",\
        "=.	c #6D6D00",\
        "-.	c #B2B200",\
        ";.	c #E2E200",\
        ">.	c #F7F700",\
        ",.	c #818100",\
        "'.	c #333300",\
        ").	c #1B1B00",\
        "!.	c #929200",\
        "~.	c #C0C000",\
        "{.	c #E0E000",\
        "].	c #A6A600",\
        "^.	c #575700",\
        "/.	c #777700",\
        "(.	c #B9B900",\
        "_.	c #E6E600",\
        ":.	c #F8F800",\
        "<.	c #E4E400",\
        "[.	c #797900",\
        "}.	c #242400",\
        "|.	c #484800",\
        "1.	c #9E9E00",\
        "2.	c #4F4F00",\
        "3.	c #C8C800",\
        "4.	c #FBFA00",\
        "5.	c #A09F00",\
        "6.	c #3A3B00",\
        "7.	c #5C5C00",\
        "8.	c #A4A400",\
        "9.	c #C6C600",\
        "0.	c #858500",\
        "a.	c #444400",\
        "b.	c #2E2E00",\
        "c.	c #D8D800",\
        "d.	c #959500",\
        "e.	c #464600",\
        "f.	c #383800",\
        "g.	c #AEAE00",\
        "h.	c #979800",\
        "i.	c #313100",\
        "j.	c #525200",\
        "k.	c #BABB00",\
        "l.	c #707000",\
        "m.	c #373700",\
        "n.	c #D2D200",\
        "o.	c #808000",\
        "p.	c #626200",\
        "q.	c #202000",\
        "r.	c #ABAB00",\
        "s.	c #FEFF00",\
        "t.	c #A5A500",\
        "u.	c #868500",\
        "v.	c #C5C400",\
        "w.	c #646400",\
        "x.	c #8C8C00",\
        "y.	c #DFDF00",\
        "z.	c #FCFD00",\
        "A.	c #ECED00",\
        "B.	c #B0B000",\
        "C.	c #4B4B00",\
        "D.	c #9C9C00",\
        "E.	c #BABA00",\
        "F.	c #4E4E00",\
        "G.	c #F9FA00",\
        "H.	c #DADA00",\
        "I.	c #8F8F00",\
        "J.	c #727200",\
        "K.	c #999900",\
        "L.	c #454500",\
        "M.	c #3B3B00",\
        "N.	c #A9A900",\
        "O.	c #CCCC00",\
        "P.	c #979700",\
        "Q.	c #515200",\
        "R.	c #B1B100",\
        "S.	c #AFAF00",\
        "T.	c #EAEA00",\
        "U.	c #CDCE00",\
        "V.	c #D0D100",\
        "W.	c #E5E500",\
        "X.	c #E3E400",\
        "Y.	c #B6B700",\
        "Z.	c #404000",\
        "`.	c #868600",\
        " +	c #3D3D00",\
        ".+	c #FDFE00",\
        "++	c #4D4C00",\
        "@+	c #898900",\
        "#+	c #434300",\
        "$+	c #D4D400",\
        "%+	c #EAEB00",\
        "&+	c #A3A400",\
        "*+	c #D8D900",\
        "=+	c #717100",\
        "-+	c #D7D700",\
        ";+	c #FBFC00",\
        ">+	c #BCBC00",\
        ",+	c #EFF000",\
        "'+	c #2D2D00",\
        ")+	c #FAF900",\
        "!+	c #818200",\
        "~+	c #747400",\
        "{+	c #B6B600",\
        "]+	c #C7C700",\
        "^+	c #A8A800",\
        "/+	c #A1A100",\
        "(+	c #868700",\
        "_+	c #353500",\
        ":+	c #BDBE00",\
        "<+	c #757500",\
        "[+	c #636300",\
        "}+	c #6B6B00",\
        "|+	c #111100",\
        "1+	c #585900",\
        "2+	c #F1F200",\
        "3+	c #D5D600",\
        "4+	c #C7C800",\
        "5+	c #DFDE00",\
        "6+	c #2B2B00",\
        "7+	c #282800",\
        "8+	c #4C4D00",\
        "9+	c #FF0000",\
        "0+	c #1F1F00",\
        "a+	c #656400",\
        "b+	c #666600",\
        "c+	c #040400",\
        "d+	c #939300",\
        "e+	c #656500",\
        "f+	c #B4B400",\
        "g+	c #D2D300",\
        "h+	c #1E1E00",\
        "i+	c #635200",\
        "j+	c #929000",\
        "k+	c #F2F300",\
        "l+	c #EEEF00",\
        "m+	c #C0C100",\
        "n+	c #777800",\
        "o+	c #323200",\
        "p+	c #6A6A00",\
        "q+	c #BFBF00",\
        "r+	c #FE0000",\
        "s+	c #DE0000",\
        "t+	c #AC5900",\
        "u+	c #C6B000",\
        "v+	c #EEEA00",\
        "w+	c #F8F900",\
        "x+	c #5D5D00",\
        "y+	c #212100",\
        "z+	c #F20000",\
        "A+	c #DF4E00",\
        "B+	c #EDAC00",\
        "C+	c #F9E700",\
        "D+	c #E5E400",\
        "E+	c #757600",\
        "F+	c #090900",\
        "G+	c #797A00",\
        "H+	c #161600",\
        "I+	c #FC1600",\
        "J+	c #FD6900",\
        "K+	c #EBB100",\
        "L+	c #B4A800",\
        "M+	c #343400",\
        "N+	c #F90D00",\
        "O+	c #C23D00",\
        "P+	c #734200",\
        "Q+	c #727300",\
        "R+	c #CECF00",\
        "S+	c #8B8A00",\
        "T+	c #FE0200",\
        "U+	c #EB1800",\
        "V+	c #BD2900",\
        "W+	c #C3C300",\
        "X+	c #CCCD00",\
        "Y+	c #6E6E00",\
        "Z+	c #737300",\
        "`+	c #FC0100",\
        " @	c #B8B900",\
        ".@	c #ECEC00",\
        "+@	c #828200",\
        "@@	c #909100",\
        "#@	c #262600",\
        "$@	c #B3B200",\
        "%@	c #DCDC00",\
        "&@	c #A5A600",\
        "*@	c #2F2F00",\
        "=@	c #838400",\
        "-@	c #EEED00",\
        ";@	c #A6A700",\
        ">@	c #4C4C00",\
        ",@	c #989800",\
        "'@	c #C3C400",\
        ")@	c #3E3E00",\
        "!@	c #3C3C00",\
        "~@	c #7B7B00",\
        "{@	c #F6F700",\
        "]@	c #636400",\
        "^@	c #565600",\
        "/@	c #888900",\
        "(@	c #C30000",\
        "_@	c #7D6100",\
        ":@	c #BCBB00",\
        "<@	c #E4E500",\
        "[@	c #595900",\
        "}@	c #E50000",\
        "|@	c #CF5D00",\
        "1@	c #E9CD00",\
        "2@	c #FAF800",\
        "3@	c #B9BA00",\
        "4@	c #848400",\
        "5@	c #787800",\
        "6@	c #DFE000",\
        "7@	c #676800",\
        "8@	c #F60000",\
        "9@	c #F23A00",\
        "0@	c #FCA200",\
        "a@	c #F1D900",\
        "b@	c #C1BE00",\
        "c@	c #FD4D00",\
        "d@	c #D49400",\
        "e@	c #8D7E00",\
        "f@	c #434500",\
        "g@	c #B1B200",\
        "h@	c #FB0000",\
        "i@	c #C71900",\
        "j@	c #890000",\
        "k@	c #F40000",\
        "l@	c #1A1A00",\
        "m@	c #0C0C00",
        "n@	c #E2E300",\
        "o@	c #8F9000",\
        "p@	c #E6E700",\
        "q@	c #ACAC00",\
        "r@	c #AAAA00",\
        "s@	c #C2C200",\
        "t@	c #7D7D00",\
        "u@	c #9D9D00",\
        "v@	c #5A1800",\
        "w@	c #837F00",\
        "x@	c #232400",\
        "y@	c #F80000",\
        "z@	c #843300",\
        "A@	c #CCBC00",\
        "B@	c #5E5F00",\
        "C@	c #E80E00",\
        "D@	c #F78B00",\
        "E@	c #FBDF00",\
        "F@	c #DDDB00",\
        "G@	c #FD4900",\
        "H@	c #E79600",\
        "I@	c #AA9A00",\
        "J@	c #646200",\
        "K@	c #FD0E00",\
        "L@	c #E14B00",\
        "M@	c #915C00",\
        "N@	c #EF0000",\
        "O@	c #B80000",\
        "                                      . + @ # $ % & *               = - ; > , ' ) !                                             ",\
        "                                        ~ { ' ] ^ / ( !               = _ : $ < [ } |                                           ",\
        "                    1 2                   3 4 5 6 ^ 7 8 9               = 0 a b < c d e                                         ",\
        "                  = f g 9                   h i j k l m n                 o p q r , s t =                                       ",\
        "                = u v w + x                   t y l k z A B                 ! C D E # F G                                       ",\
        "                H I J K s L M                   f N > < O P Q                 R S T E U V W                                     ",\
        "                1 P X b Y Z `  .                ..+.@.^ b #.) $.                h %.&.k *.A W                                   ",\
        "                  =.-.;.>.j 7 ,.'.                ).!.: > # w C 3                 t ~.&.< {.].^.                                ",\
        "                    /.(._.:.<.y [.}.=               |.1.@ # $ ; !.2.              = +.3.^ 4.' 5.R                               ",\
        "                      ,.~.z 6 ;.i =.* $.R 6.          7.8.X 6 K 9.0.a.              b.` c >.< c.d.e.                            ",\
        "                      f.u 3.^ , {.g.1.) h.f i.          j.4 *.k ^ k.l.                m.` #., 6 n.,.b.                          ",\
        "                        = o.[ b E , k < >.%.p.            q.r.> s.T t.$.                = u.j E :.v.w.                          ",\
        "                          o x.y.z.s.s.s.E A.B.g             C.y U k D D.9                 f.C j r ^ E.B                         ",\
        "                            F.s G.E E E E , H.I.C.            J.~.T < {.K.L.L.M.x           Q N.D , z y Q                       ",\
        "                            1 O.G.E E E E s._.P.Q.            m.x.@.> b ' R.%.S.A B           _ I T.< _.-.B                     ",\
        "                            a.U.6 E E E E E *.K.$.              R C V.:.:.W.D W.X.Y.^.        Z.`.~.T < ;.A Q                   ",\
        "                             +; b E E E E s._.C F.                3 + X..+k .+k k T.r.F.        ++@+3.>.< q P C.                ",\
        "                          #+_ $+6 r r r r r %+&+h                 = t *+k E E E E E 5 =+=         '.( -+G.:.[ L 2.              ",\
        "                          8 7 T ;+# $ K K :.K >+l.                = ) ,+r E E E E E > @+=           '+L y.)+$ 3.!+| j.F.C.      ",\
        "                        ~+{+T., A.V.% ]+]+#.q ^+p.                = /+^ r E E E E E ^ (+=             _++ 5 < ^ :+J.[.<+=+*     ",\
        "                      [+g.<.< J (.~+W $.$.,.I.}+                  |+t.> r E E E E E T ,.=               1+&+<.z.2+n.3+n.4+d..   ",\
        "                    a.8.5+b T >+,. ._+6+7+8+Q                     = { l r E E E E E > @+=                 /.B.j , :.b :.> 3+x.= ",\
        "9+                0+K.#.>.> Z ` $.                                a+9.:.s.E E E k E n.b+=                 |.!+n., E E E r J %.c+",\
        "9+9+            | d+n.$ $ w C *                                 e+f+z k 2+l &.T g+]+d+M.                    t 3.< E E E E # ~.h+",\
        "9+9+9+        i+j+% k+>.H.t.b+                                p.N.;.< l+m+E.y (.& n+o+                      p+3.< E E E E # q+|+",\
        "9+9+9+9+9+r+s+t+u+v+w+{.S.J.                                x+{ ' 6 T 9.t C.2  .y+=                         =.% , E E E E $ >+= ",\
        "9+9+9+9+9+9+z+A+B+C+D+f+E+                                ! C -+)+K O.u F+                                M.G+c , E E E r 2+{+H+",\
        "9+9+9+9+9+9+r+I+J+K+L+f                                 M+` a 6 6 [ x.9                                   w.&+W.k k k 6 > H.& = ",\
        "9+9+9+9+9+9+9+9+N+O+P+                                = Q+R+:.E X S+9                                   | ` q k , z &.-+].+.o   ",\
        "  9+9+9+9+9+9+9+T+U+V+                                t W+> E D d.H                                   o+_ a < :.X+Y+Z+n F.x     ",\
        "9+9+9+9+9+9+9+9+9+`+                                t  @.@;+D ].h                                   x +@; # >.@ @@#@m.6+=       ",\
        "9+9+9+9+9+9+9+9+9+9+                              b+$@_.6 *.y =.                                  e.@+9.^ b %@&@Q               ",\
        "9+9+9+9+9+9+9+9+9+9+                            n g.5 b .@~.o.*@                                9 =@/ -@, ;.S.f                 ",\
        "9+9+9+9+9+9+9+9+9+9+9+                        h ;@X 6 ^ ]+x.>@                                  ~+I j , j f+Z+                  ",\
        "  9+9+9+9+9+9+9+9+9+9+9+                    >@,@#.b :.c p 2.                                  Q 4 W., J (.b+                    ",\
        "  9+9+9+9+9+9+9+9+9+9+9+9+                |.+@v >., q @+o+                                  ! `.{.r $ '@)@                      ",\
        "              9+9+9+9+9+9+                =+W+K z.5 L M+                                  !@~@#.s.{@; ]@                        ",\
        "                9+9+9+9+9+9+            b+7 J < 5 1.^@                                  i.0.$+< :.n./@M+                        ",\
        "                  9+9+9+9+9+9+9+9+r+(@_@:@z 6 <@B.Z+                                  6+`.v # < *+) [@                          ",\
        "                    9+9+9+9+9+9+9+9+}@|@1@2@T.3@4@                                    5@]+l k 6@P 7@                            ",\
        "                    9+9+9+9+9+9+9+9+8@9@0@a@b@@+$.                                  W >+&.k _.S w.                              ",\
        "                      9+9+9+9+9+9+9+9+9+c@d@e@f@                                  3 ;@j k .@g@|                                 ",\
        "                        9+9+9+9+9+9+9+9+h@i@j@                                  [+P.O k J ~.^@                                  ",\
        "                        9+9+9+9+9+9+9+9+9+8@k@                                Q P.X r > 3.~+                                    ",\
        "                        9+9+9+9+9+9+9+9+9+9+9+                               +L #.r b R+o.l@                                    ",\
        "                        9+9+9+9+9+9+9+9+9+9+9+                            m@d [ b E @ +@M.                                      ",\
        "                        9+9+9+9+9+9+9+9+9+9+9+                            n ; # E q +@H                                         ",\
        "                        9+9+9+9+9+9+9+9+9+9+9+                          j.N ^ k n@o@L.                                          ",\
        "                          9+9+9+9+9+9+9+9+9+9+9+                      g -..@, p@q@x                                             ",\
        "                          9+9+9+9+9+9+9+9+9+9+9+9+                  J.S.D , T.E.}+                                              ",\
        "                                      9+9+9+9+9+9+9+              t r@5 k ,+s@t@                                                ",\
        "                                        9+9+9+9+9+9+            3 u@%@< >.3.+.*@                                                ",\
        "                                          9+9+9+9+9+9+9+9+9+9+v@w@@ 6 , w J.x@                                                  ",\
        "                                            9+9+9+9+9+9+9+9+y@z@A@)+s.#.B@=                                                     ",\
        "                                              9+9+9+9+9+9+9+9+C@D@E@F@@@!@                                                      ",\
        "                                              9+9+9+9+9+9+9+9+h@G@H@I@J@                                                        ",\
        "                                                9+9+9+9+9+9+9+9+K@L@M@                                                          ",\
        "                                                9+9+9+9+9+9+9+9+r+N@O@                                                          ",\
        "                                                9+9+9+9+9+9+9+9+9+r+                                                            ",\
        "                                                9+9+9+9+9+9+9+9+9+9+                                                            ",\
        "                                                9+9+9+9+9+9+9+9+9+9+                                                            ",\
        "                                                9+9+9+9+9+9+9+9+9+9+9+                                                          ",\
        "                                                  9+9+9+9+9+9+9+9+9+9+                                                          ",\
        "                                                    9+9+9+9+9+9+9+9+                                                            "])

    def textEnglish(self):
        buttonText = "Cascade oblique dimensions"
        helpText = "Cascade oblique dimensions"+ "\n"\
                   "- select the cascading distance"+ "\n"\
                   "- select some  parallel oblique measures"+ "\n"\
                   "- the first selected maesure defines the position"+ "\n"\
                   "- click this button"
        return(buttonText,helpText)

    def textGerman(self):
        buttonText = "Kaskadiere schräge Bemaßungen"
        helpText = "Kaskadiere schräge Bemaßungen"+ "\n"\
                   "- stelle den Abstand der Kaskadierung ein"+ "\n"\
                   "- wähle mehrere parallele schräge Maße"+ "\n"\
                   "- das Erste bestimmt die Position"+ "\n"\
                   "- drücke diesen Knopf"
        return(buttonText,helpText)

    def textItalian(self):
        buttonText = "Distanziamento dimensioni oblique"
        helpText = "Distanzia (ortogonalmente), al valore impostato, le quote oblique selezionate:"+ "\n"\
                   "- impostare Valore distanziamento"+ "\n"\
                   "- selezionare due o più quote oblique"+ "\n"\
                   "- fare clic su questo pulsante"
        return(buttonText,helpText)

    def textFrench(self):
        buttonText = "Espacement des dimensions obliques"
        helpText = "Espaces (orthogonalement), à la valeur définie, les dimensions obliques sélectionnées:"+ "\n"\
                   "- définir Valeur d'espacement"+ "\n"\
                   "- sélectionnez au moins deux dimensions obliques"+ "\n"\
                   "- cliquez sur ce bouton"
        return(buttonText,helpText)

    def textSpanish(self):
        buttonText = "Espaciado de dimensión oblicuas"
        helpText = "Espacios (ortogonalmente), en el valor establecido, las dimensiones oblicuas seleccionadas:"+ "\n"\
                   "- establecer Valor de espaciado"+ "\n"\
                   "- seleccione dos o más dimensiones oblicuas"+ "\n"\
                   "- haga clic en este botón"
        return(buttonText,helpText)

    def activated(self): # cascadeObliqueDimension
        Selected = gui.Selection.getSelectionEx()
        ObliqueDimList = [Select.Object for Select in Selected if Select.Object.Type == 'Distance']
        if len(ObliqueDimList) > 1:
            DimPoints = ObliqueDimList[0].getArrowPositions()
            DimPos = app.Vector(ObliqueDimList[0].X,ObliqueDimList[0].Y,0)
            Direction = DimPoints[0].sub(DimPoints[1])
            Normal = app.Vector(Direction.y,-Direction.x,0)
            CarrierLine = Part.Line(DimPos,DimPos.add(Direction))
            DistLine = Part.Line(app.Vector(),Normal)
            Ip = CarrierLine.intersect(DistLine)
            Delta = app.Vector(Ip[0].X,Ip[0].Y,Ip[0].Z).normalize()*DimAttrib.getDimLineDistance()
            for i,Dimension in enumerate(ObliqueDimList):
                DimPos = app.Vector(Dimension.X,Dimension.Y,0)
                NormalLine = Part.Line(DimPos,DimPos.add(Normal))
                Ip = CarrierLine.intersect(NormalLine)
                Dimension.X, Dimension.Y = Ip[0].X+Delta.x*i,Ip[0].Y+Delta.y*i

Attrib = LineAttributes()
DimAttrib = DimensionAttributes()
Lang = translate()
if __name__ == "__main__":
    DialogContainer().show()
