150 lines
7.2 KiB
HTML
150 lines
7.2 KiB
HTML
<html><head><title>Macro Automatic drawing/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 Automatic drawing/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="Automatic_drawing"><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> Automatic drawing</span></h3>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Descripción
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven left macro-description">Este código permite al usuario poner la vista de su objeto en una hoja de dibujo con 4 posiciones diferentes (alzado,planta,isométrica,perfil derecho). Necesita algunos cambios para ser perfectamente efectiva
|
|
</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:Normandc" title="User:Normandc">Normandc</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">2016-09-26
|
|
</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="#Automatic_drawing"><span class="tocnumber">1</span> <span class="toctext">Automatic drawing</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-1"><a href="#C.C3.B3mo_se_utiliza"><span class="tocnumber">1.1</span> <span class="toctext">Cómo se utiliza</span></a></li>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Limitaciones"><span class="tocnumber">1.2</span> <span class="toctext">Limitaciones</span></a></li>
|
|
<li class="toclevel-2 tocsection-3"><a href="#La_macro"><span class="tocnumber">1.3</span> <span class="toctext">La macro</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
<p><br />
|
|
</p><p>Este código genera una Hoja de <a href="https://www.freecadweb.org/wiki/index.php?title=Drawing_Module/es" title="Drawing Module/es">Dibujo</a> con tres vistas ortográficas (alzado, planta y perfil derecho) alineadas entre sí, y una vista isométrica situada en la parte superior derecha de la hoja. Calcula la escala basada en el tamaño del modelo y el espacio disponible en la hoja. La vista isométrica está escalada a 2/3 de las otras.
|
|
</p><p>Utiliza el <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Multiview_orthographic_projection#First-angle_projection">Sistema de representación europeo</a>.
|
|
</p>
|
|
<h4><span class="mw-headline" id="C.C3.B3mo_se_utiliza">Cómo se utiliza</span></h4>
|
|
<p>Es necesario seleccionar un objeto antes de ejecutar la macro.
|
|
</p>
|
|
<h4><span class="mw-headline" id="Limitaciones">Limitaciones</span></h4>
|
|
<ul><li> La eslaca no es estándar. Puedes tener que cambiar las vistas manualmente a una escala estándar.</li>
|
|
<li> Sólo funciona con un único objeto (esta es una limitación del entorno de Dibujo)</li>
|
|
<li> Es necesario modificarla para que trabaje en el <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Multiview_orthographic_projection#Third-angle_projection">sistema americano de representación</a> utilizado en los EE.UU. y Canada.</li></ul>
|
|
<h4><span class="mw-headline" id="La_macro">La macro</span></h4>
|
|
<pre>import FreeCAD, Part, Drawing
|
|
if len(Gui.Selection.getSelectionEx())>1:
|
|
App.Console.PrintError("Warning: Only the first item is generate")
|
|
if len(Gui.Selection.getSelectionEx())==0:
|
|
App.Console.PrintError("Warning: Need to select one item")
|
|
Piece=Gui.Selection.getSelectionEx()[0]
|
|
App.activeDocument().addObject('Drawing::FeaturePage','AutoDrawing')
|
|
App.activeDocument().AutoDrawing.Template = App.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg'
|
|
DH=20
|
|
DL=30
|
|
L=Piece.Object.Shape.BoundBox.XMax
|
|
H=Piece.Object.Shape.BoundBox.ZMax
|
|
P=Piece.Object.Shape.BoundBox.YMax
|
|
Sc=(400-3*DL)/(L+H)
|
|
Sc2=(250-3*DH)/(P+H)
|
|
if Sc>Sc2 :
|
|
Sc=Sc2
|
|
TopX=DL+Sc*L
|
|
FrontX=DL+Sc*L
|
|
RightX=2*DL+Sc*L
|
|
IsoX=2*DL+Sc*(L)
|
|
TopY=DH+Sc*P
|
|
RightY=DH+P*Sc
|
|
FrontY=2*DH+Sc*(P+H)
|
|
IsoY=2*DH+Sc*P
|
|
|
|
print TopX,RightX,TopY,FrontY
|
|
|
|
#Create topView
|
|
App.activeDocument().addObject('Drawing::FeatureViewPart','topView')
|
|
App.activeDocument().topView.Source =Piece.Object
|
|
App.activeDocument().topView.Direction = (0,0,1)
|
|
App.activeDocument().topView.Rotation=180
|
|
App.activeDocument().topView.X = TopX
|
|
App.activeDocument().topView.Y = TopY
|
|
App.activeDocument().topView.ShowHiddenLines=True
|
|
App.activeDocument().AutoDrawing.addObject(App.activeDocument().topView)
|
|
App.activeDocument().topView.Scale = Sc
|
|
#Create FrontView
|
|
App.activeDocument().addObject('Drawing::FeatureViewPart','FrontView')
|
|
App.activeDocument().FrontView.Source =Piece.Object
|
|
App.activeDocument().FrontView.Direction = (0,-1,0)
|
|
App.activeDocument().FrontView.Rotation=90
|
|
App.activeDocument().FrontView.Scale = Sc
|
|
App.activeDocument().FrontView.X = FrontX
|
|
App.activeDocument().FrontView.Y = FrontY
|
|
App.activeDocument().FrontView.ShowHiddenLines=True
|
|
App.activeDocument().AutoDrawing.addObject(App.activeDocument().FrontView)
|
|
#Create RightView
|
|
App.activeDocument().addObject('Drawing::FeatureViewPart','RightView')
|
|
App.activeDocument().RightView.Source =Piece.Object
|
|
App.activeDocument().RightView.Direction = (1,0,0)
|
|
App.activeDocument().RightView.Scale = Sc
|
|
App.activeDocument().RightView.X = RightX
|
|
App.activeDocument().RightView.Y = RightY
|
|
App.activeDocument().RightView.ShowHiddenLines=True
|
|
App.activeDocument().AutoDrawing.addObject(App.activeDocument().RightView)
|
|
#Create IsotView
|
|
App.activeDocument().addObject('Drawing::FeatureViewPart','IsoView')
|
|
App.activeDocument().IsoView.Source =Piece.Object
|
|
App.activeDocument().IsoView.Direction = (1,1,1)
|
|
App.activeDocument().IsoView.Rotation=60
|
|
App.activeDocument().IsoView.Scale = Sc*.6
|
|
App.activeDocument().IsoView.X = IsoX
|
|
App.activeDocument().IsoView.Y = IsoY
|
|
App.activeDocument().IsoView.ShowHiddenLines=True
|
|
App.activeDocument().AutoDrawing.addObject(App.activeDocument().IsoView) </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_Automatic_drawing/es&oldid=240118">http://www.freecadweb.org/wiki/index.php?title=Macro_Automatic_drawing/es&oldid=240118</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> |