5axes / Calibration-Shapes

A Cura plugin that adds simple shapes (cube, cylinder, tube) and also 24 Calibration and test parts + 7 Postprocessing scripts
GNU Affero General Public License v3.0
330 stars 69 forks source link

Adding the calibration objects doesn't work on Linux #4

Closed nallath closed 3 years ago

nallath commented 3 years ago

I'm testing the plugin on Fedora and the second set of calibration objects (Calibration cube, temp tower, etc) are not loaded when clicked.

The logs show the following:

2021-01-27 09:31:07,436 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]: Traceback (most recent call last):
2021-01-27 09:31:07,438 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:   File "/home/jaime/Development/Uranium/UM/Qt/Bindings/ExtensionModel.py", line 54, in subMenuTriggered
2021-01-27 09:31:07,440 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:     item["extension"].activateMenuItem(option_name)
2021-01-27 09:31:07,442 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:   File "/home/jaime/Development/Uranium/UM/Extension.py", line 50, in activateMenuItem
2021-01-27 09:31:07,444 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:     self._menu_function_dict[name]()
2021-01-27 09:31:07,445 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:   File "/home/jaime/.local/share/cura/4.7/plugins/CalibrationShapes/CalibrationShapes/CalibrationShapes.py", line 212, in addTempTower
2021-01-27 09:31:07,446 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:     self._addShape(self._toMeshData(trimesh.load(model_definition_path)))
2021-01-27 09:31:07,448 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:   File "/usr/local/lib/python3.8/site-packages/trimesh/exchange/load.py", line 108, in load
2021-01-27 09:31:07,449 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:     ) = parse_file_args(file_obj=file_obj,
2021-01-27 09:31:07,452 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:   File "/usr/local/lib/python3.8/site-packages/trimesh/exchange/load.py", line 573, in parse_file_args
2021-01-27 09:31:07,454 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]:     raise ValueError('string is not a file: {}'.format(file_obj))
2021-01-27 09:31:07,455 - WARNING - [MainThread] UM.Qt.Bindings.ExtensionModel.subMenuTriggered [58]: ValueError: string is not a file: /home/jaime/.local/share/cura/4.7/plugins/CalibrationShapes/CalibrationShapes/models\TempTower.stl
baikal commented 3 years ago

@nallath Just noticed the same problem. This is due to the Windows-style path separator \ in the .stl names. Using the platform-independent path joining instead fixes that. E.g. model_definition_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "models", "CalibrationCube.stl") instead of model_definition_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "models\CalibrationCube.stl") in CalibrationShapes.py. And the other six ones as well ...

5axes commented 3 years ago

Solved V1.0.4 thanks a lot @baikal