Commit 7d63cae7 authored by sumpfralle's avatar sumpfralle

added the "WaterlineCutter" to the GUI


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@675 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent cae26191
...@@ -2493,6 +2493,20 @@ It will spare some material close to the model (depending on the "step down" val ...@@ -2493,6 +2493,20 @@ It will spare some material close to the model (depending on the "step down" val
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkRadioButton" id="WaterlineCutter">
<property name="label" translatable="yes">Waterlines</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">DropCutter</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
</child> </child>
</object> </object>
......
...@@ -534,8 +534,10 @@ class ProjectGui: ...@@ -534,8 +534,10 @@ class ProjectGui:
self.gui.get_object(name).connect("clicked", self.handle_tool_settings_change) self.gui.get_object(name).connect("clicked", self.handle_tool_settings_change)
self.gui.get_object("ToolName").connect("changed", self.handle_tool_settings_change) self.gui.get_object("ToolName").connect("changed", self.handle_tool_settings_change)
# connect the "consistency check" and the update-handler with all toolpath settings # connect the "consistency check" and the update-handler with all toolpath settings
for objname in ("PathAccumulator", "SimpleCutter", "ZigZagCutter", "PolygonCutter", "ContourCutter", for objname in ("PathAccumulator", "SimpleCutter", "ZigZagCutter",
"DropCutter", "PushCutter", "PathDirectionX", "PathDirectionY", "PathDirectionXY", "SettingEnableODE"): "PolygonCutter", "ContourCutter", "DropCutter", "PushCutter",
"EngraveCutter", "WaterlineCutter", "PathDirectionX",
"PathDirectionY", "PathDirectionXY", "SettingEnableODE"):
self.gui.get_object(objname).connect("toggled", self.update_process_controls) self.gui.get_object(objname).connect("toggled", self.update_process_controls)
if objname != "SettingEnableODE": if objname != "SettingEnableODE":
self.gui.get_object(objname).connect("toggled", self.handle_process_settings_change) self.gui.get_object(objname).connect("toggled", self.handle_process_settings_change)
...@@ -1295,7 +1297,8 @@ class ProjectGui: ...@@ -1295,7 +1297,8 @@ class ProjectGui:
# possible dependencies of the DropCutter # possible dependencies of the DropCutter
get_obj = self.gui.get_object get_obj = self.gui.get_object
cutter_name = None cutter_name = None
for one_cutter in ("DropCutter", "PushCutter", "EngraveCutter"): for one_cutter in ("DropCutter", "PushCutter", "EngraveCutter",
"WaterlineCutter"):
if get_obj(one_cutter).get_active(): if get_obj(one_cutter).get_active():
cutter_name = one_cutter cutter_name = one_cutter
if cutter_name == "DropCutter": if cutter_name == "DropCutter":
...@@ -1308,10 +1311,14 @@ class ProjectGui: ...@@ -1308,10 +1311,14 @@ class ProjectGui:
or get_obj("PolygonCutter").get_active() \ or get_obj("PolygonCutter").get_active() \
or get_obj("ContourCutter").get_active()): or get_obj("ContourCutter").get_active()):
get_obj("SimpleCutter").set_active(True) get_obj("SimpleCutter").set_active(True)
else: elif cutter_name == "EngraveCutter":
# engraving
if not get_obj("SimpleCutter").get_active(): if not get_obj("SimpleCutter").get_active():
get_obj("SimpleCutter").set_active(True) get_obj("SimpleCutter").set_active(True)
elif cutter_name == "WaterlineCutter":
if not get_obj("PathAccumulator").get_active():
get_obj("PathAccumulator").set_active(True)
else:
raise ValueError("Invalid cutter selected: %s" % str(cutter_name))
all_controls = ("PathDirectionX", "PathDirectionY", "PathDirectionXY", all_controls = ("PathDirectionX", "PathDirectionY", "PathDirectionXY",
"SimpleCutter", "PolygonCutter", "ContourCutter", "SimpleCutter", "PolygonCutter", "ContourCutter",
"PathAccumulator", "ZigZagCutter", "MaxStepDownControl", "PathAccumulator", "ZigZagCutter", "MaxStepDownControl",
...@@ -1327,6 +1334,8 @@ class ProjectGui: ...@@ -1327,6 +1334,8 @@ class ProjectGui:
"OverlapPercentControl"), "OverlapPercentControl"),
"EngraveCutter": ("SimpleCutter", "MaxStepDownControl", "EngraveCutter": ("SimpleCutter", "MaxStepDownControl",
"EngraveOffsetControl"), "EngraveOffsetControl"),
"WaterlineCutter": ("PathAccumulator", "MaterialAllowanceControl",
"MaxStepDownControl"),
} }
for one_control in all_controls: for one_control in all_controls:
get_obj(one_control).set_sensitive(one_control in active_controls[cutter_name]) get_obj(one_control).set_sensitive(one_control in active_controls[cutter_name])
...@@ -2286,7 +2295,8 @@ class ProjectGui: ...@@ -2286,7 +2295,8 @@ class ProjectGui:
settings["name"] = self.gui.get_object("ProcessSettingName").get_text() settings["name"] = self.gui.get_object("ProcessSettingName").get_text()
# path generator # path generator
def get_path_generator(): def get_path_generator():
for name in ("DropCutter", "PushCutter", "EngraveCutter"): for name in ("DropCutter", "PushCutter", "EngraveCutter",
"WaterlineCutter"):
if self.gui.get_object(name).get_active(): if self.gui.get_object(name).get_active():
return name return name
settings["path_generator"] = get_path_generator() settings["path_generator"] = get_path_generator()
......
...@@ -33,7 +33,8 @@ import math ...@@ -33,7 +33,8 @@ import math
class Waterline: class Waterline:
def __init__(self, cutter, model, path_processor): def __init__(self, cutter, model, path_processor, physics=None):
# TODO: implement ODE for physics
self.cutter = cutter self.cutter = cutter
self.model = model self.model = model
self.pa = path_processor self.pa = path_processor
......
...@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License ...@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
__all__ = ["DropCutter", "PushCutter", "EngraveCutter"] __all__ = ["DropCutter", "PushCutter", "EngraveCutter", "Waterline"]
from pycam.Geometry.utils import INFINITE, epsilon, sqrt from pycam.Geometry.utils import INFINITE, epsilon, sqrt
from pycam.Geometry.Point import Point from pycam.Geometry.Point import Point
......
...@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License ...@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.PathGenerators import DropCutter, PushCutter, EngraveCutter from pycam.PathGenerators import DropCutter, PushCutter, EngraveCutter, Waterline
from pycam.Geometry.utils import number from pycam.Geometry.utils import number
import pycam.PathProcessors import pycam.PathProcessors
import pycam.Cutters import pycam.Cutters
...@@ -33,7 +33,7 @@ log = pycam.Utils.log.get_logger() ...@@ -33,7 +33,7 @@ log = pycam.Utils.log.get_logger()
DIRECTIONS = frozenset(("x", "y", "xy")) DIRECTIONS = frozenset(("x", "y", "xy"))
PATH_GENERATORS = frozenset(("DropCutter", "PushCutter", "EngraveCutter")) PATH_GENERATORS = frozenset(("DropCutter", "PushCutter", "EngraveCutter", "WaterlineCutter"))
PATH_POSTPROCESSORS = frozenset(("ContourCutter", "PathAccumulator", PATH_POSTPROCESSORS = frozenset(("ContourCutter", "PathAccumulator",
"PolygonCutter", "SimpleCutter", "ZigZagCutter")) "PolygonCutter", "SimpleCutter", "ZigZagCutter"))
CALCULATION_BACKENDS = frozenset((None, "ODE")) CALCULATION_BACKENDS = frozenset((None, "ODE"))
...@@ -291,14 +291,25 @@ def generate_toolpath(model, tool_settings=None, ...@@ -291,14 +291,25 @@ def generate_toolpath(model, tool_settings=None,
% (direction, DIRECTIONS) % (direction, DIRECTIONS)
toolpath = generator.GenerateToolPath(minx, maxx, miny, maxy, minz, toolpath = generator.GenerateToolPath(minx, maxx, miny, maxy, minz,
maxz, dx, dy, dz, callback) maxz, dx, dy, dz, callback)
else: elif path_generator == "EngraveCutter":
# EngraveCutter
if step_down > 0: if step_down > 0:
dz = step_down dz = step_down
else: else:
dz = maxz - minz dz = maxz - minz
toolpath = generator.GenerateToolPath(minz, maxz, stepping, dz, toolpath = generator.GenerateToolPath(minz, maxz, stepping, dz,
callback) callback)
elif path_generator == "WaterlineCutter":
if step_down > 0:
dz = step_down
else:
dz = maxz - minz
if dz <= 0:
dz = 1
toolpath = generator.GenerateToolPath(minx, maxx, miny, maxy, minz,
maxz, dz, callback)
else:
return "Invalid path generator (%s): not one of %s" \
% (path_generator, PATH_GENERATORS)
return toolpath return toolpath
def _get_pathgenerator_instance(trimesh_model, contour_model, cutter, def _get_pathgenerator_instance(trimesh_model, contour_model, cutter,
...@@ -342,6 +353,15 @@ def _get_pathgenerator_instance(trimesh_model, contour_model, cutter, ...@@ -342,6 +353,15 @@ def _get_pathgenerator_instance(trimesh_model, contour_model, cutter,
+ "DXF file)." + "DXF file)."
return EngraveCutter.EngraveCutter(cutter, trimesh_model, return EngraveCutter.EngraveCutter(cutter, trimesh_model,
contour_model, processor, physics=physics) contour_model, processor, physics=physics)
elif pathgenerator == "WaterlineCutter":
if pathprocessor == "PathAccumulator":
processor = pycam.PathProcessors.PathAccumulator()
else:
return ("Invalid postprocessor (%s) for 'WaterlineCutter' - it " \
+ "should be one of these: %s") \
% (processor, PATH_POSTPROCESSORS)
return Waterline.Waterline(cutter, trimesh_model, processor,
physics=physics)
else: else:
return "Invalid path generator (%s): not one of %s" \ return "Invalid path generator (%s): not one of %s" \
% (pathgenerator, PATH_GENERATORS) % (pathgenerator, PATH_GENERATORS)
......
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