Draft: move circular, ortho, and polar make functions

Previously they were in `draftobjects`, but since they
don't define new objects, just create objects,
they are moved to `draftmake`.

Also ajust the `CMakeLists.txt` and the corresponding Gui Commands
which use these make functions.

These functions internally use the `Draft.makeArray` function.
We will put comments as reminders so that when this function
is moved to its own module, we can update the derived functions.
This commit is contained in:
vocx-fc
2020-05-13 21:30:20 -05:00
committed by Yorik van Havre
parent 79927f3504
commit 3172e82dc1
8 changed files with 46 additions and 23 deletions

View File

@@ -86,6 +86,7 @@ SET(Draft_make_functions
draftmake/make_block.py
draftmake/make_bspline.py
draftmake/make_circle.py
draftmake/make_circulararray.py
draftmake/make_clone.py
draftmake/make_copy.py
draftmake/make_drawingview.py
@@ -93,13 +94,15 @@ SET(Draft_make_functions
draftmake/make_facebinder.py
draftmake/make_fillet.py
draftmake/make_line.py
draftmake/make_orthoarray.py
draftmake/make_patharray.py
draftmake/make_polygon.py
draftmake/make_point.py
draftmake/make_pointarray.py
draftmake/make_polararray.py
draftmake/make_polygon.py
draftmake/make_rectangle.py
draftmake/make_shapestring.py
draftmake/make_shape2dview.py
draftmake/make_shapestring.py
draftmake/make_sketch.py
draftmake/make_wire.py
draftmake/make_wpproxy.py
@@ -113,14 +116,11 @@ SET(Draft_objects
draftobjects/bezcurve.py
draftobjects/block.py
draftobjects/bspline.py
draftobjects/circulararray.py
draftobjects/circle.py
draftobjects/clone.py
draftobjects/drawingview.py
draftobjects/ellipse.py
draftobjects/facebinder.py
draftobjects/orthoarray.py
draftobjects/polararray.py
draftobjects/draft_annotation.py
draftobjects/fillet.py
draftobjects/draftlink.py

View File

@@ -338,6 +338,13 @@ if FreeCAD.GuiUp:
from draftviewproviders.view_array import ViewProviderDraftArray
from draftviewproviders.view_array import _ViewProviderDraftArray
# from draftmake.make_circulararray import make_circular_array
# from draftmake.make_orthoarray import make_ortho_array
# from draftmake.make_orthoarray import make_ortho_array2d
# from draftmake.make_orthoarray import make_rect_array
# from draftmake.make_orthoarray import make_rect_array2d
# from draftmake.make_polararray import make_polar_array
# facebinder
from draftmake.make_facebinder import make_facebinder, makeFacebinder
from draftobjects.facebinder import Facebinder, _Facebinder

View File

@@ -20,13 +20,14 @@
# * USA *
# * *
# ***************************************************************************
"""Provides the object code for Draft CircularArray."""
## @package circulararray
"""Provides functions for creating circular arrays in a plane."""
## @package make_circulararray
# \ingroup DRAFT
# \brief This module provides the object code for Draft CircularArray.
# \brief Provides functions for creating circular arrays in a plane.
import FreeCAD as App
import Draft
# import draftmake.make_array as make_array
import draftutils.utils as utils
from draftutils.messages import _msg, _err
from draftutils.translate import _tr
@@ -141,6 +142,7 @@ def make_circular_array(obj,
_msg("use_link: {}".format(bool(use_link)))
# new_obj = make_array.make_array()
new_obj = Draft.makeArray(obj,
arg1=r_distance, arg2=tan_distance,
arg3=axis, arg4=center,

View File

@@ -20,13 +20,14 @@
# * USA *
# * *
# ***************************************************************************
"""Provide the object code for Draft Array."""
## @package orthoarray
"""Provides functions for creating orthogonal arrays in 2D and 3D."""
## @package make_orthoarray
# \ingroup DRAFT
# \brief Provide the object code for Draft Array.
# \brief Provides functions for creating orthogonal arrays in 2D and 3D.
import FreeCAD as App
import Draft
# import draftmake.make_array as make_array
import draftutils.utils as utils
from draftutils.messages import _msg, _wrn, _err
from draftutils.translate import _tr
@@ -179,6 +180,7 @@ def make_ortho_array(obj,
_msg("use_link: {}".format(bool(use_link)))
# new_obj = make_array.make_array()
new_obj = Draft.makeArray(obj,
arg1=v_x, arg2=v_y, arg3=v_z,
arg4=n_x, arg5=n_y, arg6=n_z,
@@ -273,6 +275,7 @@ def make_ortho_array2d(obj,
_msg("use_link: {}".format(bool(use_link)))
# new_obj = make_array.make_array()
new_obj = Draft.makeArray(obj,
arg1=v_x, arg2=v_y,
arg3=n_x, arg4=n_y,

View File

@@ -20,13 +20,14 @@
# * USA *
# * *
# ***************************************************************************
"""Provide the object code for Draft PolarArray."""
## @package polararray
"""Provides functions for creating polar arrays in a plane."""
## @package make_polararray
# \ingroup DRAFT
# \brief This module provides the object code for Draft PolarArray.
# \brief Provides functions for creating polar arrays in a plane.
import FreeCAD as App
import Draft
# import draftmake.make_array as make_array
import draftutils.utils as utils
from draftutils.messages import _msg, _err
from draftutils.translate import _tr
@@ -106,6 +107,7 @@ def make_polar_array(obj,
_msg("use_link: {}".format(bool(use_link)))
# new_obj = make_array.make_array()
new_obj = Draft.makeArray(obj,
arg1=center, arg2=angle, arg3=number,
use_link=use_link)

View File

@@ -278,7 +278,7 @@ class TaskPanelCircularArray:
# of this class, the GuiCommand.
# This is needed to schedule geometry manipulation
# that would crash Coin3D if done in the event callback.
_cmd = "draftobjects.circulararray.make_circular_array"
_cmd = "DD.make_circular_array"
_cmd += "("
_cmd += "App.ActiveDocument." + sel_obj.Name + ", "
_cmd += "r_distance=" + str(self.r_distance) + ", "
@@ -290,8 +290,11 @@ class TaskPanelCircularArray:
_cmd += "use_link=" + str(self.use_link)
_cmd += ")"
_cmd_list = ["Gui.addModule('Draft')",
"Gui.addModule('draftobjects.circulararray')",
Gui.addModule('Draft')
Gui.addModule('draftmake.make_circulararray')
_cmd_list = ["# DD = Draft # in the future",
"DD = draftmake.make_circulararray",
"obj = " + _cmd,
"obj.Fuse = " + str(self.fuse),
"Draft.autogroup(obj)",

View File

@@ -248,7 +248,7 @@ class TaskPanelOrthoArray:
# of this class, the GuiCommand.
# This is needed to schedule geometry manipulation
# that would crash Coin3D if done in the event callback.
_cmd = "draftobjects.orthoarray.make_ortho_array"
_cmd = "DD.make_ortho_array"
_cmd += "("
_cmd += "App.ActiveDocument." + sel_obj.Name + ", "
_cmd += "v_x=" + DraftVecUtils.toString(self.v_x) + ", "
@@ -260,8 +260,11 @@ class TaskPanelOrthoArray:
_cmd += "use_link=" + str(self.use_link)
_cmd += ")"
_cmd_list = ["Gui.addModule('Draft')",
"Gui.addModule('draftobjects.orthoarray')",
Gui.addModule('Draft')
Gui.addModule('draftmake.make_orthoarray')
_cmd_list = ["# DD = Draft # in the future",
"DD = draftmake.make_orthoarray",
"obj = " + _cmd,
"obj.Fuse = " + str(self.fuse),
"Draft.autogroup(obj)",

View File

@@ -242,7 +242,7 @@ class TaskPanelPolarArray:
# of this class, the GuiCommand.
# This is needed to schedule geometry manipulation
# that would crash Coin3D if done in the event callback.
_cmd = "draftobjects.polararray.make_polar_array"
_cmd = "DD.make_polar_array"
_cmd += "("
_cmd += "App.ActiveDocument." + sel_obj.Name + ", "
_cmd += "number=" + str(self.number) + ", "
@@ -251,8 +251,11 @@ class TaskPanelPolarArray:
_cmd += "use_link=" + str(self.use_link)
_cmd += ")"
_cmd_list = ["Gui.addModule('Draft')",
"Gui.addModule('draftobjects.polararray')",
Gui.addModule('Draft')
Gui.addModule('draftmake.make_polararray')
_cmd_list = ["# DD = Draft # in the future",
"DD = draftmake.make_polararray",
"obj = " + _cmd,
"obj.Fuse = " + str(self.fuse),
"Draft.autogroup(obj)",