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

101 lines
3.5 KiB
HTML

<html><head><title>Macro Draw 2D Function/sv</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 Draw 2D Function/sv</h1></div>
<div id="mw-content-text" lang="sv" 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="Draw_2D_Function"><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> Draw 2D Function</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Beskrivning
</th></tr>
<tr>
<td class="ctEven left macro-description">Ingen
</td></tr>
<tr>
<th class="ctOdd">Författare
</th></tr>
<tr>
<td class="ctEven macro-author"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Unknown&amp;action=edit&amp;redlink=1" class="new" title="User:Unknown (page does not exist)">unknown</a>
</td></tr>
<tr>
<th class="ctOdd">Links
</th></tr>
<tr>
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/sv" title="Macros recipes/sv">Makron recept</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/sv" title="How to install macros/sv">How to install macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/sv" title="Customize Toolbars/sv">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">Date last modification
</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="#Draw_2D_Function"><span class="tocnumber">1</span> <span class="toctext">Draw 2D Function</span></a></li>
</ul>
</div>
</td></tr>
</table>
<p><br />
</p><p>Använd den för att rita en funktion som beskrivs av en "ekvation" [z=F(x)] (Z-X plan) Exemplet här genererar en parabol. Behöver definieras&#160;:
</p><p>F=variabel som används i funktionen,
</p><p>X=startvärde på x,
</p><p>Nb= antal steg,
</p><p>Z=funktionsuttryck med x
</p><p>ZZ=funktionsuttryck med xx
</p><p><br />
</p>
<pre># F = variable used in the function,
# X = initial value of x,
# Nb = Number of step,
# Z = function express with x
# ZZ = function express with xx
import FreeCAD, FreeCADGui, Part
import math
F=800
X=-500
Nb=10
Step=1000/Nb
Y=0
for I in range(Nb):
XX=X+Step
Z=X*X/(4*F)
ZZ=XX*XX/(4*F)
if I==0:
print "Le test est vrai&#160;!"
nomme=Part.makeLine((X,Y,Z),(XX,Y,ZZ))
WWire=Part.Wire([nomme])
else&#160;:
print "Le test est 2&#160;!"
nomme=Part.makeLine((X,Y,Z),(XX,Y,ZZ))
WWire=Part.Wire([WWire,nomme])
X=XX
Part.show(WWire) </pre>
</div>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_Draw_2D_Function/sv&amp;oldid=240575">http://www.freecadweb.org/wiki/index.php?title=Macro_Draw_2D_Function/sv&amp;oldid=240575</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>