Commit 13608b72 authored by sumpfralle's avatar sumpfralle

when chaning a process type: try to detect non-changed default values of the...

when chaning a process type: try to detect non-changed default values of the former process type and replace these values with the defaults of the new process type


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1192 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 4a032cd1
......@@ -1009,7 +1009,7 @@ class ProjectGui(object):
filename = filename()
if not filename:
filename = self.settings.get("get_filename_func")("Loading model ...",
mode_load=True, type_filter=FILTER_MODEL, extra_widget=gtk.Label("Test"))
mode_load=True, type_filter=FILTER_MODEL)
if filename:
file_type, importer = pycam.Importers.detect_file_type(filename)
if file_type and callable(importer):
......
......@@ -210,6 +210,23 @@ class Processes(pycam.Plugins.ListPluginBase):
if process is None or strategy is None:
control_box.hide()
else:
# Check if any of the relevant controls are still at their default
# values for this process type. These values are overridden by the
# default value of the new (changed) process type.
# E.g. this changes the "overlap" value from 10 to 60 when
# switching from slicing to surfacing.
if process["strategy"] and process["strategy"] in \
self.core.get("get_parameter_sets")("process"):
old_strategy = self.core.get("get_parameter_sets")("process")[process["strategy"]]
if process["strategy"] != strategy["name"]:
changes = {}
common_keys = [key for key in old_strategy["parameters"] \
if key in strategy["parameters"]]
for key in common_keys:
if process["parameters"][key] == \
old_strategy["parameters"][key]:
changes[key] = strategy["parameters"][key]
self.core.get("set_parameter_values")("process", changes)
process["strategy"] = strategy["name"]
parameters = process["parameters"]
parameters.update(self.core.get("get_parameter_values")("process"))
......
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