callback that recognizes when I click onto a drawing element?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
a3bksll47
Posts: 197
Joined: Sat Mar 17, 2018 3:42 am

callback that recognizes when I click onto a drawing element?

Post by a3bksll47 »

I want to select an element by clicking onto it, and have some kind of event callback recognize that I clicked on that object. Anything in the Python API that does that?
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: callback that recognizes when I click onto a drawing element?

Post by carlopav »

a3bksll47 wrote: Tue Apr 07, 2020 5:05 am I want to select an element by clicking onto it, and have some kind of event callback recognize that I clicked on that object. Anything in the Python API that does that?
You probably can use a selection observer. You can find some very useful code snippets here:
https://wiki.freecadweb.org/Code_snippets
I had some problems with addEventCallback, so probably you should prefer addEventCallbackPivy; but that could be related to my low coding skills
follow my experiments on BIM modelling for architecture design
a3bksll47
Posts: 197
Joined: Sat Mar 17, 2018 3:42 am

Re: callback that recognizes when I click onto a drawing element?

Post by a3bksll47 »

carlopav wrote: Wed Apr 08, 2020 8:59 pm
a3bksll47 wrote: Tue Apr 07, 2020 5:05 am I want to select an element by clicking onto it, and have some kind of event callback recognize that I clicked on that object. Anything in the Python API that does that?
You probably can use a selection observer. You can find some very useful code snippets here:
https://wiki.freecadweb.org/Code_snippets
I had some problems with addEventCallback, so probably you should prefer addEventCallbackPivy; but that could be related to my low coding skills
Ok, thanks for this. I'll check it out.
Post Reply