jes notes Index Gallery . Shaft passers Snap issues

2025-02-25

Last modified: 2025-02-26 09:08:37

< 2025-02-24 2025-02-26 >

FreeCAD

Regarding the timer warnings, hyarion suggests putting a breakpoint in the timer functions (QObject::startTimer and QBasicTimer::start), to see what might be causing the warning.

And the other thing is to try again to see if I can pass the GIL to the worker thread.

https://gist.github.com/jes/6a8b3dca8fce3e74f367ad37576792da this is the backtrace from the timer warning - it is quite deep, but the issue basically is that the QListWidgetItem::setHidden call in PartDesign should I think be done with invokeMethod if it's not running on the main thread - this could be very annoying, because I expect the same thing comes up in lots of places.

One option is we could "swap" the role of the worker thread and the abort dialog thread (i.e. make a new thread to run the abort dialog, and run the actual function on the main thread) - but then we lose the ability to force abort.

However currently force abort basically always segfaults freecad anyway so we're not really losing all that much.

That would also make the GIL issue go away!

That's assuming it is actually possible to run the dialog on a non-main thread.

No, it's not possible.

New plan: run the abort dialog in a separate process and send a SIGHUP when cancelled.

Need to handle and ignore SIGPIPE; need to make --computation-dialog not have a mandatory argument.

OK, well I have done that and I was quite happy with it, but it sounds like people in Discord don't like it.

I've posted this comment and I'm stopping https://github.com/FreeCAD/FreeCAD/pull/19796#issuecomment-2682280027

So next thing is see if I can reduce unnecessary recomputes, starting by looking at opening up the ViewProviderTransformed. My recollection is it does at least 2 recomputes before letting you interact with it. And you might not want either of them if you're just about to change.

Opening up a Part Design mirrored transform, with breakpoint on PartDesign::Transformed::execute, I get these backtraces:

#0  0x00007fffb28c00b8 in PartDesign::Transformed::execute() ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/_PartDesign.so
#1  0x00007ffff391e99c in App::DocumentObject::recompute() ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#2  0x00007fffbf6f7017 in Part::Feature::recompute() ()
   from /home/jes/projects/FreeCAD/build/Mod/Part/Part.so
#3  0x00007fffb284c58d in PartDesign::Feature::recompute() ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/_PartDesign.so
#4  0x00007ffff37d7cd5 in App::Document::_recomputeFeature(App::DocumentObject*) ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#5  0x00007ffff37d5400 in App::Document::recompute(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, bool, bool*, int) ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#6  0x00007ffff39f6f0e in App::DocumentPy::recompute(_object*) ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#7  0x00007ffff39ed091 in App::DocumentPy::staticCallback_recompute(_object*, _object*)
    () from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#8  0x00007ffff1d38468 in cfunction_call (func=0x7fffcb534bd0, 
    args=0x7ffff239e5c8 <_PyRuntime+76264>, kwargs=0x0) at ../Objects/methodobject.c:548
#9  0x00007ffff1cdb7af in _PyObject_MakeTpCall (
    tstate=0x7ffff23fbf68 <_PyRuntime+459656>, callable=callable@entry=0x7fffcb534bd0, 
    args=args@entry=0x7ffff7fb2078, nargs=<optimised out>, keywords=0x0)
    at ../Objects/call.c:240
#10 0x00007ffff1cdbb47 in _PyObject_VectorcallTstate (kwnames=<optimised out>, 
    nargsf=<optimised out>, args=0x7ffff7fb2078, callable=0x7fffcb534bd0, 
    tstate=<optimised out>) at ../Include/internal/pycore_call.h:90
#11 0x00007ffff1c765ee in _PyEval_EvalFrameDefault (
    tstate=tstate@entry=0x7ffff23fbf68 <_PyRuntime+459656>, frame=<optimised out>, 
    frame@entry=0x7ffff7fb2020, throwflag=throwflag@entry=0) at Python/bytecodes.c:2706
#12 0x00007ffff1df986f in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff7fb2020, 
    tstate=0x7ffff23fbf68 <_PyRuntime+459656>) at ../Include/internal/pycore_ceval.h:89
#13 _PyEval_Vector (args=0x0, argcount=0, kwnames=0x0, locals=0x7fffeb6fd340, 
    func=0x7fffdc044540, tstate=0x7ffff23fbf68 <_PyRuntime+459656>)
    at ../Python/ceval.c:1683
#14 PyEval_EvalCode (co=co@entry=0x7fffdc00bc30, globals=globals@entry=0x7fffeb6fd340, 
    locals=locals@entry=0x7fffeb6fd340) at ../Python/ceval.c:578
