diff --git a/src/Mod/Draft/App/PreCompiled.cpp b/src/Mod/Draft/App/PreCompiled.cpp index 6c2bd0aad7..2432ed0264 100644 --- a/src/Mod/Draft/App/PreCompiled.cpp +++ b/src/Mod/Draft/App/PreCompiled.cpp @@ -20,4 +20,4 @@ * * ***************************************************************************/ -#include "PreCompiled.h" +#include "PreCompiled.h" diff --git a/src/Mod/Draft/draftfunctions/array.py b/src/Mod/Draft/draftfunctions/array.py index 7b0a187935..4222b7e953 100644 --- a/src/Mod/Draft/draftfunctions/array.py +++ b/src/Mod/Draft/draftfunctions/array.py @@ -39,14 +39,14 @@ def array(objectslist, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None): """ This function creates an array of independent objects. Use make_array() to create a parametric array object. - + Creates an array of the given objects (that can be an object or a list of objects). In case of rectangular array, xnum of iterations in the x direction at xvector distance between iterations, and same for y and z directions with yvector and ynum and zvector and znum. - + 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. @@ -69,7 +69,7 @@ def array(objectslist, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None): def rectArray(objectslist,xvector,yvector,xnum,ynum): - utils.type_check([(xvector, App.Vector), + utils.type_check([(xvector, App.Vector), (yvector, App.Vector), (xnum,int), (ynum,int)], "rectArray") diff --git a/src/Mod/Draft/draftfunctions/draftify.py b/src/Mod/Draft/draftfunctions/draftify.py index b708638311..8d8d14e762 100644 --- a/src/Mod/Draft/draftfunctions/draftify.py +++ b/src/Mod/Draft/draftfunctions/draftify.py @@ -45,10 +45,10 @@ DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils") def draftify(objectslist, makeblock=False, delete=True): """draftify(objectslist,[makeblock],[delete]) - - Turn each object of the given list (objectslist can also be a single - object) into a Draft parametric wire. - + + Turn each object of the given list (objectslist can also be a single + object) into a Draft parametric wire. + TODO: support more objects Parameters @@ -57,7 +57,7 @@ def draftify(objectslist, makeblock=False, delete=True): makeblock : bool If makeblock is True, multiple objects will be grouped in a block. - + delete : bool If delete = False, old objects are not deleted """ diff --git a/src/Mod/Draft/draftfunctions/extrude.py b/src/Mod/Draft/draftfunctions/extrude.py index 082b396828..970bdaa0df 100644 --- a/src/Mod/Draft/draftfunctions/extrude.py +++ b/src/Mod/Draft/draftfunctions/extrude.py @@ -33,7 +33,7 @@ import draftutils.gui_utils as gui_utils def extrude(obj, vector, solid=False): """extrude(object, vector, [solid]) - + Create a Part::Extrusion object from a given object. Parameters @@ -42,7 +42,7 @@ def extrude(obj, vector, solid=False): vector : Base.Vector The extrusion direction and module. - + solid : bool TODO: describe. """ diff --git a/src/Mod/Draft/draftfunctions/fuse.py b/src/Mod/Draft/draftfunctions/fuse.py index 7d34e35ed4..899aa3880d 100644 --- a/src/Mod/Draft/draftfunctions/fuse.py +++ b/src/Mod/Draft/draftfunctions/fuse.py @@ -38,11 +38,11 @@ if App.GuiUp: def fuse(object1, object2): """fuse(oject1, object2) - - Returns an object made from the union of the 2 given objects. + + 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. - + """ if not App.ActiveDocument: App.Console.PrintError("No active document. Aborting\n") diff --git a/src/Mod/Draft/draftfunctions/heal.py b/src/Mod/Draft/draftfunctions/heal.py index 49e841c779..0e3c01ac72 100644 --- a/src/Mod/Draft/draftfunctions/heal.py +++ b/src/Mod/Draft/draftfunctions/heal.py @@ -35,9 +35,9 @@ from draftmake.make_copy import make_copy def heal(objlist=None, delete=True, reparent=True): """heal([objlist],[delete],[reparent]) - + Recreate Draft objects that are damaged, for example if created from an - earlier version. If ran without arguments, all the objects in the document + earlier version. If ran without arguments, all the objects in the document will be healed if they are damaged. Parameters @@ -48,7 +48,7 @@ def heal(objlist=None, delete=True, reparent=True): If delete is True, the damaged objects are deleted (default). reparent : bool - If reparent is True (default), new objects go at the very same place + If reparent is True (default), new objects go at the very same place in the tree than their original. """ diff --git a/src/Mod/Draft/draftgeoutils/geo_arrays.py b/src/Mod/Draft/draftgeoutils/geo_arrays.py index a798967888..e4410d58d7 100644 --- a/src/Mod/Draft/draftgeoutils/geo_arrays.py +++ b/src/Mod/Draft/draftgeoutils/geo_arrays.py @@ -100,7 +100,7 @@ def get_twisted_placements(path, count=15, rot_factor=0.25): places.append(place) params.append((v0, tan, angle, rot)) - + increment += inc return places, params diff --git a/src/Mod/Draft/draftmake/make_block.py b/src/Mod/Draft/draftmake/make_block.py index b1edce5538..2ca91d1dd1 100644 --- a/src/Mod/Draft/draftmake/make_block.py +++ b/src/Mod/Draft/draftmake/make_block.py @@ -38,7 +38,7 @@ if App.GuiUp: def make_block(objectslist): """make_block(objectslist) - + Creates a Draft Block from the given objects. Parameters diff --git a/src/Mod/Draft/draftmake/make_drawingview.py b/src/Mod/Draft/draftmake/make_drawingview.py index 4fa5c97db5..c7a7d9c37b 100644 --- a/src/Mod/Draft/draftmake/make_drawingview.py +++ b/src/Mod/Draft/draftmake/make_drawingview.py @@ -40,17 +40,17 @@ from draftobjects.drawingview import DrawingView def make_drawing_view(obj, page, lwmod=None, tmod=None, otherProjection=None): """ make_drawing_view(object,page,[lwmod,tmod]) - + This function is OBSOLETE, since TechDraw substituted the Drawing Workbench. - Add a View of the given object to the given page. + Add a View of the given object to the given page. Parameters ---------- - lwmod : - modifies lineweights (in percent), - + lwmod : + modifies lineweights (in percent), + tmod : - modifies text heights (in percent). + modifies text heights (in percent). The Hint scale, X and Y of the page are used. TODO: Document it properly diff --git a/src/Mod/Draft/draftmake/make_line.py b/src/Mod/Draft/draftmake/make_line.py index eec782f38b..d1030a0be8 100644 --- a/src/Mod/Draft/draftmake/make_line.py +++ b/src/Mod/Draft/draftmake/make_line.py @@ -33,18 +33,18 @@ import draftmake.make_wire as make_wire def make_line(first_param, last_param=None): """makeLine(first_param, p2) - + Creates a line from 2 points or from a given object. Parameters ---------- - first_param : + first_param : Base.Vector -> First point of the line (if p2 is None) Part.LineSegment -> Line is created from the given Linesegment Shape -> Line is created from the give Shape last_param : Base.Vector - Second point of the line, if not set the function evaluates + Second point of the line, if not set the function evaluates the first_param to look for a Part.LineSegment or a Shape """ if last_param: diff --git a/src/Mod/Draft/draftmake/make_shape2dview.py b/src/Mod/Draft/draftmake/make_shape2dview.py index fb72dc7af0..402b8ec3ba 100644 --- a/src/Mod/Draft/draftmake/make_shape2dview.py +++ b/src/Mod/Draft/draftmake/make_shape2dview.py @@ -38,12 +38,12 @@ if App.GuiUp: def make_shape2dview(baseobj,projectionVector=None,facenumbers=[]): """make_shape2dview(object, [projectionVector], [facenumbers]) - - Add a 2D shape to the document, which is a 2D projection of the given object. - + + Add a 2D shape to the document, which is a 2D projection of the given object. + Parameters ---------- - object : + object : TODO: Describe projectionVector : Base.Vector diff --git a/src/Mod/Draft/draftmake/make_shapestring.py b/src/Mod/Draft/draftmake/make_shapestring.py index 1acd3bb029..b413b39145 100644 --- a/src/Mod/Draft/draftmake/make_shapestring.py +++ b/src/Mod/Draft/draftmake/make_shapestring.py @@ -38,19 +38,19 @@ if App.GuiUp: def make_shapestring(String, FontFile, Size=100, Tracking=0): """ShapeString(Text,FontFile,[Height],[Track]) - + Turns a text string into a Compound Shape - + Parameters ---------- - majradius : + majradius : Major radius of the ellipse. """ if not App.ActiveDocument: App.Console.PrintError("No active document. Aborting\n") return - + obj = App.ActiveDocument.addObject("Part::Part2DObjectPython", "ShapeString") ShapeString(obj) diff --git a/src/Mod/Draft/draftmake/make_wpproxy.py b/src/Mod/Draft/draftmake/make_wpproxy.py index ea232109c0..62ae7dedf6 100644 --- a/src/Mod/Draft/draftmake/make_wpproxy.py +++ b/src/Mod/Draft/draftmake/make_wpproxy.py @@ -37,7 +37,7 @@ if App.GuiUp: def make_workingplaneproxy(placement): """make_working_plane_proxy(placement) - + Creates a Working Plane proxy object in the current document. Parameters diff --git a/src/Mod/Draft/draftobjects/bezcurve.py b/src/Mod/Draft/draftobjects/bezcurve.py index 60f0623055..54f12e4eb6 100644 --- a/src/Mod/Draft/draftobjects/bezcurve.py +++ b/src/Mod/Draft/draftobjects/bezcurve.py @@ -45,7 +45,7 @@ class BezCurve(DraftObject): "The points of the Bezier curve") obj.addProperty("App::PropertyVectorList", "Points", "Draft", _tip) - _tip = QT_TRANSLATE_NOOP("App::Property", + _tip = QT_TRANSLATE_NOOP("App::Property", "The degree of the Bezier function") obj.addProperty("App::PropertyInteger", "Degree", "Draft", _tip) @@ -99,7 +99,7 @@ class BezCurve(DraftObject): #fp.Continuity = [0]*numsegments def onChanged(self, fp, prop): - if prop == 'Closed': + if prop == 'Closed': # if remove the last entry when curve gets opened oldlen = len(fp.Continuity) newlen = (len(self._segpoleslst(fp))-1+1*fp.Closed) @@ -108,15 +108,15 @@ class BezCurve(DraftObject): if oldlen < newlen: fp.Continuity = fp.Continuity + [0]*(newlen-oldlen) - if (hasattr(fp,'Closed') and - fp.Closed and + if (hasattr(fp,'Closed') and + fp.Closed and prop in ['Points','Degree','Closed'] and len(fp.Points) % fp.Degree): # the curve editing tools can't handle extra points - fp.Points=fp.Points[:(fp.Degree*(len(fp.Points)//fp.Degree))] + fp.Points=fp.Points[:(fp.Degree*(len(fp.Points)//fp.Degree))] #for closed curves - if prop in ["Degree"] and fp.Degree >= 1: + if prop in ["Degree"] and fp.Degree >= 1: self.resetcontinuity(fp) if prop in ["Points","Degree","Continuity","Closed"]: @@ -149,7 +149,7 @@ class BezCurve(DraftObject): if hasattr(fp,"Area") and hasattr(w,"Area"): fp.Area = w.Area if hasattr(fp,"Length") and hasattr(w,"Length"): - fp.Length = w.Length + fp.Length = w.Length fp.Placement = plm @classmethod diff --git a/src/Mod/Draft/draftobjects/bspline.py b/src/Mod/Draft/draftobjects/bspline.py index d16ffb4ec2..22c6de731e 100644 --- a/src/Mod/Draft/draftobjects/bspline.py +++ b/src/Mod/Draft/draftobjects/bspline.py @@ -49,7 +49,7 @@ class BSpline(DraftObject): "If the B-spline is closed or not") obj.addProperty("App::PropertyBool","Closed", "Draft", _tip) - _tip = QT_TRANSLATE_NOOP("App::Property", + _tip = QT_TRANSLATE_NOOP("App::Property", "Create a face if this spline is closed") obj.addProperty("App::PropertyBool","MakeFace", "Draft",_tip) diff --git a/src/Mod/Draft/draftobjects/circle.py b/src/Mod/Draft/draftobjects/circle.py index 3a7af22c91..7be18b3827 100644 --- a/src/Mod/Draft/draftobjects/circle.py +++ b/src/Mod/Draft/draftobjects/circle.py @@ -42,7 +42,7 @@ class Circle(DraftObject): super(Circle, self).__init__(obj, "Circle") _tip = QT_TRANSLATE_NOOP("App::Property", "Start angle of the arc") - obj.addProperty("App::PropertyAngle", "FirstAngle", + obj.addProperty("App::PropertyAngle", "FirstAngle", "Draft", _tip) _tip = QT_TRANSLATE_NOOP("App::Property", "End angle of the arc (for a full circle, \ diff --git a/src/Mod/Draft/draftobjects/clone.py b/src/Mod/Draft/draftobjects/clone.py index e89c0f0ce5..e30bd077a6 100644 --- a/src/Mod/Draft/draftobjects/clone.py +++ b/src/Mod/Draft/draftobjects/clone.py @@ -56,7 +56,7 @@ class Clone(DraftObject): "set True for fusion or False for compound") obj.addProperty("App::PropertyBool", "Fuse", "Draft", _tip) - + obj.Scale = App.Vector(1,1,1) def join(self,obj,shapes): diff --git a/src/Mod/Draft/draftobjects/polygon.py b/src/Mod/Draft/draftobjects/polygon.py index 7ef39dfaa2..a83ddbae70 100644 --- a/src/Mod/Draft/draftobjects/polygon.py +++ b/src/Mod/Draft/draftobjects/polygon.py @@ -50,27 +50,27 @@ class Polygon(DraftObject): _tip = QT_TRANSLATE_NOOP("App::Property", "Radius of the control circle") obj.addProperty("App::PropertyLength", "Radius", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "How the polygon must be drawn from the control circle") obj.addProperty("App::PropertyEnumeration", "DrawMode", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "Radius to use to fillet the corners") obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "Size of the chamfer to give to the corners") obj.addProperty("App::PropertyLength", "ChamferSize", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "Create a face") obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object") obj.addProperty("App::PropertyArea", "Area", "Draft", _tip) - + obj.MakeFace = get_param("fillmode",True) obj.DrawMode = ['inscribed','circumscribed'] obj.FacesNumber = 0 @@ -101,7 +101,7 @@ class Polygon(DraftObject): shape = w if "FilletRadius" in obj.PropertiesList: if obj.FilletRadius.Value != 0: - w = DraftGeomUtils.filletWire(shape, + w = DraftGeomUtils.filletWire(shape, obj.FilletRadius.Value) if w: shape = w diff --git a/src/Mod/Draft/draftobjects/rectangle.py b/src/Mod/Draft/draftobjects/rectangle.py index 27dac7cf49..d0db0ea0cd 100644 --- a/src/Mod/Draft/draftobjects/rectangle.py +++ b/src/Mod/Draft/draftobjects/rectangle.py @@ -50,22 +50,22 @@ class Rectangle(DraftObject): _tip = QT_TRANSLATE_NOOP("App::Property", "Radius to use to fillet the corners") obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "Size of the chamfer to give to the corners") obj.addProperty("App::PropertyLength", "ChamferSize", "Draft", _tip) _tip = QT_TRANSLATE_NOOP("App::Property", "Create a face") obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "Horizontal subdivisions of this rectangle") obj.addProperty("App::PropertyInteger", "Rows", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "Vertical subdivisions of this rectangle") obj.addProperty("App::PropertyInteger", "Columns", "Draft", _tip) - + _tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object") obj.addProperty("App::PropertyArea", "Area", "Draft", _tip) - + obj.MakeFace = get_param("fillmode",True) obj.Length=1 obj.Height=1 @@ -83,7 +83,7 @@ class Rectangle(DraftObject): plm = obj.Placement shape = None - + if hasattr(obj,"Rows") and hasattr(obj,"Columns"): # TODO: verify if this is needed: if obj.Rows > 1: @@ -157,7 +157,7 @@ class Rectangle(DraftObject): shape = Part.Face(shape) else: shape = Part.Face(shape) - + obj.Shape = shape if hasattr(obj,"Area") and hasattr(shape,"Area"): diff --git a/src/Mod/Draft/draftobjects/wire.py b/src/Mod/Draft/draftobjects/wire.py index 148d291405..bc7c33c922 100644 --- a/src/Mod/Draft/draftobjects/wire.py +++ b/src/Mod/Draft/draftobjects/wire.py @@ -91,7 +91,7 @@ class Wire(DraftObject): _tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object") obj.addProperty("App::PropertyArea","Area", "Draft",_tip) - + obj.MakeFace = get_param("fillmode",True) obj.Closed = False diff --git a/src/Mod/Draft/drafttests/test_draftgeomutils.py b/src/Mod/Draft/drafttests/test_draftgeomutils.py index 3cf94f1c38..4e72a3eddd 100644 --- a/src/Mod/Draft/drafttests/test_draftgeomutils.py +++ b/src/Mod/Draft/drafttests/test_draftgeomutils.py @@ -94,7 +94,7 @@ class TestDraftGeomUtils(unittest.TestCase): edge.Orientation = "Reversed" edges.append(edge) wire6 = Part.Wire(edges) - + edges = [] for start, mid, end in zip(points[:-2], points[1:-1], points[2:]): edge = Part.Arc(start, mid, end).toShape() @@ -122,7 +122,7 @@ class TestDraftGeomUtils(unittest.TestCase): num_subtests += 1 # TODO: it should be "with self.subtest(subtest):" but then it doesn't report failures. extended = DraftGeomUtils.get_extended_wire(wire, offset_start, offset_end) # Test that the extended wire's length is correctly changed - self.assertAlmostEqual(extended.Length, wire.Length + offset_start + offset_end, + self.assertAlmostEqual(extended.Length, wire.Length + offset_start + offset_end, DraftGeomUtils.precision(), "'{0}.{1}' failed".format(operation, subtest)) if offset_start == 0.0: # If offset_start is 0.0, check that the wire's start point is unchanged