# HELP: Spiral like Rectangle Offset

Hi, friends,

I’m looking for a Script guru’s help. I need a script to make a spiral curve offset from a rectangle.
Options to choose should be:

1. Distance
2. Corner (sharp/round)
3. Start position (from the center/from the contour)
4. Tolerance (if it`s needed, i`m not sure)

Thanks for any help!

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,

here’s one way:

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

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?

Best regards,

it’s a python script but it sounds like you may be trying to run it as a macro?

just realized i don’t know how to use python scripts on windows (i’m on mac)…

@Helvetosaur… can you give a brief instruction on how unirevers can use the script above? thanks

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.

–Mitch

1 Like