#15 0x00007ffff1e54178 in run_eval_code_obj (
    tstate=tstate@entry=0x7ffff23fbf68 <_PyRuntime+459656>, co=co@entry=0x7fffdc00bc30, 
    globals=globals@entry=0x7fffeb6fd340, locals=locals@entry=0x7fffeb6fd340)
    at ../Python/pythonrun.c:1722
#16 0x00007ffff1e5429c in run_mod (mod=mod@entry=0x55555a7031a8, 
    filename=filename@entry=0x7ffff2391a40 <_PyRuntime+24160>, 
    globals=globals@entry=0x7fffeb6fd340, locals=locals@entry=0x7fffeb6fd340, 
    flags=flags@entry=0x0, arena=arena@entry=0x7fffdc1f3cb0)
    at ../Python/pythonrun.c:1743
#17 0x00007ffff1e578b4 in PyRun_StringFlags (str=<optimised out>, 
    start=<optimised out>, globals=0x7fffeb6fd340, locals=0x7fffeb6fd340, flags=0x0)
    at ../Python/pythonrun.c:1618
#18 0x00007ffff278a95a in Base::InterpreterSingleton::runString[abi:cxx11](char const*)
    () from /home/jes/projects/FreeCAD/build/lib/libFreeCADBase.so
#19 0x00007ffff578b681 in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) () from /home/jes/projects/FreeCAD/build/lib/libFreeCADGui.so
#20 0x00007ffff578b23d in Gui::Command::_doCommand(char const*, int, Gui::Command::DoCmd_Type, char const*, ...) () from /home/jes/projects/FreeCAD/build/lib/libFreeCADGui.so
#21 0x00007ffff578c670 in Gui::Command::updateActive() ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADGui.so
#22 0x00007fffb1339221 in prepareTransformed(PartDesign::Body*, Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)>)::{lambda(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}::operator()(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >) const ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#23 0x00007fffb1339d66 in prepareTransformed(PartDesign::Body*, Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::Docu--Type <RET> for more, q to quit, c to continue without paging--c
mentObject*> >)>) ()

and

#0  0x00007fffb28c00b8 in PartDesign::Transformed::execute() ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/_PartDesign.so
#1  0x00007ffff391e99c in App::DocumentObject::recompute() ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#2  0x00007fffbf6f7017 in Part::Feature::recompute() ()
   from /home/jes/projects/FreeCAD/build/Mod/Part/Part.so
#3  0x00007fffb284c58d in PartDesign::Feature::recompute() ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/_PartDesign.so
#4  0x00007ffff37d7cd5 in App::Document::_recomputeFeature(App::DocumentObject*) ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#5  0x00007ffff37d5400 in App::Document::recompute(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, bool, bool*, int) ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#6  0x00007ffff39f6f0e in App::DocumentPy::recompute(_object*) ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#7  0x00007ffff39ed091 in App::DocumentPy::staticCallback_recompute(_object*, _object*)
    () from /home/jes/projects/FreeCAD/build/lib/libFreeCADApp.so
#8  0x00007ffff1d38468 in cfunction_call (func=0x7fffcb534bd0, 
    args=0x7ffff239e5c8 <_PyRuntime+76264>, kwargs=0x0) at ../Objects/methodobject.c:548
#9  0x00007ffff1cdb7af in _PyObject_MakeTpCall (
    tstate=0x7ffff23fbf68 <_PyRuntime+459656>, callable=callable@entry=0x7fffcb534bd0, 
    args=args@entry=0x7ffff7fb2078, nargs=<optimised out>, keywords=0x0)
    at ../Objects/call.c:240
#10 0x00007ffff1cdbb47 in _PyObject_VectorcallTstate (kwnames=<optimised out>, 
    nargsf=<optimised out>, args=0x7ffff7fb2078, callable=0x7fffcb534bd0, 
    tstate=<optimised out>) at ../Include/internal/pycore_call.h:90
#11 0x00007ffff1c765ee in _PyEval_EvalFrameDefault (
    tstate=tstate@entry=0x7ffff23fbf68 <_PyRuntime+459656>, frame=<optimised out>, 
    frame@entry=0x7ffff7fb2020, throwflag=throwflag@entry=0) at Python/bytecodes.c:2706
#12 0x00007ffff1df986f in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff7fb2020, 
    tstate=0x7ffff23fbf68 <_PyRuntime+459656>) at ../Include/internal/pycore_ceval.h:89
#13 _PyEval_Vector (args=0x0, argcount=0, kwnames=0x0, locals=0x7fffeb6fd340, 
    func=0x7fffdc044540, tstate=0x7ffff23fbf68 <_PyRuntime+459656>)
    at ../Python/ceval.c:1683
#14 PyEval_EvalCode (co=co@entry=0x7fffdc00bc30, globals=globals@entry=0x7fffeb6fd340, 
    locals=locals@entry=0x7fffeb6fd340) at ../Python/ceval.c:578
