Example #1
0
"""Provides various functions to work with offsets."""
## @package offsets
# \ingroup draftgeoutils
# \brief Provides various functions to work with offsets.

import lazy_loader.lazy_loader as lz

import FreeCAD as App
import DraftVecUtils

from draftgeoutils.general import geomType, vec
from draftgeoutils.geometry import get_normal
from draftgeoutils.intersections import wiresIntersect, connect

# Delay import of module until first use because it is heavy
Part = lz.LazyLoader("Part", globals(), "Part")

## \addtogroup draftgeoutils
# @{


def pocket2d(shape, offset):
    """Return a list of wires obtained from offsetting wires from the shape.

    Return a list of wires obtained from offsetting the wires
    from the given shape by the given offset, and intersection if needed.
    """
    # find the outer wire
    length = 0
    outerWire = None
    innerWires = []
Example #2
0
File: svg.py Project: Mu-L/FreeCAD
import math
import lazy_loader.lazy_loader as lz

import FreeCAD as App
import DraftVecUtils
import WorkingPlane
import draftutils.utils as utils
import draftfunctions.svgtext as svgtext

from draftfunctions.svgshapes import get_proj, get_circle, get_path
from draftutils.utils import param
from draftutils.messages import _wrn, _err

# Delay import of module until first use because it is heavy
Part = lz.LazyLoader("Part", globals(), "Part")
DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")

## \addtogroup draftfunctions
# @{


def get_line_style(line_style, scale):
    """Return a linestyle scaled by a factor."""
    style = None

    if line_style == "Dashed":
        style = param.GetString("svgDashedLine", "0.09,0.05")
    elif line_style == "Dashdot":
        style = param.GetString("svgDashdotLine", "0.09,0.05,0.02,0.05")
    elif line_style == "Dotted":
Example #3
0
import math
import lazy_loader.lazy_loader as lz
from PySide.QtCore import QT_TRANSLATE_NOOP

import FreeCAD as App
import FreeCADGui as Gui
import Draft_rc
import DraftVecUtils
import draftguitools.gui_base_original as gui_base_original
import draftguitools.gui_tool_utils as gui_tool_utils
import draftguitools.gui_trackers as trackers

from draftutils.translate import translate
from draftutils.messages import _msg

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 draftguitools
# @{


class Dimension(gui_base_original.Creator):
    """Gui command for the Dimension tool.

    This includes at the moment linear, radial, diametrical,
    and angular dimensions depending on the selected object
    and the modifier key (ALT) used.
Example #4
0
## @package WorkingPlane
#  \ingroup DRAFT
#  \brief This module handles the Working Plane and grid of the Draft module.
#
#  This module provides the plane class which provides a virtual working plane
#  in FreeCAD and a couple of utility functions.

import math
import lazy_loader.lazy_loader as lz

import FreeCAD
import DraftVecUtils
from FreeCAD import Vector
from draftutils.translate import translate

DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
Part = lz.LazyLoader("Part", globals(), "Part")
FreeCADGui = lz.LazyLoader("FreeCADGui", globals(), "FreeCADGui")

__title__ = "FreeCAD Working Plane utility"
__author__ = "Ken Cline"
__url__ = "https://www.freecadweb.org"


class Plane:
    """A WorkPlane object.

    Parameters
    ----------
    u: Base::Vector3, optional
        An axis (vector) that helps define the working plane.