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
<property name="position">2</property>
</packing>
</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>
</child>
</object>
......
......@@ -534,8 +534,10 @@ class ProjectGui:
self.gui.get_object(name).connect("clicked", 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
for objname in ("PathAccumulator", "SimpleCutter", "ZigZagCutter", "PolygonCutter", "ContourCutter",
"DropCutter", "PushCutter", "PathDirectionX", "PathDirectionY", "PathDirectionXY", "SettingEnableODE"):
for objname in ("PathAccumulator", "SimpleCutter", "ZigZagCutter",
"PolygonCutter", "ContourCutter", "DropCutter", "PushCutter",
"EngraveCutter", "WaterlineCutter", "PathDirectionX",
"PathDirectionY", "PathDirectionXY", "SettingEnableODE"):
self.gui.get_object(objname).connect("toggled", self.update_process_controls)
if objname != "SettingEnableODE":
self.gui.get_object(objname).connect("toggled", self.handle_process_settings_change)
......@@ -1295,7 +1297,8 @@ class ProjectGui:
# possible dependencies of the DropCutter
get_obj = self.gui.get_object
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():
cutter_name = one_cutter
if cutter_name == "DropCutter":
......@@ -1308,10 +1311,14 @@ class ProjectGui:
or get_obj("PolygonCutter").get_active() \
or get_obj("ContourCutter").get_active()):
get_obj("SimpleCutter").set_active(True)
else:
# engraving
elif cutter_name == "EngraveCutter":
if not get_obj("SimpleCutter").get_active():
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",
"SimpleCutter", "PolygonCutter", "ContourCutter",
"PathAccumulator", "ZigZagCutter", "MaxStepDownControl",
......@@ -1327,6 +1334,8 @@ class ProjectGui:
"OverlapPercentControl"),
"EngraveCutter": ("SimpleCutter", "MaxStepDownControl",
"EngraveOffsetControl"),
"WaterlineCutter": ("PathAccumulator", "MaterialAllowanceControl",
"MaxStepDownControl"),
}
for one_control in all_controls:
get_obj(one_control).set_sensitive(one_control in active_controls[cutter_name])
......@@ -2286,7 +2295,8 @@ class ProjectGui:
settings["name"] = self.gui.get_object("ProcessSettingName").get_text()
# 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():
return name
settings["path_generator"] = get_path_generator()
......
......@@ -33,7 +33,8 @@ import math
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.model = model
self.pa = path_processor
......
......@@ -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/>.
"""
__all__ = ["DropCutter", "PushCutter", "EngraveCutter"]
__all__ = ["DropCutter", "PushCutter", "EngraveCutter", "Waterline"]
from pycam.Geometry.utils import INFINITE, epsilon, sqrt
from pycam.Geometry.Point import Point
......
......@@ -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/>.
"""
from pycam.PathGenerators import DropCutter, PushCutter, EngraveCutter
from pycam.PathGenerators import DropCutter, PushCutter, EngraveCutter, Waterline
from pycam.Geometry.utils import number
import pycam.PathProcessors
import pycam.Cutters
......@@ -33,7 +33,7 @@ log = pycam.Utils.log.get_logger()
DIRECTIONS = frozenset(("x", "y", "xy"))
PATH_GENERATORS = frozenset(("DropCutter", "PushCutter", "EngraveCutter"))
PATH_GENERATORS = frozenset(("DropCutter", "PushCutter", "EngraveCutter", "WaterlineCutter"))
PATH_POSTPROCESSORS = frozenset(("ContourCutter", "PathAccumulator",
"PolygonCutter", "SimpleCutter", "ZigZagCutter"))
CALCULATION_BACKENDS = frozenset((None, "ODE"))
......@@ -291,14 +291,25 @@ def generate_toolpath(model, tool_settings=None,
% (direction, DIRECTIONS)
toolpath = generator.GenerateToolPath(minx, maxx, miny, maxy, minz,
maxz, dx, dy, dz, callback)
else:
# EngraveCutter
elif path_generator == "EngraveCutter":
if step_down > 0:
dz = step_down
else:
dz = maxz - minz
toolpath = generator.GenerateToolPath(minz, maxz, stepping, dz,
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
def _get_pathgenerator_instance(trimesh_model, contour_model, cutter,
......@@ -342,6 +353,15 @@ def _get_pathgenerator_instance(trimesh_model, contour_model, cutter,
+ "DXF file)."
return EngraveCutter.EngraveCutter(cutter, trimesh_model,
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:
return "Invalid path generator (%s): not one of %s" \
% (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