Macro Draw 2D Function/sv: Difference between revisions
(Updating to match new version of source page) |
Renatorivo (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Macro|Icon=Text-x-python|Name=draw2DFunction|Description=Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane)|Author=unknown}} |
{{Macro/sv|Icon=Text-x-python|Name=draw2DFunction|Name/sv=draw2DFunction|Description=Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane)|Author=unknown}} |
||
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 /> |
|||
F=variabel som används i funktionen, |
|||
X = initial value of x,<br /> |
|||
Nb = Number of step,<br /> |
|||
X=startvärde på x, |
|||
Z = function express with x <br /> |
|||
ZZ = function express with xx<br /> |
|||
Nb= antal steg, |
|||
Z=funktionsuttryck med x |
|||
ZZ=funktionsuttryck med xx |
|||
Revision as of 19:31, 14 May 2014
File:Text-x-python draw2DFunction |
Beskrivning |
---|
Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane) Författare : unknown |
Författare |
unknown |
Ladda ner |
None |
länkar |
Makros recept Så här installerar du makron Hur man anpassar verktygsfält |
Makroversion |
1.0 |
Datum senaste ändring |
None |
FreeCAD Version(s) |
None |
Standard genväg |
None |
Se även |
None |
Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane) The example done here generate a parabol.
Has no dialog. Needs to be defined :
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
# 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)