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

149 lines
6.7 KiB
HTML

<html><head><title>Macro Stairs/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 Stairs/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="Scala_a_chiocciola"><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> Scala a chiocciola</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Descrizione
</th></tr>
<tr>
<td class="ctEven left">Crea una scala a chiocciola.
</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.03
</td></tr>
<tr>
<th class="ctOdd">Data ultima modifica
</th></tr>
<tr>
<td class="ctEven macro-date">2015-03-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="#Scala_a_chiocciola"><span class="tocnumber">1</span> <span class="toctext">Scala a chiocciola</span></a></li>
<li class="toclevel-1 tocsection-1"><a href="#Descrizione"><span class="tocnumber">2</span> <span class="toctext">Descrizione</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Uso"><span class="tocnumber">3</span> <span class="toctext">Uso</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Script"><span class="tocnumber">4</span> <span class="toctext">Script</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Link"><span class="tocnumber">5</span> <span class="toctext">Link</span></a></li>
</ul>
</div>
</td></tr>
</table>
<p><br />
</p>
<h2><span class="mw-headline" id="Descrizione">Descrizione</span></h2>
<p>Crea una scala a chiocciola
</p>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CircularStair.png" class="image"><img alt="Macro CircularStair.png" src="480px-Macro_CircularStair.png" width="480" height="360" srcset="/wiki/images/7/72/Macro_CircularStair.png 1.5x" /></a></div>
<div style="clear:both"></div>
<h2><span class="mw-headline" id="Uso">Uso</span></h2>
<p>Creare lo scalino modello, selezionare l'oggetto e avviare la macro
</p>
<ul><li><b>Hmarche</b> &#160;: alzata dello scalino</li>
<li><b>nombre</b> &#160;: numero di scalini per giro</li>
<li><b>rayon</b> &#160;: raggio (rispetto all'asse dello scalino)</li>
<li><b>tours</b> &#160;: numero di giri </li>
<li><b>cloner</b> &#160;: 1=crea cloni 0=crea copie</li>
<li><b>cylindre</b>&#160;: 1=crea cilindro 0=senza cilindro (piantone)</li></ul>
<h2><span class="mw-headline" id="Script">Script</span></h2>
<p><b>Macro_Stairs.FCMacro</b>
</p>
<pre># Select your object(s) give&#160;:
# head marche
# number objects for 1 turn
# radius (axe to object)
# number turns
# the original object is not modify
# Macro_Stairs.FCMacro
import FreeCAD, Draft, Part
__title__ = "CircularStair"
__author__ = "Mario52"
__date__ = "01/03/2015"
__url__ = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.03"
sel = FreeCADGui.Selection.getSelection()
############## Modify here ####################
Hmarche = 10 # head marche
nombre = 18 # number objects for 1 turn
rayon = 20 # radius (axe to object)
tours = 5 # nomber turns pitch
cloner = 1 # 1=clone 0=copy
cylindre = 1 # 1=create cylinder 0=not cylinder
###############################################
vecligne=[FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(rayon,0.0,0.0)] # vector for line directrice
ligne = Draft.makeWire(vecligne,closed=False,face=False,support=None) # creation de la ligne de base
coor_X = coor_Y = coor_Z = 0.0
for i0 in range(tours):
for i in range(0,360,((360/nombre))): # boucle principale 0 to 360 degrees
FreeCAD.ActiveDocument.getObject(ligne.Name).Placement=App.Placement(App.Vector(0,0,coor_Z), App.Rotation(App.Vector(0,0,1),i), App.Vector(0,0,0))
a = ligne.Shape.Edges[0].Vertexes[1] # fin de la ligne
coor_X = (a.Point.x)
coor_Y = (a.Point.y)
if cloner == 1:
obj=Draft.clone(sel)
else:
obj = Draft.scale(sel,delta=App.Vector(1, 1, 1),center=App.Vector(),copy=True,legacy=True)
try:
for io in range(len(obj)):
obj[io].Placement=App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(i,0,0), App.Vector(0,0,0))
except Exception:
obj.Placement=App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(i,0,0), App.Vector(0,0,0))
coor_Z += Hmarche
App.ActiveDocument.removeObject(ligne.Name) # remove ligne de base directrice
# create cylinder
if cylindre == 1:
App.ActiveDocument.addObject("Part::Cylinder","Cylinder")
App.ActiveDocument.ActiveObject.Label = "Cylindre"
FreeCAD.ActiveDocument.ActiveObject.Height = (Hmarche * nombre * tours) # heigth of cylinder
FreeCAD.ActiveDocument.ActiveObject.Radius = (rayon) # radius of cylinder
FreeCAD.ActiveDocument.recompute() </pre>
<h2><span class="mw-headline" id="Link">Link</span></h2>
<p>La discussione nel forum <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=3&amp;t=9921">Newbie question - spiral staris reloaded</a>
</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_Stairs/it&amp;oldid=241154">http://www.freecadweb.org/wiki/index.php?title=Macro_Stairs/it&amp;oldid=241154</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>