Basic 2D drawing tools and other generic tools. More...

Namespaces

 DraftGeomUtils
 
 DraftGui
 GUI elements and utilities of the Draft workbench.
 
 DraftSnap
 Snapping system used by Draft & Arch workbenches.
 
 DraftTools
 GUI Commands of the Draft workbench.
 
 DraftTrackers
 Custom Pivy-based objects used by the Draft workbench.
 
 importAirfoilDAT
 Airfoil (.dat) file importer.
 
 importDWG
 DWG file importer & exporter.
 
 importDXF
 DXF file importer & exporter.
 
 importOCA
 OCA (Open CAD Format) file import & export.
 
 importSVG
 SVG file importer & exporter.
 
 WorkingPlane
 This module handles the Working Plane and grid of the Draft module.
 

Modules

 DraftGeomUtils
 Shape manipulation utilities for the Draft workbench.
 
 DraftVecUtils
 Vector math utilities used in Draft workbench.
 

Functions

def Draft.array (objectslist, arg1, arg2, arg3, arg4=None)
 
def Draft.autogroup (obj)
 
def Draft.clone (obj, delta=None, forcedraft=False)
 
def Draft.compareObjects (obj1, obj2)
 
def Draft.cut (object1, object2)
 
def Draft.dimSymbol (symbol=None, invert=False)
 
def Draft.downgrade (objects, delete=False, force=None)
 
def Draft.draftify (objectslist, makeblock=False, delete=True)
 
def Draft.epsilon ()
 
def Draft.extrude (obj, vector, solid=False)
 
def Draft.formatObject (target, origin=None)
 
def Draft.fuse (object1, object2)
 
def Draft.get3DView ()
 
def Draft.getCloneBase (obj, strict=False)
 
def Draft.getDXF (obj, direction=None)
 
def Draft.getGroupContents (objectslist, walls=False, addgroups=False)
 
def Draft.getGroupNames ()
 
def Draft.getMovableChildren (objectslist, recursive=True)
 
def Draft.getObjectsOfType (objectslist, typ)
 
def Draft.getParam (param, default=None)
 
def Draft.getParamType (param)
 
def Draft.getRealName (name)
 
def Draft.getrgb (color, testbw=True)
 
def Draft.getSelection ()
 
def Draft.getSelectionEx ()
 
def Draft.getSVG (obj, scale=1, linewidth=0.35, fontsize=12, fillstyle="shape color", direction=None, linestyle=None, color=None, linespacing=None, techdraw=False, rotation=0)
 
def Draft.getType (obj)
 
def Draft.heal (objlist=None, delete=True, reparent=True)
 
def Draft.isClone (obj, objtype, recursive=False)
 
def Draft.loadSvgPatterns ()
 
def Draft.loadTexture (filename, size=None)
 
def Draft.makeAngularDimension (center, angles, p3, normal=None)
 
def Draft.makeArray (baseobject, arg1, arg2, arg3, arg4=None, name="Array")
 
def Draft.makeBezCurve (pointslist, closed=False, placement=None, face=None, support=None, Degree=None)
 
def Draft.makeBlock (objectslist)
 
def Draft.makeBSpline (pointslist, closed=False, placement=None, face=None, support=None)
 
def Draft.makeCircle (radius, placement=None, face=None, startangle=None, endangle=None, support=None)
 
def Draft.makeCopy (obj, force=None, reparent=False)
 
def Draft.makeDimension (p1, p2, p3=None, p4=None)
 
def Draft.makeDrawingView (obj, page, lwmod=None, tmod=None, otherProjection=None)
 
def Draft.makeEllipse (majradius, minradius, placement=None, face=True, support=None)
 
def Draft.makeFacebinder (selectionset, name="Facebinder")
 
def Draft.makeLine (p1, p2)
 
def Draft.makePathArray (baseobject, pathobject, count, xlate=None, align=False, pathobjsubs=[])
 
def Draft.makePoint (X=0, Y=0, Z=0, color=None, name="Point", point_size=5)
 
def Draft.makePolygon (nfaces, radius=1, inscribed=True, placement=None, face=None, support=None)
 
def Draft.makeRectangle (length, height, placement=None, face=None, support=None)
 
def Draft.makeShape2DView (baseobj, projectionVector=None, facenumbers=[])
 
def Draft.makeShapeString (String, FontFile, Size=100, Tracking=0)
 
def Draft.makeSketch (objectslist, autoconstraints=False, addTo=None, delete=False, name="Sketch", radiusPrecision=-1)
 
def Draft.makeText (stringslist, point=Vector(0, 0, 0), screen=False)
 
def Draft.makeVisGroup (group=None, name="VisGroup")
 
def Draft.makeWire (pointslist, closed=False, placement=None, face=None, support=None)
 
def Draft.mirror (objlist, p1, p2)
 
def Draft.move (objectslist, vector, copy=False)
 
def Draft.offset (obj, delta, copy=False, bind=False, sym=False, occ=False)
 
def Draft.precision ()
 
def Draft.printShape (shape)
 
def Draft.QT_TRANSLATE_NOOP (ctxt, txt)
 
def Draft.removeHidden (objectslist)
 
def Draft.rotate (objectslist, angle, center=Vector(0, 0, 0), axis=Vector(0, 0, 1), copy=False)
 
def Draft.scale (objectslist, delta=Vector(1, 1, 1), center=Vector(0, 0, 0), copy=False, legacy=False)
 
def Draft.select (objs=None)
 
def Draft.setParam (param, value)
 
def Draft.shapify (obj)
 
def Draft.stringencodecoin (ustr)
 
def Draft.svgpatterns ()
 
def Draft.tolerance ()
 
