235 lines
7.8 KiB
HTML
235 lines
7.8 KiB
HTML
<html><head><title>Macro Corner shapes wizard/es</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 Corner shapes wizard/es</h1></div>
|
|
|
|
<div id="mw-content-text" lang="es" 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="Corner_shapes_wizard"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Text-x-python.png" class="image"><img alt="Text-x-python.png" src="32px-Text-x-python.png" width="32" height="32" srcset="/wiki/images/2/2c/Text-x-python.png 1.5x" /></a> Corner shapes wizard</span></h3>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Descripción
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven left macro-description">Esta macro es una aplicación completa, muestra un letrero de diálogo preguntando por las dimensiones de tu cantonera, luego crea el objeto en el documento y crea una página con las vistas en planta, alzado y laterales de la pieza.
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Autor
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-author"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Nicotuf&action=edit&redlink=1" class="new" title="User:Nicotuf (page does not exist)">Nicotuf</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Vista
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/es" title="Macros recipes/es">Macros recipes</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/es" title="How to install macros/es">How to install macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/es" title="Customize Toolbars/es">How to customize toolbars</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Version
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-version">1.0
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Fecha de la última modificación
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-version">2011-08-01
|
|
</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="#Corner_shapes_wizard"><span class="tocnumber">1</span> <span class="toctext">Corner shapes wizard</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
<p><br />
|
|
</p><p>Esta macro es una aplicación completa, muestra un letrero de diálogo preguntando por las dimensiones de tu cantonera, luego crea el objeto en el documento y crea una página con las vistas en planta, alzado y laterales de la pieza.
|
|
</p><p>There is a <a href="https://www.freecadweb.org/wiki/index.php?title=Macro_Corner_shapes_wizard/update" title="Macro Corner shapes wizard/update">modified version</a> with changes GUI.
|
|
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:CornerShape1.png" class="image"><img alt="CornerShape1.png" src="CornerShape1.png" width="610" height="186" /></a>
|
|
</p><p><br />
|
|
</p>
|
|
<pre># -*- coding:utf-8 -*-
|
|
|
|
#####################################
|
|
# Importation de fonctions externes :
|
|
|
|
#from os import *
|
|
import FreeCAD, FreeCADGui, Part, Draft, math, MeshPart, Mesh, Drawing
|
|
from PyQt4 import QtGui,QtCore
|
|
from FreeCAD import Base
|
|
App=FreeCAD
|
|
Gui=FreeCADGui
|
|
|
|
##################################
|
|
# Défnition Class :
|
|
|
|
class Corniere:
|
|
def __init__(self, obj):
|
|
obj.addProperty("App::PropertyLength","L1","Corniere","Largeur 1").L1=20.0
|
|
obj.addProperty("App::PropertyLength","L2","Corniere","Largeur 2").L2=20.0
|
|
obj.addProperty("App::PropertyLength","e1","Corniere","Epaisseur 1").e1=2.0
|
|
#obj.addProperty("App::PropertyLength","e2","Corniere","Epaisseur 2").e2=2.0
|
|
obj.addProperty("App::PropertyLength","Longueur","Corniere","Longueur").Longueur=200.0
|
|
obj.Proxy = self
|
|
|
|
def execute(self, fp):
|
|
P1=Base.Vector(fp.e1,fp.e1,0)
|
|
S1=Part.makeBox(fp.L1,fp.L2,fp.Longueur)
|
|
S2=Part.makeBox(fp.L1-fp.e1,fp.L2-fp.e1,fp.Longueur,P1)
|
|
fp.Shape=S1.cut(S2)
|
|
|
|
##################################
|
|
# Défnition locale de fonctions :
|
|
|
|
|
|
def proceed():
|
|
QtGui.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
|
|
|
|
if FreeCAD.ActiveDocument==None:
|
|
FreeCAD.newDocument("Corniere")
|
|
|
|
oldDocumentObjects=App.ActiveDocument.Objects
|
|
|
|
try:
|
|
QL1 = float(l1.text())
|
|
QL2 = float(l2.text())
|
|
Qe = float(l3.text())
|
|
QLongueur = float(l4.text())
|
|
except:
|
|
FreeCAD.Console.PrintError("Wrong input! Only numbers allowed...\n")
|
|
|
|
Cor=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Corniere")
|
|
Corniere(Cor)
|
|
Cor.ViewObject.Proxy=0
|
|
Cor.L1=QL1
|
|
Cor.L2=QL2
|
|
Cor.e1=Qe
|
|
Cor.Longueur=QLongueur
|
|
|
|
App.ActiveDocument.recompute()
|
|
Gui.SendMsgToActiveView("ViewFit")
|
|
|
|
QtGui.qApp.restoreOverrideCursor()
|
|
|
|
Plan(Cor)
|
|
|
|
dialog.hide()
|
|
|
|
def hide():
|
|
|
|
dialog.hide()
|
|
|
|
def Plan(obj):
|
|
|
|
ObjetProjete=obj.Shape
|
|
|
|
TailleX=ObjetProjete.BoundBox.XLength
|
|
TailleY=ObjetProjete.BoundBox.YLength
|
|
TailleZ=ObjetProjete.BoundBox.ZLength
|
|
|
|
page = App.activeDocument().addObject('Drawing::FeaturePage','Page')
|
|
page.Template = App.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg'
|
|
vueprofil = App.activeDocument().addObject('Drawing::FeatureViewPart','VueProfil')
|
|
vueprofil.Source = obj
|
|
vueprofil.Direction = (0.0,0.0,1.0)
|
|
vueprofil.Scale = 1.0
|
|
vueprofil.X = 50.0
|
|
vueprofil.Y = 50.0
|
|
page.addObject(vueprofil)
|
|
|
|
vuegauche = App.activeDocument().addObject('Drawing::FeatureViewPart','Vuegauche')
|
|
vuegauche.Source = obj
|
|
vuegauche.Direction = (-1.0,0.0,0.0)
|
|
vuegauche.ShowHiddenLines = True
|
|
vuegauche.Scale = 1.0
|
|
vuegauche.Rotation = 180.0
|
|
vuegauche.X = 50.0+TailleX/2+TailleX
|
|
vuegauche.Y = 50.0
|
|
page.addObject(vuegauche)
|
|
|
|
vuedessus = App.activeDocument().addObject('Drawing::FeatureViewPart','Vuedessus')
|
|
vuedessus.Source = obj
|
|
vuedessus.Direction = (0.0,-1.0,0.0)
|
|
vuedessus.ShowHiddenLines = True
|
|
vuedessus.Scale = 1.0
|
|
vuedessus.Rotation = 180.0
|
|
vuedessus.X = 50.0+TailleX/2+TailleX
|
|
vuedessus.Y = 50.0+TailleX/2+TailleY+TailleX
|
|
page.addObject(vuedessus)
|
|
|
|
vueiso = App.activeDocument().addObject('Drawing::FeatureViewPart','VueIso')
|
|
vueiso.Source = obj
|
|
vueiso.Direction = (-1.0,-1.0,0.5)
|
|
vueiso.Scale = 1.0
|
|
vueiso.ShowSmoothLines = True
|
|
vueiso.X = TailleZ+TailleX/2
|
|
vueiso.Y = 7*TailleZ+3*TailleY
|
|
page.addObject(vueiso)
|
|
|
|
|
|
App.activeDocument().recompute()
|
|
|
|
PageFile = open(page.PageResult,'r')
|
|
OutFile = open('temp.svg','w')
|
|
OutFile.write(PageFile.read())
|
|
del OutFile,PageFile
|
|
|
|
|
|
dialog = QtGui.QDialog()
|
|
dialog.resize(200,200)
|
|
dialog.setWindowTitle("Corniere")
|
|
la = QtGui.QVBoxLayout(dialog)
|
|
|
|
e1 = QtGui.QLabel("Dimensions de la corniere")
|
|
commentFont=QtGui.QFont("Arial",10,True)
|
|
e1.setFont(commentFont)
|
|
la.addWidget(e1)
|
|
|
|
t1 = QtGui.QLabel("L1")
|
|
la.addWidget(t1)
|
|
l1 = QtGui.QLineEdit()
|
|
l1.setText("20")
|
|
la.addWidget(l1)
|
|
|
|
t2 = QtGui.QLabel("L2")
|
|
la.addWidget(t2)
|
|
l2 = QtGui.QLineEdit()
|
|
l2.setText("20")
|
|
la.addWidget(l2)
|
|
|
|
t3 = QtGui.QLabel("e")
|
|
la.addWidget(t3)
|
|
l3 = QtGui.QLineEdit()
|
|
l3.setText("2")
|
|
la.addWidget(l3)
|
|
|
|
t4 = QtGui.QLabel("Longueur")
|
|
la.addWidget(t4)
|
|
l4 = QtGui.QLineEdit()
|
|
l4.setText("300")
|
|
la.addWidget(l4)
|
|
|
|
okbox = QtGui.QDialogButtonBox(dialog)
|
|
okbox.setOrientation(QtCore.Qt.Horizontal)
|
|
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel </pre>
|
|
<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_Corner_shapes_wizard/es&oldid=241169">http://www.freecadweb.org/wiki/index.php?title=Macro_Corner_shapes_wizard/es&oldid=241169</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> |