Commit a8a6b6b9 authored by sumpfralle's avatar sumpfralle

switched tool size controls from radius to diameter


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@480 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 53d483fe
...@@ -5,6 +5,7 @@ Version 0.3.0 - UNRELEASED ...@@ -5,6 +5,7 @@ Version 0.3.0 - UNRELEASED
* integrated "help" links pointing to the wiki * integrated "help" links pointing to the wiki
* allow non-square profiles for the support grid * allow non-square profiles for the support grid
* improved OpenGL lightning (contributed by imyrek) * improved OpenGL lightning (contributed by imyrek)
* switched default tool size from radius to diameter
* fixed performance issue when using a support grid * fixed performance issue when using a support grid
* fixed empty toolpath after transforming the model * fixed empty toolpath after transforming the model
* added minor fix for PushCutter * added minor fix for PushCutter
......
...@@ -167,12 +167,12 @@ if __name__ == "__main__": ...@@ -167,12 +167,12 @@ if __name__ == "__main__":
choices=["cylindrical", "spherical", "toroidal"], choices=["cylindrical", "spherical", "toroidal"],
help="tool shape for the operation (cylindrical, spherical, " \ help="tool shape for the operation (cylindrical, spherical, " \
+ "toroidal)") + "toroidal)")
group_tool.add_option("", "--tool-radius", dest="tool_radius", group_tool.add_option("", "--tool-size", dest="tool_diameter",
default=1.0, action="store", type="float", default=1.0, action="store", type="float",
help="radius of the tool") help="diameter of the tool")
group_tool.add_option("", "--tool-torus-radius", dest="tool_torus_radius", group_tool.add_option("", "--tool-torus-size", dest="tool_torus_diameter",
default=0.25, action="store", type="float", default=0.25, action="store", type="float",
help="torus radius of the tool (only for toroidal tool shape)") help="torus diameter of the tool (only for toroidal tool shape)")
group_tool.add_option("", "--tool-feedrate", dest="tool_feedrate", group_tool.add_option("", "--tool-feedrate", dest="tool_feedrate",
default=1000, action="store", type="float", default=1000, action="store", type="float",
help="allowed movement velocity of the tool (units/minute)") help="allowed movement velocity of the tool (units/minute)")
...@@ -258,8 +258,9 @@ if __name__ == "__main__": ...@@ -258,8 +258,9 @@ if __name__ == "__main__":
"spherical": "SphericalCutter", "spherical": "SphericalCutter",
"toroidal": "ToroidalCutter", "toroidal": "ToroidalCutter",
}[opts.tool_shape] }[opts.tool_shape]
tps.set_tool(opts.tool_id, tool_shape, opts.tool_radius, tps.set_tool(opts.tool_id, tool_shape, 0.5 * opts.tool_diameter,
opts.tool_torus_radius, opts.tool_speed, opts.tool_feedrate) 0.5 * opts.tool_torus_diameter, opts.tool_speed,
opts.tool_feedrate)
if opts.support_grid_enabled: if opts.support_grid_enabled:
tps.set_support_grid(opts.support_grid_distance, tps.set_support_grid(opts.support_grid_distance,
opts.support_grid_thickness, opts.support_grid_height) opts.support_grid_thickness, opts.support_grid_height)
...@@ -326,10 +327,10 @@ if __name__ == "__main__": ...@@ -326,10 +327,10 @@ if __name__ == "__main__":
if opts.boundary_mode == "along": if opts.boundary_mode == "along":
offset = (0, 0, 0) offset = (0, 0, 0)
elif opts.boundary_mode == "inside": elif opts.boundary_mode == "inside":
offset = (-opts.tool_radius, -opts.tool_radius, 0) offset = (-0.5 * opts.tool_diameter, -0.5 * opts.tool_diameter, 0)
else: else:
# "outside" # "outside"
offset = (opts.tool_radius, opts.tool_radius, 0) offset = (0.5 * opts.tool_diameter, 0.5 * opts.tool_diameter, 0)
process_bounds = Bounds(Bounds.TYPE_FIXED_MARGIN, offset, offset) process_bounds = Bounds(Bounds.TYPE_FIXED_MARGIN, offset, offset)
process_bounds.set_reference(bounds) process_bounds.set_reference(bounds)
tps.set_bounds(process_bounds) tps.set_bounds(process_bounds)
...@@ -353,7 +354,7 @@ if __name__ == "__main__": ...@@ -353,7 +354,7 @@ if __name__ == "__main__":
tp.get_path(), opts.unit_size, start_pos.x, tp.get_path(), opts.unit_size, start_pos.x,
start_pos.y, start_pos.z, opts.tool_feedrate, start_pos.y, start_pos.z, opts.tool_feedrate,
opts.tool_speed, safety_height=opts.safety_height, opts.tool_speed, safety_height=opts.safety_height,
max_skip_safety_distance=2*opts.tool_radius, max_skip_safety_distance=opts.tool_diameter,
comment=meta_data) comment=meta_data)
if close_destination: if close_destination:
destination.close() destination.close()
......
...@@ -358,11 +358,8 @@ class ProjectGui: ...@@ -358,11 +358,8 @@ class ProjectGui:
sim_detail_obj = self.gui.get_object("SimulationDetailsValue") sim_detail_obj = self.gui.get_object("SimulationDetailsValue")
self.settings.add_item("simulation_details_level", sim_detail_obj.get_value, sim_detail_obj.set_value) self.settings.add_item("simulation_details_level", sim_detail_obj.get_value, sim_detail_obj.set_value)
# drill settings # drill settings
for objname, key in ( for objname in ("ToolDiameterControl", "TorusDiameterControl",
("ToolRadiusControl", "tool_radius"), "FeedrateControl", "SpeedControl"):
("TorusRadiusControl", "torus_radius"),
("FeedrateControl", "feedrate"),
("SpeedControl", "speed")):
self.gui.get_object(objname).connect("value-changed", self.handle_tool_settings_change) self.gui.get_object(objname).connect("value-changed", self.handle_tool_settings_change)
for name in ("SphericalCutter", "CylindricalCutter", "ToroidalCutter"): for name in ("SphericalCutter", "CylindricalCutter", "ToroidalCutter"):
self.gui.get_object(name).connect("clicked", self.handle_tool_settings_change) self.gui.get_object(name).connect("clicked", self.handle_tool_settings_change)
...@@ -720,9 +717,9 @@ class ProjectGui: ...@@ -720,9 +717,9 @@ class ProjectGui:
unit = self.settings.get("unit") unit = self.settings.get("unit")
tool_desc = "Tool: %s " % tool["shape"] tool_desc = "Tool: %s " % tool["shape"]
if tool["shape"] != "ToroidalCutter": if tool["shape"] != "ToroidalCutter":
tool_desc += "(%.4f%s)" % (tool["tool_radius"], unit) tool_desc += "(%.4f%s)" % (2 * tool["tool_radius"], unit)
else: else:
tool_desc += "(%.4f%s / %.4f%s)" % (tool["tool_radius"], unit, tool["torus_radius"], unit) tool_desc += "(%.4f%s / %.4f%s)" % ( 2 * tool["tool_radius"], unit, 2 * tool["torus_radius"], unit)
lines.append(tool_desc) lines.append(tool_desc)
lines.append("Speed: %d/minute / Feedrate: %d%s/minute" % (tool["speed"], tool["feedrate"], unit)) lines.append("Speed: %d/minute / Feedrate: %d%s/minute" % (tool["speed"], tool["feedrate"], unit))
lines.append("Path: %s / %s" % (process["path_generator"], process["path_postprocessor"])) lines.append("Path: %s / %s" % (process["path_generator"], process["path_postprocessor"]))
...@@ -895,10 +892,14 @@ class ProjectGui: ...@@ -895,10 +892,14 @@ class ProjectGui:
def update_tool_controls(self, widget=None, data=None): def update_tool_controls(self, widget=None, data=None):
# disable the toroidal radius if the toroidal cutter is not enabled # disable the toroidal radius if the toroidal cutter is not enabled
is_torus_shape = self.gui.get_object("ToroidalCutter").get_active() if self.gui.get_object("ToroidalCutter").get_active():
self.gui.get_object("TorusRadiusControl").set_sensitive(is_torus_shape) self.gui.get_object("TorusDiameterControl").show()
for objname, default_value in (("ToolRadiusControl", 1.0), self.gui.get_object("TorusDiameterLabel").show()
("TorusRadiusControl", 0.25), else:
self.gui.get_object("TorusDiameterControl").hide()
self.gui.get_object("TorusDiameterLabel").hide()
for objname, default_value in (("ToolDiameterControl", 1.0),
("TorusDiameterControl", 0.25),
("SpeedControl", 1000), ("SpeedControl", 1000),
("FeedrateControl", 200)): ("FeedrateControl", 200)):
obj = self.gui.get_object(objname) obj = self.gui.get_object(objname)
...@@ -1053,11 +1054,14 @@ class ProjectGui: ...@@ -1053,11 +1054,14 @@ class ProjectGui:
self.gui.get_object(value).set_active(True) self.gui.get_object(value).set_active(True)
set_cutter_shape_name(settings["shape"]) set_cutter_shape_name(settings["shape"])
for objname, key in ( for objname, key in (
("ToolRadiusControl", "tool_radius"),
("TorusRadiusControl", "torus_radius"),
("FeedrateControl", "feedrate"), ("FeedrateControl", "feedrate"),
("SpeedControl", "speed")): ("SpeedControl", "speed")):
self.gui.get_object(objname).set_value(settings[key]) self.gui.get_object(objname).set_value(settings[key])
# radius -> diameter
for objname, key in (
("ToolDiameterControl", "tool_radius"),
("TorusDiameterControl", "torus_radius")):
self.gui.get_object(objname).set_value(2 * settings[key])
def _load_tool_settings_from_gui(self, settings=None): def _load_tool_settings_from_gui(self, settings=None):
if settings is None: if settings is None:
...@@ -1069,11 +1073,14 @@ class ProjectGui: ...@@ -1069,11 +1073,14 @@ class ProjectGui:
return name return name
settings["shape"] = get_cutter_shape_name() settings["shape"] = get_cutter_shape_name()
for objname, key in ( for objname, key in (
("ToolRadiusControl", "tool_radius"),
("TorusRadiusControl", "torus_radius"),
("FeedrateControl", "feedrate"), ("FeedrateControl", "feedrate"),
("SpeedControl", "speed")): ("SpeedControl", "speed")):
settings[key] = self.gui.get_object(objname).get_value() settings[key] = self.gui.get_object(objname).get_value()
# diameter -> radius
for objname, key in (
("ToolDiameterControl", "tool_radius"),
("TorusDiameterControl", "torus_radius")):
settings[key] = 0.5 * self.gui.get_object(objname).get_value()
return settings return settings
@gui_activity_guard @gui_activity_guard
...@@ -2075,7 +2082,7 @@ class ProjectGui: ...@@ -2075,7 +2082,7 @@ class ProjectGui:
toolpath_settings = pycam.Gui.Settings.ToolpathSettings() toolpath_settings = pycam.Gui.Settings.ToolpathSettings()
# this offset allows to cut a model with a minimal boundary box correctly # this offset allows to cut a model with a minimal boundary box correctly
offset = tool_settings["tool_radius"] / 2.0 offset = tool_settings["tool_radius"]
# check the configured direction of the offset (boundary mode) # check the configured direction of the offset (boundary mode)
if self.settings.get("boundary_mode") == self.BOUNDARY_MODES["inside"]: if self.settings.get("boundary_mode") == self.BOUNDARY_MODES["inside"]:
# use the negative offset to stay inside the boundaries # use the negative offset to stay inside the boundaries
......
...@@ -122,20 +122,20 @@ feedrate: 1000 ...@@ -122,20 +122,20 @@ feedrate: 1000
speed: 200 speed: 200
[Tool0] [Tool0]
name: Cylindrical (r=3) name: Cylindrical (d=3)
shape: CylindricalCutter shape: CylindricalCutter
tool_radius: 3 tool_radius: 1.5
[Tool1] [Tool1]
name: Toroidal (r=2) name: Toroidal (d=2)
shape: ToroidalCutter shape: ToroidalCutter
tool_radius: 2 tool_radius: 1
torus_radius: 0.2 torus_radius: 0.2
[Tool2] [Tool2]
name: Spherical (r=1.0) name: Spherical (d=1.0)
shape: SphericalCutter shape: SphericalCutter
tool_radius: 1.0 tool_radius: 0.5
[ProcessDefault] [ProcessDefault]
path_direction: x path_direction: x
......
...@@ -1352,20 +1352,20 @@ ...@@ -1352,20 +1352,20 @@
<property name="column_spacing">2</property> <property name="column_spacing">2</property>
<property name="row_spacing">4</property> <property name="row_spacing">4</property>
<child> <child>
<object class="GtkLabel" id="ToolRadiusLabel"> <object class="GtkLabel" id="ToolDiameterLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Tool Radius:</property> <property name="label" translatable="yes">Tool Diameter:</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="TorusRadiusLabel"> <object class="GtkLabel" id="TorusDiameterLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Torus Radius:</property> <property name="label" translatable="yes">Torus Diameter:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
...@@ -1374,11 +1374,11 @@ ...@@ -1374,11 +1374,11 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="ToolRadiusControl"> <object class="GtkSpinButton" id="ToolDiameterControl">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="adjustment">toolradius</property> <property name="adjustment">tooldiameter</property>
<property name="digits">4</property> <property name="digits">4</property>
<property name="numeric">True</property> <property name="numeric">True</property>
</object> </object>
...@@ -1390,11 +1390,11 @@ ...@@ -1390,11 +1390,11 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="TorusRadiusControl"> <object class="GtkSpinButton" id="TorusDiameterControl">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="adjustment">torusradius</property> <property name="adjustment">torusdiameter</property>
<property name="digits">4</property> <property name="digits">4</property>
<property name="numeric">True</property> <property name="numeric">True</property>
</object> </object>
...@@ -4190,12 +4190,12 @@ upon interesting bugs and weird results.</property> ...@@ -4190,12 +4190,12 @@ upon interesting bugs and weird results.</property>
<property name="upper">10000</property> <property name="upper">10000</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
</object> </object>
<object class="GtkAdjustment" id="toolradius"> <object class="GtkAdjustment" id="tooldiameter">
<property name="lower">0.0001</property> <property name="lower">0.0001</property>
<property name="upper">500</property> <property name="upper">500</property>
<property name="step_increment">0.10000000000000001</property> <property name="step_increment">0.10000000000000001</property>
</object> </object>
<object class="GtkAdjustment" id="torusradius"> <object class="GtkAdjustment" id="torusdiameter">
<property name="lower">0.0001</property> <property name="lower">0.0001</property>
<property name="upper">500</property> <property name="upper">500</property>
<property name="step_increment">0.050000000000000003</property> <property name="step_increment">0.050000000000000003</property>
......
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