Draft: add modules of draftmake to the proper Doxygen group

This includes `make_arc_3points`, `make_array`, `make_bezcurve`,
`make_block`, `make_bspline`, `make_circle`, `make_circulararray`,
`make_clone`, `make_copy`, `make_dimension`, `make_drawingview`,
`make_ellipse`, `make_facebinder`, `make_fillet`, `make_label`,
`make_line`, `make_orthoarray`, `make_patharray`, `make_point`,
`make_pointarray`, `make_polararray`, `make_polygon`,
`make_rectangle`, `make_shape2dview`, `make_shapestring`,
`make_sketch`, `make_text`, `make_wire`, `make_wpproxy`.

These are added to the `draftmake` Doxygen group
so that the functions contained in each module are listed
appropriately in the automatically generated documentation.
This commit is contained in:
vocx-fc
2020-06-30 21:24:16 -05:00
committed by Yorik van Havre
parent f4611f0a31
commit a82d6b9801
29 changed files with 294 additions and 227 deletions

View File

@@ -20,11 +20,13 @@
# * USA *
# * *
# ***************************************************************************
"""Provides the object code for Draft Arc_3Points."""
## @package arc_3points
# \ingroup DRAFT
# \brief Provides the object code for Draft Arc_3Points.
"""Provides functions to create Arc objects by using 3 points."""
## @package make_arc_3points
# \ingroup draftmake
# \brief Provides functions to create Arc objects by using 3 points.
## \addtogroup draftmake
# @{
import math
import FreeCAD as App
@@ -204,3 +206,5 @@ def make_arc_3points(points, placement=None, face=False,
_msg(_tr("Final placement: ") + "{}".format(obj.Placement))
return obj
## @}

View File

@@ -20,11 +20,16 @@
# * USA *
# * *
# ***************************************************************************
"""Provide the code for the Draft make_array function."""
## @package make_array
# \ingroup DRAFT
# \brief This module provides the code for Draft make_array function.
"""Provides functions to create Array objects.
This includes orthogonal arrays, polar arrays, and circular arrays.
"""
## @package make_array
# \ingroup draftmake
# \brief Provides functions to create Array objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
@@ -148,3 +153,5 @@ def makeArray(baseobject,
return make_array(baseobject,
arg1, arg2, arg3,
arg4, arg5, arg6, use_link)
## @}

View File

@@ -20,26 +20,27 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_bezcurve function.
"""
"""Provides functions to create BezCurve objects."""
## @package make_bezcurve
# \ingroup DRAFT
# \brief This module provides the code for Draft make_bezcurve function.
# \ingroup draftmake
# \brief Provides functions to create BezCurve objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftutils.utils import type_check
from draftutils.translate import translate
from draftobjects.bezcurve import BezCurve
if App.GuiUp:
from draftviewproviders.view_bezcurve import ViewProviderBezCurve
def make_bezcurve(pointslist, closed=False, placement=None, face=None, support=None, degree=None):
def make_bezcurve(pointslist,
closed=False, placement=None, face=None, support=None,
degree=None):
"""make_bezcurve(pointslist, [closed], [placement])
Creates a Bezier Curve object from the given list of vectors.
@@ -76,7 +77,8 @@ def make_bezcurve(pointslist, closed=False, placement=None, face=None, support=N
for v in pointslist.Vertexes:
nlist.append(v.Point)
pointslist = nlist
if placement: type_check([(placement,App.Placement)], "make_bezcurve")
if placement:
utils.type_check([(placement,App.Placement)], "make_bezcurve")
if len(pointslist) == 2: fname = "Line"
else: fname = "BezCurve"
obj = App.ActiveDocument.addObject("Part::Part2DObjectPython",fname)
@@ -98,10 +100,12 @@ def make_bezcurve(pointslist, closed=False, placement=None, face=None, support=N
ViewProviderBezCurve(obj.ViewObject)
# if not face: obj.ViewObject.DisplayMode = "Wireframe"
# obj.ViewObject.DisplayMode = "Wireframe"
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makeBezCurve = make_bezcurve
## @}

View File

@@ -20,17 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_block function.
"""
"""Provides functions to create Block objects."""
## @package make_block
# \ingroup DRAFT
# \brief This module provides the code for Draft make_block function.
# \ingroup draftmake
# \brief Provides functions to create Block objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.block import Block
if App.GuiUp:
from draftviewproviders.view_base import ViewProviderDraftPart
@@ -56,8 +57,10 @@ def make_block(objectslist):
ViewProviderDraftPart(obj.ViewObject)
for o in objectslist:
o.ViewObject.Visibility = False
select(obj)
gui_utils.select(obj)
return obj
makeBlock = make_block
## @}

View File

@@ -20,20 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_bspline function.
"""
"""Provides functions to create BSpline objects."""
## @package make_bspline
# \ingroup DRAFT
# \brief This module provides the code for Draft make_bspline function.
# \ingroup draftmake
# \brief Provides functions to create BSpline objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftutils.utils import type_check
from draftutils.translate import translate
from draftobjects.bspline import BSpline
if App.GuiUp:
@@ -90,7 +88,8 @@ def make_bspline(pointslist, closed=False, placement=None, face=None, support=No
App.Console.PrintError(translate("Draft", _err)+"\n")
return
# should have sensible parms from here on
if placement: type_check([(placement,App.Placement)], "make_bspline")
if placement:
utils.type_check([(placement,App.Placement)], "make_bspline")
if len(pointslist) == 2: fname = "Line"
else: fname = "BSpline"
obj = App.ActiveDocument.addObject("Part::Part2DObjectPython",fname)
@@ -103,10 +102,12 @@ def make_bspline(pointslist, closed=False, placement=None, face=None, support=No
if placement: obj.Placement = placement
if App.GuiUp:
ViewProviderBSpline(obj.ViewObject)
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makeBSpline = make_bspline
## @}

View File

@@ -20,26 +20,23 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_circle function.
"""
## @package make circle
# \ingroup DRAFT
# \brief This module provides the code for Draft make_circle.
"""Provides functions to create Circle objects."""
## @package make_circle
# \ingroup draftmake
# \brief Provides functions to create Circle objects.
## \addtogroup draftmake
# @{
import math
import FreeCAD as App
import Part
import DraftGeomUtils
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftutils.utils import type_check
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
from draftobjects.circle import Circle
if App.GuiUp:
from draftviewproviders.view_base import ViewProviderDraft
@@ -78,7 +75,8 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
App.Console.PrintError("No active document. Aborting\n")
return
if placement: type_check([(placement,App.Placement)], "make_circle")
if placement:
utils.type_check([(placement,App.Placement)], "make_circle")
if startangle != endangle:
_name = "Arc"
@@ -126,10 +124,12 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
if App.GuiUp:
ViewProviderDraft(obj.ViewObject)
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makeCircle = make_circle
## @}

View File

@@ -20,13 +20,14 @@
# * USA *
# * *
# ***************************************************************************
"""Provides functions for creating circular arrays in a plane."""
"""Provides functions to create circular Array objects."""
## @package make_circulararray
# \ingroup DRAFT
# \brief Provides functions for creating circular arrays in a plane.
# \ingroup draftmake
# \brief Provides functions to create circular Array objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftmake.make_array as make_array
import draftutils.utils as utils
@@ -172,3 +173,5 @@ def make_circular_array(base_object,
arg5=number, arg6=symmetry,
use_link=use_link)
return new_obj
## @}

View File

@@ -20,22 +20,19 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_clone function.
"""
"""Provides functions to create Clone objects."""
## @package make_clone
# \ingroup DRAFT
# \brief This module provides the code for Draft make_clone function.
# \ingroup draftmake
# \brief Provides functions to create Clone objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import DraftGeomUtils
import draftutils.utils as utils
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.clone import Clone
if App.GuiUp:
from draftutils.todo import ToDo
from draftviewproviders.view_clone import ViewProviderClone
@@ -102,11 +99,11 @@ def make_clone(obj, delta=None, forcedraft=False):
except:
pass
if App.GuiUp:
format_object(cl,base)
gui_utils.format_object(cl,base)
cl.ViewObject.DiffuseColor = base.ViewObject.DiffuseColor
if utils.get_type(obj[0]) in ["Window","BuildingPart"]:
ToDo.delay(Arch.recolorize,cl)
select(cl)
gui_utils.select(cl)
return cl
# fall back to Draft clone mode
if not cl:
@@ -121,13 +118,15 @@ def make_clone(obj, delta=None, forcedraft=False):
cl.Placement.move(delta)
elif (len(obj) == 1) and hasattr(obj[0],"Placement"):
cl.Placement = obj[0].Placement
format_object(cl,obj[0])
gui_utils.format_object(cl,obj[0])
if hasattr(cl,"LongName") and hasattr(obj[0],"LongName"):
cl.LongName = obj[0].LongName
if App.GuiUp and (len(obj) > 1):
cl.ViewObject.Proxy.resetColors(cl.ViewObject)
select(cl)
gui_utils.select(cl)
return cl
clone = make_clone
## @}

View File

@@ -20,19 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_copy function.
"""
"""Provides functions to create copies of objects."""
## @package make_copy
# \ingroup DRAFT
# \brief This module provides the code for Draft make_copy function.
# \ingroup draftmake
# \brief Provides functions to create copies of objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
def make_copy(obj, force=None, reparent=False, simple_copy=False):
"""makeCopy(object, [force], [reparent])
@@ -85,4 +84,5 @@ def make_copy(obj, force=None, reparent=False, simple_copy=False):
par.Group = group
return newobj
## @}

View File

@@ -23,11 +23,16 @@
# * USA *
# * *
# ***************************************************************************
"""Provides functions to crate dimension objects."""
## @package make_dimension
# \ingroup DRAFT
# \brief Provides functions to crate dimension objects.
"""Provides functions to create LinearDimension or AngularDinemsion objects.
This includes linear dimensions, radial dimensions, and angular dimensions.
"""
## @package make_dimension
# \ingroup draftmake
# \brief Provides functions to create Linear or AngularDimension objects.
## \addtogroup draftmake
# @{
import math
import FreeCAD as App
@@ -40,8 +45,9 @@ from draftobjects.dimension import (LinearDimension,
AngularDimension)
if App.GuiUp:
from draftviewproviders.view_dimension import ViewProviderLinearDimension
from draftviewproviders.view_dimension import ViewProviderAngularDimension
from draftviewproviders.view_dimension \
import (ViewProviderLinearDimension,
ViewProviderAngularDimension)
def make_dimension(p1, p2, p3=None, p4=None):
@@ -646,3 +652,5 @@ def makeAngularDimension(center, angles, p3, normal=None):
return make_angular_dimension(center=center, angles=angles,
dim_line=p3, normal=normal)
## @}

View File

@@ -20,15 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_drawing_view function.
OBSOLETE: Drawing Workbench was substituted by TechDraw.
"""Provides functions to create DrawingView objects.
These functions must be considered obsolete as the Drawing Workbench
is obsolete since v0.17.
"""
## @package make_drawingview
# \ingroup DRAFT
# \brief This module provides the code for Draft make_drawing_view function
# \ingroup draftmake
# \brief Provides functions to create DrawingView objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
from draftobjects.drawingview import DrawingView
@@ -104,3 +107,5 @@ def make_drawing_view(obj, page, lwmod=None, tmod=None, otherProjection=None):
makeDrawingView = make_drawing_view
## @}

View File

@@ -20,18 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_ellipse function.
"""
"""Provides functions to create Ellipse objects."""
## @package make_ellipse
# \ingroup DRAFT
# \brief This module provides the code for Draft make_ellipse function.
# \ingroup draftmake
# \brief Provides functions to create Ellipse objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.ellipse import Ellipse
if App.GuiUp:
from draftviewproviders.view_base import ViewProviderDraft
@@ -76,10 +76,12 @@ def make_ellipse(majradius, minradius, placement=None, face=True, support=None):
ViewProviderDraft(obj.ViewObject)
#if not face:
# obj.ViewObject.DisplayMode = "Wireframe"
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makeEllipse = make_ellipse
## @}

View File

@@ -20,17 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_facebinder function.
"""
"""Provides functions to create Facebinder objects."""
## @package make_facebinder
# \ingroup DRAFT
# \brief This module provides the code for Draft make_facebinder function.
# \ingroup draftmake
# \brief Provides functions to create Facebinder objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.facebinder import Facebinder
if App.GuiUp:
from draftviewproviders.view_facebinder import ViewProviderFacebinder
@@ -59,8 +60,10 @@ def make_facebinder(selectionset, name="Facebinder"):
ViewProviderFacebinder(fb.ViewObject)
faces = [] # unused variable?
fb.Proxy.addSubobjects(fb, selectionset)
select(fb)
gui_utils.select(fb)
return fb
makeFacebinder = make_facebinder
## @}

View File

@@ -18,34 +18,34 @@
# * USA *
# * *
# ***************************************************************************
"""Provides the code to create Fillet objects.
"""Provides functions to create Fillet objects between two lines.
This creates a `Part::Part2DObjectPython`, and then assigns the Proxy class
`Fillet`, and the `ViewProviderFillet` for the view provider.
"""
## @package make_fillet
# \ingroup DRAFT
# \brief Provides the code to create Fillet objects.
# \ingroup draftmake
# \brief Provides functions to create Fillet objects between two lines.
import lazy_loader.lazy_loader as lz
import FreeCAD as App
import Draft_rc
import DraftGeomUtils
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
import draftobjects.fillet as fillet
from draftutils.messages import _msg, _err
from draftutils.translate import _tr
if App.GuiUp:
import draftviewproviders.view_fillet as view_fillet
# Delay import of Part module until first use because it is heavy
# Delay import of module until first use because it is heavy
Part = lz.LazyLoader("Part", globals(), "Part")
DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
# The module is used to prevent complaints from code checkers (flake8)
True if Draft_rc.__name__ else False
## \addtogroup draftmake
# @{
def _print_obj_length(obj, edge, num=1):
@@ -171,3 +171,5 @@ def make_fillet(objs, radius=100, chamfer=False, delete=False):
gui_utils.autogroup(obj)
return obj
## @}

View File

@@ -23,11 +23,13 @@
# * USA *
# * *
# ***************************************************************************
"""Provides the make function to create Draft Label objects."""
"""Provides functions to create Label objects."""
## @package make_label
# \ingroup DRAFT
# \brief Provides the make function to create Draft Label objects.
# \ingroup draftmake
# \brief Provides functions to create Label objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.gui_utils as gui_utils
import draftutils.utils as utils
@@ -408,3 +410,5 @@ def makeLabel(targetpoint=None, target=None, direction=None,
label_type=labeltype,
direction=direction,
distance=distance)
## @}

View File

@@ -20,18 +20,15 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_line function.
"""
"""Provides functions to create two-point Wire objects."""
## @package make_line
# \ingroup DRAFT
# \brief This module provides the code for Draft make_line function.
# \ingroup draftmake
# \brief Provides functions to create two-point Wire objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftmake.make_wire import make_wire
import draftmake.make_wire as make_wire
def make_line(first_param, last_param=None):
@@ -65,9 +62,11 @@ def make_line(first_param, last_param=None):
App.Console.PrintError(_err + "\n")
return
obj = make_wire([p1,p2])
obj = make_wire.make_wire([p1,p2])
return obj
makeLine = make_line
## @}

View File

@@ -20,15 +20,16 @@
# * USA *
# * *
# ***************************************************************************
"""Provides functions for creating orthogonal arrays in 2D and 3D."""
"""Provides functions to create orthogonal 2D and 3D Array objects."""
## @package make_orthoarray
# \ingroup DRAFT
# \brief Provides functions for creating orthogonal arrays in 2D and 3D.
# \ingroup draftmake
# \brief Provides functions to create orthogonal 2D and 3D Arrays.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftmake.make_array as make_array
import draftutils.utils as utils
import draftmake.make_array as make_array
from draftutils.messages import _msg, _wrn, _err
from draftutils.translate import _tr
@@ -525,3 +526,5 @@ def make_rect_array2d(base_object,
n_y=n_y,
use_link=use_link)
return new_obj
## @}

View File

@@ -25,15 +25,17 @@
# * USA *
# * *
# ***************************************************************************
"""Provides functions for creating path arrays.
"""Provides functions to create PathArray objects.
The copies will be placed along a path like a polyline, spline, or bezier
curve.
"""
## @package make_patharray
# \ingroup DRAFT
# \brief Provides functions for creating path arrays.
# \ingroup draftmake
# \brief Provides functions to create PathArray objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
@@ -315,3 +317,5 @@ def makePathArray(baseobject, pathobject, count,
xlate, pathobjsubs,
align,
use_link)
## @}

View File

@@ -20,18 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_point function.
"""
"""Provides functions to create Point objects."""
## @package make_point
# \ingroup DRAFT
# \brief This module provides the code for Draft make_point function.
# \ingroup draftmake
# \brief Provides functions to create Point objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.point import Point
if App.GuiUp:
import FreeCADGui as Gui
from draftviewproviders.view_point import ViewProviderPoint
@@ -88,9 +88,11 @@ def make_point(X=0, Y=0, Z=0, color=None, name = "Point", point_size= 5):
obj.ViewObject.PointColor = (float(color[0]), float(color[1]), float(color[2]))
obj.ViewObject.PointSize = point_size
obj.ViewObject.Visibility = True
select(obj)
gui_utils.select(obj)
return obj
makePoint = make_point
## @}

View File

@@ -24,15 +24,17 @@
# * USA *
# * *
# ***************************************************************************
"""Provides functions for creating point arrays.
"""Provides functions to create PointArray objects.
The copies will be placed along a list of points defined by a sketch,
a `Part::Compound`, or a `Draft Block`.
"""
## @package make_pointarray
# \ingroup DRAFT
# \brief This module provides the code for Draft make_point_array function.
# \ingroup draftmake
# \brief Provides functions to create PointArray objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
@@ -177,3 +179,5 @@ def makePointArray(base, ptlst):
utils.use_instead('make_point_array')
return make_point_array(base, ptlst)
## @}

View File

@@ -20,15 +20,16 @@
# * USA *
# * *
# ***************************************************************************
"""Provides functions for creating polar arrays in a plane."""
"""Provides functions to create polar Array objects."""
## @package make_polararray
# \ingroup DRAFT
# \brief Provides functions for creating polar arrays in a plane.
# \ingroup draftmake
# \brief Provides functions to create polar Array objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftmake.make_array as make_array
import draftutils.utils as utils
import draftmake.make_array as make_array
from draftutils.messages import _msg, _err
from draftutils.translate import _tr
@@ -132,3 +133,5 @@ def make_polar_array(base_object,
arg1=center, arg2=angle, arg3=number,
use_link=use_link)
return new_obj
## @}

View File

@@ -20,24 +20,20 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the object code for Draft make_rectangle function.
"""
## @package make_rectangle
# \ingroup DRAFT
# \brief This module provides the code for Draft make_rectangle function.
"""Provides functions to create Polygon objects."""
## @package make_polygon
# \ingroup draftmake
# \brief Provides functions to create Polygon objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftutils.utils import type_check
import draftutils.gui_utils as gui_utils
from draftobjects.polygon import Polygon
from draftviewproviders.view_base import ViewProviderDraft
def make_polygon(nfaces, radius=1, inscribed=True, placement=None, face=None, support=None):
"""makePolgon(edges,[radius],[inscribed],[placement],[face])
@@ -82,10 +78,12 @@ def make_polygon(nfaces, radius=1, inscribed=True, placement=None, face=None, su
if placement: obj.Placement = placement
if App.GuiUp:
ViewProviderDraft(obj.ViewObject)
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makePolygon = make_polygon
## @}

View File

@@ -20,20 +20,19 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_rectangle function.
"""
"""Provides functions to create Rectangle objects."""
## @package make_rectangle
# \ingroup DRAFT
# \ingroup draftmake
# \brief This module provides the code for Draft make_rectangle function.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftutils.utils import type_check
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
from draftobjects.rectangle import Rectangle
if App.GuiUp:
from draftviewproviders.view_rectangle import ViewProviderRectangle
@@ -75,7 +74,8 @@ def make_rectangle(length, height=0, placement=None, face=None, support=None):
rp = App.Placement(verts[0],rr)
return makeRectangle(xv.Length,yv.Length,rp,face,support)
if placement: type_check([(placement,App.Placement)], "make_rectangle")
if placement:
utils.type_check([(placement,App.Placement)], "make_rectangle")
obj = App.ActiveDocument.addObject("Part::Part2DObjectPython","Rectangle")
Rectangle(obj)
@@ -91,10 +91,12 @@ def make_rectangle(length, height=0, placement=None, face=None, support=None):
if App.GuiUp:
ViewProviderRectangle(obj.ViewObject)
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makeRectangle = make_rectangle
## @}

View File

@@ -20,17 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_shape2dview function.
"""
"""Provides functions to create Shape2DView objects."""
## @package make_shape2dview
# \ingroup DRAFT
# \brief This module provides the code for Draft make_shape2dview function.
# \ingroup draftmake
# \brief Provides functions to create Shape2DView objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.shape2dview import Shape2DView
if App.GuiUp:
from draftviewproviders.view_base import ViewProviderDraftAlt
@@ -63,9 +64,11 @@ def make_shape2dview(baseobj,projectionVector=None,facenumbers=[]):
obj.Projection = projectionVector
if facenumbers:
obj.FaceNumbers = facenumbers
select(obj)
gui_utils.select(obj)
return obj
makeShape2DView = make_shape2dview
## @}

View File

@@ -20,18 +20,18 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_shapestring function.
"""
"""Provides functions to create ShapeString objects."""
## @package make_shapestring
# \ingroup DRAFT
# \brief This module provides the code for Draft make_shapestring function.
# \ingroup draftmake
# \brief Provides functions to create ShapeString objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
import draftutils.gui_utils as gui_utils
from draftobjects.shapestring import ShapeString
if App.GuiUp:
from draftviewproviders.view_base import ViewProviderDraft
@@ -61,12 +61,14 @@ def make_shapestring(String, FontFile, Size=100, Tracking=0):
if App.GuiUp:
ViewProviderDraft(obj.ViewObject)
format_object(obj)
gui_utils.format_object(obj)
obrep = obj.ViewObject
if "PointSize" in obrep.PropertiesList: obrep.PointSize = 1 # hide the segment end points
select(obj)
gui_utils.select(obj)
obj.recompute()
return obj
makeShapeString = make_shapestring
## @}

View File

@@ -20,29 +20,23 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_sketch function.
"""
"""Provides functions to create Sketch objects from Draft objects."""
## @package make_sketch
# \ingroup DRAFT
# \brief This module provides the code for Draft make_sketch function.
# \ingroup draftmake
# \brief Provides functions to create Sketch objects from Draft objects.
## \addtogroup draftmake
# @{
import math
import FreeCAD as App
import DraftVecUtils
import DraftGeomUtils
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
from draftutils.translate import translate
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftobjects.ellipse import Ellipse
if App.GuiUp:
from draftviewproviders.view_base import ViewProviderDraft
def make_sketch(objectslist, autoconstraints=False, addTo=None,
delete=False, name="Sketch", radiusPrecision=-1):
@@ -303,7 +297,7 @@ def make_sketch(objectslist, autoconstraints=False, addTo=None,
nobj.addGeometry(DraftGeomUtils.orientEdge(
newedge,norm,make_arc=True))
ok = True
format_object(nobj,obj)
gui_utils.format_object(nobj,obj)
if ok and delete and hasattr(obj,'Shape'):
doc = obj.Document
def delObj(obj):
@@ -334,3 +328,5 @@ def make_sketch(objectslist, autoconstraints=False, addTo=None,
makeSketch = make_sketch
## @}

View File

@@ -22,11 +22,13 @@
# * USA *
# * *
# ***************************************************************************
"""Provides the make function to create Draft Text objects."""
"""Provides functions to create Text objects."""
## @package make_text
# \ingroup DRAFT
# \brief Provides the make function to create Draft Text objects.
# \ingroup draftmake
# \brief Provides functions to create Text objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
@@ -216,5 +218,6 @@ def convert_draft_texts(textslist=None):
def convertDraftTexts(textslist=[]):
"""Convert Text. DEPRECATED. Use 'convert_draft_texts'."""
utils.use_instead("convert_draft_texts")
return convert_draft_texts(textslist)
## @}

View File

@@ -19,22 +19,20 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_wire function.
"""
"""Provides functions to create multipoint Wire objects."""
## @package make_wire
# \ingroup DRAFT
# \brief This module provides the code for Draft make_wire function.
# \ingroup draftmake
# \brief Provides functions to create multipoint Wire objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
import DraftGeomUtils
from draftutils.gui_utils import format_object
from draftutils.gui_utils import select
from draftutils.utils import type_check
import draftutils.utils as utils
import draftutils.gui_utils as gui_utils
from draftobjects.wire import Wire
if App.GuiUp:
from draftviewproviders.view_wire import ViewProviderWire
@@ -90,7 +88,7 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
#print(closed)
if placement:
type_check([(placement, App.Placement)], "make_wire")
utils.type_check([(placement, App.Placement)], "make_wire")
ipl = placement.inverse()
if not bs2wire:
pointslist = [ipl.multVec(p) for p in pointslist]
@@ -114,10 +112,12 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
if App.GuiUp:
ViewProviderWire(obj.ViewObject)
format_object(obj)
select(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
makeWire = make_wire
## @}

View File

@@ -20,12 +20,13 @@
# * USA *
# * *
# ***************************************************************************
"""This module provides the code for Draft make_workingplaneproxy function.
"""
"""Provides functions to create WorkingPlaneProxy objects."""
## @package make_wpproxy
# \ingroup DRAFT
# \brief This module provides the code for Draft makeworkingplane_proxy function.
# \ingroup draftmake
# \brief Provides functions to create WorkingPlaneProxy objects.
## \addtogroup draftmake
# @{
import FreeCAD as App
from draftobjects.wpproxy import WorkingPlaneProxy
@@ -56,3 +57,5 @@ def make_workingplaneproxy(placement):
makeWorkingPlaneProxy = make_workingplaneproxy
## @}