def Draft.typecheck (args_and_types, name="?")
 
def Draft.ungroup (obj)
 
def Draft.upgrade (objects, delete=False, force=None)
 

Variables

list Draft.arrowtypes = ["Dot","Circle","Arrow","Tick"]
 
bool Draft.gui = True
 

Detailed Description

Basic 2D drawing tools and other generic tools.

Create and manipulate basic 2D objects.

This module offers a range of tools to create and manipulate basic 2D objects

The module allows to create 2D geometric objects such as line, rectangle, circle, etc, modify these objects by moving, scaling or rotating them, and offers a couple of other utilities to manipulate further these objects, such as decompose them (downgrade) into smaller elements.

The functionality of the module is divided into GUI tools, usable from the FreeCAD interface, and corresponding python functions, that can perform the same operation programmatically.

Function Documentation

def Draft.array (   objectslist,
  arg1,
  arg2,
  arg3,
  arg4 = None 
)
array(objectslist,xvector,yvector,xnum,ynum) for rectangular array, or
array(objectslist,center,totalangle,totalnum) for polar array: Creates an array
of the objects contained in list (that can be an object or a list of objects)
with, in case of rectangular array, xnum of iterations in the x direction
at xvector distance between iterations, and same for y direction with yvector
and ynum. In case of polar array, center is a vector, totalangle is the angle
to cover (in degrees) and totalnum is the number of objects, including the original.

This function creates an array of independent objects. Use makeArray() to create a
parametric array object.

References Draft.move(), Draft.rotate(), and Draft.typecheck().

Referenced by Fem::FemPostScalarClipFilter.execute(), Fem::FemPostWarpVectorFilter.execute(), Gui::ViewVolumeProjection.getProjectionMatrix(), Gui::PropertyView::PropFind.operator()(), and FemGui::ViewProviderFemPostObject.update().

def Draft.autogroup (   obj)
def Draft.clone (   obj,
  delta = None,
  forcedraft = False 
)
def Draft.compareObjects (   obj1,
  obj2 
)

References Draft.getType().

def Draft.cut (   object1,
  object2 
)
cut(oject1,object2): returns a cut object made from
the difference of the 2 given objects.

References Draft.formatObject(), and Draft.select().

Referenced by Draft.downgrade(), Mesh::MeshObject.getKernel(), Part::TopoShape.getShape(), OpenSCAD2Dgeom.Overlappingfaces.makeshape(), ArchSite.makeSolarDiagram(), and Gui::EditorView.onUpdate().

def Draft.dimSymbol (   symbol = None,
  invert = False 
)

References Draft.getParam().

def Draft.downgrade (   objects,
  delete = False,
  force = None 
)
downgrade(objects,delete=False,force=None): Downgrades the given object(s) (can be
an object or a list of objects). If delete is True, old objects are deleted.
The force attribute can be used to
force a certain way of downgrading. It can be: explode, shapify, subtr,
splitFaces, cut2, getWire, splitWires, splitCompounds.
Returns a dictionnary containing two lists, a list of new objects and a list
of objects to be deleted

References Draft.cut(), Draft.getType(), and Draft.shapify().

def Draft.draftify (   objectslist,
  makeblock = False,
  delete = True 
)
draftify(objectslist,[makeblock],[delete]): turns each object of the given list
(objectslist can also be a single object) into a Draft parametric
wire. If makeblock is True, multiple objects will be grouped in a block.
If delete = False, old objects are not deleted

References Draft.formatObject(), DraftGeomUtils.geomType(), DraftGeomUtils.hasCurves(), Draft.makeBlock(), Draft.makeCircle(), and Draft.makeWire().

Referenced by Draft.upgrade().

def Draft.extrude (   obj,
  vector,
  solid = False 
)
makeExtrusion(object,vector): extrudes the given object
in the direction given by the vector. The original object
gets hidden.

References Draft.formatObject(), and Draft.select().

Referenced by DraftTools.Trimex.trimObject().

def Draft.formatObject (   target,
  origin = None 
)
formatObject(targetObject,[originObject]): This function applies
to the given target object the current properties
set on the toolbar (line color and line width),
or copies the properties of another object if given as origin.
It also places the object in construction group if needed.

References Draft.getParam().

Referenced by DraftGui.DraftToolBar.apply(), Draft.clone(), Draft.cut(), Draft.draftify(), Draft.extrude(), Draft.fuse(), Draft.makeAngularDimension(), Draft.makeBezCurve(), Draft.makeBSpline(), Draft.makeCircle(), Draft.makeCopy(), Draft.makeDimension(), Draft.makeEllipse(), Draft.makePathArray(), Draft.makePolygon(), Draft.makeRectangle(), Draft.makeShapeString(), Draft.makeSketch(), ArchStructure.makeStructuralSystem(), Draft.makeText(), Draft.makeVisGroup(), Draft.makeWire(), Draft.mirror(), Draft.move(), Draft.offset(), Draft.rotate(), and Draft.scale().

def Draft.fuse (   object1,
  object2 
)
fuse(oject1,object2): returns an object made from
the union of the 2 given objects. If the objects are
coplanar, a special Draft Wire is used, otherwise we use
a standard Part fuse.

References Draft.formatObject(), DraftGeomUtils.isCoplanar(), and Draft.select().

Referenced by PartDesign::Transformed.execute(), Part::TopoShape.getShape(), and Draft.upgrade().

def Draft.getCloneBase (   obj,
  strict = False 
)
getCloneBase(obj,[strict]): returns the object cloned by this object, if
any, or this object if it is no clone. If strict is True, if this object is
not a clone, this function returns False

References Draft.getType().

Referenced by Draft.clone(), and importIFC.export().

def Draft.getDXF (   obj,
  direction = None 
)
getDXF(object,[direction]): returns a DXF entity from the given
object. If direction is given, the object is projected in 2D.

References Draft.getType(), DraftVecUtils.isNull(), and DraftVecUtils.project().

Referenced by importDXF.getViewDXF().

def Draft.getGroupContents (   objectslist,
  walls = False,
  addgroups = False 
)
getGroupContents(objectlist,[walls,addgroups]): if any object of the given list
is a group, its content is appened to the list, which is returned. If walls is True,
walls and structures are also scanned for included windows or rebars. If addgroups 
is true, the group itself is also included in the list.

References Draft.getType(), and Draft.isClone().

Referenced by DraftTools.SelectGroup.Activated(), ArchCommands.check(), importGBXML.export(), importOBJ.export(), importDAE.export(), importIFClegacy.export(), importIFC.export(), importDXF.export(), ArchSectionPlane.getDXF(), ArchSectionPlane.getSVG(), ArchFloor.makeFloor(), and ArchSpace.removeSpaceBoundaries().

def Draft.getGroupNames ( )

References Draft.getType().

Referenced by Draft.ungroup().

def Draft.getMovableChildren (   objectslist,
  recursive = True 
)
getMovableChildren(objectslist,[recursive]): extends the given list of objects
with all child objects that have a "MoveWithHost" property set to True. If
recursive is True, all descendents are considered, otherwise only direct children.

References Draft.getType().

Referenced by Draft.move(), and Draft.rotate().

def Draft.getParamType (   param)

Referenced by Draft.getParam(), and Draft.setParam().

def Draft.getRealName (   name)
def Draft.getrgb (   color,
  testbw = True 
)
getRGB(color,[testbw]): returns a rgb value #000000 from a freecad color
if testwb = True (default), pure white will be converted into pure black

References Draft.getParam().

Referenced by ArchPanel.PanelView.execute(), importWebGL.getObjectData(), and Draft.getSVG().

def Draft.getSVG (   obj,
  scale = 1,
  linewidth = 0.35,
  fontsize = 12,
  fillstyle = "shape color",
  direction = None,
  linestyle = None,
  color = None,
  linespacing = None,
  techdraw = False,
  rotation = 0 
)
getSVG(object,[scale], [linewidth],[fontsize],[fillstyle],[direction],[linestyle],[color],[linespacing]):
returns a string containing a SVG representation of the given object,
with the given linewidth and fontsize (used if the given object contains
any text). You can also supply an arbitrary projection vector. the
scale parameter allows to scale linewidths down, so they are resolution-independant.

References DraftVecUtils.angle(), DraftGeomUtils.findEdge(), DraftGeomUtils.geomType(), Draft.getrgb(), Draft.getType(), DraftVecUtils.project(), DraftVecUtils.rotate(), DraftVecUtils.scaleTo(), and Draft.svgpatterns().

Referenced by importSVG.export(), and ArchSectionPlane.getSVG().

def Draft.getType (   obj)

Referenced by DraftTools.Draft_Slope.accept(), ArchPanel.CommandPanelCut.Activated(), DraftTools.Wire.Activated(), Spreadsheet_legacy._Command_Spreadsheet_Controller.Activated(), Spreadsheet_legacy._Command_Spreadsheet_PropertyController.Activated(), DraftTools.AddPoint.Activated(), DraftTools.DelPoint.Activated(), DraftTools.WireToBSpline.Activated(), DraftTools.Draft_FlipDimension.Activated(), DraftTools.Draft_Slope.Activated(), PathScripts.PathEngrave.TaskPanel.addBase(), ArchCommands.addComponents(), DraftTools.Edit.addPoint(), Measure::Measurement.addReference3D(), ArchSpace.addSpaceBoundaries(), ArchComponent.addToComponent(), importSVG.svgHandler.applyTrans(), ArchWall.areSameWallTypes(), ArchCommands.check(), ArchComponent.ViewProviderComponent.claimChildren(), ArchComponent.Component.clone(), Draft.compareObjects(), ArchStructure.StructureTaskPanel.connectNodes(), DraftTools.Edit.delPoint(), DraftTools.Stretch.doStretch(), Draft.downgrade(), ArchPanel.PanelCut.execute(), importGBXML.export(), importIFClegacy.export(), importIFC.export(), Spreadsheet_legacy.export(), importDXF.export(), ArchStructure.StructureTaskPanel.extendNodes(), DraftTools.Edit.finish(), ArchCommands.fixDAG(), Draft.getCloneBase(), Spreadsheet_legacy.Spreadsheet.getControlledCells(), Spreadsheet_legacy.Spreadsheet.getControllingCells(), Spreadsheet_legacy.SpreadsheetController.getDataSet(), ArchSectionPlane.getDXF(), Draft.getDXF(), App::Property.getEditorName(), Draft.getGroupContents(), Draft.getGroupNames(), ArchCommands.getHost(), Draft.getMovableChildren(), Draft.getObjectsOfType(), ArchComponent.Component.getSiblings(), ArchSectionPlane.getSVG(), Draft.getSVG(), Draft.heal(), ArchComponent.Component.hideSubobjects(), importIFC.insert(), Draft.isClone(), ArchVRM.Renderer.join(), ArchWall.joinWalls(), ArchBuilding.makeBuilding(), Draft.makeCopy(), Draft.makeDrawingView(), ArchFloor.makeFloor(), ArchCommands.makeIfcSpreadsheet(), ArchPipe.makePipeConnector(), ArchRebar.makeRebar(), Draft.makeSketch(), ArchSite.makeSolarDiagram(), ArchStructure.makeStructuralSystem(), ArchWall.makeWall(), ArchWindow.makeWindow(), ArchWindow.makeWindowPreset(), ArchCommands.mergeCells(), Draft.move(), DraftTools.Edit.numericInput(), Draft.offset(), ArchComponent.Component.onChanged(), ArchCommands.printWarning(), DraftTools.Edit.proceed(), ArchComponent.Component.processSubShapes(), ArchCommands.pruneIncluded(), Spreadsheet_legacy.Spreadsheet.recompute(), ArchCommands.removeComponents(), ArchComponent.removeFromComponent(), ArchCommands.removeShape(), ArchSpace.removeSpaceBoundaries(), DraftTools.Edit.resetTrackers(), Draft.scale(), DraftTools.Edit.smoothBezPoint(), DraftSnap.Snapper.snap(), DraftSnap.Snapper.snapToExtensions(), DraftSnap.Snapper.snapToSpecials(), DraftTools.Trimex.trimObject(), DraftTools.Trimex.trimObjects(), DraftTools.Edit.update(), and Draft.upgrade().

