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

102 lines
3.6 KiB
HTML

<html><head><title>Macro Draw 2D Function/cs</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/cs</h1></div>
<div id="mw-content-text" lang="cs" 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="Vykresli_2D_funkci"><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> Vykresli 2D funkci</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Description
</th></tr>
<tr>
<td class="ctEven left macro-description">Použijete k nakreslení funkce popsané "rovnicí" [z=F(x)] (Z-X rovina)
</td></tr>
<tr>
<th class="ctOdd">Author
</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/cs" title="Macros recipes/cs">Makro návody</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/cs" title="How to install macros/cs">How to install macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/cs" title="Customize Toolbars/cs">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-date">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="#Vykresli_2D_funkci"><span class="tocnumber">1</span> <span class="toctext">Vykresli 2D funkci</span></a></li>
</ul>
</div>
</td></tr>
</table>
<p><br />
</p><p>Použijete k nakreslení funkce popsané "rovnicí" [z=F(x)] (Z-X rovina). Příklad ukázaný zde generuje parabolu.<br />
Nemá žádné dialogové okno. Je potřeba definovat&#160;:<br />
F = proměnná použitá ve funkci,<br />
X = iniciační hodnota x,<br />
Nb = počet kroků,<br />
Z = funkce vyjádřená x <br />
ZZ = funkce vyjádřená xx<br />
</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/cs&amp;oldid=240578">http://www.freecadweb.org/wiki/index.php?title=Macro_Draw_2D_Function/cs&amp;oldid=240578</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>