Commit 5f1a3d10 authored by sumpfralle's avatar sumpfralle

fixed handling of empty "filename_templates" in "get_filename_via_dialog"

fix floating inaccuracy problem in ContourFollow
added string representation for Bounds instances


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@722 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0a221447
......@@ -2894,8 +2894,10 @@ class ProjectGui:
for file_filter in get_filters_from_list(type_filter):
dialog.add_filter(file_filter)
# guess the export filename based on the model's filename
valid_templates = [one_template for one_template in filename_templates
if one_template]
if filename_templates is None:
valid_templates = []
else:
valid_templates = [t for t in filename_templates if one_template]
if valid_templates:
filename_template = valid_templates[0]
# remove the extension
......
......@@ -349,10 +349,15 @@ class ContourFollow:
# the highest point of the triangle is at z
outer_edges = []
else:
# this should not happen
raise ValueError(("Could not find a waterline, but " \
+ "there are points above z level (%f): %s / %s") \
% (z, triangle, points_above))
if abs(triangle.minz - z) < epsilon:
# This is just an accuracy issue (see the
# "triangle.minz >= z" statement above).
outer_edges = []
else:
# this should not happen
raise ValueError(("Could not find a waterline, but " \
+ "there are points above z level (%f): " \
+ "%s / %s") % (z, triangle, points_above))
else:
# remove points that are not part of the waterline
points_above = [p for p in points_above
......@@ -451,6 +456,7 @@ class ContourFollow:
proj_cp = plane.get_point_projection(cp)
# e.g. the Spherical Cutter often does not collide exactly above
# the potential collision line.
# TODO: maybe an "is cp inside of the triangle" check would be good?
if (triangle is hit_t) or (edge.is_point_inside(proj_cp)):
result.append((cl, edge))
# continue with the next outer_edge
......
......@@ -177,6 +177,11 @@ class Bounds:
self.set_bounds(bounds_low, bounds_high)
self.reference = reference
def __repr__(self):
bounds_type_labels = ("relative", "fixed", "custom")
return "Bounds(%s, %s, %s)" % (bounds_type_labels[self.bounds_type],
self.bounds_low, self.bounds_high)
def is_valid(self):
for index in range(3):
if self.bounds_low[index] > self.bounds_high[index]:
......
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