def Draft.heal (   objlist = None,
  delete = True,
  reparent = True 
)
heal([objlist],[delete],[reparent]) - recreates Draft objects that are damaged,
for example if created from an earlier version. If delete is True,
the damaged objects are deleted (default). If ran without arguments, all the objects
in the document will be healed if they are damaged. If reparent is True (default),
new objects go at the very same place in the tree than their original.

References Draft.getType(), and Draft.makeCopy().

Referenced by DraftTools.Heal.Activated().

def Draft.isClone (   obj,
  objtype,
  recursive = False 
)
isClone(obj,objtype,[recursive]): returns True if the given object is
a clone of an object of the given type. If recursive is True, also check if
the clone is a clone of clone (of clone...)  of the given type.

References Draft.getType().

Referenced by ArchComponent.ViewProviderComponent.claimChildren(), Draft.getGroupContents(), ArchComponent.Component.hideSubobjects(), ArchWindow.makeWindowPreset(), ArchComponent.Component.processSubShapes(), and ArchComponent.removeFromComponent().

def Draft.loadSvgPatterns ( )
def Draft.loadTexture (   filename,
  size = None 
)
loadTexture(filename,[size]): returns a SoSFImage from a file. If size
is defined (an int or a tuple), and provided the input image is a png file,
it will be scaled to match the given size.

Referenced by ArchWall.areSameWallTypes().

def Draft.makeAngularDimension (   center,
  angles,
  p3,
  normal = None 
)
makeAngularDimension(center,angle1,angle2,p3,[normal]): creates an angular Dimension
from the given center, with the given list of angles, passing through p3.

References Draft.formatObject(), Draft.get3DView(), and Draft.select().

def Draft.makeArray (   baseobject,
  arg1,
  arg2,
  arg3,
  arg4 = None,
  name = "Array" 
)
makeArray(object,xvector,yvector,xnum,ynum,[name]) for rectangular array, or
makeArray(object,center,totalangle,totalnum,[name]) for polar array: Creates an array
of the given object
with, in case of rectangular array, xnum of iterations in the x direction
at xvector distance between iterations, and same for y direction with yvector
and ynum. In case of polar array, center is a vector, totalangle is the angle
to cover (in degrees) and totalnum is the number of objects, including the original.
The result is a parametric Draft Array.

References Draft.select().

def Draft.makeBezCurve (   pointslist,
  closed = False,
  placement = None,
  face = None,
  support = None,
  Degree = None 
)
makeBezCurve(pointslist,[closed],[placement]): Creates a Bezier Curve object
from the given list of vectors.   Instead of a pointslist, you can also pass a Part Wire.

References Draft.formatObject(), Draft.select(), and Draft.typecheck().

Referenced by importDXF.drawSpline().

def Draft.makeBlock (   objectslist)
makeBlock(objectslist): Creates a Draft Block from the given objects

References Draft.select().

Referenced by Draft.draftify(), importDXF.drawLayerBlock(), and Draft.upgrade().

def Draft.makeBSpline (   pointslist,
  closed = False,
  placement = None,
  face = None,
  support = None 
)
makeBSpline(pointslist,[closed],[placement]): Creates a B-Spline object
from the given list of vectors. If closed is True or first
and last points are identical, the wire is closed. If face is
true (and wire is closed), the wire will appear filled. Instead of
a pointslist, you can also pass a Part Wire.

References Draft.formatObject(), Draft.select(), and Draft.typecheck().

Referenced by importDXF.drawSplineIterpolation(), Draft.offset(), and TestDraft.DraftTest.testBSpline().

def Draft.makeCircle (   radius,
  placement = None,
  face = None,
  startangle = None,
  endangle = None,
  support = None 
)
makeCircle(radius,[placement,face,startangle,endangle])
or makeCircle(edge,[face]):
Creates a circle object with given radius. If placement is given, it is
used. If face is False, the circle is shown as a
wireframe, otherwise as a face. If startangle AND endangle are given
(in degrees), they are used and the object appears as an arc. If an edge
is passed, its Curve must be a Part.Circle

References DraftVecUtils.angle(), Draft.formatObject(), DraftGeomUtils.geomType(), Draft.select(), and Draft.typecheck().

Referenced by prototype.Node.addtofreecad(), Draft.draftify(), importDXF.drawArc(), importDXF.drawCircle(), Draft.offset(), TestDraft.DraftTest.testArc(), TestDraft.DraftTest.testCircle(), and Part::Module.~Module().

def Draft.makeCopy (   obj,
  force = None,
  reparent = False 
)
makeCopy(object): returns an exact copy of an object

References Draft.formatObject(), Draft.getRealName(), and Draft.getType().

Referenced by Draft.heal(), Draft.move(), Draft.rotate(), and Draft.scale().

def Draft.makeDimension (   p1,
  p2,
  p3 = None,
  p4 = None 
)
makeDimension(p1,p2,[p3]) or makeDimension(object,i1,i2,p3)
or makeDimension(objlist,indices,p3): Creates a Dimension object with
the dimension line passign through p3.The current line width and color
will be used. There are multiple  ways to create a dimension, depending on
the arguments you pass to it:
- (p1,p2,p3): creates a standard dimension from p1 to p2
- (object,i1,i2,p3): creates a linked dimension to the given object,
measuring the distance between its vertices indexed i1 and i2
- (object,i1,mode,p3): creates a linked dimension
to the given object, i1 is the index of the (curved) edge to measure,
and mode is either "radius" or "diameter".

References Draft.formatObject(), Draft.get3DView(), and Draft.select().

Referenced by TestDraft.DraftTest.testDimension().

def Draft.makeDrawingView (   obj,
  page,
  lwmod = None,
  tmod = None,
  otherProjection = None 
)
makeDrawingView(object,page,[lwmod,tmod]) - adds a View of the given object to the
given page. lwmod modifies lineweights (in percent), tmod modifies text heights
(in percent). The Hint scale, X and Y of the page are used.

References Draft.getType(), ArchPanel.makePanelView(), and Draft.svgpatterns().

def Draft.makeEllipse (   majradius,
  minradius,
  placement = None,
  face = True,
  support = None 
)
makeEllipse(majradius,minradius,[placement],[face],[support]): makes
an ellipse with the given major and minor radius, and optionally
a placement.

References Draft.formatObject(), and Draft.select().

Referenced by importDXF.drawEllipse(), and TestDraft.DraftTest.testEllipse().

def Draft.makeFacebinder (   selectionset,
  name = "Facebinder" 
)
makeFacebinder(selectionset,[name]): creates a Facebinder object from a selection set.
Only faces will be added.

References Draft.select().

def Draft.makePathArray (   baseobject,
  pathobject,
  count,
  xlate = None,
  align = False,
  pathobjsubs = [] 
)
makePathArray(docobj,path,count,xlate,align,pathobjsubs): distribute
count copies of a document baseobject along a pathobject or subobjects of a
pathobject. Optionally translates each copy by FreeCAD.Vector xlate direction
and distance to adjust for difference in shape centre vs shape reference point.
Optionally aligns baseobject to tangent/normal/binormal of path.

References Draft.formatObject(), and Draft.select().

Referenced by DraftTools.PathArray.proceed().

def Draft.makePoint (   X = 0,
  Y = 0,
  Z = 0,
  color = None,
  name = "Point",
  point_size = 5 
)
makePoint(x,y,z ,[color(r,g,b),point_size]) or
    makePoint(Vector,color(r,g,b),point_size]) -
    creates a Point in the current document.
    example usage:
    p1 = makePoint()
    p1.ViewObject.Visibility= False # make it invisible
    p1.ViewObject.Visibility= True  # make it visible
    p1 = makePoint(-1,0,0) #make a point at -1,0,0
    p1 = makePoint(1,0,0,(1,0,0)) # color = red
    p1.X = 1 #move it in x
    p1.ViewObject.PointColor =(0.0,0.0,1.0) #change the color-make sure values are floats

References Draft.select().

Referenced by importDXF.processdxf(), and TestDraft.DraftTest.testPoint().

def Draft.makePolygon (   nfaces,
  radius = 1,
  inscribed = True,
  placement = None,
  face = None,
  support = None 
)
makePolgon(nfaces,[radius],[inscribed],[placement],[face]): Creates a
polygon object with the given number of faces and the radius.
if inscribed is False, the polygon is circumscribed around a circle
with the given radius, otherwise it is inscribed. If face is True,
the resulting shape is displayed as a face, otherwise as a wireframe.

References Draft.formatObject(), and Draft.select().

Referenced by prototype.Node.addtofreecad(), Draft.offset(), importCSG.p_cylinder_action(), TestDraft.DraftTest.testPolygon(), and Part::Module.~Module().

def Draft.makeRectangle (   length,
  height,
  placement = None,
  face = None,
  support = None 
)
makeRectangle(length,width,[placement],[face]): Creates a Rectangle
object with length in X direction and height in Y direction.
If a placement is given, it is used. If face is False, the
rectangle is shown as a wireframe, otherwise as a face.

References Draft.formatObject(), Draft.select(), and Draft.typecheck().

Referenced by Draft.offset(), TestArch.ArchTest.testFrame(), TestDraft.DraftTest.testOffset(), TestDraft.DraftTest.testRectangle(), and TestArch.ArchTest.testRoof().

def Draft.makeShape2DView (   baseobj,
  projectionVector = None,
  facenumbers = [] 
)
makeShape2DView(object,[projectionVector,facenumbers]) - adds a 2D shape to the document, which is a
2D projection of the given object. A specific projection vector can also be given. You can also
specify a list of face numbers to be considered in individual faces mode.

References Draft.makeSketch(), and Draft.select().

Referenced by DraftTools.Shape2DView.proceed().

def Draft.makeShapeString (   String,
  FontFile,
  Size = 100,
  Tracking = 0 
)
ShapeString(Text,FontFile,Height,Track): Turns a text string
into a Compound Shape

References Draft.formatObject(), and Draft.select().

def Draft.makeSketch (   objectslist,
  autoconstraints = False,
  addTo = None,
  delete = False,
  name = "Sketch",
  radiusPrecision = -1 
)
makeSketch(objectslist,[autoconstraints],[addTo],[delete],[name],[radiusPrecision]): 

Makes a Sketch objectslist with the given Draft objects. 

* objectlist: can be single or list of objects of Draft type objects,
    Part::Feature, Part.Shape, or mix of them.

* autoconstraints(False): if True, constraints will be automatically added to
    wire nodes, rectangles and circles. 

* addTo(None) : if set to an existing sketch, geometry will be added to it
    instead of creating a new one.

* delete(False): if True, the original object will be deleted. 
    If set to a string 'all' the object and all its linked object will be
    deleted

* name('Sketch'): the name for the new sketch object

* radiusPrecision(-1): If <0, disable radius constraint. If =0, add indiviaul
    radius constraint. If >0, the radius will be rounded according to this
    precision, and 'Equal' constraint will be added to curve with equal
    radius within precision.

References DraftVecUtils.angle(), DraftVecUtils.equals(), Draft.formatObject(), DraftGeomUtils.geomType(), DraftGeomUtils.getNormal(), Draft.getType(), DraftGeomUtils.isAligned(), DraftGeomUtils.isPlanar(), DraftGeomUtils.orientEdge(), and DraftVecUtils.rotate().

Referenced by ArchWall.joinWalls(), Draft.makeShape2DView(), ArchWindow.makeWindowPreset(), and importDXF.processdxf().

def Draft.makeText (   stringslist,
  point = Vector(0,0,0),
  screen = False 
)
makeText(strings,[point],[screen]): Creates a Text object at the given point,
containing the strings given in the strings list, one string by line (strings
can also be one single string). The current color and text height and font
specified in preferences are used.
If screen is True, the text always faces the view direction.

References Draft.formatObject(), Draft.getParam(), Draft.select(), and Draft.typecheck().

Referenced by TestDraft.DraftTest.testText().

def Draft.makeVisGroup (   group = None,
  name = "VisGroup" 
)
makeVisGroup([group]): creates a VisGroup object in the given group, or in the
active document if no group is given

References Draft.formatObject().

Referenced by importDXF.locateLayer().

def Draft.makeWire (   pointslist,
  closed = False,
  placement = None,
  face = None,
  support = None 
)
makeWire(pointslist,[closed],[placement]): Creates a Wire object
from the given list of vectors. If closed is True or first
and last points are identical, the wire is closed. If face is
true (and wire is closed), the wire will appear filled. Instead of
a pointslist, you can also pass a Part Wire.

References Draft.formatObject(), DraftGeomUtils.isReallyClosed(), Draft.select(), and Draft.typecheck().

Referenced by Draft.draftify(), importDXF.drawLine(), importDXF.drawPolyline(), importDXF.drawSplineIterpolation(), Draft.makeLine(), Draft.offset(), importDXF.processdxf(), TestDraft.DraftTest.testWire(), and Draft.upgrade().

def Draft.mirror (   objlist,
  p1,
  p2 
)
mirror(objlist,p1,p2,[clone]): creates a mirrored version of the given object(s)
along an axis that passes through the two vectors p1 and p2.

References Draft.formatObject().

Referenced by shipOutlineDraw.TaskPanel.TaskPanel.accept(), Part::TopoShape.getShape(), and shipOutlineDraw.Preview.Preview.update().

def Draft.offset (   obj,
  delta,
  copy = False,
  bind = False,
  sym = False,
  occ = False 
)
offset(object,delta,[copymode],[bind]): offsets the given wire by
applying the given delta Vector to its first vertex. If copymode is
True, another object is created, otherwise the same object gets
offsetted. If bind is True, and provided the wire is open, the original
and the offsetted wires will be bound by their endpoints, forming a face
if sym is True, bind must be true too, and the offset is made on both
sides, the total width being the given delta length. If offsetting a
BSpline, the delta must not be a Vector but a list of Vectors, one for
each node of the spline.

References Draft.formatObject(), Draft.getParam(), Draft.getType(), DraftGeomUtils.getVerts(), DraftGeomUtils.hasCurves(), DraftGeomUtils.isReallyClosed(), Draft.makeBSpline(), Draft.makeCircle(), Draft.makePolygon(), Draft.makeRectangle(), Draft.makeWire(), DraftGeomUtils.offsetWire(), DraftVecUtils.project(), DraftVecUtils.rotate(), and Draft.select().

