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): ...@@ -43,7 +43,7 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
def teardown(self): def teardown(self):
self.core.get("unregister_parameter_set")("task", "milling") self.core.get("unregister_parameter_set")("task", "milling")
def run_task(self, task): def run_task(self, task, callback=None):
environment = {} environment = {}
for key in task["parameters"]: for key in task["parameters"]:
environment[key] = task["parameters"][key] environment[key] = task["parameters"][key]
...@@ -55,8 +55,17 @@ class TaskTypeMilling(pycam.Plugins.PluginBase): ...@@ -55,8 +55,17 @@ class TaskTypeMilling(pycam.Plugins.PluginBase):
path_generator, motion_grid, (low, high) = funcs["process"]( path_generator, motion_grid, (low, high) = funcs["process"](
environment["process"], environment=environment) environment["process"], environment=environment)
models = task["parameters"]["collision_models"] models = task["parameters"]["collision_models"]
# TODO: low[2]/high[2] moves = path_generator.GenerateToolPath(tool, models, motion_grid,
toolpath = path_generator.GenerateToolPath(tool, models, motion_grid, minz=low[2], maxz=high[2], draw_callback=callback)
minz=low[2], maxz=high[2]) kwargs = {}
return toolpath 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): ...@@ -153,7 +153,7 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
return return
else: else:
toolpath = self.toolpath[toolpath_index] toolpath = self.toolpath[toolpath_index]
paths = toolpath.get_paths() paths = toolpath.paths
# set the current cutter # set the current cutter
self.cutter = pycam.Cutters.get_tool_from_settings( self.cutter = pycam.Cutters.get_tool_from_settings(
toolpath.get_tool_settings()) toolpath.get_tool_settings())
......
...@@ -260,8 +260,10 @@ class ListPluginBase(PluginBase, list): ...@@ -260,8 +260,10 @@ class ListPluginBase(PluginBase, list):
super(ListPluginBase, self).__init__(*args, **kwargs) super(ListPluginBase, self).__init__(*args, **kwargs)
self._update_model_funcs = [] self._update_model_funcs = []
def get_function(func_name): def get_function(func_name):
return lambda *args, **kwargs: self._change_wrapper(func_name, *args, **kwargs) return lambda *args, **kwargs: \
for name in ("append", "insert", "pop", "reverse", "sort"): self._change_wrapper(func_name, *args, **kwargs)
for name in ("append", "extend", "insert", "pop", "reverse", "remove",
"sort"):
setattr(self, name, get_function(name)) setattr(self, name, get_function(name))
def _change_wrapper(self, func_name, *args, **kwargs): def _change_wrapper(self, func_name, *args, **kwargs):
...@@ -348,6 +350,7 @@ class ListPluginBase(PluginBase, list): ...@@ -348,6 +350,7 @@ class ListPluginBase(PluginBase, list):
new_selection.append(index + 1) new_selection.append(index + 1)
elif action == self.ACTION_DELETE: elif action == self.ACTION_DELETE:
self.pop(index) self.pop(index)
if len(self) > 0:
new_selection.append(min(index, len(self) - 1)) new_selection.append(min(index, len(self) - 1))
else: else:
pass pass
......
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