Commit 79c7aead authored by sumpfralle's avatar sumpfralle

fixed references to "bounds" in config files

accept missing "Default" sections


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@532 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 803edec6
...@@ -235,7 +235,14 @@ class PolygonExtractor: ...@@ -235,7 +235,14 @@ class PolygonExtractor:
curr_path = Iterator(self.curr_path_list) curr_path = Iterator(self.curr_path_list)
winding = 0 winding = 0
while (prev_point.remains() > 0) or (curr_point.remains() > 0): loop_counter = 0
while (prev_point.remains() > 1) or (curr_point.remains() > 1):
loop_counter += 1
if loop_counter % 1000 == 999:
print "prev: %s" % str(prev_point.remains())
print "curr: %s" % str(curr_point.remains())
if loop_counter > 100000:
break
if DEBUG_POLYGONEXTRACTOR: if DEBUG_POLYGONEXTRACTOR:
print "num_prev=%d, num_curr=%d" \ print "num_prev=%d, num_curr=%d" \
% (prev_point.remains(), curr_point.remains()) % (prev_point.remains(), curr_point.remains())
......
...@@ -299,6 +299,7 @@ process: 3 ...@@ -299,6 +299,7 @@ process: 3
} }
DEFAULT_SUFFIX = "Default" DEFAULT_SUFFIX = "Default"
REFERENCE_TAG = "_reference_"
def __init__(self): def __init__(self):
self.config = None self.config = None
...@@ -404,8 +405,12 @@ process: 3 ...@@ -404,8 +405,12 @@ process: 3
raw=raw) raw=raw)
except ConfigParser.NoOptionError: except ConfigParser.NoOptionError:
try: try:
value_raw = self.config.get( try:
prefix + self.DEFAULT_SUFFIX, key, raw=raw) value_raw = self.config.get(
prefix + self.DEFAULT_SUFFIX, key, raw=raw)
except (ConfigParser.NoSectionError,
ConfigParser.NoOptionError):
value_raw = None
except ConfigParser.NoOptionError: except ConfigParser.NoOptionError:
value_raw = None value_raw = None
if not value_raw is None: if not value_raw is None:
...@@ -448,6 +453,11 @@ process: 3 ...@@ -448,6 +453,11 @@ process: 3
try: try:
return lists[key].index(value) return lists[key].index(value)
except ValueError: except ValueError:
# special handling for non-direct object references ("bounds")
for index, item in enumerate(lists[key]):
if (self.REFERENCE_TAG in item) \
and (value is item[self.REFERENCE_TAG]):
return index
return None return None
else: else:
return str(value_type(value)) return str(value_type(value))
...@@ -472,6 +482,8 @@ process: 3 ...@@ -472,6 +482,8 @@ process: 3
for index, axis in enumerate("xyz"): for index, axis in enumerate("xyz"):
result["%s_low" % axis] = low[index] result["%s_low" % axis] = low[index]
result["%s_high" % axis] = high[index] result["%s_high" % axis] = high[index]
# special handler to allow tasks to track this new object
result[self.REFERENCE_TAG] = b
return result return result
result = [] result = []
if tools is None: if tools is None:
......
...@@ -77,12 +77,13 @@ def get_free_paths_triangles(model, cutter, p1, p2): ...@@ -77,12 +77,13 @@ def get_free_paths_triangles(model, cutter, p1, p2):
count = 0 count = 0
points = [] points = []
maybe_first_is_missing = False
for h in hits: for h in hits:
if h.dir == forward: if h.dir == forward:
if count == 0: if count == 0:
if h.d >= 0: if h.d >= 0:
if len(points) == 0: if len(points) == 0:
points.append(p1) maybe_first_is_missing = True
points.append(h.cl) points.append(h.cl)
count += 1 count += 1
else: else:
...@@ -91,10 +92,12 @@ def get_free_paths_triangles(model, cutter, p1, p2): ...@@ -91,10 +92,12 @@ def get_free_paths_triangles(model, cutter, p1, p2):
if h.d <= xyz_dist: if h.d <= xyz_dist:
points.append(h.cl) points.append(h.cl)
if len(points)%2 == 1: if maybe_first_is_missing:
points.append(p2) points.insert(0, p1)
if len(points) % 2 == 1:
points.append(p2)
if len(hits)==0: if len(hits) == 0:
points.append(p1) points.append(p1)
points.append(p2) points.append(p2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment