Modules that contain classes that define custom scripted objects. More...

Classes

class  draftobjects.array.Array
 
class  draftobjects.base.DraftObject
 
class  draftobjects.bezcurve.BezCurve
 
class  draftobjects.block.Block
 
class  draftobjects.bspline.BSpline
 
class  draftobjects.circle.Circle
 
class  draftobjects.clone.Clone
 
class  draftobjects.dimension.AngularDimension
 
class  draftobjects.dimension.DimensionBase
 
class  draftobjects.dimension.LinearDimension
 
class  draftobjects.draft_annotation.DraftAnnotation
 
class  draftobjects.draftlink.DraftLink
 
class  draftobjects.drawingview.DrawingView
 
class  draftobjects.ellipse.Ellipse
 
class  draftobjects.facebinder.Facebinder
 
class  draftobjects.fillet.Fillet
 
class  draftobjects.label.Label
 
class  draftobjects.layer.Layer
 
class  draftobjects.layer.LayerContainer
 
class  draftobjects.patharray.PathArray
 
class  draftobjects.pathtwistedarray.PathTwistedArray
 
class  draftobjects.point.Point
 
class  draftobjects.pointarray.PointArray
 
class  draftobjects.polygon.Polygon
 
class  draftobjects.rectangle.Rectangle
 
class  draftobjects.shape2dview.Shape2DView
 
class  draftobjects.shapestring.ShapeString
 
class  draftobjects.text.Text
 
class  draftobjects.wire.Wire
 
class  draftobjects.wpproxy.WorkingPlaneProxy
 

Namespaces

namespace  array
 Provides functions to create non-parametric arrayed copies.
 
namespace  base
 Provides the object code for the base Draft object.
 
namespace  bezcurve
 Provides the object code for the BezCurve object.
 
namespace  block
 Provides the object code for the Block object.
 
namespace  bspline
 Provides the object code for the BSpline object.
 
namespace  circle
 Provides the object code for the Circle object.
 
namespace  clone
 Provides the object code for the Clone object.
 
namespace  dimension
 Provides the object code for the dimension objects.
 
namespace  draft_annotation
 Provides the object code for all annotation type objects.
 
 
namespace  drawingview
 Provides the object code for the DrawingView object (OBSOLETE).
 
namespace  ellipse
 Provides the object code for the Ellipse object.
 
namespace  facebinder
 Provides the object code for the Facebinder object.
 
namespace  fillet
 Provides the object code for the Fillet object.
 
namespace  label
 Provides the object code for the Label object.
 
namespace  layer
 Provides the object code for the Layer object.
 
namespace  patharray
 Provides the object code for the PathArray object.
 
namespace  pathtwistedarray
 Provides the object code for the TwistedArray object.
 
namespace  point
 Provides the object code for the Point object.
 
namespace  pointarray
 Provides the object code for the PointArray object.
 
namespace  polygon
 Provides the object code for the Polygon object.
 
namespace  rectangle
 Provides the object code for the Rectangle object.
 
namespace  shape2dview
 Provides the object code for the Shape2dView object.
 
namespace  shapestring
 Provides the object code for the ShapeString object.
 
namespace  text
 Provides the object code for the Text object.
 
namespace  wire
 Provides the object code for the Wire (Polyline) object.
 
namespace  wpproxy
 Provides the object code for the WorkingPlaneProxy object.
 

Functions

def draftobjects.pointarray.build_copies (base_object, pt_list=None, placement=App.Placement())
 
def draftobjects.pointarray.build_placements (base_object, pt_list=None, placement=App.Placement())
 
def draftobjects.patharray.calculate_placement (globalRotation, edge, offset, RefPt, xlate, align, normal=None, mode='Original', overrideNormal=False)
 
def draftobjects.array.circ_placements (base_placement, r_distance, tan_distance, axis, center, circle_number, symmetry)
 
def draftobjects.label.get_label_types ()
 
def draftobjects.patharray.get_parameter_from_v0 (edge, offset)
 
def draftobjects.pointarray.get_point_list (point_object)
 