#15 0x00007ffff1e54178 in run_eval_code_obj (
    tstate=tstate@entry=0x7ffff23fbf68 <_PyRuntime+459656>, co=co@entry=0x7fffdc00bc30, 
    globals=globals@entry=0x7fffeb6fd340, locals=locals@entry=0x7fffeb6fd340)
    at ../Python/pythonrun.c:1722
#16 0x00007ffff1e5429c in run_mod (mod=mod@entry=0x55555a7031a8, 
    filename=filename@entry=0x7ffff2391a40 <_PyRuntime+24160>, 
    globals=globals@entry=0x7fffeb6fd340, locals=locals@entry=0x7fffeb6fd340, 
    flags=flags@entry=0x0, arena=arena@entry=0x7fffdc1f3cb0)
    at ../Python/pythonrun.c:1743
#17 0x00007ffff1e578b4 in PyRun_StringFlags (str=<optimised out>, 
    start=<optimised out>, globals=0x7fffeb6fd340, locals=0x7fffeb6fd340, flags=0x0)
    at ../Python/pythonrun.c:1618
#18 0x00007ffff278a95a in Base::InterpreterSingleton::runString[abi:cxx11](char const*)
    () from /home/jes/projects/FreeCAD/build/lib/libFreeCADBase.so
#19 0x00007ffff578b681 in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) () from /home/jes/projects/FreeCAD/build/lib/libFreeCADGui.so
#20 0x00007ffff578b23d in Gui::Command::_doCommand(char const*, int, Gui::Command::DoCmd_Type, char const*, ...) () from /home/jes/projects/FreeCAD/build/lib/libFreeCADGui.so
#21 0x00007ffff578c670 in Gui::Command::updateActive() ()
   from /home/jes/projects/FreeCAD/build/lib/libFreeCADGui.so
#22 0x00007fffb132e67b in finishFeature(Gui::Command const*, App::DocumentObject*, App::DocumentObject*, bool, bool) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#23 0x00007fffb1339f1a in finishTransformed(Gui::Command*, App::DocumentObject*) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#24 0x00007fffb133a43b in CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}::operator()(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >) const ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
--Type <RET> for more, q to quit, c to continue without paging--c
#25 0x00007fffb1342ae9 in void std::__invoke_impl<void, CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}&, App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > >(std::__invoke_other, CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}&, App::DocumentObject*&&, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >&&) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#26 0x00007fffb1341903 in std::enable_if<is_invocable_r_v<void, CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}&, App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > >, void>::type std::__invoke_r<void, CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}&, App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > >(CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}&, App::DocumentObject*&&, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >&&) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#27 0x00007fffb133fe95 in std::_Function_handler<void (App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >), CmdPartDesignMirrored::activated(int)::{lambda(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}>::_M_invoke(std::_Any_data const&, App::DocumentObject*&&, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >&&) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#28 0x00007fffb134c0e5 in std::function<void (App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)>::operator()(App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >) const ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#29 0x00007fffb13396e3 in prepareTransformed(PartDesign::Body*, Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)>)::{lambda(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)#1}::operator()(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >) const ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#30 0x00007fffb1339d66 in prepareTransformed(PartDesign::Body*, Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (App::DocumentObject*, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> >)>) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
#31 0x00007fffb133a605 in CmdPartDesignMirrored::activated(int) ()
   from /home/jes/projects/FreeCAD/build/Mod/PartDesign/PartDesignGui.so

Car ramp toy

All pieces printed:

Not flawless prints, but good enough for this.

Next up is lay out the hole locations in Inkscape and see if I can fit them all on one sheet of paper.

Or can I do it with Techdraw?

Great success, Techdraw:

The line in the middle is to line up with the centre line of the piece of wood.

I tried to get Techdraw to draw a cosmetic centre line but couldn't work out how to do it, decided to manually model a centre line.

But I had some trouble getting a modelled centre line to show up, in the end I made a cut all the way through the object and that worked.

Happily it just fits on one sheet of paper. If it didn't I could have put a few on one sheet and then moved it down referencing the first holes.

Lol great, this is mirrored. I have manually transferred the holes and centre line to the other side, will just use that.

Just need some cars now.

I was thinking that for the axle I could use the 1mm blued pivot steel or something, and make the wheels a glued press fit onto the ends, maybe rough them up on the lathe.

Oh, but that will force the wheels to turn together. I really want the wheels to turn independently I think.

I'm saying 1mm blued pivot steel, loose fit in the wheels, loose fit in the body, and then try to mushroom out the ends by tapping and see what happens.

I think I want to drop a weight into the middle of the car body while it's printing. An M10 nut. It will add 10.5 grams.

I'm printing the wheels in PolyMax PC, just because it is black and it is already loaded in the AMS.

< 2025-02-24 2025-02-26 >