I forgot to explain why I need that script. I do milling paths for an old milling 2.5D Italian machine Tecnodinamica (TD-600). That path is designed for R10 flat milling cutter. All paths are drawn manually and this really takes a lot of time (look at the pic for example) I guess that script may be useful not only for me but for someone else.
Best regards,
Vlad
pretty basic as it just draws from the origin… parameters are- length of innermost line, offset distance, and # of turns
import rhinoscriptsyntax as rs
def square_spiral():
first = rs.GetReal('Length of first line', 50)
if not first: return
gap = rs.GetReal('Offset distance', 10)
if not gap: return
turns = rs.GetInteger('Number of turns', 5, 1)
if not turns: return
polylist = []
for i in range(turns):
#negative x then positive x... negative y then positive y
x = gap * i
y = first / 2 + gap * i
z = 0
pt1 = rs.coerce3dpoint([-x, -y, z])
pt2 = rs.coerce3dpoint([-x, y, z])
pt3 = rs.coerce3dpoint([x + gap, y, z])
pt4 = rs.coerce3dpoint([x + gap, -y - gap, z])
polylist.extend([pt1, pt2, pt3, pt4])
rs.AddPolyline(polylist)
square_spiral()
Thank you Jeff! However when I run you script it asks to something import… And I have no idea what it is… Can you explain me please what kind of file I should import first?
The easiest thing is to open the python script editor with the command EditPythonScript, then copy the text out of Jeff’s post and paste it in there. Then use the little green arrow button to run the script and follow the command prompts.
It is possible to set it up as an alias or a toolbar button, but for a test, the above is faster and easier.