Draft: clean up CircularArray code

Avoid `Draft.py` in the `make_circular_array` function because
it creates a circular dependency.

Use function to find the object in `make_circular_array`.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays interactively from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
This commit is contained in:
vocx-fc
2020-05-24 21:28:58 -05:00
committed by Yorik van Havre
parent 33d3fb1fa9
commit 66959b2688
3 changed files with 60 additions and 35 deletions

View File

@@ -32,11 +32,12 @@ import FreeCAD as App
import FreeCADGui as Gui
import Draft
import Draft_rc # include resources, icons, ui files
import draftutils.todo as todo
from draftutils.messages import _msg, _log
from draftutils.translate import _tr
from draftguitools import gui_base
from drafttaskpanels import task_circulararray
import draftutils.todo as todo
# The module is used to prevent complaints from code checkers (flake8)
bool(Draft_rc.__name__)
@@ -58,11 +59,12 @@ class CircularArray(gui_base.GuiCommandBase):
def GetResources(self):
"""Set icon, menu and tooltip."""
_tip = ("Creates copies of a selected object, "
"and places the copies in a circular pattern.\n"
"The properties of the array can be further modified after "
"the new object is created, including turning it into "
"a different type of array.")
_tip = ("Creates copies of the selected object, "
"and places the copies in a radial pattern\n"
"creating various circular layers.\n"
"\n"
"The array can be turned into an orthogonal "
"or a polar array by changing its type.")
d = {'Pixmap': 'Draft_CircularArray',
'MenuText': QT_TRANSLATE_NOOP("Draft", "Circular array"),