Commit bb3f2c9a authored by sumpfralle's avatar sumpfralle

fixed the waterline strategy


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1187 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent a699b5ab
......@@ -53,7 +53,7 @@ class PushCutter(object):
self.pa = path_processor
self.physics = physics
# check if we use a PolygonExtractor
self._use_polygon_extractor = hasattr(self.pa, "pe")
self._use_polygon_extractor = hasattr(self.pa, "polygon_extractor")
def GenerateToolPath(self, cutter, models, motion_grid, minz=None, maxz=None, draw_callback=None):
# Transfer the grid (a generator) into a list of lists and count the
......
......@@ -133,7 +133,6 @@ def get_free_paths_triangles(models, cutter, p1, p2, return_triangles=False):
# return only the cutter locations (without triangles)
return [cut_info[0] for cut_info in points]
def get_free_paths_ode(physics, p1, p2, depth=8):
""" Recursive function for splitting a line (usually along x or y) into
small pieces to gather connected paths for the PushCutter.
......
......@@ -32,32 +32,32 @@ class PolygonCutter(pycam.PathProcessors.BasePathProcessor):
super(PolygonCutter, self).__init__()
self.curr_path = None
self.scanline = None
self.poly_extractor = PolygonExtractor(PolygonExtractor.MONOTONE)
self.polygon_extractor = PolygonExtractor(PolygonExtractor.MONOTONE)
self.reverse = reverse
def append(self, point):
self.poly_extractor.append(point)
self.polygon_extractor.append(point)
def new_direction(self, direction):
self.poly_extractor.new_direction(direction)
self.polygon_extractor.new_direction(direction)
def end_direction(self):
self.poly_extractor.end_direction()
self.polygon_extractor.end_direction()
def new_scanline(self):
self.poly_extractor.new_scanline()
self.polygon_extractor.new_scanline()
def end_scanline(self):
self.poly_extractor.end_scanline()
self.polygon_extractor.end_scanline()
def finish(self):
self.poly_extractor.finish()
self.polygon_extractor.finish()
paths = []
source_paths = []
if self.poly_extractor.hor_path_list:
source_paths.extend(self.poly_extractor.hor_path_list)
if self.poly_extractor.ver_path_list:
source_paths.extend(self.poly_extractor.ver_path_list)
if self.polygon_extractor.hor_path_list:
source_paths.extend(self.polygon_extractor.hor_path_list)
if self.polygon_extractor.ver_path_list:
source_paths.extend(self.polygon_extractor.ver_path_list)
for path in source_paths:
points = path.points
for i in range(0, (len(points)+1)/2):
......
......@@ -240,7 +240,6 @@ class Bounds(pycam.Plugins.ListPluginBase):
removal_list.reverse()
for index in removal_list:
bounds["Models"].pop(index)
print "Removed model %d" % index
def _store_bounds_settings(self, widget=None):
data = self.get_selected()
......
......@@ -105,6 +105,8 @@ class PathParamMillingStyle(pycam.Plugins.PluginBase):
"process-changed"))
self.core.get("register_parameter")("path_pattern", "milling_style",
self.control)
self.core.get("register_parameter")("process", "milling_style",
self.control)
self.core.register_ui("process_path_parameters", "Milling style",
self.control.get_widget(), weight=50)
return True
......@@ -112,6 +114,7 @@ class PathParamMillingStyle(pycam.Plugins.PluginBase):
def teardown(self):
self.core.unregister_ui("process_path_parameters", self.control.get_widget())
self.core.get("unregister_parameter")("path_pattern", "milling_style")
self.core.get("unregister_parameter")("process", "milling_style")
class PathParamGridDirection(pycam.Plugins.PluginBase):
......@@ -128,6 +131,8 @@ class PathParamGridDirection(pycam.Plugins.PluginBase):
"process-changed"))
self.core.get("register_parameter")("path_pattern", "grid_direction",
self.control)
self.core.get("register_parameter")("process", "grid_direction",
self.control)
self.core.register_ui("process_path_parameters", "Direction",
self.control.get_widget(), weight=40)
return True
......@@ -135,6 +140,7 @@ class PathParamGridDirection(pycam.Plugins.PluginBase):
def teardown(self):
self.core.unregister_ui("process_path_parameters", self.control.get_widget())
self.core.get("unregister_parameter")("path_pattern", "grid_direction")
self.core.get("unregister_parameter")("process", "grid_direction")
class PathParamSpiralDirection(pycam.Plugins.PluginBase):
......
......@@ -25,6 +25,7 @@ import pycam.Plugins
import pycam.PathGenerators.PushCutter
import pycam.PathProcessors.PathAccumulator
import pycam.Toolpath.MotionGrid
from pycam.Toolpath.MotionGrid import START_X, START_Y, START_Z
class ProcessStrategySlicing(pycam.Plugins.PluginBase):
......@@ -56,7 +57,7 @@ class ProcessStrategySlicing(pycam.Plugins.PluginBase):
line_distance = 2 * tool_params["radius"] * \
(1.0 - process["parameters"]["overlap"])
path_generator = pycam.PathGenerators.PushCutter.PushCutter(
pycam.PathProcessors.PathAccumulator.PathAccumulator())
pycam.PathProcessors.SimpleCutter.SimpleCutter())
path_pattern = process["parameters"]["path_pattern"]
path_get_func = self.core.get("get_parameter_sets")(
"path_pattern")[path_pattern["name"]]["func"]
......@@ -76,6 +77,7 @@ class ProcessStrategyContour(pycam.Plugins.PluginBase):
def setup(self):
parameters = {"step_down": 1.0,
"material_allowance": 0,
"overlap": 0.8,
"milling_style": pycam.Toolpath.MotionGrid.MILLING_STYLE_IGNORE,
}
self.core.get("register_parameter_set")("process", "contour",
......@@ -86,8 +88,23 @@ class ProcessStrategyContour(pycam.Plugins.PluginBase):
def teardown(self):
self.core.get("unregister_parameter_set")("process", "contour")
def run_process(self, strategy, environment=None):
pass
def run_process(self, process, environment=None):
tool = environment["tool"]
tool_params = tool["parameters"]
low, high = environment["bounds"].get_absolute_limits(
tool=tool, models=environment["collision_models"])
line_distance = 2 * tool_params["radius"] * \
(1.0 - process["parameters"]["overlap"])
path_generator = pycam.PathGenerators.PushCutter.PushCutter(
pycam.PathProcessors.ContourCutter.ContourCutter())
# TODO: milling_style currently refers to the grid lines - not to the waterlines
motion_grid = pycam.Toolpath.MotionGrid.get_fixed_grid(
(low, high), process["parameters"]["step_down"],
line_distance=line_distance,
grid_direction=pycam.Toolpath.MotionGrid.GRID_DIRECTION_X,
milling_style=process["parameters"]["milling_style"],
start_position=(START_X | START_Z))
return path_generator, motion_grid, (low, high)
class ProcessStrategySurfacing(pycam.Plugins.PluginBase):
......
......@@ -58,6 +58,9 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
models = task["parameters"]["collision_models"]
moves = path_generator.GenerateToolPath(tool, models, motion_grid,
minz=low[2], maxz=high[2], draw_callback=callback)
if not moves:
self.log.info("No valid moves found")
return None
data = {}
for item_name in ("tool", "process", "bounds"):
self.core.call_chain("get_toolpath_information",
......
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