def draftobjects.dimension.measure_one_obj_edge (obj, subelement, dim_point, diameter=False)
 
def draftobjects.dimension.measure_one_obj_vertices (obj, subelements)
 
def draftobjects.dimension.measure_two_obj_angles (link_sub_1, link_sub_2)
 
def draftobjects.dimension.measure_two_objects (link_sub_1, link_sub_2)
 
def draftobjects.patharray.placements_on_path (shapeRotation, pathwire, count, xlate, align, mode='Original', forceNormal=False, normalOverride=None)
 
def draftobjects.array.polar_placements (base_placement, center, angle, number, axis, axisvector)
 
def draftobjects.array.rect_placements (base_placement, xvector, yvector, zvector, xnum, ynum, znum)
 
def draftobjects.label.return_info (target, typ, subelement=None)
 

Variables

def draftobjects.patharray.calculatePlacement = calculate_placement
 
def draftobjects.patharray.calculatePlacementsOnPath = placements_on_path
 
 draftobjects.label.DraftLabel = Label
 
 draftobjects.text.DraftText = Text
 
def draftobjects.patharray.getParameterFromV0 = get_parameter_from_v0
 

Detailed Description

Modules that contain classes that define custom scripted objects.

Function Documentation

◆ build_copies()

def draftobjects.pointarray.build_copies (   base_object,
  pt_list = None,
  placement = App.Placement() 
)
Build a compound of copies from the base object and list of points.

Returns
-------
Part::TopoShape
    The compound shape created by `Part.makeCompound`.

References draftobjects.pointarray.build_copies().

Referenced by draftobjects.pointarray.build_copies().

◆ build_placements()

def draftobjects.pointarray.build_placements (   base_object,
  pt_list = None,
  placement = App.Placement() 
)
Build a placements from the base object and list of points.

Returns
-------
list(App.Placement)

Referenced by draftobjects.pointarray.PointArray.execute().

◆ calculate_placement()

def draftobjects.patharray.calculate_placement (   globalRotation,
  edge,
  offset,
  RefPt,
  xlate,
  align,
  normal = None,
  mode = 'Original',
  overrideNormal = False 
)
Orient shape to a local coordinate system (tangent, normal, binormal).

Orient shape at parameter offset, normally length.

http://en.wikipedia.org/wiki/Euler_angles (previous version)
http://en.wikipedia.org/wiki/Quaternions

References draftobjects.patharray.get_parameter_from_v0().

Referenced by draftobjects.patharray.placements_on_path().

◆ circ_placements()

def draftobjects.array.circ_placements (   base_placement,
  r_distance,
  tan_distance,
  axis,
  center,
  circle_number,
  symmetry 
)
Determine the placements where the circular copies will be.

Referenced by draftobjects.array.Array.execute().

◆ get_label_types()

◆ get_parameter_from_v0()

def draftobjects.patharray.get_parameter_from_v0 (   edge,
  offset 
)
Return parameter at distance offset from edge.Vertexes[0].

sb method in Part.TopoShapeEdge???

References DraftVecUtils.equals().

Referenced by draftobjects.patharray.calculate_placement(), and draftobjects.patharray.placements_on_path().

◆ get_point_list()

def draftobjects.pointarray.get_point_list (   point_object)
Extract a list of points from a point object.

Parameters
----------
point_object: Part::Feature
    Either a `Draft Block`, a `Part::Compound`,
    or a `Sketcher::SketchObject` containing points.

Returns
-------
list, int
    A list of points that have `X`, `Y`, `Z` coordinates;
    the second element is the number of elements.
    If the list is empty, the second element is zero.

To Do
-----
- This function currently extracts the points inside a `Draft Block`,
  a `Part::Compound`, or a `Sketch`. To make this more general,
  this function could be augmented to extract a list of points
  from the vertices of any object with a `Part::TopoShape` (2D or 3D).

- If the input is a `Part::Compound`, it should handle all valid types
  of objects simultaneously, that is, `Draft Points`, `Part::Vertexes`,
  `Sketches` with points, and possibly any other object with
  a `Part::TopoShape` as in the previous point.
  It should recursively call itself to extract
  points contained in nested compounds.

