CauldronDevelopmentLLC / CAMotics

Open-Source Simulation & Computer Aided Machining - A 3-axis CNC GCode simulator
Other
602 stars 138 forks source link

Python API `get_path()` throws NULL pointer runtime error #406

Closed nikcleju closed 5 months ago

nikcleju commented 10 months ago

I'm running the Python example (examples/python/camotics_python_example.py) using the latest master sources, and I get a NULL pointer error when calling get_path().

CAMotics version 1.3.0
Traceback (most recent call last):
  File "/home/ncleju/source/CAMotics/examples/python/camotics_python_example.py", line 342, in <module>
    path = s.get_path()
           ^^^^^^^^^^^^
RuntimeError: Can't dereference NULL pointer!
bluesun212 commented 5 months ago

I believe this issue arose after the commit on Jul 29, 2023, "Fixed picking, double click on 3D view opens GCode file and at line, …". The issue seems to lie in the ToolPath::write function in src/gcode/ToolPath.cpp. Changing the line SmartPointer<string> filename; to SmartPointer<string> filename = new string(); fixes this issue for me.

jcoffland commented 5 months ago

Thanks!