Commit 05f49414 authored by sumpfralle's avatar sumpfralle

adapt to change of toolpath class

fixed table selection for empty models


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1155 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 67639b45
......@@ -43,7 +43,7 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
def teardown(self):
self.core.get("unregister_parameter_set")("task", "milling")
def run_task(self, task):
def run_task(self, task, callback=None):
environment = {}
for key in task["parameters"]:
environment[key] = task["parameters"][key]
......@@ -55,8 +55,17 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
path_generator, motion_grid, (low, high) = funcs["process"](
environment["process"], environment=environment)
models = task["parameters"]["collision_models"]
# TODO: low[2]/high[2]
toolpath = path_generator.GenerateToolPath(tool, models, motion_grid,
minz=low[2], maxz=high[2])
return toolpath
moves = path_generator.GenerateToolPath(tool, models, motion_grid,
minz=low[2], maxz=high[2], draw_callback=callback)
kwargs = {}
try:
kwargs["max_safe_distance"] = 2 * environment["tool"]["radius"]
except KeyError:
pass
try:
kwargs["feedrate"] = environment["tool"]["feedrate"]
except KeyError:
pass
tp = pycam.Toolpath.Toolpath(moves, **kwargs)
return tp
......@@ -153,7 +153,7 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
return
else:
toolpath = self.toolpath[toolpath_index]
paths = toolpath.get_paths()
paths = toolpath.paths
# set the current cutter
self.cutter = pycam.Cutters.get_tool_from_settings(
toolpath.get_tool_settings())
......
......@@ -260,8 +260,10 @@ class ListPluginBase(PluginBase, list):
super(ListPluginBase, self).__init__(*args, **kwargs)
self._update_model_funcs = []
def get_function(func_name):
return lambda *args, **kwargs: self._change_wrapper(func_name, *args, **kwargs)
for name in ("append", "insert", "pop", "reverse", "sort"):
return lambda *args, **kwargs: \
self._change_wrapper(func_name, *args, **kwargs)
for name in ("append", "extend", "insert", "pop", "reverse", "remove",
"sort"):
setattr(self, name, get_function(name))
def _change_wrapper(self, func_name, *args, **kwargs):
......@@ -348,7 +350,8 @@ class ListPluginBase(PluginBase, list):
new_selection.append(index + 1)
elif action == self.ACTION_DELETE:
self.pop(index)
new_selection.append(min(index, len(self) - 1))
if len(self) > 0:
new_selection.append(min(index, len(self) - 1))
else:
pass
self._update_model()
......
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