SebKuzminsky / pycam

Other
338 stars 99 forks source link

Crash on loading SVG #207

Open bullestock opened 1 year ago

bullestock commented 1 year ago

On Arch, I get the following backtrace when attempting to load the attached SVG:

gh301am-clamp-base


An unexpected exception occurred: please send the text below to the developers of PyCAM. Thanks a lot!
Traceback (most recent call last):
  File "/usr/share/pycam-git/pycam/Gui/Project.py", line 84, in gui_activity_guard_wrapper
    result = func(self, *args, **kwargs)
  File "/usr/share/pycam-git/pycam/Gui/Project.py", line 569, in load_model_file
    self.settings.get("models").add_model(model_params, name=name_suggestion)
  File "/usr/share/pycam-git/pycam/Plugins/Models.py", line 156, in add_model
    with merge_history_and_block_events(self.core):
  File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/usr/share/pycam-git/pycam/Flow/history.py", line 121, in merge_history_and_block_events
    with settings.blocked_events(history.subscribed_events, emit_after=emit_events_after):
  File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/usr/share/pycam-git/pycam/Utils/events.py", line 183, in blocked_events
    self.emit_event(event)
  File "/usr/share/pycam-git/pycam/Utils/events.py", line 136, in emit_event
    handler()
  File "/usr/share/pycam-git/pycam/Plugins/OpenGLWindow.py", line 590, in _restore_latest_view
    self.rotate_view(view=self._last_view)
  File "/usr/share/pycam-git/pycam/Plugins/OpenGLWindow.py", line 708, in rotate_view
    self.camera.set_view(view)
  File "/usr/share/pycam-git/pycam/Plugins/OpenGLWindow.py", line 763, in set_view
    self.center_view()
  File "/usr/share/pycam-git/pycam/Plugins/OpenGLWindow.py", line 773, in center_view
    low, high = self._get_low_high_dims()
  File "/usr/share/pycam-git/pycam/Plugins/OpenGLWindow.py", line 768, in _get_low_high_dims
    self.core.call_chain("get_draw_dimension", low, high)
  File "/usr/share/pycam-git/pycam/Utils/events.py", line 266, in call_chain
    data.func(*args, **kwargs)
  File "/usr/share/pycam-git/pycam/Plugins/OpenGLViewModel.py", line 64, in get_draw_dimension
    model_box = model_dict.get_model().get_bounds().get_bounds()
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 292, in wrapped
    return self.get_cached(inst, args, kwargs, calc_function)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 347, in get_cached
    cache_item = CacheItem(time.time(), calc_function(inst, *args, **kwargs))
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 237, in inner_function
    result = func(self, *args, **kwargs)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 1021, in get_model
    model = self.get_value("source").get(CollectionName.MODELS)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 292, in wrapped
    return self.get_cached(inst, args, kwargs, calc_function)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 347, in get_cached
    cache_item = CacheItem(time.time(), calc_function(inst, *args, **kwargs))
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 237, in inner_function
    result = func(self, *args, **kwargs)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 729, in get
    return self._get_source_location(source_type)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 237, in inner_function
    result = func(self, *args, **kwargs)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 256, in inner_function
    return func(self, *args, **kwargs)
  File "/usr/share/pycam-git/pycam/workspace/data_models.py", line 774, in _get_source_location
    return detected_filetype.importer(detected_filetype.uri)
  File "/usr/share/pycam-git/pycam/Importers/SVGDirectImporter.py", line 268, in import_model
    for polygon in get_polygons_from_path_groups(path_groups):
  File "/usr/share/pycam-git/pycam/Importers/SVGDirectImporter.py", line 261, in get_polygons_from_path_groups
    polygons.extend(_get_polygons_from_svg_path(path, level))
  File "/usr/share/pycam-git/pycam/Importers/SVGDirectImporter.py", line 231, in _get_polygons_from_svg_path
    current_polygon.append(line)
  File "/usr/share/pycam-git/pycam/Geometry/Polygon.py", line 233, in append
    raise ValueError("This line does not fit to the polygon")
ValueError: This line does not fit to the polygon```