Macro Draw 2D Function/es: Difference between revisions

From FreeCAD Documentation
m (FuzzyBot moved page Macro draw2DFunction/es to Macro Draw 2D Function/es without leaving a redirect: Part of translatable page "Macro draw2DFunction".)
(Updating to match new version of source page)
Line 1: Line 1:
{{Macro/es|Icon=Text-x-python|Name=draw2DFunction|Name/es=draw2DFunction|Description= Utilízala para dibujar una función descrita por una "ecuación" [z=F(x)] (Z-X plano)|Author=unknown}}
{{Macro|Icon=Text-x-python|Name=Draw 2D Function|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 />
Utilízala para dibujar una función descrita por una "ecuación" [z=F(x)] (Z-X plano) El ejemplo indicado aquí genera una parábola.

Has no dialog. Needs to be defined :<br />
Necesita ser definida:
F = variable used in the function,<br />

X = initial value of x,<br />
F=variable utilizada en la función,
Nb = Number of step,<br />

Z = function express with x <br />
X=Valor inicial de x,
ZZ = function express with xx<br />

Nb= Número de pasos,

Z=Función expresada express con x

ZZ=Función expresada express con xx





Revision as of 06:45, 27 June 2016

File:Text-x-python Draw 2D Function

Description
Use it to draw a function described by a "equation" [z=F(x)] (Z-X plane)

Author: unknown
Author
unknown
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Utilízala para dibujar una función descrita por una "ecuación" [z=F(x)] (Z-X plano) El ejemplo indicado aquí genera una parábola.

Necesita ser definida:

F=variable utilizada en la función,

X=Valor inicial de x,

Nb= Número de pasos,

Z=Función expresada express con x

ZZ=Función expresada express con 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)