FreeCAD-Doc/localwiki/Macro_CartoucheFC_Full-it.html
2018-07-19 18:47:02 -05:00

1235 lines
62 KiB
HTML

<html><head><title>Macro CartoucheFC Full/it</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Macro CartoucheFC Full/it</h1></div>
<div id="mw-content-text" lang="it" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"><table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 10px;">
<tr>
<td class="ctTitle">
<h3><span class="mw-headline" id="CartoucheFC"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CartoucheFC_Full.png" class="image"><img alt="Macro CartoucheFC Full.png" src="32px-Macro_CartoucheFC_Full.png" width="32" height="18" srcset="/wiki/images/thumb/6/68/Macro_CartoucheFC_Full.png/48px-Macro_CartoucheFC_Full.png 1.5x, /wiki/images/thumb/6/68/Macro_CartoucheFC_Full.png/64px-Macro_CartoucheFC_Full.png 2x" /></a> CartoucheFC</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Descrizione
</th></tr>
<tr>
<td class="ctEven left">Questa macro è una applicazione completa che permette di compilare tutti i campi della tabella del foglio di disegno.
</td></tr>
<tr>
<th class="ctOdd">Autore
</th></tr>
<tr>
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">Mario52</a>
</td></tr>
<tr>
<th class="ctOdd">Link
</th></tr>
<tr>
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/it" title="Macros recipes/it">Esempi di macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/it" title="How to install macros/it">Come installare le Macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/it" title="Customize Toolbars/it">Personalizzare la barra degli strumenti</a>
</td></tr>
<tr>
<th class="ctOdd">Versione
</th></tr>
<tr>
<td class="ctEven macro-version">00.10
</td></tr>
<tr>
<th class="ctOdd">Data ultima modifica
</th></tr>
<tr>
<td class="ctEven macro-date">2017-02-15
</td></tr>
<tr>
<th class="ctOdd">
</th></tr>
<tr>
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#CartoucheFC"><span class="tocnumber">1</span> <span class="toctext">CartoucheFC</span></a></li>
<li class="toclevel-1 tocsection-1"><a href="#Uso"><span class="tocnumber">2</span> <span class="toctext">Uso</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Codice"><span class="tocnumber">3</span> <span class="toctext">Codice</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Ulteriori_informazioni"><span class="tocnumber">4</span> <span class="toctext">Ulteriori informazioni</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Revisione"><span class="tocnumber">5</span> <span class="toctext">Revisione</span></a></li>
</ul>
</div>
</td></tr>
</table>
<p><br />
</p><p>Questa macro è una applicazione completa che permette di compilare tutti i campi della tabella del foglio di disegno nel modello
</p><p>Scaricare i modelli dalla pagina <a href="https://www.freecadweb.org/wiki/index.php?title=Misc_templates_Full/it" title="Misc templates Full/it">Modelli vari completi</a>
</p><p>L'ordine di compilazione dei campi di testo è quello descritto nella figura seguente . I campi di data e ora sono separati da "spazio trattino spazio" " - " e costituiscono una unica riga di testo.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CartoucheFC_Full_00.png" class="image" title="CartoucheFC_Full"><img alt="CartoucheFC_Full" src="680px-Macro_CartoucheFC_Full_00.png" width="680" height="363" srcset="/wiki/images/2/23/Macro_CartoucheFC_Full_00.png 1.5x" /></a>
</p>
<h3><span class="mw-headline" id="Uso">Uso</span></h3>
<p><b>Nota: Alcuni caratteri come &amp; o $ non sono accettati, e forse anche altri caratteri speciali.</b>
</p><p>Se avete domande o volete aggiungere una funzione, potete contattarmi sul forum francese <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=12&amp;t=2049">Remplir cartouche</a>
</p>
<ul><li>La finestra rimane sovrapposta alle altre, questo permette di controllare la tabella senza uscire dal programma.</li>
<li>Copiare il codice in un file denominato <b>Macro_CartoucheFC_Full.FCMacro</b> e posizionarlo nella directory usuale delle macro.</li>
<li>Creare un foglio di disegno utilizzando il modulo Drawing di FreeCAD, poi avviare la macro <b>Macro_CartoucheFC_Full</b>.</li>
<li>All'avvio, il programma carica in memoria tutti i dati già presenti nella tabella del foglio (se è già stata compilata). Tutti i dati caricati sono resi automaticamente utilizzando il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;"> Memo</span> e rimangono in memoria fino alla chiusura del programma.</li>
<li>I pulsanti Data <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;"> D.</span> e Ora <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;"> H.</span> visualizzano la data e l'ora del sistema.</li></ul>
<dl><dd><ul><li>Il formato della data dipende dal simbolo del formato regionale selezionato: <b>EU</b> o <b>US</b>. Nel caso sia stata inserita manualmente una data la commutazione non avviene automaticamente, ma, quando si modifica il simbolo, è necessario cliccare nuovamente sui pulsanti data. Controllare prima della stampa.</li></ul></dd></dl>
<ul><li>Prima tutto selezionare vostra pagina di lavoro.</li>
<li>Scegliere il formato della pagina.</li>
<li>Il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Symbole EU</span> o US commuta il simbolo del verso della proiezione "Select your Symbol" visualizzato per impostazione predefinita. Compare il simbolo attivo. Fare clic sul pulsante e verificare sul foglio il simbolo attivo, cliccare una seconda volta per modificarlo.</li></ul>
<dl><dd><ul><li>La scelta di questo simbolo incide sul formato della data <b>EU = dd/MM/yyyy</b> e <b>US = MM/dd/yyyy</b>.</li>
<li><b>Attenzione</b>: questo comando non passa attraverso il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Apply</span>, ma commuta immediatamente il simbolo a ogni pressione del tasto. Controllare sempre sul foglio di lavoro se il simbolo attivo è quello corretto.</li></ul></dd></dl>
<ul><li>Il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Clean</span> cancella tutti i campi della tabella. È possibile ripristinare i dati originali utilizzando il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Memo</span>.</li>
<li>Il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Apply</span> salva tutti i campi della tabella nel foglio. È possibile ripristinare i dati originali utilizzando il pulsante <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Memo</span>, tranne il simbolo regionale che è indipendente e agisce in modo immediato.</li></ul>
<h3><span class="mw-headline" id="Codice">Codice</span></h3>
<p>L'icona per la vostra toolBar <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CartoucheFC_Full.png" class="image"><img alt="Macro CartoucheFC Full.png" src="Macro_CartoucheFC_Full.png" width="65" height="36" /></a>
</p><p>Macro_CartoucheFC_Full.FCMacro
</p>
<pre># -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) 2014 2016 2017 &lt;mario52&gt; *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* This software is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this macro; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
***************************************************************************
* WARNING! All changes in this file will be lost and *
* may cause malfunction of the program *
***************************************************************************
"""
#OS: Windows 10
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.16.6706 (Git)
#Build type: Release
#Branch: releases/FreeCAD-0-16
#Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
#Python version: 2.7.8
#Qt version: 4.8.7
#Coin version: 4.0.0a
#OCC version: 6.8.0.oce-0.17
__title__ = "Macro_CartoucheFC_Full"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__Wiki__ = "http://www.freecadweb.org/wiki/Macro_CartoucheFC_Full"
__version__ = "00.10"
__date__ = "15/02/2017"
__Requires__ = ("all version and freecad " +
" DESIGNED_BY, CREATION_DATE, CHECKED_BY, CHECK_DATE, SIZE, SCALE, WEIGHT, DRAWING_NUMBER, SHEET, " +
" TITLE, DESCRIPTION, COMPANY, COPYRIGHT, Note_A, Note_B, Note_C, Note_D, Note_E, Note_F, Note_G, Note_H, Note_I" )
__Template__ = " A3_Landscape_xx_FULL.svg, A3_Portrait_xx_FULL, A4_Landscape_xx_FULL.svg, A4_Portrait_xx_FULL"
__Template_Link__ = "http://www.freecadweb.org/wiki/index.php?title=Misc_templates_Full"
import PySide
from PySide import QtCore, QtGui
import Draft, Part, FreeCAD, math, PartGui, FreeCADGui
from math import sqrt, pi, sin, cos, asin
from FreeCAD import Base
def utf8(unio):
return unicode(unio).encode('UTF8')
global path
#path = FreeCAD.ConfigGet("AppHomePath")
path = FreeCAD.ConfigGet("UserAppData")
global PageActive &#160;; PageActive = "Select your page" # essais
#global PageActive &#160;; PageActive = "Page" # page active
global DESIGNED_BY &#160;; DESIGNED_BY = "" # lineEdit01 DESIGNED_BY
global MDESIGNED_BY &#160;; MDESIGNED_BY = "" #
global CREATION_DATE &#160;; CREATION_DATE = "" # lineEdit02 CREATION_DATE date
global MCREATION_DATE &#160;; MCREATION_DATE = "" #
global CREA_DATE &#160;; CREA_DATE = "" # lineEdit02h date
global MCREA_DATE &#160;; MCREA_DATE = "" #
global CREA_TIME &#160;; CREA_TIME = "" # lineEdit02h heure
global MCREA_TIME &#160;; MCREA_TIME = "" #
global CHECKED_BY &#160;; CHECKED_BY = "" # lineEdit03
global MCHECKED_BY &#160;; MCHECKED_BY = "" #
global CHECK_DATE &#160;; CHECK_DATE = "" # lineEdit04 date
global MCHECK_DATE &#160;; MCHECK_DATE = "" #
global CHEC_DATE &#160;; CHEC_DATE = "" # lineEdit04 date
global MCHEC_DATE &#160;; MCHEC_DATE = "" #
global CHEC_TIME &#160;; CHEC_TIME = "" # lineEdit04h heure
global MCHEC_TIME &#160;; MCHEC_TIME = "" #
global SIZE &#160;; SIZE = "" # lineEdit05
global MSIZE &#160;; MSIZE = "" #
global SCALE &#160;; SCALE = "" # lineEdit06
global MSCALE &#160;; MSCALE = "" #
global WEIGHT &#160;; WEIGHT = "" # lineEdit07
global MWEIGHT &#160;; MWEIGHT = "" #
global DRAWING_NUMBER &#160;; DRAWING_NUMBER = "" # lineEdit08
global MDRAWING_NUMBER&#160;; MDRAWING_NUMBER = "" #
global SHEET &#160;; SHEET = "" # lineEdit09
global MSHEET &#160;; MSHEET = "" #
global TITLE &#160;; TITLE = "" # textEdit_01
global MTITLE &#160;; MTITLE = "" #
global DESCRIPTION &#160;; DESCRIPTION = "" # textEdit_02
global MDESCRIPTION &#160;; MDESCRIPTION = "" #
global COMPANY &#160;; COMPANY = "" # textEdit_02b
global MCOMPANY &#160;; MCOMPANY = "" #
global COPYRIGHT &#160;; COPYRIGHT = "" # lineEdit_20
global MCOPYRIGHT &#160;; MCOPYRIGHT = "" #
global Note_A &#160;; Note_A = "" # lineEdit_10
global MNote_A &#160;; MNote_A = "" #
global Note_B &#160;; Note_B = "" # lineEdit_11
global MNote_B &#160;; MNote_B = "" #
global Note_C &#160;; Note_C = "" # lineEdit_12
global MNote_C &#160;; MNote_C = "" #
global Note_D &#160;; Note_D = "" # lineEdit_13
global MNote_D &#160;; MNote_D = "" #
global Note_E &#160;; Note_E = "" # lineEdit_14
global MNote_E &#160;; MNote_E = "" #
global Note_F &#160;; Note_F = "" # lineEdit_15
global MNote_F &#160;; MNote_F = "" #
global Note_G &#160;; Note_G = "" # lineEdit_16
global MNote_G &#160;; MNote_G = "" #
global Note_H &#160;; Note_H = "" # lineEdit_17
global MNote_H &#160;; MNote_H = "" #
global Note_I &#160;; Note_I = "" # lineEdit_18
global MNote_I &#160;; MNote_I = "" #
global SymbolSwitch &#160;; SymbolSwitch = 1 # 0=US 1=EU
global ui &#160;; ui = ""
def heure():
return QtCore.QTime().currentTime().toString('hh:mm:ss')
def dateEu():
return QtCore.QDate().currentDate().toString('dd/MM/yyyy') # forme euro
def dateUK():
return QtCore.QDate().currentDate().toString('yyyy/MM/dd') # forme UK
def dateUs():
return QtCore.QDate().currentDate().toString('MM/dd/yyyy') # forme US
def dateComp():
return QtCore.QDate().currentDate().toString('dddd d MMMM yyyy') # Retourne "dimanche 20 Juillet 77"
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
def errorDialog(msg):
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",msg)
diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # cette fonction met la fenetre en avant
diag.exec_()
def symbol_EU(depx, depy, scale): #symbol_EU =O
global PageActive
global ui
try:
page = App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0]
except Exception:
page = App.activeDocument().getObjectsByLabel(PageActive)[0]
if len(str(page))&#160;!= 2:
comP = []
nameL = []
if "Page" in (page.Name):
for ii in (page.Group):
if ((ii.Label) == "Symbol_EU") or ((ii.Label) == "Symbol_US")&#160;:
App.activeDocument().removeObject(ii.Name)
points=[FreeCAD.Vector(-7.5,0.0,0.0),FreeCAD.Vector(20.0,0.0,0.0)]
i = Draft.makeWire(points,closed=False,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
points=[FreeCAD.Vector(12.5,7.5,0.0),FreeCAD.Vector(12.5,-7.5,0.0)]
i = Draft.makeWire(points,closed=False,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
points=[FreeCAD.Vector(-5,2.5,0.0),FreeCAD.Vector(5.0,5.0,0.0),FreeCAD.Vector(5.0,-5.0,0.0),FreeCAD.Vector(-5.0,-2.5,0.0)]
i = Draft.makeWire(points,closed=True,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
pl=FreeCAD.Placement()
pl.Rotation.Q=(0.0,-0.0,-0.0,1.0)
pl.Base=FreeCAD.Vector(12.5,-0.0,0.0)
i = Draft.makeCircle(radius=2.5,placement=pl,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
i = Draft.makeCircle(radius=5.0,placement=pl,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
comp = Part.makeCompound(comP)
Part.show(comp)
App.ActiveDocument.ActiveObject.Label = "Symbol_EU"
obj = FreeCAD.ActiveDocument.ActiveObject
obj.ViewObject.LineColor = (0.0,0.0,0.0)
obj.ViewObject.Visibility = False
obj2 = Draft.makeDrawingView(obj, page)
obj2.X = depx
obj2.Y = depy
obj2.Scale = scale #0.8 # A3
obj2.Label = "Symbol_EU"
for i in nameL: App.activeDocument().removeObject(i)
App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0].addObject(obj)
App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0].addObject(obj2)
App.ActiveDocument.recompute()
else:
ui.pushButton05.setStyleSheet("background-color: red") # This function gives a color button
FreeCAD.Console.PrintError("Error selected page [ " + PageActive + " ]" + "\n")
def symbol_US(depx, depy, scale): #symbol_US O=
global PageActive
global ui
try:
page = App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0]
except Exception:
page = App.activeDocument().getObjectsByLabel(PageActive)[0]
if len(str(page))&#160;!= 2:
comP = []
nameL = []
if "Page" in (page.Name):
for ii in (page.Group):
if ((ii.Label) == "Symbol_EU") or ((ii.Label) == "Symbol_US")&#160;:
App.activeDocument().removeObject(ii.Name)
points=[FreeCAD.Vector(-7.5,0.0,0.0),FreeCAD.Vector(20.0,0.0,0.0)]
i = Draft.makeWire(points,closed=False,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
points=[FreeCAD.Vector(0.0,7.5,0.0),FreeCAD.Vector(0.0,-7.5,0.0)]
i = Draft.makeWire(points,closed=False,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
points=[FreeCAD.Vector(7.5,2.5,0.0),FreeCAD.Vector(17.5,5.0,0.0),FreeCAD.Vector(17.5,-5.0,0.0),FreeCAD.Vector(7.5,-2.5,0.0)]
i = Draft.makeWire(points,closed=True,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
pl=FreeCAD.Placement()
pl.Rotation.Q=(0.0,-0.0,-0.0,1.0)
pl.Base=FreeCAD.Vector(0.0,-0.0,0.0)
i = Draft.makeCircle(radius=2.5,placement=pl,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
i = Draft.makeCircle(radius=5.0,placement=pl,face=False,support=None)
comP.append(i.Shape)
nameL.append(i.Name)
comp = Part.makeCompound(comP)
Part.show(comp)
App.ActiveDocument.ActiveObject.Label = "Symbol_US"
obj = FreeCAD.ActiveDocument.ActiveObject
obj.ViewObject.LineColor = (0.0,0.0,0.0)
obj.ViewObject.Visibility = False
obj2 = Draft.makeDrawingView(obj, page)
obj2.X = depx
obj2.Y = depy
obj2.Scale = scale #0.8 # A3
obj2.Label = "Symbol_US"
for i in nameL: App.activeDocument().removeObject(i)
App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0].addObject(obj)
App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0].addObject(obj2)
App.ActiveDocument.recompute()
else:
ui.pushButton05.setStyleSheet("background-color: red") # This function gives a color button
FreeCAD.Console.PrintError("Error selected page [ " + PageActive + " ]" + "\n")
def memoEntree():
global MDESIGNED_BY, MCREATION_DATE, MCREA_DATE , MCREA_TIME, MCHECKED_BY, MCHECK_DATE
global MCHEC_DATE , MCHEC_TIME , MSIZE , MSCALE , MWEIGHT ,MDRAWING_NUMBER
global MSHEET , MTITLE , MDESCRIPTION, MCOMPANY , MCOPYRIGHT
global MNote_A, MNote_B, MNote_C, MNote_D, MNote_E, MNote_F, MNote_G, MNote_H, MNote_I
global PageActive
try:
page = App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0].Name
except Exception:
page = App.activeDocument().getObjectsByLabel(PageActive)[0]
try:
MDESIGNED_BY = App.activeDocument().getObject(page).EditableTexts[0] # lineEdit01 DESIGNED_BY
MCREATION_DATE = App.activeDocument().getObject(page).EditableTexts[1] # lineEdit02 CREATION_DATE date
MCREA_DATE = MCREA_TIME = MCHEC_DATE = MCHEC_TIME = ""
try:
MCREA_DATE = MCREATION_DATE.split(" - ")[0] # lineEdit02h date
except:
MCREA_DATE = MCREATION_DATE
try:
MCREA_TIME = MCREATION_DATE.split(" - ")[1] # lineEdit02h heure
except: None
MCHECKED_BY = App.activeDocument().getObject(page).EditableTexts[2] # lineEdit03
MCHECK_DATE = App.activeDocument().getObject(page).EditableTexts[3] # lineEdit04 date
try:
MCHEC_DATE = MCHECK_DATE.split(" - ")[0] # lineEdit04 date
except:
MCHEC_DATE = MCHECK_DATE
try:
MCHEC_TIME = MCHECK_DATE.split(" - ")[1] # lineEdit04h heure
except: None
MSIZE = App.activeDocument().getObject(page).EditableTexts[4] # lineEdit05
MSCALE = App.activeDocument().getObject(page).EditableTexts[5] # lineEdit06
MWEIGHT = App.activeDocument().getObject(page).EditableTexts[6] # lineEdit07
MDRAWING_NUMBER = App.activeDocument().getObject(page).EditableTexts[7] # lineEdit08
MSHEET = App.activeDocument().getObject(page).EditableTexts[8] # lineEdit09
MTITLE = App.activeDocument().getObject(page).EditableTexts[9] # textEdit_01
try:
MDESCRIPTION = App.activeDocument().getObject(page).EditableTexts[10] # textEdit_02
MCOMPANY = App.activeDocument().getObject(page).EditableTexts[11] # textEdit_02b
MCOPYRIGHT = App.activeDocument().getObject(page).EditableTexts[12] # lineEdit_20
MNote_A = App.activeDocument().getObject(page).EditableTexts[13] # lineEdit_10
MNote_B = App.activeDocument().getObject(page).EditableTexts[14] # lineEdit_11
MNote_C = App.activeDocument().getObject(page).EditableTexts[15] # lineEdit_12
MNote_D = App.activeDocument().getObject(page).EditableTexts[16] # lineEdit_13
MNote_E = App.activeDocument().getObject(page).EditableTexts[17] # lineEdit_14
MNote_F = App.activeDocument().getObject(page).EditableTexts[18] # lineEdit_15
MNote_G = App.activeDocument().getObject(page).EditableTexts[19] # lineEdit_16
MNote_H = App.activeDocument().getObject(page).EditableTexts[20] # lineEdit_17
MNote_I = App.activeDocument().getObject(page).EditableTexts[21] # lineEdit_18
except Exception:
App.Console.PrintError("Erreur cartouche level DESCRIPTION (Missing field)"+"\n"
"You may be using an inadequate template. Try with this template"+"\n")
App.Console.PrintMessage("http://www.freecadweb.org/wiki/index.php?title=Misc_templates_Full"+"\n\n")
App.Console.PrintError("Or for the original FreeCAD template use this macro"+"\n")
App.Console.PrintMessage("http://www.freecadweb.org/wiki/index.php?title=Macro_CartoucheFC"+"\n")
errorDialog("Erreur cartouche level DESCRIPTION (Missing field)"+"\n"
"You may be using an inadequate template. Try with this template"+"\n"
"http://www.freecadweb.org/wiki/index.php?title=Misc_templates_Full"+"\n\n"
"Or for the original FreeCAD template use this macro"+"\n"
"http://www.freecadweb.org/wiki/index.php?title=Macro_CartoucheFC"+"\n\n")
except:
errorDialog("Erreur cartouche")
class Ui_MainWindow(object):
def __init__(self, MainWindow):
global path
global PageActive
self.window = MainWindow
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(810, 400)
MainWindow.setMaximumSize(QtCore.QSize(810, 400))
self.centralWidget = QtGui.QWidget(MainWindow)
self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
# self.pushButton01 = QtGui.QPushButton(self.centralWidget)
# self.pushButton01.setGeometry(QtCore.QRect(115, 360, 93, 28))
# self.pushButton01.setObjectName(_fromUtf8("pushButton01"))
# self.pushButton01.clicked.connect(self.on_pushButton01_clicked) #connection pushButton01
self.pushButton02 = QtGui.QPushButton(self.centralWidget)
self.pushButton02.setGeometry(QtCore.QRect(225, 360, 93, 28))
self.pushButton02.setObjectName(_fromUtf8("pushButton02"))
self.pushButton02.clicked.connect(self.on_pushButton02_clicked) #connection pushButton02
self.pushButton03 = QtGui.QPushButton(self.centralWidget)
self.pushButton03.setGeometry(QtCore.QRect(335, 360, 93, 28))
self.pushButton03.setToolTip("The memo button work only with the first Page")
self.pushButton03.setObjectName(_fromUtf8("pushButton03"))
self.pushButton03.clicked.connect(self.on_pushButton03_clicked) #connection pushButton03
self.pushButton04 = QtGui.QPushButton(self.centralWidget)
self.pushButton04.setGeometry(QtCore.QRect(445, 360, 93, 28))
self.pushButton04.setObjectName(_fromUtf8("pushButton04"))
self.pushButton04.clicked.connect(self.on_pushButton04_clicked) #connection pushButton04
self.pushButton05 = QtGui.QPushButton(self.centralWidget)
self.pushButton05.setGeometry(QtCore.QRect(555, 360, 93, 28))
# self.pushButton05.setStyleSheet("background-color: red") # This function gives a color button
self.pushButton05.setObjectName(_fromUtf8("pushButton05"))
self.pushButton05.clicked.connect(self.on_pushButton05_clicked) #connection pushButton05
#####
self.groupBox = QtGui.QGroupBox(self.centralWidget)
self.groupBox.setGeometry(QtCore.QRect(20, 159, 190, 101))
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.label_20 = QtGui.QLabel(self.groupBox)
self.label_20.setGeometry(QtCore.QRect(115, 5, 61, 17))
self.label_20.setObjectName(_fromUtf8("label_20"))
############### font and color Label
font = QtGui.QFont()
font.setBold(True)
self.label_20.setFont(font)
self.label_20.setStyleSheet("color&#160;: #ff0000")
############### font and color
self.label_20.setVisible(False)
self.radioButton_0 = QtGui.QRadioButton(self.groupBox)
self.radioButton_0.setGeometry(QtCore.QRect(95, 1, 91, 17))
self.radioButton_0.setChecked(True)
self.radioButton_0.setEnabled(False)
self.radioButton_0.setVisible(False)
self.radioButton_0.setObjectName(_fromUtf8("radioButton_0"))
self.radioButton_1 = QtGui.QRadioButton(self.groupBox)
self.radioButton_1.setGeometry(QtCore.QRect(95, 20, 91, 17))
self.radioButton_1.setObjectName(_fromUtf8("radioButton_1"))
self.radioButton_1.clicked.connect(self.on_radioButton_A3_clicked)# connect radioButton_A3
self.radioButton_2 = QtGui.QRadioButton(self.groupBox)
self.radioButton_2.setGeometry(QtCore.QRect(95, 39, 91, 17))
self.radioButton_2.setObjectName(_fromUtf8("radioButton_2"))
self.radioButton_2.clicked.connect(self.on_radioButton_A3_clicked)# connect radioButton_A3
self.radioButton_3 = QtGui.QRadioButton(self.groupBox)
self.radioButton_3.setGeometry(QtCore.QRect(95, 58, 91, 17))
self.radioButton_3.setObjectName(_fromUtf8("radioButton_3"))
self.radioButton_3.clicked.connect(self.on_radioButton_A4_clicked)# connect radioButton_A4
self.radioButton_4 = QtGui.QRadioButton(self.groupBox)
self.radioButton_4.setGeometry(QtCore.QRect(95, 76, 91, 17))
self.radioButton_4.setObjectName(_fromUtf8("radioButton_4"))
self.radioButton_4.clicked.connect(self.on_radioButton_A4_clicked)# connect radioButton_A4
self.lineEdit_05 = QtGui.QLineEdit(self.groupBox)
self.lineEdit_05.setGeometry(QtCore.QRect(10, 16, 75, 41))
font = QtGui.QFont()
font.setPointSize(25)
font.setBold(False)
font.setWeight(50)
self.lineEdit_05.setFont(font)
self.lineEdit_05.setAlignment(QtCore.Qt.AlignCenter)
self.lineEdit_05.setObjectName(_fromUtf8("lineEdit_05"))
self.lineEdit_05.setText(SIZE)
self.frame = QtGui.QFrame(self.groupBox)
self.frame.setGeometry(QtCore.QRect(10, 58, 74, 41))
self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
self.frame.setFrameShadow(QtGui.QFrame.Raised)
self.frame.setObjectName(_fromUtf8("frame"))
self.radioButton_EU = QtGui.QRadioButton(self.frame)
self.radioButton_EU.setGeometry(QtCore.QRect(0, 1, 41, 17))
self.radioButton_EU.setChecked(True)
self.radioButton_EU.setObjectName(_fromUtf8("radioButton_EU"))
self.radioButton_EU.clicked.connect(self.on_radioButton_EU_clicked) #connection radioButton_EU
self.radioButton_US = QtGui.QRadioButton(self.frame)
self.radioButton_US.setGeometry(QtCore.QRect(37, 1, 41, 17))
self.radioButton_US.setObjectName(_fromUtf8("radioButton_US"))
self.radioButton_US.clicked.connect(self.on_radioButton_US_clicked) #connection radioButton_US
self.pushButton10 = QtGui.QPushButton(self.frame)
self.pushButton10.setGeometry(QtCore.QRect(0, 18, 75, 23))
self.pushButton10.setToolTip("Create the symbol EU or US"+"\n"
"This button is Independent of the Write button"+"\n"
"If you desire modify the symbol in the cartouche,"+"\n"
"delete the inadequate symbol manualy.")
self.pushButton10.setEnabled(False)
self.pushButton10.setObjectName(_fromUtf8("pushButton10"))
self.pushButton10.clicked.connect(self.on_pushButton10_clicked) #connection pushButton10
#####
self.pushButton06 = QtGui.QPushButton(self.centralWidget)
self.pushButton06.setGeometry(QtCore.QRect(170, 57, 20, 20))
self.pushButton06.setObjectName(_fromUtf8("pushButton06"))
self.pushButton06.clicked.connect(self.on_pushButton06_clicked) #connection pushButton06
self.pushButton07 = QtGui.QPushButton(self.centralWidget)
self.pushButton07.setGeometry(QtCore.QRect(190, 57, 20, 20))
self.pushButton07.setObjectName(_fromUtf8("pushButton07"))
self.pushButton07.clicked.connect(self.on_pushButton07_clicked) #connection pushButton07
self.pushButton08 = QtGui.QPushButton(self.centralWidget)
self.pushButton08.setGeometry(QtCore.QRect(170, 137, 20, 20))
self.pushButton08.setObjectName(_fromUtf8("pushButton08"))
self.pushButton08.clicked.connect(self.on_pushButton08_clicked) #connection pushButton08
self.pushButton09 = QtGui.QPushButton(self.centralWidget)
self.pushButton09.setGeometry(QtCore.QRect(190, 137, 20, 20))
self.pushButton09.setObjectName(_fromUtf8("pushButton09"))
self.pushButton09.clicked.connect(self.on_pushButton09_clicked) #connection pushButton09
self.lineEdit_01 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_01.setGeometry(QtCore.QRect(20, 20, 190, 16))
font = QtGui.QFont()
font.setPointSize(7)
self.lineEdit_01.setFont(font)
self.lineEdit_01.setObjectName(_fromUtf8("lineEdit_01"))
self.lineEdit_01.setText(DESIGNED_BY)
self.lineEdit_02 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_02.setGeometry(QtCore.QRect(20, 60, 82, 16))
font = QtGui.QFont()
font.setPointSize(7)
self.lineEdit_02.setFont(font)
self.lineEdit_02.setObjectName(_fromUtf8("lineEdit_02"))
self.lineEdit_02.setText(CREA_DATE)
self.lineEdit_02h = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_02h.setGeometry(QtCore.QRect(98, 60, 72, 16))
font = QtGui.QFont()
font.setPointSize(7)
self.lineEdit_02h.setFont(font)
self.lineEdit_02h.setObjectName(_fromUtf8("lineEdit_02h"))
self.lineEdit_02h.setText(CREA_TIME)
self.lineEdit_03 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_03.setGeometry(QtCore.QRect(20, 100, 190, 16))
font = QtGui.QFont()
font.setPointSize(7)
self.lineEdit_03.setFont(font)
self.lineEdit_03.setObjectName(_fromUtf8("lineEdit_03"))
self.lineEdit_03.setText(CHECKED_BY)
self.lineEdit_04 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_04.setGeometry(QtCore.QRect(20, 140, 82, 16))
font = QtGui.QFont()
font.setPointSize(7)
self.lineEdit_04.setFont(font)
self.lineEdit_04.setObjectName(_fromUtf8("lineEdit_04"))
self.lineEdit_04.setText(CHEC_DATE)
self.lineEdit_04h = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_04h.setGeometry(QtCore.QRect(98, 140, 72, 16))
font = QtGui.QFont()
font.setPointSize(7)
self.lineEdit_04h.setFont(font)
self.lineEdit_04h.setObjectName(_fromUtf8("lineEdit_04h"))
self.lineEdit_04h.setText(CHEC_TIME)
self.lineEdit_06 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_06.setGeometry(QtCore.QRect(20, 280, 61, 41))
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_06.setFont(font)
self.lineEdit_06.setAlignment(QtCore.Qt.AlignCenter)
self.lineEdit_06.setObjectName(_fromUtf8("lineEdit_06"))
self.lineEdit_06.setText(SCALE)
self.lineEdit_07 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_07.setGeometry(QtCore.QRect(100, 280, 101, 41))
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_07.setFont(font)
self.lineEdit_07.setAlignment(QtCore.Qt.AlignCenter)
self.lineEdit_07.setObjectName(_fromUtf8("lineEdit_07"))
self.lineEdit_07.setText(WEIGHT)
self.lineEdit_08 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_08.setGeometry(QtCore.QRect(220, 280, 341, 41))
self.lineEdit_08.setObjectName(_fromUtf8("lineEdit_08"))
self.lineEdit_08.setText(DRAWING_NUMBER)
self.lineEdit_09 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_09.setGeometry(QtCore.QRect(570, 280, 81, 41))
self.lineEdit_09.setObjectName(_fromUtf8("lineEdit_09"))
self.lineEdit_09.setText(SHEET)
self.lineEdit_20 = QtGui.QLineEdit(self.centralWidget) # Copyright
self.lineEdit_20.setGeometry(QtCore.QRect(20, 330, 771, 22))
self.lineEdit_20.setObjectName(_fromUtf8("lineEdit_20"))
self.lineEdit_20.setText(COPYRIGHT)
self.lineEdit_10 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_10.setGeometry(QtCore.QRect(690, 290, 101, 30))
self.lineEdit_10.setObjectName(_fromUtf8("lineEdit_10"))
self.lineEdit_10.setText(Note_A)
self.lineEdit_11 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_11.setGeometry(QtCore.QRect(690, 260, 101, 30))
self.lineEdit_11.setObjectName(_fromUtf8("lineEdit_11"))
self.lineEdit_11.setText(Note_B)
self.lineEdit_12 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_12.setGeometry(QtCore.QRect(690, 230, 101, 30))
self.lineEdit_12.setObjectName(_fromUtf8("lineEdit_12"))
self.lineEdit_12.setText(Note_C)
self.lineEdit_13 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_13.setGeometry(QtCore.QRect(690, 200, 101, 30))
self.lineEdit_13.setObjectName(_fromUtf8("lineEdit_13"))
self.lineEdit_13.setText(Note_D)
self.lineEdit_14 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_14.setGeometry(QtCore.QRect(690, 170, 101, 30))
self.lineEdit_14.setObjectName(_fromUtf8("lineEdit_14"))
self.lineEdit_14.setText(Note_E)
self.lineEdit_15 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_15.setGeometry(QtCore.QRect(690, 140, 101, 30))
self.lineEdit_15.setObjectName(_fromUtf8("lineEdit_15"))
self.lineEdit_15.setText(Note_F)
self.lineEdit_16 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_16.setGeometry(QtCore.QRect(690, 110, 101, 30))
self.lineEdit_16.setObjectName(_fromUtf8("lineEdit_16"))
self.lineEdit_16.setText(Note_G)
self.lineEdit_17 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_17.setGeometry(QtCore.QRect(690, 80, 101, 30))
self.lineEdit_17.setObjectName(_fromUtf8("lineEdit_17"))
self.lineEdit_17.setText(Note_H)
self.lineEdit_18 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_18.setGeometry(QtCore.QRect(690, 50, 101, 30))
self.lineEdit_18.setObjectName(_fromUtf8("lineEdit_18"))
self.lineEdit_18.setText(Note_I)
##
self.lineEdit_page = QtGui.QLineEdit(self.centralWidget) # nom de page
self.lineEdit_page.setGeometry(QtCore.QRect(20, 365, 181, 20))
self.lineEdit_page.setToolTip("Name page to work"+"\n"
"The name of the first page is always named 'Page'"
"Select the new page in the Combo view")
self.lineEdit_page.setObjectName(_fromUtf8("lineEdit_page"))
self.lineEdit_page.setEnabled(False)
self.lineEdit_page.setStyleSheet("color: red")
self.lineEdit_page.setText(PageActive)
self.lineEdit_page.textChanged.connect(self.on_lineEdit_page_Pressed) #
self.label_01T = QtGui.QLabel(self.centralWidget)
self.label_01T.setGeometry(QtCore.QRect(220, 0, 91, 16))
self.label_01T.setObjectName(_fromUtf8("label_01T"))
self.textEdit_01 = QtGui.QTextEdit(self.centralWidget) # Title
self.textEdit_01.setGeometry(QtCore.QRect(220, 20, 431,55 ))
font = QtGui.QFont()
font.setPointSize(15)
font.setBold(True)
font.setWeight(75)
self.textEdit_01.setFont(font)
self.textEdit_01.setObjectName(_fromUtf8("textEdit_01"))
self.textEdit_01.setText(TITLE)
self.label_02T = QtGui.QLabel(self.centralWidget)
self.label_02T.setGeometry(QtCore.QRect(220, 80, 101, 16))
self.label_02T.setObjectName(_fromUtf8("label_02T"))
self.textEdit_02 = QtGui.QTextEdit(self.centralWidget) # DESCRIPTION
self.textEdit_02.setGeometry(QtCore.QRect(220, 100, 431, 55))
self.textEdit_02.setObjectName(_fromUtf8("textEdit_02"))
self.textEdit_02.setText(DESCRIPTION)
self.label_02bT = QtGui.QLabel(self.centralWidget)
self.label_02bT.setGeometry(QtCore.QRect(220, 160, 90, 16))
self.label_02bT.setObjectName(_fromUtf8("label_02bT"))
self.textEdit_02b = QtGui.QTextEdit(self.centralWidget) # COMPANY
self.textEdit_02b.setGeometry(QtCore.QRect(220, 180, 340, 60))
self.textEdit_02b.setObjectName(_fromUtf8("textEdit_02b"))
self.textEdit_02b.setText(COMPANY)
self.label_01 = QtGui.QLabel(self.centralWidget)
self.label_01.setGeometry(QtCore.QRect(20, 0, 91, 16))
self.label_01.setObjectName(_fromUtf8("label_01"))
self.label_02 = QtGui.QLabel(self.centralWidget)
self.label_02.setGeometry(QtCore.QRect(20, 40, 53, 16))
self.label_02.setObjectName(_fromUtf8("label_02"))
self.label_03 = QtGui.QLabel(self.centralWidget)
self.label_03.setGeometry(QtCore.QRect(20, 80, 101, 16))
self.label_03.setObjectName(_fromUtf8("label_03"))
self.label_04 = QtGui.QLabel(self.centralWidget)
self.label_04.setGeometry(QtCore.QRect(20, 120, 91, 16))
self.label_04.setObjectName(_fromUtf8("label_04"))
self.label_06 = QtGui.QLabel(self.centralWidget)
self.label_06.setGeometry(QtCore.QRect(20, 260, 53, 16))
self.label_06.setObjectName(_fromUtf8("label_06"))
self.label_07 = QtGui.QLabel(self.centralWidget)
self.label_07.setGeometry(QtCore.QRect(100, 260, 101, 16))
self.label_07.setObjectName(_fromUtf8("label_07"))
self.label_08 = QtGui.QLabel(self.centralWidget)
self.label_08.setGeometry(QtCore.QRect(220, 260, 121, 16))
self.label_08.setObjectName(_fromUtf8("label_08"))
self.label_09 = QtGui.QLabel(self.centralWidget)
self.label_09.setGeometry(QtCore.QRect(570, 260, 53, 16))
self.label_09.setObjectName(_fromUtf8("label_09"))
self.label_10 = QtGui.QLabel(self.centralWidget)
self.label_10.setGeometry(QtCore.QRect(670, 290, 16, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_10.setFont(font)
self.label_10.setObjectName(_fromUtf8("label_10"))
self.label_11 = QtGui.QLabel(self.centralWidget)
self.label_11.setGeometry(QtCore.QRect(670, 260, 16, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_11.setFont(font)
self.label_11.setObjectName(_fromUtf8("label_11"))
self.label_12 = QtGui.QLabel(self.centralWidget)
self.label_12.setGeometry(QtCore.QRect(670, 230, 16, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_12.setFont(font)
self.label_12.setObjectName(_fromUtf8("label_12"))
self.label_13 = QtGui.QLabel(self.centralWidget)
self.label_13.setGeometry(QtCore.QRect(670, 200, 18, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_13.setFont(font)
self.label_13.setObjectName(_fromUtf8("label_13"))
self.label_14 = QtGui.QLabel(self.centralWidget)
self.label_14.setGeometry(QtCore.QRect(670, 170, 15, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_14.setFont(font)
self.label_14.setObjectName(_fromUtf8("label_14"))
self.label_15 = QtGui.QLabel(self.centralWidget)
self.label_15.setGeometry(QtCore.QRect(670, 140, 14, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_15.setFont(font)
self.label_15.setObjectName(_fromUtf8("label_15"))
self.label_16 = QtGui.QLabel(self.centralWidget)
self.label_16.setGeometry(QtCore.QRect(670, 110, 18, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_16.setFont(font)
self.label_16.setObjectName(_fromUtf8("label_16"))
self.label_17 = QtGui.QLabel(self.centralWidget)
self.label_17.setGeometry(QtCore.QRect(670, 80, 18, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_17.setFont(font)
self.label_17.setObjectName(_fromUtf8("label_17"))
self.label_18 = QtGui.QLabel(self.centralWidget)
self.label_18.setGeometry(QtCore.QRect(670, 50, 10, 33))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_18.setFont(font)
self.label_18.setObjectName(_fromUtf8("label_18"))
self.label_19 = QtGui.QLabel(self.centralWidget)
self.label_19.setGeometry(QtCore.QRect(720, 15, 100, 33))
self.label_19.setObjectName(_fromUtf8("label_19"))
self.label_page = QtGui.QLabel(self.centralWidget)
self.label_page.setGeometry(QtCore.QRect(20, 350, 181, 16))
self.label_page.setObjectName(_fromUtf8("label_page"))
self.label_Version = QtGui.QLabel(self.centralWidget) # Version
self.label_Version.setGeometry(QtCore.QRect(685, 383, 121, 20))
self.label_Version.setObjectName(_fromUtf8("label_Version"))
MainWindow.setCentralWidget(self.centralWidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # cette fonction met la fenetre en avant
MainWindow.setWindowTitle("Cartouche (Full)")
# self.pushButton01.setText("Position")
self.pushButton02.setText("Quit") #Quitter
self.pushButton03.setText("Memo")
self.pushButton04.setText("Clean")#Nettoyer
self.pushButton05.setText("Write")#Appliquer
self.pushButton06.setText("D.")
self.pushButton07.setText("H.")
self.pushButton08.setText("D.")
self.pushButton09.setText("H.")
self.pushButton10.setText("Create Symb.")
self.label_01.setText("Designed by&#160;:")
self.label_02.setText("Date&#160;:")
self.label_03.setText("Checked by&#160;:")
self.label_04.setText("Date&#160;:")
self.label_06.setText("Scale&#160;:")
self.label_07.setText("Weight (Kg)&#160;:")
self.label_08.setText("Drawing number&#160;:")
self.label_01T.setText("Title&#160;:")
self.label_02T.setText("Description&#160;:")
self.label_02bT.setText("Company&#160;:")
self.label_09.setText("Sheet&#160;:")
self.label_10.setText("A")
self.label_11.setText("B")
self.label_12.setText("C")
self.label_13.setText("D")
self.label_14.setText("E")
self.label_15.setText("F")
self.label_16.setText("G")
self.label_17.setText("H")
self.label_18.setText("I")
self.label_19.setText("Notes")
self.label_20.setText("Warning")
self.label_page.setText("Name page to work")
self.label_Version.setText("Ver: 00.10 15/02/2017") # Version
self.groupBox.setTitle("Size&#160;:")
self.radioButton_1.setText("A3 Landscape")
self.radioButton_2.setText("A3 Portrait")
self.radioButton_3.setText("A4 Landscape")
self.radioButton_4.setText("A4 Portrait")
self.radioButton_EU.setText("EU")
self.radioButton_US.setText("US")
self.lineEdit_05.setText("?")
#______________________________________________________________________________________
# Radio Boutons
def on_radioButton_A3_clicked(self): # connect radioButton_A3
self.label_20.setVisible(False)
self.pushButton10.setEnabled(True)
self.lineEdit_05.setText("A3")
self.pushButton10.setStyleSheet("color: QPalette.Base") # origin system
def on_radioButton_A4_clicked(self): # connect radioButton_A4
self.label_20.setVisible(False)
self.pushButton10.setEnabled(True)
self.lineEdit_05.setText("A4")
self.pushButton10.setStyleSheet("color: QPalette.Base") # origin system
# Radio Boutons
def on_radioButton_EU_clicked(self): # Bouton /Symbole EU
global SymbolSwitch
SymbolSwitch = 1
def on_radioButton_US_clicked(self): # Bouton /Symbole US
global SymbolSwitch
SymbolSwitch = 0
def on_pushButton10_clicked(self): # Bouton /Symbole EU US disposition dans le cartouche
global SymbolSwitch
global PageActive
self.label_20.setVisible(False)
if self.radioButton_0.isChecked():
self.label_20.setVisible(True)
self.pushButton10.setEnabled(False)
self.pushButton10.setStyleSheet("color: red")
self.lineEdit_page.setStyleSheet("color: red")
FreeCAD.Console.PrintError("Select one format A3 or A4 for the Symbole" + "\n")
else:
self.pushButton10.setEnabled(True)
self.pushButton10.setStyleSheet("background-color: #FF5B2B")
self.pushButton10.setText("Wait.")
FreeCADGui.updateGui() # rafraichi l'ecran
if SymbolSwitch == 1:
if self.radioButton_1.isChecked():
symbol_EU(247.5, 263.5, 0.8) # A3 Landscape
elif self.radioButton_2.isChecked():
symbol_EU(124.55, 386.3, 0.8) # A3 Portrait
elif self.radioButton_3.isChecked():
symbol_EU(158.7, 181.35, 0.6) # A4 Landscape
elif self.radioButton_4.isChecked():
symbol_EU(71.9, 269.0, 0.6) # A4 Portrait
else:
if self.radioButton_1.isChecked():
symbol_US(247.5, 263.5, 0.8) # A3 Landscape
elif self.radioButton_2.isChecked():
symbol_US(124.55, 386.3, 0.8) # A3 Portrait
elif self.radioButton_3.isChecked():
symbol_US(158.7, 181.35, 0.6) # A4 Landscape
elif self.radioButton_4.isChecked():
symbol_US(71.9, 269.0, 0.6) # A4 Portrait
self.pushButton10.setStyleSheet("color: QPalette.Base") # origin system
self.pushButton10.setText("Create Symb.")
FreeCADGui.updateGui() # rafraichi l'ecran
def on_lineEdit_page_Pressed(self): # Name page
global PageActive
PageActive = self.lineEdit_page.text()
def on_pushButton09_clicked(self): # Bouton /heure document
self.lineEdit_04h.setText(str(heure()))
def on_pushButton08_clicked(self): # Bouton date/ document
global SymbolSwitch
if SymbolSwitch==0:
self.lineEdit_04.setText(str(dateUs()))
else:
self.lineEdit_04.setText(str(dateEu()))
def on_pushButton07_clicked(self): # Bouton /heure checked
self.lineEdit_02h.setText(str(heure()))
def on_pushButton06_clicked(self): # Bouton date/ checked
global SymbolSwitch
if SymbolSwitch==0:
self.lineEdit_02.setText(str(dateUs()))
else:
self.lineEdit_02.setText(str(dateEu()))
def on_pushButton05_clicked(self): # Bouton Appliquer
try:
global DESIGNED_BY, CREATION_DATE, CREA_DATE , CREA_TIME, CHECKED_BY, CHECK_DATE
global CHEC_DATE , CHEC_TIME , SIZE , SCALE , WEIGHT ,DRAWING_NUMBER
global SHEET , TITLE , DESCRIPTION, COMPANY , COPYRIGHT
global Note_A, Note_B, Note_C, Note_D, Note_E, Note_F, Note_G, Note_H, Note_I
global ui
global SymbolSwitch
global PageActive
try:
page = App.activeDocument().getObjectsByLabel(PageActive.encode('utf-8'))[0]
except Exception:
page = App.activeDocument().getObjectsByLabel(PageActive)[0]
if len(str(page))&#160;!= 2:
self.pushButton05.setStyleSheet("background-color: #FF5B2B")
self.pushButton05.setText("Wait.")
FreeCADGui.updateGui() # rafraichi l'ecran
DESIGNED_BY = (self.lineEdit_01.text())
CREATION_DATE = (self.lineEdit_02.text())+" - "+(self.lineEdit_02h.text())
CHECKED_BY = (self.lineEdit_03.text())
CHECK_DATE = (self.lineEdit_04.text())+" - "+(self.lineEdit_04h.text())
SIZE = (self.lineEdit_05.text())
SCALE = (self.lineEdit_06.text())
WEIGHT = (self.lineEdit_07.text())
DRAWING_NUMBER = (self.lineEdit_08.text())
SHEET = (self.lineEdit_09.text())
TITLE = (self.textEdit_01.toPlainText())
DESCRIPTION = (self.textEdit_02.toPlainText())
COMPANY = (self.textEdit_02b.toPlainText())
COPYRIGHT = (self.lineEdit_20.text())
Note_A = (self.lineEdit_10.text())
Note_B = (self.lineEdit_11.text())
Note_C = (self.lineEdit_12.text())
Note_D = (self.lineEdit_13.text())
Note_E = (self.lineEdit_14.text())
Note_F = (self.lineEdit_15.text())
Note_G = (self.lineEdit_16.text())
Note_H = (self.lineEdit_17.text())
Note_I = (self.lineEdit_18.text())
try:
FreeCAD.getDocument(App.ActiveDocument.Name).getObject(page.Name).EditableTexts = [DESIGNED_BY, CREATION_DATE, CHECKED_BY, CHECK_DATE, SIZE, SCALE, WEIGHT, DRAWING_NUMBER, SHEET, TITLE, DESCRIPTION, COMPANY, COPYRIGHT, Note_A, Note_B, Note_C, Note_D, Note_E, Note_F, Note_G, Note_H, Note_I, ]
#old FreeCAD.getDocument(App.ActiveDocument.Name).getObjectsByLabel(PageActive.encode('utf-8'))[0].EditableTexts = [DESIGNED_BY, CREATION_DATE, CHECKED_BY, CHECK_DATE, SIZE, SCALE, WEIGHT, DRAWING_NUMBER, SHEET, TITLE, DESCRIPTION, COMPANY, COPYRIGHT, Note_A, Note_B, Note_C, Note_D, Note_E, Note_F, Note_G, Note_H, Note_I, ]
App.ActiveDocument.recompute()
FreeCAD.Console.PrintMessage("Write done to ( " + page.Label + " )" + "\n")
self.pushButton05.setStyleSheet("color: QPalette.Base")
except Exception:
FreeCAD.Console.PrintError("Error write cartouche or verify the selected page ( " + page.Label + " )" + "\n")
self.pushButton05.setStyleSheet("background-color: red")
else:
FreeCAD.Console.PrintError("Error selected page ( " + Page.Label + " )" + "\n")
self.pushButton05.setStyleSheet("background-color: red")
except Exception:
self.pushButton05.setStyleSheet("background-color: red")
FreeCAD.Console.PrintError("Error or not page " + "\n")
self.pushButton05.setText("Write")
App.ActiveDocument.recompute()
def on_pushButton04_clicked(self): # Bouton nettoyer
self.lineEdit_01.setText("")
self.lineEdit_02.setText("")
self.lineEdit_02h.setText("")
self.lineEdit_03.setText("")
self.lineEdit_04.setText("")
self.lineEdit_04h.setText("")
self.lineEdit_05.setText("?")
self.lineEdit_06.setText("")
self.lineEdit_07.setText("")
self.lineEdit_08.setText("")
self.lineEdit_09.setText("")
self.textEdit_01.setText("")
self.textEdit_02.setText("")
self.textEdit_02b.setText("")
self.lineEdit_20.setText("")
self.lineEdit_10.setText("")
self.lineEdit_11.setText("")
self.lineEdit_12.setText("")
self.lineEdit_13.setText("")
self.lineEdit_14.setText("")
self.lineEdit_15.setText("")
self.lineEdit_16.setText("")
self.lineEdit_17.setText("")
self.lineEdit_18.setText("")
self.pushButton10.setStyleSheet("color: QPalette.Base") # origin system
self.label_20.setVisible(False)
self.radioButton_0.setChecked(True)
self.pushButton05.setEnabled(True)
self.pushButton05.setStyleSheet("background-color: QPalette.Base") # origin system
self.groupBox.setEnabled(True)
def on_pushButton03_clicked(self): # Bouton Memo
global MDESIGNED_BY, MCREATION_DATE, MCREA_DATE , MCREA_TIME, MCHECKED_BY, MCHECK_DATE
global MCHEC_DATE , MCHEC_TIME , MSIZE , MSCALE , MWEIGHT ,MDRAWING_NUMBER
global MSHEET , MTITLE , MDESCRIPTION, MCOMPANY , MCOPYRIGHT
global MNote_A, MNote_B, MNote_C, MNote_D, MNote_E, MNote_F, MNote_G, MNote_H, MNote_I
self.lineEdit_01.setText(MDESIGNED_BY)
self.lineEdit_02.setText(MCREA_DATE)
self.lineEdit_02h.setText(MCREA_TIME)
self.lineEdit_03.setText(MCHECKED_BY)
self.lineEdit_04.setText(MCHEC_DATE)
self.lineEdit_04h.setText(MCHEC_TIME)
self.lineEdit_05.setText("?") #(SIZE)
self.lineEdit_06.setText(MSCALE)
self.lineEdit_07.setText(MWEIGHT)
self.lineEdit_08.setText(MDRAWING_NUMBER)
self.lineEdit_09.setText(MSHEET)
self.textEdit_01.setText(MTITLE)
self.textEdit_02.setText(MDESCRIPTION)
self.textEdit_02b.setText(MCOMPANY)
self.lineEdit_20.setText(MCOPYRIGHT)
self.lineEdit_10.setText(MNote_A)
self.lineEdit_11.setText(MNote_B)
self.lineEdit_12.setText(MNote_C)
self.lineEdit_13.setText(MNote_D)
self.lineEdit_14.setText(MNote_E)
self.lineEdit_15.setText(MNote_F)
self.lineEdit_16.setText(MNote_G)
self.lineEdit_17.setText(MNote_H)
self.lineEdit_18.setText(MNote_I)
# self.lineEdit_page.setText(PageActive)
self.radioButton_0.setChecked(True)
def on_pushButton02_clicked(self): # Bouton Quitter
App.Console.PrintMessage("End CartoucheFC_Full\r\n")
self.window.hide()
FreeCADGui.Selection.removeObserver(s) # Uninstalls the resident function
App.Console.PrintMessage("removeObserver"+"\n")
# def on_pushButton01_clicked(self): # Bouton appel de Position
# MainWindow.resize(210, 480)
# executer()
# MainWindow.resize(810, 480)
#______________________________________________________________________________________
class SelObserver:
print "run.."
def setSelection(self,document): # Selection in ComboView
global PageActive
global ui
if len(Gui.Selection.getSelection(document)) == 1:
ff = ui
ff.lineEdit_page.setStyleSheet("color: QPalette.Base") # origin system
ff.pushButton05.setEnabled(True)
ff.pushButton05.setStyleSheet("background-color: QPalette.Base") # origin system
ff.groupBox.setEnabled(True)
if (str(Gui.Selection.getSelection(document)[0].Name[0:4]) == "Page"):
PageActive = str(Gui.Selection.getSelection(document)[0].Label.encode('utf-8'))
try:
ff.lineEdit_page.setText(unicode(PageActive,'utf-8')) # convert if accent
except Exception:
ff.lineEdit_page.setText(PageActive) # normal
memoEntree() # entree memo click mouse
ff.on_pushButton03_clicked() # Bouton Memo
else:
FreeCAD.Console.PrintError("Select a valid Page__________________________" + "\n")
ff.lineEdit_page.setStyleSheet("color: red")
ff.lineEdit_page.setText("Select a valid Page") #
ff.pushButton05.setEnabled(False)
ff.pushButton05.setStyleSheet("background-color: red") # This function gives a color button
ff.groupBox.setEnabled(False)
FreeCAD.Console.PrintMessage(" " + "Name Label" + "\n")
for i in App.ActiveDocument.Objects:
if i.Name[0:4] == "Page":
name = i.Name + " "
labe = i.Label+ " "
FreeCAD.Console.PrintMessage(" Valid Page&#160;: " + name[:15] + "," + labe[:25] + "\n")
FreeCAD.Console.PrintError("_____________________________________________" + "\n")
for obj in FreeCAD.ActiveDocument.Objects: # deslectionne
FreeCADGui.Selection.removeSelection(obj)
s=SelObserver()
FreeCADGui.Selection.addObserver(s) # install the function mode resident
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow(MainWindow)
MainWindow.show() </pre>
<h3><span class="mw-headline" id="Ulteriori_informazioni">Ulteriori informazioni</span></h3>
<p>I campi non hanno alcun limite di lunghezza, controllare il risultato nella tabella.
</p><p>Questo programma crea nel progetto un disegno che rappresenta il simbolo di proiezione regionale, non modificatelo, è registrato in forma nascosta quindi è invisibile.
</p><p>Per visualizzare il simbolo di proiezione rimuovere il commento dalle righe commentate e viceversa
</p>
<pre># App.getDocument(App.ActiveDocument.Name).removeObject("Symbol_EU")
FreeCADGui.getDocument(App.ActiveDocument.Name).getObject("Symbol_EU").Visibility = False </pre>
<p>oppure
</p>
<pre># App.getDocument(App.ActiveDocument.Name).removeObject("Symbol_US")
FreeCADGui.getDocument(App.ActiveDocument.Name).getObject("Symbol_US").Visibility = False </pre>
<p>Si sono prodotti alcuni errori in esecuzione quando il simbolo è stato cancellato.
</p><p>Questo modulo funziona con il foglio di disegno incluso in FreeCAD che si chiama <b>Page</b>. Non cambiate il nome del foglio!
</p>
<h2><span class="mw-headline" id="Revisione">Revisione</span></h2>
<p>ver "00.10"&#160;: 15/02/2017&#160;: regolazione per le pagine multiple (E possibile di perdere una pagina se sono tropo)
</p><p>ver "00,09"&#160;: 10/02/2017&#160;: Aggiunto pulsanti di opzione per la scelta del tipo di simbolo e correggere la posizione del simbolo nelle pagine (la versione precedente cancellave il simbolo di una pagina per ricostruire dentro la nuova pagina) e Aggiunto dalla selezione mouse e test sulla selezione di pagine
</p><p>ver "00.08&#160;: 06/02/2017&#160;: il campo di testo accetta i nomi con accenti e altri caratteri
</p><p>ver "00.07&#160;: 05/02/2017&#160;: aggiunto un campo di testo "nome della pagina" (per multi pagine nello stesso progetto) nota: non accetta i caratteri speciali "àùé ...ecc"
</p><p>ver 00.06&#160;: 13/10/2016 &#160;: selezionare il formato della pagine questa selezione imposta la posizione del simbolo convenzionale (per FreeCAD ver 0.17)
</p><p>ver 5&#160;: 08/08/2014 PyQt4 e PySide
</p>
<div style="clear:both"></div>
</div>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_CartoucheFC_Full/it&amp;oldid=240142">http://www.freecadweb.org/wiki/index.php?title=Macro_CartoucheFC_Full/it&amp;oldid=240142</a>"</div>
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
</div>
</div>
<div id="mw-navigation">
<h2>Navigation menu</h2>
</body></html>