the following code does just what I want but I feel it is a little bit messy and I want to make it cleaner for better reading in the future, any suggestions?
Enable Python support and load DesignScript library
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
Place your code below this line
slider = IN[0]
B = IN[1]
TR = IN[2]
Height = IN[3]
output =
ylst = [0, TR, TR*2]
zlst = range(3)
def create3points():
if 0<=slider < 10:
zlst[0]= slider
zlst[1]= 0
zlst[2]= 0
elif 10<=slider<20:
zlst[0]= 10
zlst[1]= (slider-10)
zlst[2]= 0
elif 20<=slider<=30:
zlst[0]= 10
zlst[1]= 10
zlst[2]= (slider-20)
p1= Point.ByCoordinates(0,ylst[0],Height*zlst[0])
p2= Point.ByCoordinates(0,ylst[1],Height*zlst[1])
p3= Point.ByCoordinates(0,ylst[2],Height*zlst[2])
output.append((p1,p2,p3))
return output
Assign your output to the OUT variable.
OUT = create3points()