Commit d428323e authored by sumpfralle's avatar sumpfralle

adjusted the namespace of the toolpath settings to match the original task settings


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@395 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 83a69d40
...@@ -413,10 +413,11 @@ class ToolpathSettings: ...@@ -413,10 +413,11 @@ class ToolpathSettings:
"thickness": float, "thickness": float,
"height": float, "height": float,
}, },
"General": { "Program": {
"calculation_backend": str, "unit": str,
"enable_ode": bool,
}, },
"ProcessSettings": { "Process": {
"generator": str, "generator": str,
"postprocessor": str, "postprocessor": str,
"path_direction": str, "path_direction": str,
...@@ -431,7 +432,7 @@ class ToolpathSettings: ...@@ -431,7 +432,7 @@ class ToolpathSettings:
META_MARKER_END = "PYCAM_TOOLPATH_SETTINGS: END" META_MARKER_END = "PYCAM_TOOLPATH_SETTINGS: END"
def __init__(self): def __init__(self):
self.general = {} self.program = {}
self.bounds = {} self.bounds = {}
self.tool_settings = {} self.tool_settings = {}
self.support_grid = {} self.support_grid = {}
...@@ -477,20 +478,23 @@ class ToolpathSettings: ...@@ -477,20 +478,23 @@ class ToolpathSettings:
return {"distance": None, "thickness": None, "height": None} return {"distance": None, "thickness": None, "height": None}
def set_calculation_backend(self, backend=None): def set_calculation_backend(self, backend=None):
self.general["calculation_backend"] = None self.program["enable_ode"] = (backend.upper() == "ODE")
def get_calculation_backend(self): def get_calculation_backend(self):
if self.general.has_key("calculation_backend"): if self.program.has_key("enable_ode"):
return self.general["calculation_backend"] if self.program["enable_ode"]:
return "ODE"
else:
return None
else: else:
return None return None
def set_unit_size(self, unit_size): def set_unit_size(self, unit_size):
self.general["unit_size"] = unit_size self.program["unit"] = unit_size
def get_unit_size(self): def get_unit_size(self):
if self.general.has_key("unit_size"): if self.program.has_key("unit"):
return self.general["unit_size"] return self.program["unit"]
else: else:
return "mm" return "mm"
...@@ -517,22 +521,29 @@ class ToolpathSettings: ...@@ -517,22 +521,29 @@ class ToolpathSettings:
for config_dict, section in ((self.bounds, "Bounds"), for config_dict, section in ((self.bounds, "Bounds"),
(self.tool_settings, "Tool"), (self.tool_settings, "Tool"),
(self.support_grid, "SupportGrid"), (self.support_grid, "SupportGrid"),
(self.process_settings, "ProcessSettings")): (self.process_settings, "Process")):
for key, value_type in self.SECTIONS[section].items(): for key, value_type in self.SECTIONS[section].items():
raw_value = config.get(section, key, None) raw_value = config.get(section, key, None)
if not raw_value is None: if raw_value is None:
continue
elif value_type == bool:
value = value_raw.lower() in ("1", "true", "yes", "on")
else:
try: try:
value = value_type(raw_value) value = value_type(raw_value)
config_dict[key] = value
except ValueError: except ValueError:
print >>sys.stderr, "Ignored invalid setting (%s -> %s): %s" % (section, key, value_raw) print >>sys.stderr, "Ignored invalid setting (%s -> %s): %s" % (section, key, value_raw)
config_dict[key] = value
def get_string(self): def get_string(self):
result = [] result = []
for config_dict, section in ((self.bounds, "Bounds"), for config_dict, section in ((self.bounds, "Bounds"),
(self.tool_settings, "Tool"), (self.tool_settings, "Tool"),
(self.support_grid, "SupportGrid"), (self.support_grid, "SupportGrid"),
(self.process_settings, "ProcessSettings")): (self.process_settings, "Process")):
# skip empty sections
if not config_dict:
continue
result.append("[%s]" % section) result.append("[%s]" % section)
for key, value_type in self.SECTIONS[section].items(): for key, value_type in self.SECTIONS[section].items():
if config_dict.has_key(key): if config_dict.has_key(key):
......
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