Commit 42afa989 authored by sumpfralle's avatar sumpfralle

fixed GCode generation for automatically distributed support bridges in "corner" mode

fixed a small glitch for zero-sized polygons (corner distribution of support bridges)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@966 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 8b0686e1
...@@ -582,7 +582,6 @@ class ToolpathSettings: ...@@ -582,7 +582,6 @@ class ToolpathSettings:
"average_distance": float, "average_distance": float,
"minimum_bridges": int, "minimum_bridges": int,
"length": float, "length": float,
"start_at_corner": bool,
}, },
"Program": { "Program": {
"unit": str, "unit": str,
...@@ -662,13 +661,15 @@ class ToolpathSettings: ...@@ -662,13 +661,15 @@ class ToolpathSettings:
def set_support_distributed(self, average_distance, minimum_bridges, def set_support_distributed(self, average_distance, minimum_bridges,
thickness, height, length, start_at_corner=False): thickness, height, length, start_at_corner=False):
self.support_grid["type"] = "distributed" if start_at_corner:
self.support_grid["type"] = "distributed_corners"
else:
self.support_grid["type"] = "distributed_edges"
self.support_grid["average_distance"] = average_distance self.support_grid["average_distance"] = average_distance
self.support_grid["minimum_bridges"] = minimum_bridges self.support_grid["minimum_bridges"] = minimum_bridges
self.support_grid["thickness"] = thickness self.support_grid["thickness"] = thickness
self.support_grid["height"] = height self.support_grid["height"] = height
self.support_grid["length"] = length self.support_grid["length"] = length
self.support_grid["start_at_corner"] = start_at_corner
def get_support_grid(self): def get_support_grid(self):
result = {} result = {}
......
...@@ -180,7 +180,7 @@ def generate_toolpath(model, tool_settings=None, ...@@ -180,7 +180,7 @@ def generate_toolpath(model, tool_settings=None,
adjustments_x=support_grid_adjustments_x, adjustments_x=support_grid_adjustments_x,
adjustments_y=support_grid_adjustments_y) adjustments_y=support_grid_adjustments_y)
trimesh_models.append(support_grid_model) trimesh_models.append(support_grid_model)
elif (support_grid_type == "distributed") \ elif (support_grid_type in ("distributed_edges", "distributed_corners")) \
and (not support_grid_average_distance is None) \ and (not support_grid_average_distance is None) \
and (not support_grid_thickness is None) \ and (not support_grid_thickness is None) \
and (not support_grid_length is None): and (not support_grid_length is None):
...@@ -204,10 +204,12 @@ def generate_toolpath(model, tool_settings=None, ...@@ -204,10 +204,12 @@ def generate_toolpath(model, tool_settings=None,
model = contour_model model = contour_model
else: else:
model = trimesh_models[0] model = trimesh_models[0]
start_at_corners = (support_grid_type == "distributed_corners")
support_grid_model = pycam.Toolpath.SupportGrid.get_support_distributed( support_grid_model = pycam.Toolpath.SupportGrid.get_support_distributed(
model, minz, support_grid_average_distance, model, minz, support_grid_average_distance,
support_grid_minimum_bridges, support_grid_thickness, support_grid_minimum_bridges, support_grid_thickness,
support_grid_height, support_grid_length) support_grid_height, support_grid_length,
start_at_corners=start_at_corners)
trimesh_models.append(support_grid_model) trimesh_models.append(support_grid_model)
elif (not support_grid_type) or (support_grid_type == "none"): elif (not support_grid_type) or (support_grid_type == "none"):
pass pass
......
...@@ -221,6 +221,9 @@ def _get_corner_bridges(polygon, z_plane, min_bridges, average_distance, avoid_d ...@@ -221,6 +221,9 @@ def _get_corner_bridges(polygon, z_plane, min_bridges, average_distance, avoid_d
- directions pointing away from the center of the polygon are preferred - directions pointing away from the center of the polygon are preferred
""" """
center = polygon.get_barycenter() center = polygon.get_barycenter()
if center is None:
# polygon is open or zero-sized
return []
points = polygon.get_points() points = polygon.get_points()
lines = polygon.get_lines() lines = polygon.get_lines()
poly_lengths = polygon.get_lengths() poly_lengths = polygon.get_lengths()
......
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