Macro Draw 2D Function

From FreeCAD Documentation
Revision as of 19:47, 15 June 2019 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Icono de macro genérico. Crea tu icono personal con el mismo nombre de la macro Draw 2D Function

Descripción
Utilízala para dibujar una función descrita por una "ecuación" [z=F(x)] (Z-X plano)

Versión macro : 1.0
Fecha última modificación : 2011-08-01
Autor : unknown
Autor
unknown
Descargar
None
Enlace
Versión Macro
1.0
Fecha última modificación
2011-08-01
Versión(es) FreeCAD
None
Acceso directo predeterminado
None
Ver también
None

Descripción

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

Script

Macro_Draw_2D_Function.FCMacro

# 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)