Commit 4598f46f authored by sumpfralle's avatar sumpfralle

added TestModel as the default fallback in case of a model loading failure

prevent Exception in case of a empty arc


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1021 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 8a989971
...@@ -105,6 +105,8 @@ def get_points_of_arc(center, radius, a1, a2, plane=None, cords=32): ...@@ -105,6 +105,8 @@ def get_points_of_arc(center, radius, a1, a2, plane=None, cords=32):
angle_diff = a2 - a1 angle_diff = a2 - a1
if angle_diff < 0: if angle_diff < 0:
angle_diff += 2 * math.pi angle_diff += 2 * math.pi
if angle_diff == 0:
return []
num_of_segments = ceil(angle_diff / (2 * math.pi) * cords) num_of_segments = ceil(angle_diff / (2 * math.pi) * cords)
angle_segment = angle_diff / num_of_segments angle_segment = angle_diff / num_of_segments
points = [] points = []
......
...@@ -29,6 +29,7 @@ import pycam.Cutters ...@@ -29,6 +29,7 @@ import pycam.Cutters
import pycam.Toolpath.Generator import pycam.Toolpath.Generator
import pycam.Toolpath import pycam.Toolpath
import pycam.Importers.CXFImporter import pycam.Importers.CXFImporter
import pycam.Importers.TestModel
import pycam.Importers import pycam.Importers
from pycam.Geometry.Point import Point, Vector from pycam.Geometry.Point import Point, Vector
from pycam.Geometry.Plane import Plane from pycam.Geometry.Plane import Plane
...@@ -439,7 +440,8 @@ class ProjectGui: ...@@ -439,7 +440,8 @@ class ProjectGui:
self._font_dialog_window_visible = False self._font_dialog_window_visible = False
self._font_dialog_window_position = None self._font_dialog_window_position = None
# set defaults # set defaults
self.model = None # fallback - in case of a failure when opening a model file
self.model = pycam.Importers.TestModel.get_test_model()
self.toolpath = pycam.Toolpath.ToolpathList() self.toolpath = pycam.Toolpath.ToolpathList()
self.cutter = None self.cutter = None
self.tool_list = [] self.tool_list = []
......
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