Referenced by ImageGui::ImageOrientationDialog.accept(), SketcherGui::SketchOrientationDialog.accept(), geoff_geometry::SpanVertex.Add(), geoff_geometry::SpanVertex.AddSpanID(), FemGui::ViewProviderFemMesh.attach(), PartGui::ViewProviderPartExt.attach(), MeshGui::ViewProviderMesh.attach(), PartGui.checkForSolids(), StdCmdFreezeViews.className(), geoff_geometry.CPTOL(), App::Application.destructObserver(), TechDrawGui::QGIViewDimension.draw(), TechDrawGui::QGIViewPart.drawSectionLine(), Part::Offset.execute(), Part::Offset2D.execute(), PartDesignGui.fixSketchSupport(), geoff_geometry::SpanVertex.Get(), geoff_geometry::Kurve.Get(), Fem::FemMesh.getElementNodes(), geoff_geometry::SpanVertex.GetIndex(), Mesh::MeshObject.getKernel(), Part::TopoShape.getShape(), Path::Area.getShape(), geoff_geometry::SpanVertex.GetSpanID(), PartDesign::LinearPattern.getTransformations(), PartDesign::PolarPattern.getTransformations(), TechDrawGui::QGISectionLine.makeArrows(), Part::Extrusion.makeDraft(), TechDrawGui::QGISectionLine.makeLine(), Part::TopoShapePy.makeOffset2D(), Part::TopoShapePy.makeOffsetShape(), TechDrawGui::QGISectionLine.makeSymbols(), Part::TopoShapePy.makeThickness(), ImageGui::ImageView.mouseDoubleClickEvent(), ImageGui::ImageView.mouseMoveEvent(), ImageGui::ImageView.mousePressEvent(), ImageGui::ImageView.mouseReleaseEvent(), geoff_geometry::Span.Offset(), Part::TopoShapeSolidPy.offsetFaces(), geoff_geometry::Kurve.OffsetISOMethod(), geoff_geometry::Kurve.OffsetMethod1(), PartGui::OffsetWidget.OffsetWidget(), PartGui::ViewProviderOffset.onDelete(), ColorPickerButton.paintEvent(), Part::OffsetSurfacePy.PyInit(), Part::OffsetCurvePy.PyInit(), Part::OffsetCurve2dPy.PyInit(), geoff_geometry::Kurve.Reverse(), zipios::ZipCDirEntry.setLocalHeaderOffset(), zipios::EndOfCentralDirectory.setOffset(), StrXUTF8.StrXUTF8(), TestDraft.DraftTest.testOffset(), ImageGui::ImageView.wheelEvent(), XUTF8Str.XUTF8Str(), and zipios::ZipCDirEntry.ZipCDirEntry().

def Draft.printShape (   shape)
prints detailed information of a shape
def Draft.QT_TRANSLATE_NOOP (   ctxt,
  txt 
)

Referenced by ArchPanel.CommandPanelSheet.Activated(), ArchStructure.StructSelectionObserver.addSelection(), ArchWall.areSameWallTypes(), Gui::PropertyEditor::PropertyModel.buildUp(), ArchEquipment.createMeshView(), Part::FaceMakerCheese.getBriefExplanation(), Part::FaceMakerBullseye.getBriefExplanation(), Part::FaceMakerSimple.getBriefExplanation(), Part::FaceMakerExtrusion.getBriefExplanation(), ArchSectionPlane.getDXF(), ArchPanel.CommandPanel.GetResources(), ArchPanel.CommandPanelCut.GetResources(), ArchPanel.CommandPanelSheet.GetResources(), ArchPanel.CommandPanelGroup.GetResources(), Part::FaceMakerCheese.getUserFriendlyName(), Part::FaceMakerBullseye.getUserFriendlyName(), Part::FaceMakerSimple.getUserFriendlyName(), Part::FaceMakerExtrusion.getUserFriendlyName(), InitGui.PathWorkbench.Initialize(), InitGui.DraftWorkbench.Initialize(), InitGui.OpenSCADWorkbench.Initialize(), MeshGui.initModule(), PartGui.initModule(), Gui::MainWindow.MainWindow(), ArchAxis.makeAxis(), ArchBuilding.makeBuilding(), ArchFloor.makeFloor(), ArchFrame.makeFrame(), ArchPipe.makePipeConnector(), ArchProfile.makeProfile(), ArchRebar.makeRebar(), ArchRoof.makeRoof(), ArchSite.makeSolarDiagram(), ArchStairs.makeStairs(), ArchStructure.makeStructuralSystem(), ArchWindow.makeWindowPreset(), Gui::PropertyEditor::PropertyItem.propertyName(), Gui::PropertyEditor::PropertyPlacementItem.PropertyPlacementItem(), ArchSpace.removeSpaceBoundaries(), Gui::ViewProviderOrigin.ViewProviderOrigin(), Gui::ViewProviderOriginFeature.ViewProviderOriginFeature(), SandboxGui::Workbench.Workbench(), and SketcherGui::Module.~Module().

def Draft.removeHidden (   objectslist)
removeHidden(objectslist): removes hidden objects from the list

Referenced by ArchCommands.check(), ArchSectionPlane.getDXF(), and ArchSectionPlane.getSVG().

def Draft.rotate (   objectslist,
  angle,
  center = Vector(0,0,0),
  axis = Vector(0,0,1),
  copy = False 
)
rotate(objects,angle,[center,axis,copy]): Rotates the objects contained
in objects (that can be a list of objects or an object) of the given angle
(in degrees) around the center, using axis as a rotation axis. If axis is
omitted, the rotation will be around the vertical Z axis.
If copy is True, the actual objects are not moved, but copies
are created instead. The objects (or their copies) are returned.

References Draft.formatObject(), Draft.getMovableChildren(), Draft.getParam(), Draft.makeCopy(), Draft.select(), DraftVecUtils.tup(), and Draft.typecheck().

Referenced by importDXF.addText(), Mod.PartDesign.fcgear.svggear.SVGWireBuilder.arc(), Draft.array(), Mod.PartDesign.fcgear.svggear.SVGWireBuilder.curve(), Mod.PartDesign.fcgear.svggear.SVGWireBuilder.line(), Mod.PartDesign.fcgear.svggear.SVGWireBuilder.move(), geoff_geometry::Matrix.Rotate(), TestDraft.DraftTest.testRotate(), and TechDrawGui::QGIView.updateView().

def Draft.scale (   objectslist,
  delta = Vector(1,1,1),
  center = Vector(0,0,0),
  copy = False,
  legacy = False 
)
scale(objects,vector,[center,copy,legacy]): Scales the objects contained
in objects (that can be a list of objects or an object) of the given scale
factors defined by the given vector (in X, Y and Z directions) around
given center. If legacy is True, direct (old) mode is used, otherwise
a parametric copy is made. If copy is True, the actual objects are not moved,
but copies are created instead. The objects (or their copies) are returned.

