Simulation.set_path() throws a RuntimeError stating "Can't dereference NULL pointer!" when used like so (with valid parameters for open and set_path):
from camotics import Simulation
sim = Simulation()
sim.open(...)
sim.set_path(...)
This is because self->s->path in PySimulation is never set. Additionally, if you insert compute_path before set_path, the error goes away (because compute_path sets the path variable), but the additional JSON data is appended to the existing path data instead of replacing it. This seems like unintended behavior given that the name is "set_path". Inserting self->s->path = new GCode::ToolPath(self->s->project.getTools()); before the line self->s->path->read(*PyJSON(path).toJSON()); in PySimulation._set_path fixed both issues for me.
Simulation.set_path()
throws aRuntimeError
stating "Can't dereference NULL pointer!" when used like so (with valid parameters foropen
andset_path
):This is because
self->s->path
inPySimulation
is never set. Additionally, if you insertcompute_path
before set_path, the error goes away (becausecompute_path
sets thepath
variable), but the additional JSON data is appended to the existing path data instead of replacing it. This seems like unintended behavior given that the name is "set_path". Insertingself->s->path = new GCode::ToolPath(self->s->project.getTools());
before the lineself->s->path->read(*PyJSON(path).toJSON());
inPySimulation._set_path
fixed both issues for me.