Reimplementing constraint solver
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Reimplementing constraint solver
well, I have fixed it all locally already, and i'm now getting the segfault you described. Investigating...
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Reimplementing constraint solver
what bothers me most, when doing it in python console, it works =(
Re: Reimplementing constraint solver
Ups! That one was unexpected indeed!
In case it serves for something:
New File, select Sketcher WB, insert new Sketch, select point tool, click => crash.
Code: Select all
#0 /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f0fcc4c8f20]
#1 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyObject_Call+0x33) [0x7f0fce77e993]
#2 0x7f0fd10c6a7e in Py::Callable::apply(Py::Tuple const&) const from /home/abdullah/github/freecad-build/lib/libFreeCADGui.so+0x4a
#3 0x7f0ef4c556f6 in FCS::ParaObject::makeParameters(Base::UnsafePyHandle<FCS::ParameterStore>) from /home/abdullah/github/freecad-build/Mod/ConstraintSolver/ConstraintSolver.so+0x348
#4 0x7f0ef4d462f6 in FCS::G2D::ParaLine::makeParameters(Base::UnsafePyHandle<FCS::ParameterStore>) from /home/abdullah/github/freecad-build/Mod/ConstraintSolver/ConstraintSolver.so+0x78
#5 0x7f0ef742abb0 in Sketcher::FCSSketch::addLineSegment(Part::GeomLineSegment const&, bool) from /home/abdullah/github/freecad-build/Mod/Sketcher/Sketcher.so+0x14a
#6 0x7f0ef742a6e6 in Sketcher::FCSSketch::addGeometry(Part::Geometry const*, bool) from /home/abdullah/github/freecad-build/Mod/Sketcher/Sketcher.so+0x144
#7 0x7f0ef742a4ad in Sketcher::FCSSketch::addGeometry(std::vector<Part::Geometry*, std::allocator<Part::Geometry*> > const&, std::vector<bool, std::allocator<bool> > const&) from /home/abdullah/github/freecad-build/Mod/Sketcher/Sketcher.so+0x141
#8 0x7f0ef742a219 in Sketcher::FCSSketch::setUpSketch(std::vector<Part::Geometry*, std::allocator<Part::Geometry*> > const&, std::vector<Sketcher::Constraint*, std::allocator<Sketcher::Constraint*> > const&, int) from /home/abdullah/github/freecad-build/Mod/Sketcher/Sketcher.so+0xd7
#9 0x7f0ef7258e96 in Sketcher::SketchObject::solve(bool) from /home/abdullah/github/freecad-build/Mod/Sketcher/Sketcher.so+0xb4
Code: Select all
// Call
Object apply( const Tuple &args ) const
{
=> PyObject *result = PyObject_CallObject( ptr(), args.ptr() );
if( result == NULL )
{
throw Exception();
}
return asObject( result );
}
Code: Select all
HParaObject child = HParaObject(
Py::Callable(reinterpret_cast<PyObject*>(v.type)).apply(Py::Tuple()));
*v.value = child;
Ask more if you need
Well yours does not crash from the UI either...
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Reimplementing constraint solver
It seems to help adding this:
before calling the type.
This should probably be placed in a variety of places in constraintsolver, I have to figure out where exactly...
Now I get a new crash, in the destructor of TaskDialog, when I close the sketch:
Code: Select all
Base::PyGILStateLocker lock;
This should probably be placed in a variety of places in constraintsolver, I have to figure out where exactly...
Now I get a new crash, in the destructor of TaskDialog, when I close the sketch:
Code: Select all
TaskDialog::~TaskDialog()
{
for (std::vector<QWidget*>::iterator it=Content.begin();it!=Content.end();++it) {
delete *it; // <-- crashes here
*it = 0;
}
}
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Reimplementing constraint solver
I have pushed a fix for makeParameters. I'll open a discussion on this topic...
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Reimplementing constraint solver
BTW, is it possible to quickly get the old sketcher in our development branch? I want to use sketches to quickly mock up some geometry for testing with console, and the fact that sketcher is broken really gets in the way of that...
Re: Reimplementing constraint solver
Quickly with compiling, sure: in SketchObject::SketchObject(), change:
Code: Select all
solvedSketch = std::make_shared<FCSSketch>();
Code: Select all
solvedSketch = std::make_shared<Sketch>();
Re: Reimplementing constraint solver
This may be related to the fact that I have removed the advance solver dialog, as it was getting in the middle of the new implementation.DeepSOIC wrote: ↑Thu Apr 09, 2020 2:52 pm It seems to help adding this:before calling the type.Code: Select all
Base::PyGILStateLocker lock;
This should probably be placed in a variety of places in constraintsolver, I have to figure out where exactly...
Now I get a new crash, in the destructor of TaskDialog, when I close the sketch:Code: Select all
TaskDialog::~TaskDialog() { for (std::vector<QWidget*>::iterator it=Content.begin();it!=Content.end();++it) { delete *it; // <-- crashes here *it = 0; } }
The sketcher on this branch lacks at this moment the find DoF (hyperlink on the solver messages). I want to have other things working before setting for a common interface.