<html><head><title>Macro Draw 2D Function/de</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/de</h1></div> <div id="mw-content-text" lang="de" 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">Beschreibung </th></tr> <tr> <td class="ctEven left">Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane) </td></tr> <tr> <th class="ctOdd">Autor </th></tr> <tr> <td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Unknown&action=edit&redlink=1" class="new" title="User:Unknown (page does not exist)">unknown</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/de" title="Macros recipes/de">Liste von Macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/de" title="How to install macros/de">How to install macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/de" title="Customize Toolbars/de">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">Datum zuletzt geƤndert </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="#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>Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane) The example done here generate a parabol.<br /> Has no dialog. Needs to be defined :<br /> F = variable used in the function,<br /> X = initial value of x,<br /> Nb = Number of step,<br /> Z = function express with x <br /> ZZ = function express with 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 !" nomme=Part.makeLine((X,Y,Z),(XX,Y,ZZ)) WWire=Part.Wire([nomme]) else : print "Le test est 2 !" 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/de&oldid=240580">http://www.freecadweb.org/wiki/index.php?title=Macro_Draw_2D_Function/de&oldid=240580</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>