Commit 188baeea authored by sumpfralle's avatar sumpfralle

don't try to fix directions of open polygons


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1014 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent c658a40c
...@@ -444,13 +444,14 @@ class ContourModel(BaseModel): ...@@ -444,13 +444,14 @@ class ContourModel(BaseModel):
return [group for group in self._line_groups if group.minz <= z] return [group for group in self._line_groups if group.minz <= z]
def detect_directions(self, callback=None): def detect_directions(self, callback=None):
finished = []
# handle only closed polygons
remaining_polys = [poly for poly in self.get_polygons() if poly.is_closed]
if callback: if callback:
progress_callback = pycam.Utils.ProgressCounter( progress_callback = pycam.Utils.ProgressCounter(
2 * len(self.get_polygons()), callback).increment 2 * len(remaining_polys), callback).increment
else: else:
progress_callback = None progress_callback = None
finished = []
remaining_polys = list(self.get_polygons())
remaining_polys.sort(key=lambda poly: abs(poly.get_area())) remaining_polys.sort(key=lambda poly: abs(poly.get_area()))
while remaining_polys: while remaining_polys:
# pick the largest polygon # pick the largest polygon
...@@ -461,6 +462,7 @@ class ContourModel(BaseModel): ...@@ -461,6 +462,7 @@ class ContourModel(BaseModel):
finished.insert(0, (current, not is_outer)) finished.insert(0, (current, not is_outer))
break break
else: else:
# no enclosing polygon was found
finished.insert(0, (current, True)) finished.insert(0, (current, True))
if progress_callback and progress_callback(): if progress_callback and progress_callback():
return return
......
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