ROT for Use of recompute() in Draft Module

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

ROT for Use of recompute() in Draft Module

Post by wandererfan »

In Draft.py, some makeXXXX(makeCircle, makeRectangle, ...) functions call FreeCAD.ActiveDocument.recompute() before returning a new object, and some (makeText, makeArray, makePathArray, makeEllipse) do not.

In DraftTools.py, again, some tools (Arc) call recompute, and some (Rectangle) do not.

Is there are rule of thumb for when and where to include the recompute() call??

wf
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: ROT for Use of recompute() in Draft Module

Post by yorik »

Yeah, there is still quite some mess in the draft module...
My first idea was: not recompute inside the Draft.makeXXX functions, so the person who uses these in scripts can choose when to recompute, but then some cases appeared where you must recompute anyway, otherwise the operation is not fully performed. And things stayed more or less like that... Maybe it's time for some housecleaning
Post Reply