Okay I have a python scripted object and when a user changes one of the parameters the onchange function of the objects class gets
driven and I can perform the appropriate redraw.
Now how do I handle the situation if the object is part of a Boolean? i.e. How do I get the boolean to redraw?
Note: I need to handle this whether the object is part of a Boolean or not and also if there is a hierarchic of booleans.
Python scripted object as part of a boolean.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Python scripted object as part of a boolean.
In general the "onChange" function is only to be used for simple and responsive user feedback, so it should trigger a object recompute only if the redraw is almost instant. It is also not part of the freecad document updates. The real execution logic for objects work without "onChange" but with "execute". Whenever you change a property in your object it gets marked as "to be recomputed" and the recompute button in freecad gets active. Once you hit it the whole document get recomputed, including your object by calling the "execute" method and all other objects that depends on it, like the mentioned booleans.
So to answer your question: use execute instead of onChange.
So to answer your question: use execute instead of onChange.