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:
curr_path = Iterator(self.curr_path_list)
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:
print "num_prev=%d, num_curr=%d" \
% (prev_point.remains(), curr_point.remains())
......
......@@ -299,6 +299,7 @@ process: 3
}
DEFAULT_SUFFIX = "Default"
REFERENCE_TAG = "_reference_"
def __init__(self):
self.config = None
......@@ -403,9 +404,13 @@ process: 3
value_raw = self.config.get(current_section_name, key,
raw=raw)
except ConfigParser.NoOptionError:
try:
try:
value_raw = self.config.get(
prefix + self.DEFAULT_SUFFIX, key, raw=raw)
except (ConfigParser.NoSectionError,
ConfigParser.NoOptionError):
value_raw = None
except ConfigParser.NoOptionError:
value_raw = None
if not value_raw is None:
......@@ -448,6 +453,11 @@ process: 3
try:
return lists[key].index(value)
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
else:
return str(value_type(value))
......@@ -472,6 +482,8 @@ process: 3
for index, axis in enumerate("xyz"):
result["%s_low" % axis] = low[index]
result["%s_high" % axis] = high[index]
# special handler to allow tasks to track this new object
result[self.REFERENCE_TAG] = b
return result
result = []
if tools is None:
......
......@@ -77,12 +77,13 @@ def get_free_paths_triangles(model, cutter, p1, p2):
count = 0
points = []
maybe_first_is_missing = False
for h in hits:
if h.dir == forward:
if count == 0:
if h.d >= 0:
if len(points) == 0:
points.append(p1)
maybe_first_is_missing = True
points.append(h.cl)
count += 1
else:
......@@ -91,10 +92,12 @@ def get_free_paths_triangles(model, cutter, p1, p2):
if h.d <= xyz_dist:
points.append(h.cl)
if len(points)%2 == 1:
if maybe_first_is_missing:
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(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