Utility modules that are used throughout the workbench. More...


class  draftutils.todo.ToDo


def draftutils.gui_utils.autogroup (obj)
def draftutils.utils.compare_objects (obj1, obj2)
def draftutils.gui_utils.dim_dash (p1, p2)
def draftutils.gui_utils.dim_symbol (symbol=None, invert=False)
def draftutils.units.display_external (internal_value, decimals=None, dim='Length', showUnit=True, unit=None)
def draftutils.utils.epsilon ()
def draftutils.utils.filter_objects_for_modifiers (objects, isCopied=False)
def draftutils.utils.find_doc (doc=None)
def draftutils.utils.find_object (obj, doc=None)
def draftutils.gui_utils.format_object (target, origin=None)
def draftutils.gui_utils.get_3d_view ()
def draftutils.gui_utils.get_bbox (obj, debug=False)
def draftutils.utils.get_clone_base (obj, strict=False, recursive=True)
def draftutils.units.get_default_unit (dim)
def draftutils.init_tools.get_draft_annotation_commands ()
def draftutils.init_tools.get_draft_array_commands ()
def draftutils.init_tools.get_draft_context_commands ()
def draftutils.init_tools.get_draft_drawing_commands ()
def draftutils.init_tools.get_draft_line_commands ()
def draftutils.init_tools.get_draft_modification_commands ()
def draftutils.init_tools.get_draft_small_commands ()
def draftutils.init_tools.get_draft_snap_commands ()
def draftutils.init_tools.get_draft_utility_commands ()
def draftutils.groups.get_group_contents (objectslist, walls=False, addgroups=False, spaces=False, noarchchild=False)
def draftutils.groups.get_group_names (doc=None)
def draftutils.groups.get_movable_children (objectslist, recursive=True)
def draftutils.utils.get_objects_of_type (objects, typ)
def draftutils.utils.get_param (param, default=None)
def draftutils.utils.get_param_type (param)
def draftutils.utils.get_real_name (name)
def draftutils.utils.get_rgb (color, testbw=True)
def draftutils.init_draft_statusbar.get_scales (unit_system=0)
def draftutils.gui_utils.get_selection (gui=App.GuiUp)
def draftutils.gui_utils.get_selection_ex (gui=App.GuiUp)
def draftutils.utils.get_type (obj)
def draftutils.groups.get_windows (obj)
def draftutils.groups.getGroupContents (objectslist, walls=False, addgroups=False, spaces=False, noarchchild=False)
def draftutils.groups.getGroupNames ()
def draftutils.groups.getMovableChildren (objectslist, recursive=True)
def draftutils.init_draft_statusbar.hide_draft_statusbar ()
def draftutils.init_tools.init_draft_menus (workbench)
def draftutils.init_draft_statusbar.init_draft_statusbar_scale ()
def draftutils.init_draft_statusbar.init_draft_statusbar_snap ()
def draftutils.init_tools.init_draft_toolbars (workbench)
def draftutils.utils.is_clone (obj, objtype, recursive=False)
def draftutils.utils.is_closed_edge (edge_index, object)
def draftutils.init_draft_statusbar.label_to_scale (label)
def draftutils.utils.load_svg_patterns ()
def draftutils.gui_utils.load_texture (filename, size=None, gui=App.GuiUp)
def draftutils.units.make_format_spec (decimals=4, dim='Length')
def draftutils.gui_utils.migrate_text_display_mode (obj_type="Text", mode="3D text", doc=None)
def draftutils.utils.precision ()
def draftutils.utils.print_header (name, description, debug=True)
def draftutils.utils.print_shape (shape)
def draftutils.gui_utils.remove_hidden (objectslist)
def draftutils.init_draft_statusbar.scale_to_label (scale)
def draftutils.gui_utils.select (objs=None, gui=App.GuiUp)
def draftutils.utils.set_param (param, value)
def draftutils.utils.shapify (obj)
def draftutils.init_draft_statusbar.show_draft_statusbar ()
def draftutils.utils.string_encode_coin (ustr)
def draftutils.utils.svg_patterns ()
def draftutils.utils.tolerance ()
def draftutils.translate.translate (context, text, utf8_decode=False)
def draftutils.utils.type_check (args_and_types, name="?")
def draftutils.groups.ungroup (obj)
def draftutils.utils.use_instead (function, version="")
def draftutils.utils.utf8_decode (text)


dictionary draftutils.utils.ANNOTATION_STYLE
list draftutils.utils.ARROW_TYPES = ["Dot", "Circle", "Arrow", "Tick", "Tick-2"]
list draftutils.utils.arrowtypes = ARROW_TYPES
def draftutils.utils.compareObjects = compare_objects
def draftutils.gui_utils.dimDash = dim_dash
def draftutils.gui_utils.dimSymbol = dim_symbol
def draftutils.units.displayExternal = display_external
list draftutils.init_draft_statusbar.draft_scales_arch_imperial
list draftutils.init_draft_statusbar.draft_scales_eng_imperial
list draftutils.init_draft_statusbar.draft_scales_metrics
def draftutils.utils.filterObjectsForModifiers = filter_objects_for_modifiers
def draftutils.gui_utils.formatObject = format_object
def draftutils.gui_utils.get3DView = get_3d_view
def draftutils.utils.getCloneBase = get_clone_base
def draftutils.units.getDefaultUnit = get_default_unit
def draftutils.utils.getObjectsOfType = get_objects_of_type
def draftutils.utils.getParam = get_param
def draftutils.utils.getParamType = get_param_type
def draftutils.utils.getRealName = get_real_name
def draftutils.utils.getrgb = get_rgb
def draftutils.gui_utils.getSelection = get_selection
def draftutils.gui_utils.getSelectionEx = get_selection_ex
def draftutils.utils.getType = get_type
def draftutils.utils.isClone = is_clone
def draftutils.utils.isClosedEdge = is_closed_edge
def draftutils.utils.loadSvgPatterns = load_svg_patterns
def draftutils.gui_utils.loadTexture = load_texture
def draftutils.units.makeFormatSpec = make_format_spec
 draftutils.utils.param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
def draftutils.utils.printShape = print_shape
 draftutils.translate.QT_TRANSLATE_NOOP = QtCore.QT_TRANSLATE_NOOP
 draftutils.translate.Qtranslate = QtCore.QCoreApplication.translate
def draftutils.gui_utils.removeHidden = remove_hidden
def draftutils.utils.setParam = set_param
def draftutils.utils.stringencodecoin = string_encode_coin
def draftutils.utils.svgpatterns = svg_patterns
 draftutils.todo.todo = ToDo
def draftutils.utils.typecheck = type_check

Detailed Description

Utility modules that are used throughout the workbench.

Function Documentation

◆ autogroup()

def draftutils.gui_utils.autogroup (   obj)
Add a given object to the defined Draft autogroup, if applicable.

This function only works if the graphical interface is available.
It checks that the `App.draftToolBar` class is available,
which contains the group to use to automatically store
new created objects.

Originally, it worked with standard groups (`App::DocumentObjectGroup`),
and Arch Workbench containers like `'Site'`, `'Building'`, `'Floor'`,
and `'BuildingPart'`.

Now it works with Draft Layers.

obj: App::DocumentObject
    Any type of object that will be stored in the group.

◆ compare_objects()

