Draft: fix trailing whitespace
This commit is contained in:
@@ -20,4 +20,4 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -38,7 +38,7 @@ if App.GuiUp:
|
||||
|
||||
def make_block(objectslist):
|
||||
"""make_block(objectslist)
|
||||
|
||||
|
||||
Creates a Draft Block from the given objects.
|
||||
|
||||
Parameters
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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, \
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user