Tuesday, July 27, 2010

Keep tool down

I changed the pocket operation to keep the tool down whenever possible.
I have changed the "area" module to make Subtract work again.
This is my function in area_funcs.py

def feed_possible(p0, p1):
....obround = make_obround(p0, p1, first_offset_for_pocket)
....a = area.Area(area_for_pocket)
....obround.Subtract(a)
....if obround.num_curves() > 0:
........return False
....return True

P.S. how do I get the spaces to stay at the start of the line in blogger?

2 comments:

Dan Falck said...

Hi Dan,
This is great. I tried it out with a simple pocket with an island and it works well.
On the spaces in a blog entry thing, you can paste code that's been modified outside of the blog edit tools. I found a little 5 line python script (from the future no less :) to put "    " in front of lines. Let's see how the comments section mangles it.
'''
blogspace.py
Turns leading spaces into HTML &nbsp tokens which shows
as correct indentation on Blogger comment fields
(and maybe other blogs).

Donald. 'Paddy' McCarthy Sept 2011
'''
import fileinput, re

for l in fileinput.input():
  print re.sub(r'^(\s*)\s',
               lambda m: ' '*m.end(),
               l.rstrip())

Dan Falck said...

Whoops, it didn't show up in the posted comment. Look at the raw HTML, and you will see the actual escape characters that give you spaces.
I will email the script to you.