def draftutils.utils.compare_objects (   obj1,
Print the differences between 2 objects.

The two objects are compared through their `TypeId` attribute,
or by using the `get_type` function.

If they are the same type their properties are compared
looking for differences.

Neither `Shape` nor `Label` attributes are compared.

obj1 : App::DocumentObject
    Any type of scripted object.
obj2 : App::DocumentObject
    Any type of scripted object.

References draftutils.utils.get_type(), and draftutils.utils.getType.

◆ dim_dash()

def draftutils.gui_utils.dim_dash (   p1,
Return a SoSeparator with a line used to make dimension dashes.

It is used by `dim_symbol` to create line end symbols
like `'Tick-2'`, `'DimOvershoot'`, and `'ExtOvershoot'` dashes.

p1: tuple of three floats or Base::Vector3
    A point to define a line vertex.

p2: tuple of three floats or Base::Vector3
    A point to define a line vertex.

    A Coin object with a `SoLineSet` created from `p1` and `p2`
    as vertices.

◆ dim_symbol()

def draftutils.gui_utils.dim_symbol (   symbol = None,
  invert = False 
Return the specified dimension symbol.

symbol: int, optional
    It defaults to `None`, in which it gets the value from the parameter
    database, `get_param("dimsymbol", 0)`.

    A numerical value defines different markers
     * 0, `SoSphere`
     * 1, `SoMarkerSet` with a circle
     * 2, `SoSeparator` with a `soCone`
     * 3, `SoSeparator` with a `SoFaceSet`
     * 4, `SoSeparator` with a `SoLineSet`, calling `dim_dash`
     * Otherwise, `SoSphere`

invert: bool, optional
    It defaults to `False`.
    If it is `True` and `symbol=2`, the cone will be rotated
    -90 degrees around the Z axis, otherwise the rotation is positive,
    +90 degrees.

    A `Coin.SoSphere`, or `Coin.SoMarkerSet` (circle),
    or `Coin.SoSeparator` (cone, face, line)
    that will be used as a dimension symbol.

References draftutils.gui_utils.dimDash.

◆ display_external()

def draftutils.units.display_external (   internal_value,
  decimals = None,
  dim = 'Length',
  showUnit = True,
  unit = None 
Return a converted value for display, according to the unit schema.

internal_value: float
    A value that will be transformed depending on the other parameters.

decimals: float, optional
    It defaults ot `None`, in which case, the decimals are 2.

dim: str, optional
    It defaults to `'Length'`. It can also be `'Angle'`.

showUnit: bool, optional
    It defaults to `True`.
    If it is `False` it won't show the unit.

unit: str, optional
    A unit string such as `'mm'`, `'cm'`, `'m'`, `'in'`, `'ft'`,
    in which to express the returned value.

◆ epsilon()

def draftutils.utils.epsilon ( )

◆ filter_objects_for_modifiers()

def draftutils.utils.filter_objects_for_modifiers (   objects,
  isCopied = False 

References Gui.getMainWindow().

◆ find_doc()

def draftutils.utils.find_doc (   doc = None)
Return the active document or find a document by name.

doc: App::Document or str, optional
    The document that will be searched in the session.
    It defaults to `None`, in which case it tries to find
    the active document.
    If `doc` is a string, it will try to get the document by `Name`.

bool, App::Document
    A tuple containing the information on whether the search
    was successful. In this case, the boolean is `True`,
    and the second value is the document instance.

False, None
    If there is no active document, or the string in `doc`
    doesn't correspond to an open document in the session.

Referenced by draftutils.utils.find_object().

◆ find_object()

def draftutils.utils.find_object (   obj,
  doc = None 
Find object in the document, inclusive by Label.

obj: App::DocumentObject or str
    The object to search in `doc`.
    Or if the `obj` is a string, it will search the object by `Label`.
    Since Labels are not guaranteed to be unique, it will get the first
    object with that label in the document.

doc: App::Document or str, optional
    The document in which the object will be searched.
    It defaults to `None`, in which case it tries to search in the
    active document.
    If `doc` is a string, it will search the document by `Name`.

bool, App::DocumentObject
    A tuple containing the information on whether the search
    was successful. In this case, the boolean is `True`,
    and the second value is the object found.

False, None
    If the object doesn't exist in the document.

References draftutils.utils.find_doc().

◆ format_object()

def draftutils.gui_utils.format_object (   target,
  origin = None 
Apply visual properties from the Draft toolbar or another object.

This function only works if the graphical interface is available
as the visual properties are attributes of the view provider

target: App::DocumentObject
    Any type of scripted object.

    This object will adopt the applicable visual properties,
    `FontSize`, `TextColor`, `LineWidth`, `PointColor`, `LineColor`,
    and `ShapeColor`, defined in the Draft toolbar
    (`Gui.draftToolBar`) or will adopt
    the properties from the `origin` object.

    The `target` is also placed in the construction group
    if the construction mode in the Draft toolbar is active.

origin: App::DocumentObject, optional
    It defaults to `None`.
    If it exists, it will provide the visual properties to assign
    to `target`, with the exception of `BoundingBox`, `Proxy`,
    `RootNode` and `Visibility`.

◆ get_3d_view()

def draftutils.gui_utils.get_3d_view ( )
Return the current 3D view.

    Return the current `ActiveView` in the active document,
    or the first `Gui::View3DInventor` view found.

    Return `None` if the graphical interface is not available.

◆ get_bbox()

def draftutils.gui_utils.get_bbox (   obj,
  debug = False 
Return a BoundBox from any object that has a Coin RootNode.

Normally the bounding box of an object can be taken
from its `Part::TopoShape`.
    >>> print(obj.Shape.BoundBox)

However, for objects without a `Shape`, such as those
derived from `App::FeaturePython` like `Draft Text` and `Draft Dimension`,
the bounding box can be calculated from the `RootNode` of the viewprovider.

obj: App::DocumentObject
    Any object that has a `ViewObject.RootNode`.

    It returns a `BoundBox` object which has information like
    minimum and maximum values of X, Y, and Z, as well as bounding box

    If there is a problem it will return `None`.

◆ get_clone_base()

def draftutils.utils.get_clone_base (   obj,
  strict = False,
  recursive = True 
Return the object cloned by this object, if any.

obj: App::DocumentObject
    Any type of object.

strict: bool, optional
    It defaults to `False`.
    If it is `True`, and this object is not a clone,
    this function will return `False`.

recursive: bool, optional
    It defaults to `True`
    If it is `True`, it call recursively to itself to
    get base object and if it is `False` then it just
    return base object, not call recursively to find
    base object.

    It `obj` is a `Draft Clone`, it will return the first object
    that is in its `Objects` property.

    If `obj` has a `CloneOf` property, it will search iteratively
    inside the object pointed to by this property.

    If `obj` is not a `Draft Clone`, nor it has a `CloneOf` property,
    it will return the same `obj`, as long as `strict` is `False`.

    It will return `False` if `obj` is not a clone,
    and `strict` is `True`.

References draftutils.utils.get_type().

◆ get_default_unit()

def draftutils.units.get_default_unit (   dim)
Return default Unit of Measure for a dimension.

It is based on the user preferences.

Referenced by draftutils.units.make_format_spec().

◆ get_draft_annotation_commands()

def draftutils.init_tools.get_draft_annotation_commands ( )
Return the annotation commands list.

Referenced by draftutils.init_tools.init_draft_menus(), and draftutils.init_tools.init_draft_toolbars().

◆ get_draft_array_commands()

def draftutils.init_tools.get_draft_array_commands ( )
Return the array commands list.

Referenced by draftutils.init_tools.get_draft_modification_commands().

◆ get_draft_context_commands()

def draftutils.init_tools.get_draft_context_commands ( )
Return the context menu commands list.

Referenced by draftutils.init_tools.init_draft_menus().

◆ get_draft_drawing_commands()

def draftutils.init_tools.get_draft_drawing_commands ( )
Return the drawing commands list.

Referenced by draftutils.init_tools.init_draft_menus(), and draftutils.init_tools.init_draft_toolbars().

◆ get_draft_line_commands()

def draftutils.init_tools.get_draft_line_commands ( )
Return the line commands list.

◆ get_draft_modification_commands()

def draftutils.init_tools.get_draft_modification_commands ( )

◆ get_draft_small_commands()

def draftutils.init_tools.get_draft_small_commands ( )
Return a list with only some utilities.

◆ get_draft_snap_commands()

def draftutils.init_tools.get_draft_snap_commands ( )
Return the snapping commands list.

Referenced by draftutils.init_draft_statusbar.init_draft_statusbar_snap().

◆ get_draft_utility_commands()

def draftutils.init_tools.get_draft_utility_commands ( )
Return the utility commands list.

Referenced by draftutils.init_tools.init_draft_menus().

◆ get_group_contents()

def draftutils.groups.get_group_contents (   objectslist,
  walls = False,
  addgroups = False,
  spaces = False,
  noarchchild = False 
Return a list of objects from expanding the input groups.

The function accepts any type of object, although it is most useful
with "groups", as it is meant to unpack the objects inside these groups.

objectslist: list
    If any object in the list is a group, its contents (`obj.Group`)
    are extracted and added to the output list.

    The "groups" are objects derived from `App::DocumentObjectGroup`,
    but they can also be `'App::Part'`, or `'Building'`, `'BuildingPart'`,
    `'Space'`, and `'Site'` from the Arch Workbench.

    Single items that aren't groups are added to the output list
    as is.

walls: bool, optional
    It defaults to `False`.
    If it is `True`, Wall and Structure objects (Arch Workbench)
    are treated as groups; they are scanned for Window, Door,
    and Rebar objects, and these are added to the output list.

addgroups: bool, optional
    It defaults to `False`.
    If it is `True`, the group itself is kept as part of the output list.

spaces: bool, optional
    It defaults to `False`.
    If it is `True`, Arch Spaces are treated as groups,
    and are added to the output list.

noarchchild: bool, optional
    It defaults to `False`.
    If it is `True`, the objects inside Building and BuildingParts
    (Arch Workbench) aren't added to the output list.

    The list of objects from each group present in `objectslist`,
    plus any other individual object given in `objectslist`.

References draftutils.groups.get_windows().

Referenced by draftutils.groups.getGroupContents().

◆ get_group_names()

def draftutils.groups.get_group_names (   doc = None)
Return a list of names of existing groups in the document.

doc: App::Document, optional
    It defaults to `None`.
    A document on which to search group names.
    It if is `None` it will search the current document.

list of str
    A list of names of objects that are "groups".
    These are objects derived from `App::DocumentObjectGroup`
    or which are of types `'Floor'`, `'Building'`, or `'Site'`
    from the Arch Workbench.

    Otherwise, return an empty list.

Referenced by draftutils.groups.getGroupNames(), and draftutils.groups.ungroup().

◆ get_movable_children()

def draftutils.groups.get_movable_children (   objectslist,
  recursive = True 
Return a list of objects with child objects that move with a host.

Builds a list of objects with all child objects (`obj.OutList`)
that have their `MoveWithHost` attribute set to `True`.
This function is mostly useful for Arch Workbench objects.

objectslist: list of App::DocumentObject
    A single scripted object or list of objects.

recursive: bool, optional
    It defaults to `True`, in which case the function
    is called recursively to also extract the children of children
    Otherwise, only direct children of the input objects
    are added to the output list.

    List of children objects that have their `MoveWithHost` attribute
    set to `True`.

Referenced by draftutils.groups.getMovableChildren().

◆ get_objects_of_type()

def draftutils.utils.get_objects_of_type (   objects,
Return only the objects that match the type in the list of objects.

objects : list of App::DocumentObject
    A list of objects which will be tested.

typ : str
    A string that indicates a type. This should be one of the types
    that can be returned by `get_type`.

list of objects
    Only the objects that match `typ` will be added to the output list.

References draftutils.utils.getType.

◆ get_param()

def draftutils.utils.get_param (   param,
  default = None 
Return a parameter value from the current parameter database.

The parameter database is located in the tree
    'User parameter:BaseApp/Preferences/Mod/Draft'

In the case that `param` is `'linewidth'` or `'color'` it will get
the values from the View parameters
    'User parameter:BaseApp/Preferences/View/DefaultShapeLineWidth'
    'User parameter:BaseApp/Preferences/View/DefaultShapeLineColor'

param : str
    A string that indicates a parameter in the parameter database.

default : optional
    It indicates the default value of the given parameter.
    It defaults to `None`, in which case it will use a specific
    value depending on the type of parameter determined
    with `get_param_type`.

int, or str, or float, or bool
    Depending on `param` and its type, by returning `ParameterGrp.GetInt`,
    `ParameterGrp.GetString`, `ParameterGrp.GetFloat`,
    `ParameterGrp.GetBool`, or `ParameterGrp.GetUnsinged`.

References draftutils.utils.getParamType.

◆ get_param_type()

def draftutils.utils.get_param_type (   param)
Return the type of the parameter entered.

param : str
    A string that indicates a parameter in the parameter database.

str or None
    The returned string could be `'int'`, `'string'`, `'float'`,
    `'bool'`, `'unsigned'`, depending on the parameter.
    It returns `None` for unhandled situations.

◆ get_real_name()

def draftutils.utils.get_real_name (   name)
Strip the trailing numbers from a string to get only the letters.

name : str
    A string that may have a number at the end, `Line001`.

    A string without the numbers at the end, `Line`.
    The returned string cannot be empty; it will have
    at least one letter.

◆ get_rgb()

def draftutils.utils.get_rgb (   color,
  testbw = True 
Return an RRGGBB value #000000 from a FreeCAD color.

testwb : bool (default = True)
    pure white will be converted into pure black

References draftutils.utils.getParam.

◆ get_scales()

def draftutils.init_draft_statusbar.get_scales (   unit_system = 0)
returns the list of preset scales accordin to unit system.

unit_system =   0 : default from user preferences
                1 : metrics
                2 : imperial architectural
                3 : imperial engineering

Referenced by draftutils.init_draft_statusbar.init_draft_statusbar_scale().

◆ get_selection()

def draftutils.gui_utils.get_selection (   gui = App.GuiUp)
Return the current selected objects.

This function only works if the graphical interface is available
as the selection module only works on the 3D view.

It wraps around `Gui.Selection.getSelection`

gui: bool, optional
    It defaults to the value of `App.GuiUp`, which is `True`
    when the interface exists, and `False` otherwise.

    This value can be set to `False` to simulate
    when the interface is not available.

list of App::DocumentObject
    Returns a list of objects in the current selection.
    It can be an empty list if no object is selected.

    If the interface is not available, it returns `None`.

◆ get_selection_ex()

def draftutils.gui_utils.get_selection_ex (   gui = App.GuiUp)
Return the current selected objects together with their subelements.

This function only works if the graphical interface is available
as the selection module only works on the 3D view.

It wraps around `Gui.Selection.getSelectionEx`

gui: bool, optional
    It defaults to the value of `App.GuiUp`, which is `True`
    when the interface exists, and `False` otherwise.

    This value can be set to `False` to simulate
    when the interface is not available.

list of Gui::SelectionObject
    Returns a list of `Gui::SelectionObject` in the current selection.
    It can be an empty list if no object is selected.

    If the interface is not available, it returns `None`.

Selection objects
One `Gui::SelectionObject` has attributes that indicate which specific
subelements, that is, vertices, wires, and faces, were selected.
This can be useful to operate on the subelements themselves.
If `G` is a `Gui::SelectionObject`
 * `G.Object` is the selected object
 * `G.ObjectName` is the name of the selected object
 * `G.HasSubObjects` is `True` if there are subelements in the selection
 * `G.SubObjects` is a tuple of the subelements' shapes
 * `G.SubElementNames` is a tuple of the subelements' names

`SubObjects` and `SubElementNames` should be empty tuples
if `HasSubObjects` is `False`.

◆ get_type()

def draftutils.utils.get_type (   obj)
Return a string indicating the type of the given object.

obj : App::DocumentObject
    Any type of scripted object created with Draft,
    or any other workbench.

    If `obj` has a `Proxy`, it will return the value of `obj.Proxy.Type`.

    * If `obj` is a `Part.Shape`, returns `'Shape'`

    * If `obj` has a `TypeId`, returns `obj.TypeId`

    In other cases, it will return `'Unknown'`,
    or `None` if `obj` is `None`.

Referenced by draftutils.utils.compare_objects(), and draftutils.utils.get_clone_base().

◆ get_windows()

def draftutils.groups.get_windows (   obj)
Return the windows and rebars inside a host.

obj: App::DocumentObject
    A scripted object of type `'Wall'` or `'Structure'`
    (Arch Workbench).
    This will be searched for objects of type `'Window'` and `'Rebar'`,
    and clones of them, and the found elements will be added
    to the output list.

    The function will search recursively all elements under `obj.OutList`,
    in case the windows and rebars are nested under other walls
    and structures.

    A list of all found windows and rebars in `obj`.
    If `obj` is itself a `'Window'` or a `'Rebar'`, or a clone of them,
    it will return the same `obj` element.

Referenced by draftutils.groups.get_group_contents().

◆ getGroupContents()

def draftutils.groups.getGroupContents (   objectslist,
  walls = False,
  addgroups = False,
  spaces = False,
  noarchchild = False 
Return a list of objects from groups. DEPRECATED.

References draftutils.groups.get_group_contents().

◆ getGroupNames()

def draftutils.groups.getGroupNames ( )
Return a list of group names. DEPRECATED.

References draftutils.groups.get_group_names().

◆ getMovableChildren()

def draftutils.groups.getMovableChildren (   objectslist,
  recursive = True 
Return a list of objects with child objects. DEPRECATED.

References draftutils.groups.get_movable_children().

◆ hide_draft_statusbar()

def draftutils.init_draft_statusbar.hide_draft_statusbar ( )
hides draft statusbar if present

References Gui.getMainWindow().

◆ init_draft_menus()

def draftutils.init_tools.init_draft_menus (   workbench)
Initialize the Draft menus.

workbench: Gui.Workbench
    The workbench class on which the commands have to be available.
    If called from within the `Initialize` method
    of a workbench class defined inside `InitGui.py`,
    it can be used as `setup_draft_menus(self)`.

References draftutils.init_tools.get_draft_annotation_commands(), draftutils.init_tools.get_draft_context_commands(), draftutils.init_tools.get_draft_drawing_commands(), draftutils.init_tools.get_draft_modification_commands(), draftutils.init_tools.get_draft_utility_commands(), and draftutils.translate.QT_TRANSLATE_NOOP.

◆ init_draft_statusbar_scale()

def draftutils.init_draft_statusbar.init_draft_statusbar_scale ( )

◆ init_draft_statusbar_snap()

def draftutils.init_draft_statusbar.init_draft_statusbar_snap ( )
this function initializes draft statusbar snap widget

References draftutils.init_tools.get_draft_snap_commands(), Gui.getMainWindow(), and draftutils.translate.QT_TRANSLATE_NOOP.

◆ init_draft_toolbars()

def draftutils.init_tools.init_draft_toolbars (   workbench)
Initialize the Draft toolbars.

workbench: Gui.Workbench
    The workbench class on which the commands have to be available.
    If called from within the `Initialize` method
    of a workbench class defined inside `InitGui.py`,
    it can be used as `setup_draft_toolbars(self)`.

References draftutils.init_tools.get_draft_annotation_commands(), draftutils.init_tools.get_draft_drawing_commands(), draftutils.init_tools.get_draft_modification_commands(), and draftutils.translate.QT_TRANSLATE_NOOP.

◆ is_clone()

def draftutils.utils.is_clone (   obj,
  recursive = False 
Return True if the given object is a clone of a certain type.

A clone is of type `'Clone'`, and has a reference
to the original object inside its `Objects` attribute,
which is an `'App::PropertyLinkListGlobal'`.

The `Objects` attribute can point to another `'Clone'` object.
If `recursive` is `True`, the function will be called recursively
to further test this clone, until the type of the original object
can be compared to `objtype`.

obj : App::DocumentObject
    The clone object that will be tested for a certain type.

objtype : str or list of str
    A type string such as one obtained from `get_type`.
    Or a list of such types.

recursive : bool, optional
    It defaults to `False`.
    If it is `True`, this same function will be called recursively
    with `obj.Object[0]` as input.

    This option only works if `obj.Object[0]` is of type `'Clone'`,
    that is, if `obj` is a clone of a clone.

    Returns `True` if `obj` is of type `'Clone'`,
    and `obj.Object[0]` is of type `objtype`.

    If `objtype` is a list, then `obj.Objects[0]`
    will be tested against each of the elements in the list,
    and it will return `True` if at least one element matches the type.

    If `obj` isn't of type `'Clone'` but has the `CloneOf` attribute,
    it will also return `True`.

    It returns `False` otherwise, for example,
    if `obj` is not even a clone.

References draftutils.utils.getType, and draftutils.utils.isClone.

◆ is_closed_edge()

def draftutils.utils.is_closed_edge (   edge_index,

◆ label_to_scale()

def draftutils.init_draft_statusbar.label_to_scale (   label)
transform a scale string into scale factor as float

References Gui.getMainWindow(), draftutils.translate.QT_TRANSLATE_NOOP, and draftutils.init_draft_statusbar.scale_to_label().

◆ load_svg_patterns()

def draftutils.utils.load_svg_patterns ( )
Load the default Draft SVG patterns and user defined patterns.

The SVG patterns are added as a dictionary to the `App.svgpatterns`

References importSVG.getContents(), and draftutils.utils.getParam.

◆ load_texture()

def draftutils.gui_utils.load_texture (   filename,
  size = None,
  gui = App.GuiUp 
Return a Coin.SoSFImage to use as a texture for a 2D plane.

This function only works if the graphical interface is available
as the visual properties that can be applied to a shape
are attributes of the view provider (`obj.ViewObject`).

filename: str
    A path to a pixel image file (PNG) that can be used as a texture
    on the face of an object.

size: tuple of two int, or a single int, optional
    It defaults to `None`.
    If a tuple is given, the two values define the width and height
    in pixels to which the loaded image will be scaled.
    If it is a single value, it is used for both dimensions.

    If it is `None`, the size will be determined from the `QImage`
    created from `filename`.

    CURRENTLY the input `size` parameter IS NOT USED.
    It always uses the `QImage` to determine this information.

gui: bool, optional
    It defaults to the value of `App.GuiUp`, which is `True`
    when the interface exists, and `False` otherwise.

    This value can be set to `False` to simulate
    when the interface is not available.

    An image object with the appropriate size, number of components
    (grayscale, grayscale and transparency, color,
    color and transparency), and byte data.

    It returns `None` if the interface is not available,
    or if there is a problem creating the image.

◆ make_format_spec()

def draftutils.units.make_format_spec (   decimals = 4,
  dim = 'Length' 
Return a string format specifier with decimals for a dimension.

It is based on the user preferences.

References draftutils.units.get_default_unit().

◆ migrate_text_display_mode()

def draftutils.gui_utils.migrate_text_display_mode (   obj_type = "Text",
  mode = "3D text",
  doc = None 
Migrate the display mode of objects of certain type.

◆ precision()

def draftutils.utils.precision ( )
Return the precision value from the parameter database.

It is the number of decimal places that a float will have.
    precision=6, 0.123456
    precision=5, 0.12345
    precision=4, 0.1234

Due to floating point operations there may be rounding errors.
Therefore, this precision number is used to round up values
so that all operations are consistent.
By default the precision is 6 decimal places.

    get_param("precision", 6)

References draftutils.utils.getParam.

◆ print_header()

def draftutils.utils.print_header (   name,
  debug = True 
Print a line to the console when something is called, and log it.

name: str
    The name of the function or class that is being called.
    This `name` will be logged in the log file, so if there are problems
    the log file can be investigated for clues.

description: str
    Arbitrary text that will be printed to the console
    when the function or class is called.

debug: bool, optional
    It defaults to `True`.
    If it is `False` the `description` will not be printed
    to the console.
    On the other hand the `name` will always be logged.

◆ print_shape()

def draftutils.utils.print_shape (   shape)
Print detailed information of a topological shape.

shape : Part::TopoShape
    Any topological shape in an object, usually obtained from `obj.Shape`.

◆ remove_hidden()

def draftutils.gui_utils.remove_hidden (   objectslist)
Return only the visible objects in the list.

This function only works if the graphical interface is available
as the `Visibility` attribute is a property of the view provider

objectslist: list of App::DocumentObject
    List of any type of object.

    Return a copy of the input list without those objects
    for which `obj.ViewObject.Visibility` is `False`.

    If the graphical interface is not loaded
    the returned list is just a copy of the input list.

◆ scale_to_label()

def draftutils.init_draft_statusbar.scale_to_label (   scale)
transform a float number into a 1:X or X:1 scale and return it as label

Referenced by draftutils.init_draft_statusbar.init_draft_statusbar_scale(), and draftutils.init_draft_statusbar.label_to_scale().

◆ select()

def draftutils.gui_utils.select (   objs = None,
  gui = App.GuiUp 
Unselects everything and selects only the given list of objects.

This function only works if the graphical interface is available
as the selection module only works on the 3D view.

objs: list of App::DocumentObject, optional
    It defaults to `None`.
    Any type of scripted object.
    It may be a list of objects or a single object.

gui: bool, optional
    It defaults to the value of `App.GuiUp`, which is `True`
    when the interface exists, and `False` otherwise.

    This value can be set to `False` to simulate
    when the interface is not available.

Referenced by Gui::Flag.contextMenuEvent(), Gui::DocumentItem.findItem(), Gui::DocumentItem.findItemByObject(), MeshGui::ViewProviderMesh.getFacetsOfRegion(), Gui::SoFCColorBar.handleEvent(), Gui::TreeWidget.itemSearch(), Gui::PropertyEditor::LinkLabel.onLinkActivated(), SketcherGui::TaskSketcherConstrains.onSelectionChanged(), SketcherGui::TaskSketcherElements.onSelectionChanged(), PathScripts.PathPocketShapeGui.TaskPanelExtensionPage.restoreSelection(), Gui::DocumentItem.showItem(), and PathScripts.PathPocketShapeGui.translate().

◆ set_param()

def draftutils.utils.set_param (   param,
Set a Draft parameter with the given value.

The parameter database is located in the tree
    'User parameter:BaseApp/Preferences/Mod/Draft'

In the case that `param` is `'linewidth'` or `'color'` it will set
the View parameters
    'User parameter:BaseApp/Preferences/View/DefaultShapeLineWidth'
    'User parameter:BaseApp/Preferences/View/DefaultShapeLineColor'

param : str
    A string that indicates a parameter in the parameter database.

value : int, or str, or float, or bool
    The appropriate value of the parameter.
    Depending on `param` and its type, determined with `get_param_type`,
    it sets the appropriate value by calling `ParameterGrp.SetInt`,
    `ParameterGrp.SetString`, `ParameterGrp.SetFloat`,
    `ParameterGrp.SetBool`, or `ParameterGrp.SetUnsinged`.

References draftutils.utils.getParamType.

◆ shapify()

def draftutils.utils.shapify (   obj)
Transform a parametric object into a static, non-parametric shape.

obj : App::DocumentObject
    Any type of scripted object.

    This object will be removed, and a non-parametric object
    with the same topological shape (`Part::TopoShape`)
    will be created.

    The new object that takes `obj.Shape` as its own.

    Depending on the contents of the Shape, the resulting object
    will be named `'Face'`, `'Solid'`, `'Compound'`,
    `'Shell'`, `'Wire'`, `'Line'`, `'Circle'`,
    or the name returned by `get_real_name(obj.Name)`.

    If there is a problem with `obj.Shape`, it will return `None`,
    and the original object will not be modified.

References draftutils.utils.getRealName.

◆ show_draft_statusbar()

def draftutils.init_draft_statusbar.show_draft_statusbar ( )
shows draft statusbar if present or initializes it

References Gui.getMainWindow().

◆ string_encode_coin()

def draftutils.utils.string_encode_coin (   ustr)
Encode a unicode object to be used as a string in coin.

ustr : str
    A string to be encoded

    Encoded string. If the coin version is >= 4
    it will encode the string to `'utf-8'`, otherwise
    it will encode it to `'latin-1'`.

◆ svg_patterns()

def draftutils.utils.svg_patterns ( )
Return a dictionary with installed SVG patterns.

    Returns `App.svgpatterns` if it exists.
    Otherwise it calls `load_svg_patterns` to create it
    before returning it.

References draftutils.utils.loadSvgPatterns.

◆ tolerance()

def draftutils.utils.tolerance ( )
Return the tolerance value from the parameter database.

This specifies a tolerance around a quantity.
    value + tolerance
    value - tolerance

By default the tolerance is 0.05.

    get_param("tolerance", 0.05)

References draftutils.utils.getParam.

Referenced by MeshGui::TaskDecimating.accept(), TechDraw::DrawUtil.angleWithX(), Part::Curve2dPy.approximateBSpline(), Part::GeometryCurvePy.approximateBSpline(), TechDraw::DrawUtil.checkParallel(), AdaptivePath.CleanPath(), Part::TopoShape.common(), Part::TopoShapePy.common(), Base::BoundBox2d.Contains(), Part::TopoShape.cut(), Part::TopoShapePy.cut(), Sketcher::SketchAnalysis.detectDegeneratedGeometries(), draftutils.utils.epsilon(), AdaptivePath::Adaptive2d.Execute(), TechDraw::DrawViewDimExtent.execute(), geoff_geometry.FEQ(), geoff_geometry.FEQZ(), SMESH_ElementSearcherImpl.FindElementsByPoint(), ReverseEngineeringGui::SegmentationManual::Private.findGeometry(), SMESH_NodeSearcherImpl.FindNearPoint(), GEOMUtils.FixShapeTolerance(), geoff_geometry.FNE(), geoff_geometry.FNEZ(), TechDraw::DrawUtil.fpCompare(), Part::TopoShape.fuse(), Part::TopoShapePy.fuse(), Part::TopoShape.generalFuse(), Part::TopoShapePy.generalFuse(), Drawing::ProjectionAlgos.getDXF(), SMESH_MeshAlgos.GetElementSearcher(), TechDraw::DrawViewDimension.getFormattedDimensionValue(), SMESH_ElementSearcherImpl.GetPointState(), Drawing::ProjectionAlgos.getSVG(), Part::TopoShapePy.getTolerance(), Part::TopoShapePy.globalTolerance(), Base::BoundBox2d.IsEqual(), Base::Vector2d.IsEqual(), Base::VectorPy.isEqual(), TechDraw::DrawUtil.isFirstVert(), Part::TopoShapePy.isInside(), TechDraw::DrawUtil.isLastVert(), Base::Vector2d.IsNull(), geoff_geometry.IsPtsLine(), Part::TangentialArc.isRadiusEqual(), TechDraw::DrawUtil.isSamePoint(), TechDraw::DrawUtil.isZeroEdge(), Part::TopoShapePy.makeOffsetShape(), Path::Area.makeSections(), Part::TopoShapePy.makeShapeFromMesh(), Part::TopoShapePy.makeThickness(), Part::TopoShapePy.multiFuse(), TechDraw::GeometryUtils.nextGeom(), Path::Area.project(), MeshPart::MeshProjection.projectOnMesh(), geoff_geometry::Kurve.Reduce(), Sketcher::SketchAnalysis.removeDegeneratedGeometries(), Part::GeomBSplineCurve.removeKnot(), Part::TopoShape.section(), Part::TopoShapePy.section(), MeshCore::MeshSimplify.simplify(), Simplify.simplify_mesh(), geoff_geometry.Split(), Part::TopoShapePy.tessellate(), Part::GeomBSplineCurve.toBiArcs(), Part::BSplineCurvePy.toBiArcs(), and Part::BSplineCurve2dPy.toBiArcs().

◆ translate()

def draftutils.translate.translate (   context,
  utf8_decode = False 
Translate the text using the Qt translate function.

It wraps around `QtGui.QApplication.translate`,
which is the same as `QtCore.QCoreApplication.translate`.

context: str
    In C++ it is typically a class name.
    But it can also be any other string to categorize the translation,
    for example, the name of a workbench, tool, or function
    that is being translated. Usually it will be the name
    of the workbench.

text: str
    Text that will be translated. It could be a single word,
    a full sentence, paragraph, or multiple paragraphs with new lines.
    Usually the last endline character '\\n'
    that finishes the string doesn't need to be included
    for translation.

utf8_decode: bool
    It defaults to `False`.
    This must be set to `True` to indicate that the `text`
    is an `'utf8'` encoded string, so it should be returned as such.
    This option is ignored when using Python 3
    as with Python 3 all strings are `'utf8'` by default.

    A unicode string returned by `QtGui.QApplication.translate`.

    If `utf8_decode` is `True`, the resulting string will be encoded
    in `'utf8'`, and a `bytes` object will be returned.
        Qtranslate = QtGui.QApplication.translate
        return Qtranslate(context, text, None).encode("utf8")

Unicode strings
Whether it is Qt4 or Qt5, the `translate` function
always returns a unicode string.
The difference is how it handles the input.

Reference: https://pyside.github.io/docs/pyside/PySide/QtCore/

In Qt4 the translate function has a 4th parameter to define the encoding
of the input string.

>>> QtCore.QCoreApplication.translate(context, text, None, UnicodeUT8)
>>> QtGui.QApplication.translate(context, text, None, UnicodeUT8)

Reference: https://doc.qt.io/qtforpython/PySide2/QtCore

In Qt5 the strings are always assumed unicode, so the 4th parameter
is for a different use, and it is not used.

>>> QtCore.QCoreApplication.translate(context, text, None)
>>> QtGui.QApplication.translate(context, text, None)

References draftutils.translate.Qtranslate.

Referenced by PartDesignGui::TaskDlgFeatureParameters.accept(), StdCmdOnlineHelpWebsite.activated(), StdCmdFreeCADWebsite.activated(), StdCmdFreeCADUserHub.activated(), StdCmdFreeCADPowerUserHub.activated(), StdCmdFreeCADForum.activated(), StdCmdFreeCADFAQ.activated(), StdCmdGroup.activated(), Gui::SelectionSingleton.addSelection(), Gui::Command.applyCommandData(), PartGui::TaskSweep.clicked(), Gui::StdCmdDownloadOnlineHelp.createAction(), StdCmdAbout.createAction(), StdViewDockUndockFullscreen.createAction(), StdCmdWindowsMenu.createAction(), Gui::DocumentObjectItem.displayStatusInfo(), Gui::Dialog::DlgActivateWindowImp.DlgActivateWindowImp(), Gui::Dialog::DlgProjectInformationImp.DlgProjectInformationImp(), Gui::PythonGroupCommand.languageChange(), StdCmdAbout.languageChange(), StdCmdDrawStyle.languageChange(), Gui::StdCmdDownloadOnlineHelp.languageChange(), StartGui::Workbench.loadStartPage(), PartGui::TaskPrimitives.modifyStandardButtons(), Gui::Dialog::UndoDialog.onFetchInfo(), Gui::Dialog::RedoDialog.onFetchInfo(), Gui::NavigationStyle.openPopupMenu(), Gui::Dialog::DlgSettingsNavigation.retranslate(), Gui::LocationDialogUi< Ui >.retranslate(), Gui::ToolBarManager.retranslate(), Gui::LocationUi< Ui >.retranslate(), Gui::LocationImpUi< Ui >.retranslate(), TechDrawGui::QGIView.rotateView(), FemGui::ViewProviderFemMeshShapeNetgen.setEdit(), Gui::SelectionSingleton.setPreselect(), Gui::PropertyEditor::PropertyItem.setPropertyName(), Gui::Dialog::DlgCustomKeyboardImp.setShortcutOfCurrentAction(), Gui::GroupCommand.setup(), Gui::MenuManager.setup(), Gui::ToolBarManager.setup(), Gui::PropertyEditor::PropertyItem.toolTip(), FemGui::ViewProviderFemPostPlaneFunction.updateData(), FemGui::ViewProviderFemPostSphereFunction.updateData(), and TechDrawGui::QGVPage.wheelEvent().

◆ type_check()

def draftutils.utils.type_check (   args_and_types,
  name = "?" 
Check that the arguments are instances of certain types.

args_and_types : list
    A list of tuples. The first element of a tuple is tested as being
    an instance of the second element.
        args_and_types = [(a, Type), (b, Type2), ...]

        isinstance(a, Type)
        isinstance(b, Type2)

    A `Type` can also be a tuple of many types, in which case
    the check is done for any of them.
        args_and_types = [(a, (Type3, int, float)), ...]

        isinstance(a, (Type3, int, float))

name : str, optional
    Defaults to `'?'`. The name of the check.

    If the first element in the tuple is not an instance of the second
    element, it raises `Draft.name`.

◆ ungroup()

def draftutils.groups.ungroup (   obj)
Remove the object from any group to which it belongs.

A "group" is any object returned by `get_group_names`.

obj: App::DocumentObject or str
    Any type of object.
    If it is a string, it must be the `Label` of that object.
    Since a label is not guaranteed to be unique in a document,
    it will use the first object found with this label.

References draftutils.groups.get_group_names().

◆ use_instead()

def draftutils.utils.use_instead (   function,
  version = "" 
Print a deprecation message and suggest another function.

This function must be used inside the definition of a function
that has been considered for deprecation, so we must provide
an alternative.
    def old_function():
        use_instead('new_function', 1.0)

    def someFunction():

function: str
    The name of the function to use instead of the current one.

version: float or str, optional
    It defaults to the empty string `''`.
    The version where this command is to be deprecated, if it is known.
    If we don't know when this command will be deprecated
    then we should not give a version.

◆ utf8_decode()

def draftutils.utils.utf8_decode (   text)
Decode the input string and return a unicode string.

Python 2:
    str -> unicode
    unicode -> unicode

Python 3:
    str -> str
    bytes -> str

It runs
        return text.decode("utf-8")
    except AttributeError:
        return text

text : str, unicode or bytes
    A str, unicode, or bytes object that may have unicode characters
    like accented characters.

    In Python 2, a `bytes` object can include accented characters,
    but in Python 3 it must only contain ASCII literal characters.

unicode or str
    In Python 2 it will try decoding the `bytes` string
    and return a `'utf-8'` decoded string.

    >>> "Aá".decode("utf-8")
    >>> b"Aá".decode("utf-8")

    In Python 2 the unicode string is prefixed with `u`,
    and unicode characters are replaced by their two-digit hexadecimal
    representation, or four digit unicode escape.

    >>> "AáBẃCñ".decode("utf-8")

    In Python 2 it will always return a `unicode` object.

    In Python 3 a regular string is already unicode encoded,
    so strings have no `decode` method. In this case, `text`
    will be returned as is.

    In Python 3, if `text` is a `bytes` object, then it will be converted
    to `str`; in this case, the `bytes` object cannot have accents,
    it must only contain ASCII literal characters.

    >>> b"ABC".decode("utf-8")

    In Python 3 it will always return a `str` object, with no prefix.

Referenced by ArchCommands.printWarning(), ArchCommands.survey(), ArchCommands.SurveyTaskPanel.update(), and DraftGui.DraftToolBar.validateFile().

Variable Documentation


dictionary draftutils.utils.ANNOTATION_STYLE
Initial value:
1 = {
2  "FontName": ("font", param.GetString("textfont", "Sans")),
3  "FontSize": ("str", str(param.GetFloat("textheight", 100))),
4  "LineSpacing": ("float", 1),
5  "ScaleMultiplier": ("float", 1),
6  "ShowUnit": ("bool", False),
7  "UnitOverride": ("str", ""),
8  "Decimals": ("int", 2),
9  "ShowLines": ("bool", True),
10  "LineWidth": ("int", param.GetInt("linewidth", 1)),
11  "LineColor": ("color", param.GetInt("color", 255)),
12  "ArrowType": ("index", param.GetInt("dimsymbol", 0)),
13  "ArrowSize": ("str", str(param.GetFloat("arrowsize", 20))),
14  "DimensionOvershoot": ("str", str(param.GetFloat("dimovershoot", 20))),
15  "ExtensionLines": ("str", str(param.GetFloat("extlines", 300))),
16  "ExtensionOvershoot": ("str", str(param.GetFloat("extovershoot", 20))),
17 }


list draftutils.utils.ARROW_TYPES = ["Dot", "Circle", "Arrow", "Tick", "Tick-2"]

◆ arrowtypes

list draftutils.utils.arrowtypes = ARROW_TYPES

◆ compareObjects

def draftutils.utils.compareObjects = compare_objects

◆ dimDash

def draftutils.gui_utils.dimDash = dim_dash

◆ dimSymbol

def draftutils.gui_utils.dimSymbol = dim_symbol

◆ displayExternal

◆ draft_scales_arch_imperial

list draftutils.init_draft_statusbar.draft_scales_arch_imperial
Initial value:
1 = ["1/16in=1ft", "3/32in=1ft", "1/8in=1ft",
2  "3/16in=1ft", "1/4in=1ft","3/8in=1ft",
3  "1/2in=1ft", "3/4in=1ft", "1in=1ft",
4  "1.5in=1ft", "3in=1ft",
5  QT_TRANSLATE_NOOP("draft","custom"),
6  ]
Definition: translate.py:205

◆ draft_scales_eng_imperial

list draftutils.init_draft_statusbar.draft_scales_eng_imperial
Initial value:
1 = ["1in=10ft", "1in=20ft", "1in=30ft",
2  "1in=40ft", "1in=50ft", "1in=60ft",
3  "1in=70ft", "1in=80ft", "1in=90ft",
4  "1in=100ft",
5  QT_TRANSLATE_NOOP("draft","custom"),
6  ]

◆ draft_scales_metrics

list draftutils.init_draft_statusbar.draft_scales_metrics
Initial value:
1 = ["1:1000", "1:500", "1:250", "1:200", "1:100",
2  "1:50", "1:25","1:20", "1:10", "1:5","1:2",
3  "1:1",
4  "2:1", "5:1", "10:1", "20:1",
5  QT_TRANSLATE_NOOP("draft","custom"),
6  ]

◆ filterObjectsForModifiers

def draftutils.utils.filterObjectsForModifiers = filter_objects_for_modifiers

◆ formatObject

def draftutils.gui_utils.formatObject = format_object

◆ get3DView

def draftutils.gui_utils.get3DView = get_3d_view

◆ getCloneBase

def draftutils.utils.getCloneBase = get_clone_base

◆ getDefaultUnit

def draftutils.units.getDefaultUnit = get_default_unit

◆ getObjectsOfType

◆ getParam

◆ getParamType

def draftutils.utils.getParamType = get_param_type

◆ getRealName

def draftutils.utils.getRealName = get_real_name

◆ getrgb

def draftutils.utils.getrgb = get_rgb

◆ getSelection

◆ getSelectionEx

◆ getType

◆ isClone

def draftutils.utils.isClone = is_clone

◆ isClosedEdge

def draftutils.utils.isClosedEdge = is_closed_edge

◆ loadSvgPatterns

def draftutils.utils.loadSvgPatterns = load_svg_patterns

◆ loadTexture

def draftutils.gui_utils.loadTexture = load_texture

◆ makeFormatSpec

def draftutils.units.makeFormatSpec = make_format_spec

◆ param

draftutils.utils.param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")

◆ printShape

def draftutils.utils.printShape = print_shape


draftutils.translate.QT_TRANSLATE_NOOP = QtCore.QT_TRANSLATE_NOOP

Referenced by InspectionGui::VisualInspection.accept(), MeshGui::TaskDecimating.accept(), MeshGui::TaskSmoothing.accept(), PartGui::LoftWidget.accept(), PartGui::SweepWidget.accept(), ReenGui::FitBSplineSurfaceWidget.accept(), ReenGui::PoissonWidget.accept(), TechDrawGui::TaskActiveView.accept(), TechDrawGui::TaskCosmeticLine.accept(), TechDrawGui::TaskWeldingSymbol.accept(), StdCmdDelete.activated(), StdCmdLinkMakeGroup.activated(), StdCmdLinkMake.activated(), StdCmdLinkMakeRelative.activated(), StdCmdLinkImport.activated(), StdCmdLinkImportAll.activated(), StdCmdMeasurementSimple.activated(), StdCmdTextDocument.activated(), StdCmdPart.activated(), StdCmdGroup.activated(), CmdSketcherConstrainHorizontal.activated(), CmdSketcherConstrainVertical.activated(), CmdSketcherConstrainLock.activated(), CmdSketcherConstrainBlock.activated(), CmdSketcherConstrainCoincident.activated(), CmdSketcherConstrainDistance.activated(), CmdSketcherConstrainPointOnObject.activated(), CmdSketcherConstrainDistanceX.activated(), CmdSketcherConstrainDistanceY.activated(), CmdSketcherConstrainParallel.activated(), CmdSketcherConstrainPerpendicular.activated(), CmdSketcherConstrainTangent.activated(), CmdSketcherConstrainRadius.activated(), CmdSketcherConstrainDiameter.activated(), CmdSketcherConstrainAngle.activated(), CmdSketcherConstrainEqual.activated(), CmdSketcherConstrainSymmetric.activated(), ArchPanel.CommandPanelSheet.Activated(), draftobjects.draft_annotation.DraftAnnotation.add_missing_properties_0v19(), ArchStructure.StructSelectionObserver.addSelection(), Gui::ManualAlignment.align(), Gui::PropertyEditor::PropertyModel.appendProperty(), SpreadsheetGui::PropertiesDialog.apply(), TechDrawGui::TaskSectionView.applyAligned(), CmdSketcherConstrainHorizontal.applyConstraint(), CmdSketcherConstrainVertical.applyConstraint(), CmdSketcherConstrainLock.applyConstraint(), CmdSketcherConstrainBlock.applyConstraint(), CmdSketcherConstrainCoincident.applyConstraint(), CmdSketcherConstrainDistance.applyConstraint(), CmdSketcherConstrainPointOnObject.applyConstraint(), CmdSketcherConstrainDistanceX.applyConstraint(), CmdSketcherConstrainDistanceY.applyConstraint(), CmdSketcherConstrainParallel.applyConstraint(), CmdSketcherConstrainPerpendicular.applyConstraint(), CmdSketcherConstrainTangent.applyConstraint(), CmdSketcherConstrainRadius.applyConstraint(), CmdSketcherConstrainDiameter.applyConstraint(), CmdSketcherConstrainAngle.applyConstraint(), CmdSketcherConstrainEqual.applyConstraint(), CmdSketcherConstrainSymmetric.applyConstraint(), TechDrawGui::TaskSectionView.applyQuick(), ArchWall.areSameWallTypes(), draftobjects.bspline.BSpline.assureProperties(), Sketcher::SketchAnalysis.autoconstraint(), TechDrawGui::QGIViewBalloon.balloonLabelDragFinished(), ArchSite.Compass.buildCoordinates(), Gui::PropertyEditor::PropertyModel.buildUp(), MeshGui::ViewProviderMesh.clipMeshCallback(), ArchSectionPlane.closeViewer(), Gui::Dialog::TransformStrategy.commitTransform(), ArchBuildingPart.convertFloors(), TechDrawGui::TaskRichAnno.createAnnoFeature(), SketcherGui::DrawSketchHandler.createAutoConstraints(), TechDrawGui::TaskCenterLine.createCenterLine(), TechDrawGui::TaskDetail.createDetail(), TechDrawGui::TaskLeaderLine.createLeaderFeature(), ArchEquipment.createMeshView(), TechDrawGui::TaskSectionView.createSectionView(), ReverseEngineeringGui::SegmentationManual.createSegment(), Gui::PointMarker.customEvent(), PointsGui::ViewProviderScattered.cut(), PointsGui::ViewProviderStructured.cut(), MeshGui::MeshSplit.cutMesh(), TechDrawGui::QGIViewDimension.datumLabelDragFinished(), MeshGui::RemoveComponents.deleteSelection(), SpreadsheetGui::SheetTableView.deleteSelection(), SketcherGui::ViewProviderSketch.editDoubleClicked(), draftobjects.bspline.BSpline.execute(), draftobjects.ellipse.Ellipse.execute(), Sketcher::SketchObject.fillet(), MeshGui::ViewProviderMesh.fillHole(), draftviewproviders.view_wire.ViewProviderWire.flatten(), Part::FaceMakerSimple.getBriefExplanation(), Part::FaceMakerBullseye.getBriefExplanation(), Part::FaceMakerCheese.getBriefExplanation(), Part::FaceMakerExtrusion.getBriefExplanation(), InitGui.ArchWorkbench.GetClassName(), InitGui.DraftWorkbench.GetClassName(), ArchMaterial.getDocumentMaterials(), ArchAxis.CommandArchGrid.GetResources(), ArchBuildingPart.CommandBuildingPart.GetResources(), ArchCurtainWall.CommandArchCurtainWall.GetResources(), ArchPanel.CommandPanel.GetResources(), ArchPanel.CommandPanelCut.GetResources(), ArchPanel.CommandPanelSheet.GetResources(), ArchPanel.CommandNest.GetResources(), ArchPanel.CommandPanelGroup.GetResources(), ArchProfile.Arch_Profile.GetResources(), ArchSchedule.CommandArchSchedule.GetResources(), ArchTruss.CommandArchTruss.GetResources(), draftguitools.gui_annotationstyleeditor.AnnotationStyleEditor.GetResources(), draftguitools.gui_arcs.Arc.GetResources(), draftguitools.gui_arcs.Arc_3Points.GetResources(), draftguitools.gui_arcs.ArcGroup.GetResources(), draftguitools.gui_array_simple.Array.GetResources(), draftguitools.gui_array_simple.LinkArray.GetResources(), draftguitools.gui_arrays.ArrayGroup.GetResources(), draftguitools.gui_beziers.BezCurve.GetResources(), draftguitools.gui_beziers.CubicBezCurve.GetResources(), draftguitools.gui_beziers.BezierGroup.GetResources(), draftguitools.gui_circles.Circle.GetResources(), draftguitools.gui_circulararray.CircularArray.GetResources(), draftguitools.gui_clone.Clone.GetResources(), draftguitools.gui_dimension_ops.FlipDimension.GetResources(), draftguitools.gui_dimensions.Dimension.GetResources(), draftguitools.gui_downgrade.Downgrade.GetResources(), draftguitools.gui_draft2sketch.Draft2Sketch.GetResources(), draftguitools.gui_drawing.Drawing.GetResources(), draftguitools.gui_ellipses.Ellipse.GetResources(), draftguitools.gui_facebinders.Facebinder.GetResources(), draftguitools.gui_fillets.Fillet.GetResources(), draftguitools.gui_grid.ToggleGrid.GetResources(), draftguitools.gui_groups.AddToGroup.GetResources(), draftguitools.gui_groups.SelectGroup.GetResources(), draftguitools.gui_groups.SetAutoGroup.GetResources(), draftguitools.gui_groups.AddToConstruction.GetResources(), draftguitools.gui_heal.Heal.GetResources(), draftguitools.gui_join.Join.GetResources(), draftguitools.gui_labels.Label.GetResources(), draftguitools.gui_layers.Layer.GetResources(), draftguitools.gui_line_add_delete.AddPoint.GetResources(), draftguitools.gui_line_add_delete.DelPoint.GetResources(), draftguitools.gui_lineops.FinishLine.GetResources(), draftguitools.gui_lineops.CloseLine.GetResources(), draftguitools.gui_lineops.UndoLine.GetResources(), draftguitools.gui_lines.Line.GetResources(), draftguitools.gui_lines.Wire.GetResources(), draftguitools.gui_lineslope.LineSlope.GetResources(), draftguitools.gui_mirror.Mirror.GetResources(), draftguitools.gui_move.Move.GetResources(), draftguitools.gui_offset.Offset.GetResources(), draftguitools.gui_orthoarray.OrthoArray.GetResources(), draftguitools.gui_patharray.PathArray.GetResources(), draftguitools.gui_patharray.PathLinkArray.GetResources(), draftguitools.gui_pathtwistedarray.PathTwistedArray.GetResources(), draftguitools.gui_pathtwistedarray.PathTwistedLinkArray.GetResources(), draftguitools.gui_planeproxy.Draft_WorkingPlaneProxy.GetResources(), draftguitools.gui_pointarray.PointArray.GetResources(), draftguitools.gui_pointarray.PointLinkArray.GetResources(), draftguitools.gui_points.Point.GetResources(), draftguitools.gui_polararray.PolarArray.GetResources(), draftguitools.gui_polygons.Polygon.GetResources(), draftguitools.gui_rectangles.Rectangle.GetResources(), draftguitools.gui_rotate.Rotate.GetResources(), draftguitools.gui_scale.Scale.GetResources(), draftguitools.gui_selectplane.Draft_SelectPlane.GetResources(), draftguitools.gui_shape2dview.Shape2DView.GetResources(), draftguitools.gui_shapestrings.ShapeString.GetResources(), draftguitools.gui_snaps.Draft_Snap_Lock.GetResources(), draftguitools.gui_snaps.Draft_Snap_Midpoint.GetResources(), draftguitools.gui_snaps.Draft_Snap_Perpendicular.GetResources(), draftguitools.gui_snaps.Draft_Snap_Grid.GetResources(), draftguitools.gui_snaps.Draft_Snap_Intersection.GetResources(), draftguitools.gui_snaps.Draft_Snap_Parallel.GetResources(), draftguitools.gui_snaps.Draft_Snap_Endpoint.GetResources(), draftguitools.gui_snaps.Draft_Snap_Angle.GetResources(), draftguitools.gui_snaps.Draft_Snap_Center.GetResources(), draftguitools.gui_snaps.Draft_Snap_Extension.GetResources(), draftguitools.gui_snaps.Draft_Snap_Near.GetResources(), draftguitools.gui_snaps.Draft_Snap_Ortho.GetResources(), draftguitools.gui_snaps.Draft_Snap_Special.GetResources(), draftguitools.gui_snaps.Draft_Snap_Dimensions.GetResources(), draftguitools.gui_snaps.Draft_Snap_WorkingPlane.GetResources(), draftguitools.gui_snaps.ShowSnapBar.GetResources(), draftguitools.gui_splines.BSpline.GetResources(), draftguitools.gui_split.Split.GetResources(), draftguitools.gui_stretch.Stretch.GetResources(), draftguitools.gui_styles.ApplyStyle.GetResources(), draftguitools.gui_subelements.SubelementHighlight.GetResources(), draftguitools.gui_texts.Text.GetResources(), draftguitools.gui_togglemodes.ToggleConstructionMode.GetResources(), draftguitools.gui_togglemodes.ToggleContinueMode.GetResources(), draftguitools.gui_togglemodes.ToggleDisplayMode.GetResources(), draftguitools.gui_trimex.Trimex.GetResources(), draftguitools.gui_upgrade.Upgrade.GetResources(), draftguitools.gui_wire2spline.WireToBSpline.GetResources(), Gui::ViewProviderDocumentObject.getTransactionText(), Part::FaceMakerSimple.getUserFriendlyName(), Part::FaceMakerBullseye.getUserFriendlyName(), Part::FaceMakerCheese.getUserFriendlyName(), Part::FaceMakerExtrusion.getUserFriendlyName(), Gui::Application.importFrom(), draftutils.init_tools.init_draft_menus(), draftutils.init_draft_statusbar.init_draft_statusbar_scale(), draftutils.init_draft_statusbar.init_draft_statusbar_snap(), draftutils.init_tools.init_draft_toolbars(), InitGui.ArchWorkbench.Initialize(), InitGui.DraftWorkbench.Initialize(), InitGui.OpenSCADWorkbench.Initialize(), SpreadsheetGui::SheetTableView.insertColumns(), SpreadsheetGui::SheetTableView.insertRows(), ArchAxis.CommandArchGrid.IsActive(), ArchSchedule.CommandArchSchedule.IsActive(), draftutils.init_draft_statusbar.label_to_scale(), draftobjects.draftlink.DraftLink.linkSetup(), Gui::MainWindow.MainWindow(), ArchBuilding.makeBuilding(), ArchBuildingPart.makeBuilding(), ArchFloor.makeFloor(), ArchFrame.makeFrame(), ArchAxis.makeGrid(), Sketcher::SketchAnalysis.makeMissingEquality(), Sketcher::SketchAnalysis.makeMissingPointOnPointCoincident(), Sketcher::SketchAnalysis.makeMissingVerticalHorizontal(), ArchPipe.makePipeConnector(), ArchStairs.makeRailing(), ArchRebar.makeRebar(), ArchRoof.makeRoof(), MeshGui::ViewProviderMesh.markPartCallback(), Sketcher::SketchObject.modifyBSplineKnotMultiplicity(), SketcherGui::ViewProviderSketch.mouseButtonPressed(), TechDrawGui::QGVPage.mouseReleaseEvent(), SketcherGui::TaskSketcherConstrains.on_listWidgetConstraints_itemChanged(), MeshGui::DlgEvaluateMeshImp.on_repairAllTogether_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairDegeneratedButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairDuplicatedFacesButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairDuplicatedPointsButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairFoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairIndicesButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairNonmanifoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairOrientationButton_clicked(), MeshGui::DlgEvaluateMeshImp.on_repairSelfIntersectionButton_clicked(), draftobjects.pointarray.PointArray.onDocumentRestored(), SpreadsheetGui::SheetView.onMsg(), DrawSketchHandlerExternal.onSelectionChanged(), DrawSketchHandlerCarbonCopy.onSelectionChanged(), PartGui::TaskDlgAttacher.open(), PartGui::FaceColors.open(), MeshGui::ViewProviderMesh.partMeshCallback(), StdCmdExpression.pasteExpressions(), ArchStructure.placeAlongEdge(), DrawSketchHandlerBSpline.pressButton(), Gui::PropertyEditor::PropertyItem.propertyName(), Gui::PropertyEditor::PropertyPlacementItem.PropertyPlacementItem(), ArchWindow.recolorize(), ArchAxis.ArchGridTaskPanel.reject(), DrawSketchHandlerCoincident.releaseButton(), DrawSketchHandlerLine.releaseButton(), DrawSketchHandlerBox.releaseButton(), DrawSketchHandlerLineSet.releaseButton(), DrawSketchHandlerArc.releaseButton(), DrawSketchHandler3PointArc.releaseButton(), DrawSketchHandlerCircle.releaseButton(), DrawSketchHandlerArcOfEllipse.releaseButton(), DrawSketchHandler3PointCircle.releaseButton(), DrawSketchHandlerPoint.releaseButton(), DrawSketchHandlerFillet.releaseButton(), DrawSketchHandlerTrimming.releaseButton(), DrawSketchHandlerExtend.releaseButton(), DrawSketchHandlerSlot.releaseButton(), DrawSketchHandlerRegularPolygon.releaseButton(), DrawSketchHandlerCopy.releaseButton(), DrawSketchHandlerRectangularArray.releaseButton(), DrawSketchHandlerArcOfHyperbola.releaseButton(), DrawSketchHandlerArcOfParabola.releaseButton(), SpreadsheetGui::SheetTableView.removeColumns(), SpreadsheetGui::SheetTableView.removeRows(), ArchSpace.removeSpaceBoundaries(), TechDrawGui::MDIViewPage.saveDXF(), MeshGui::ViewProviderMesh.segmMeshCallback(), draftviewproviders.view_draft_annotation.ViewProviderDraftAnnotation.set_annotation_properties(), draftobjects.array.Array.set_circular_properties(), draftobjects.array.Array.set_general_properties(), draftviewproviders.view_dimension.ViewProviderDimensionBase.set_graphics_properties(), draftviewproviders.view_draft_annotation.ViewProviderDraftAnnotation.set_graphics_properties(), draftviewproviders.view_label.ViewProviderLabel.set_graphics_properties(), draftobjects.label.Label.set_label_properties(), draftobjects.label.Label.set_leader_properties(), draftobjects.array.Array.set_link_properties(), draftobjects.array.Array.set_ortho_properties(), draftviewproviders.view_layer.ViewProviderLayer.set_override_options(), draftobjects.array.Array.set_polar_circular_properties(), draftobjects.array.Array.set_polar_properties(), draftobjects.dimension.DimensionBase.set_properties(), draftobjects.dimension.LinearDimension.set_properties(), draftobjects.dimension.AngularDimension.set_properties(), draftobjects.layer.Layer.set_properties(), draftobjects.pointarray.PointArray.set_properties(), draftobjects.text.Text.set_properties(), draftviewproviders.view_text.ViewProviderText.set_properties(), draftobjects.label.Label.set_target_properties(), draftviewproviders.view_dimension.ViewProviderDimensionBase.set_text_properties(), draftviewproviders.view_label.ViewProviderLabel.set_text_properties(), draftviewproviders.view_dimension.ViewProviderDimensionBase.set_units_properties(), draftviewproviders.view_layer.ViewProviderLayer.set_visual_properties(), SpreadsheetGui::WorkbenchHelper.setBackgroundColor(), SpreadsheetGui::SheetModel.setData(), SpreadsheetGui::WorkbenchHelper.setForegroundColor(), ArchMaterial.MultiMaterialDelegate.setModelData(), ArchProfile.Arch_Profile.setPreset(), ArchAxis.ArchGrid.setProperties(), ArchBuildingPart.BuildingPart.setProperties(), ArchComponent.Component.setProperties(), ArchCurtainWall.CurtainWall.setProperties(), ArchPanel.PanelView.setProperties(), ArchPanel.PanelCut.setProperties(), ArchPanel.PanelSheet.setProperties(), ArchReference.ArchReference.setProperties(), ArchTruss.Truss.setProperties(), ArchBuildingPart.ViewProviderBuildingPart.setProperties(), ArchComponent.ViewProviderComponent.setProperties(), ArchPanel.ViewProviderPanelCut.setProperties(), ArchPanel.ViewProviderPanelSheet.setProperties(), ArchReference.ViewProviderArchReference.setProperties(), SketcherGui::ConstraintView.swapNamedOfSelectedItems(), MeshGui::MeshSplit.trimMesh(), MeshGui::ViewProviderMesh.trimMeshCallback(), TechDrawGui::TaskRichAnno.updateAnnoFeature(), TechDrawGui::TaskCenterLine.updateCenterLine(), TechDrawGui::TaskDetail.updateDetail(), TechDrawGui::TaskLeaderLine.updateLeaderFeature(), Gui::ViewProviderOrigin.ViewProviderOrigin(), Gui::ViewProviderOriginFeature.ViewProviderOriginFeature(), SandboxGui::Workbench.Workbench(), ArchBuildingPart.ViewProviderBuildingPart.writeCamera(), draftviewproviders.view_wpproxy.ViewProviderWorkingPlaneProxy.writeCamera(), and draftviewproviders.view_wpproxy.ViewProviderWorkingPlaneProxy.writeState().

◆ Qtranslate

draftutils.translate.Qtranslate = QtCore.QCoreApplication.translate

◆ removeHidden

def draftutils.gui_utils.removeHidden = remove_hidden

◆ setParam

def draftutils.utils.setParam = set_param

◆ stringencodecoin

def draftutils.utils.stringencodecoin = string_encode_coin

◆ svgpatterns

def draftutils.utils.svgpatterns = svg_patterns

◆ todo

◆ typecheck

def draftutils.utils.typecheck = type_check