Referenced by draftobjects.pointarray.PointArray.execute().

◆ measure_one_obj_edge()

def draftobjects.dimension.measure_one_obj_edge (   obj,
  subelement,
  dim_point,
  diameter = False 
)
Measure one object with one subelement, a straight or circular edge.

Parameters
----------
obj: Part::Feature
    The object that is measured.

subelement: str
    The subelement that is measured, for example, `'Edge1'`.

dim_line: Base::Vector3
    A point through which the dimension goes through.

References DraftVecUtils.scaleTo().

Referenced by draftobjects.dimension.LinearDimension.execute().

◆ measure_one_obj_vertices()

def draftobjects.dimension.measure_one_obj_vertices (   obj,
  subelements 
)
Measure two vertices in the same object.

Referenced by draftobjects.dimension.LinearDimension.execute().

◆ measure_two_obj_angles()

def draftobjects.dimension.measure_two_obj_angles (   link_sub_1,
  link_sub_2 
)
Measure two edges from two different objects to measure the angle.

This function is a prototype because it does not determine all possible
starting and ending angles that could be used to draw the dimension line,
which is a circular arc.

Parameters
----------
link_sub_1: tuple
    A tuple containing one object and a list of subelement strings,
    which may be empty. Only the first subelement is considered, which
    must be an edge.
    ::
        link_sub_1 = (obj1, ['EdgeN', ...])

link_sub_2: tuple
    Same.

References DraftVecUtils.angle().

◆ measure_two_objects()

def draftobjects.dimension.measure_two_objects (   link_sub_1,
  link_sub_2 
)
Measure two vertices from two different objects.

Parameters
----------
link_sub_1: tuple
    A tuple containing one object and a list of subelement strings,
    which may be empty. Only the first subelement is considered, which
    must be a vertex.
    ::
        link_sub_1 = (obj1, ['VertexN', ...])

link_sub_2: tuple
    Same.

Referenced by draftobjects.dimension.LinearDimension.execute().

◆ placements_on_path()

def draftobjects.patharray.placements_on_path (   shapeRotation,
  pathwire,
  count,
  xlate,
  align,
  mode = 'Original',
  forceNormal = False,
  normalOverride = None 
)
Calculate the placements of a shape along a given path.

Each copy will be distributed evenly.

References draftobjects.patharray.calculate_placement(), and draftobjects.patharray.get_parameter_from_v0().

Referenced by draftobjects.patharray.PathArray.execute().

◆ polar_placements()

def draftobjects.array.polar_placements (   base_placement,
  center,
  angle,
  number,
  axis,
  axisvector 
)
Determine the placements where the polar copies will be.

References DraftVecUtils.isNull(), and DraftVecUtils.tup().

Referenced by draftobjects.array.Array.execute().

◆ rect_placements()

def draftobjects.array.rect_placements (   base_placement,
  xvector,
  yvector,
  zvector,
  xnum,
  ynum,
  znum 
)
Determine the placements where the rectangular copies will be.

Referenced by draftobjects.array.Array.execute().

◆ return_info()

def draftobjects.label.return_info (   target,
  typ,
  subelement = None 
)
Return the text list from the target and the given type.

Parameters
----------
target: Part::Feature
    The object targeted by the label.

typ: str
    It is the type of information that we want to extract.

subelement: str, optional
    A string indicating a subelement of the `target`;
    it could be `'VertexN'`, `'EdgeN'`, or `'FaceN'`,
    where `'N'` is a number that starts from `1` up to the maximum
    number of subelements in that target.

Referenced by draftobjects.label.Label.execute().

Variable Documentation

◆ calculatePlacement

def draftobjects.patharray.calculatePlacement = calculate_placement

◆ calculatePlacementsOnPath

def draftobjects.patharray.calculatePlacementsOnPath = placements_on_path

◆ DraftLabel

draftobjects.label.DraftLabel = Label

◆ DraftText

draftobjects.text.DraftText = Text

◆ getParameterFromV0

def draftobjects.patharray.getParameterFromV0 = get_parameter_from_v0