References Draft.formatObject(), Draft.getParam(), Draft.getType(), Draft.makeCopy(), DraftVecUtils.project(), and Draft.select().

Referenced by FemGui::TaskDlgFemConstraintInitialTemperature.accept(), FemGui::TaskDlgFemConstraintFixed.accept(), FemGui::TaskDlgFemConstraintPlaneRotation.accept(), FemGui::TaskDlgFemConstraintPressure.accept(), FemGui::TaskDlgFemConstraintContact.accept(), FemGui::TaskDlgFemConstraintTemperature.accept(), FemGui::TaskDlgFemConstraintForce.accept(), FemGui::TaskDlgFemConstraintHeatflux.accept(), FemGui::TaskDlgFemConstraintTransform.accept(), FemGui::TaskDlgFemConstraintFluidBoundary.accept(), FemGui::TaskDlgFemConstraintDisplacement.accept(), TechDrawGeometry::GeometryObject.addGeomFromCompound(), Gui::NavigationStyle.boxZoom(), Part::TopoShape.convertToMatrix(), TechDrawGui::QGIViewPart.drawMatting(), TechDrawGui::QGIViewPart.drawSectionLine(), TechDraw::DrawViewDetail.execute(), DraftGeomUtils.fillet(), SketcherGui::SoDatumLabel.generatePrimitives(), DrawingGui::OrthoViews.get_configs(), MeshGui::ViewProviderMesh.getFacetsOfRegion(), DrawingGui::orthoview.getScale(), Gui::SoAutoZoomTranslation.getScaleFactor(), SketcherGui::SoZoomTranslation.getScaleFactor(), SketcherGui::ViewProviderSketch.getScaleFactor(), Drawing::ProjectionAlgos.getSVG(), Base::Rotation.getValue(), Fem::Constraint.getViewProviderName(), TechDraw::DrawGeomHatch.getViewProviderName(), Gui::SoShapeScale.GLRender(), SketcherGui::SoDatumLabel.GLRender(), StdCmdToggleNavigation.isActive(), TechDraw::DrawGeomHatch.makeEdgeOverlay(), TechDraw::DrawProjGroup.makeViewBbs(), Fem::ConstraintPressure.onChanged(), Fem::ConstraintPlaneRotation.onChanged(), Fem::ConstraintFixed.onChanged(), Fem::ConstraintHeatflux.onChanged(), Fem::ConstraintInitialTemperature.onChanged(), Fem::ConstraintForce.onChanged(), Fem::ConstraintTemperature.onChanged(), Fem::ConstraintTransform.onChanged(), Fem::ConstraintContact.onChanged(), Fem::ConstraintFluidBoundary.onChanged(), Fem::ConstraintDisplacement.onChanged(), geoff_geometry::Matrix.operator!=(), DrawingGui::orthoview.orthoview(), DrawingGui::OrthoViews.OrthoViews(), Gui::NavigationStyle.processMotionEvent(), Fem::FemVTKTools.readFluidicResult(), ImageGui::GLImageBox.redraw(), Base::Matrix4D.scale(), TechDrawGui::TaskProjGroup.scaleManuallyChanged(), TechDrawGui::TaskProjGroup.scaleTypeChanged(), DrawingGui::OrthoViews.set_configs(), DrawingGui::OrthoViews.set_Ortho(), DrawingGui::orthoview.setPos(), DrawingGui::orthoview.setScale(), Base::Rotation.setValue(), MeshCore::PlaneFitSmoothing.Smooth(), MeshCore::PlaneFitSmoothing.SmoothPoints(), DraftSnap.Snapper.snapToPolygon(), GCS::System.solve(), Gui::SoShapeScale.SoShapeScale(), geoff_geometry::Circle.Transform(), TechDraw::DrawProjGroup.updateChildren(), RotTransDragger.valueChangedCB(), TechDrawGui::TaskProjGroup.viewToggled(), DrawingGui::SvgView.wheelEvent(), TechDrawGui::QGVPage.wheelEvent(), DrawingGui::Module.~Module(), Drawing::Module.~Module(), TechDraw::Module.~Module(), and DrawingGui::OrthoViews.~OrthoViews().

def Draft.shapify (   obj)
shapify(object): transforms a parametric shape object into
non-parametric and returns the new object

References DraftGeomUtils.geomType(), and Draft.getRealName().

Referenced by Draft.downgrade().

def Draft.stringencodecoin (   ustr)
stringencodecoin(str): Encodes a unicode object to be used as a string in coin
def Draft.svgpatterns ( )
svgpatterns(): returns a dictionnary with installed SVG patterns

References Draft.loadSvgPatterns().

Referenced by ArchWall.areSameWallTypes(), Draft.getSVG(), and Draft.makeDrawingView().

def Draft.ungroup (   obj)
def Draft.upgrade (   objects,
  delete = False,
  force = None 
)
upgrade(objects,delete=False,force=None): Upgrades the given object(s) (can be
an object or a list of objects). If delete is True, old objects are deleted.
The force attribute can be used to
force a certain way of upgrading. It can be: makeCompound, closeGroupWires,
makeSolid, closeWire, turnToParts, makeFusion, makeShell, makeFaces, draftify,
joinFaces, makeSketchFace, makeWires
Returns a dictionnary containing two lists, a list of new objects and a list
of objects to be deleted

References DraftGeomUtils.concatenate(), Draft.draftify(), Draft.fuse(), DraftGeomUtils.geomType(), Draft.getType(), DraftGeomUtils.hasCurves(), DraftGeomUtils.isCoplanar(), Draft.makeBlock(), Draft.makeLine(), and Draft.makeWire().

Variable Documentation

list Draft.arrowtypes = ["Dot","Circle","Arrow","Tick"]