Commit 0b88b5f2 authored by sumpfralle's avatar sumpfralle

fixed various small issues


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@605 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 05721153
...@@ -10,5 +10,5 @@ recursive-include desktop * ...@@ -10,5 +10,5 @@ recursive-include desktop *
recursive-include man * recursive-include man *
recursive-include src * recursive-include src *
recursive-include share * recursive-include share *
recursive-include Samples * recursive-include samples *
recursive-include Tests * recursive-include Tests *
...@@ -103,6 +103,7 @@ def get_default_model(): ...@@ -103,6 +103,7 @@ def get_default_model():
return pycam.Importers.TestModel.get_test_model() return pycam.Importers.TestModel.get_test_model()
def load_model_file(filename, program_locations): def load_model_file(filename, program_locations):
filename = os.path.expanduser(filename)
if not os.path.isfile(filename): if not os.path.isfile(filename):
log.warn("The input file ('%') was not found!" % filename) log.warn("The input file ('%') was not found!" % filename)
return None return None
...@@ -310,7 +311,7 @@ if __name__ == "__main__": ...@@ -310,7 +311,7 @@ if __name__ == "__main__":
(opts, args) = parser.parse_args() (opts, args) = parser.parse_args()
if len(args) > 0: if len(args) > 0:
inputfile = args[0] inputfile = os.path.expanduser(args[0])
else: else:
inputfile = None inputfile = None
...@@ -354,6 +355,9 @@ if __name__ == "__main__": ...@@ -354,6 +355,9 @@ if __name__ == "__main__":
progress_bar = pycam.Gui.Console.ConsoleProgressBar(sys.stdout, progress_bar = pycam.Gui.Console.ConsoleProgressBar(sys.stdout,
progress_styles[opts.progress]) progress_styles[opts.progress])
if opts.config_file:
opts.config_file = os.path.expanduser(opts.config_file)
if not opts.export_gcode and not opts.export_task_config: if not opts.export_gcode and not opts.export_task_config:
show_gui(inputfile, opts.config_file) show_gui(inputfile, opts.config_file)
else: else:
......
...@@ -260,8 +260,11 @@ class Polygon(TransformableContainer): ...@@ -260,8 +260,11 @@ class Polygon(TransformableContainer):
cross_offset = p2.sub(p1).cross(self._plane.n).normalized() cross_offset = p2.sub(p1).cross(self._plane.n).normalized()
bisector_normalized = self.get_bisector(index) bisector_normalized = self.get_bisector(index)
factor = cross_offset.dot(bisector_normalized) factor = cross_offset.dot(bisector_normalized)
bisector_sized = bisector_normalized.mul(offset / factor) if factor != 0:
return p1.add(bisector_sized) bisector_sized = bisector_normalized.mul(offset / factor)
return p1.add(bisector_sized)
else:
return p2
def simplify_polygon_intersections(lines): def simplify_polygon_intersections(lines):
new_group = lines[:] new_group = lines[:]
# remove all non-adjacent intersecting lines (this splits the group) # remove all non-adjacent intersecting lines (this splits the group)
......
...@@ -795,8 +795,9 @@ class ProjectGui: ...@@ -795,8 +795,9 @@ class ProjectGui:
new_value = self.grid_adjustment_value.get_value() new_value = self.grid_adjustment_value.get_value()
self.settings.set("support_grid_adjustment_value", new_value) self.settings.set("support_grid_adjustment_value", new_value)
tree_iter = self.grid_adjustment_selector.get_active_iter() tree_iter = self.grid_adjustment_selector.get_active_iter()
value_string = "(%+.1f)" % new_value if not tree_iter is None:
self.grid_adjustment_model.set(tree_iter, 1, value_string) value_string = "(%+.1f)" % new_value
self.grid_adjustment_model.set(tree_iter, 1, value_string)
self.update_support_grid_model() self.update_support_grid_model()
self.update_view() self.update_view()
...@@ -1915,6 +1916,7 @@ class ProjectGui: ...@@ -1915,6 +1916,7 @@ class ProjectGui:
if not model is None: if not model is None:
self.model = model self.model = model
# do some initialization # do some initialization
self.append_to_queue(self.update_scale_controls)
self.append_to_queue(self.toggle_3d_view, value=True) self.append_to_queue(self.toggle_3d_view, value=True)
self.append_to_queue(self.update_view) self.append_to_queue(self.update_view)
......
...@@ -192,8 +192,13 @@ class DXFParser: ...@@ -192,8 +192,13 @@ class DXFParser:
log.warn("DXFImporter: Incomplete LINE definition between line " \ log.warn("DXFImporter: Incomplete LINE definition between line " \
+ "%d and %d" % (start_line, end_line)) + "%d and %d" % (start_line, end_line))
else: else:
self.lines.append(Line(Point(p1[0], p1[1], p1[2]), line = Line(Point(p1[0], p1[1], p1[2]), Point(p2[0], p2[1], p2[2]))
Point(p2[0], p2[1], p2[2]))) if line.len > 0:
self.lines.append(line)
else:
log.warn("DXFImporter: Ignoring zero-length LINE (between " \
+ "input line %d and %d): %s" % (start_line, end_line,
line))
def check_header(self): def check_header(self):
# TODO: this function is not used? # TODO: this function is not used?
......
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