import rhinoscriptsyntax as rs

# Get the parameters
length = rs.GetReal("lenght of the screw [mm]")
r_0 = rs.GetReal("first radius of the screw [mm]")
r_1 = rs.GetReal("second radius of the screw [mm]")
pitch = rs.GetReal("pitch of the screw [mm]")
core_r = rs.GetReal("core radius of the screw [mm]")
height = rs.GetReal("core height of the screw [mm]")

length = 280
p_0 = (0,0,0)
p_1 = (0,0,length)
pitch = 26
turns = length/pitch
r_0 = 20
r_1 = 18

sp = rs.AddSpiral(p_0, p_1, pitch, turns, r_0, r_1)
rs.AddCylinder(p_0, height, core_r, cap=True)

pt = rs.CurveStartPoint(sp)
pl = rs.AddPoint(pt)

plane = rs.PlaneFromFrame( pl, [0,0,1], [1,0,0] )

sh = rs.AddRectangle(plane,2,-6)
rs.AddSweep1(sp, sh)