Please have mercy on me and help me troubleshoot this stupid code.
Code: Select all
File "<input>", line 6
else: #elif I <= Y <= xmax:
^
SyntaxError: invalid syntax
Code: Select all
import FreeCAD, FreeCADGui, Part
import math
from math import cos,tan
doc=App.activeDocument()
#======== DRAW A FUNCTION =========
# Use it to draw a function described
# by a "equation" [z=F(x)] (Z-X plane)
# The example done here generate a parabol
#
# Change the part inside two comment
# to do your function.
#==================================
#Describe your variables here:
h=3.5
theta=11
pi=3.14159265359
#Describing initial conditions
X=0
Y=0
Z=0
I=h*pi/(4*tan(theta))
xmax=h/(2*tan(theta))+I
#---------------------------
#Choose the number of steps:
Nb=10
Step=1000/Nb
Y=0
for P in range(0,Nb,Step):
X=0
Y=Y+Step #Describe the function (express with Y and YY)(ex: z=Y^2/(4*F))
if 0 <= Y <= I:
Z=h*((1-cos((pi*Y)/(2*I))/2)
else: #elif I <= Y <= xmax:
Z=tan(theta)*(Y-I)+h/2
#---------------------------------------------------------------
name=doc.addObject("Part::Polygon","Polygon")
name.Nodes=P
doc.recompute()