From 77882051fa930963d64d6cdd2f3d674b745699b1 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 2 Jan 2015 19:53:39 -0200 Subject: [PATCH] Draft: Made initial Face mode dependent on fill mode pref setting - fixes #1812 --- src/Mod/Draft/Draft.py | 26 ++++++++++---------- src/Mod/Draft/Resources/ui/userprefs-base.ui | 5 +++- src/Mod/Draft/importDXF.py | 5 ++-- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 647e1db81873..47a8ef3adf8b 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -610,7 +610,7 @@ def makeCircle(radius, placement=None, face=True, startangle=None, endangle=None n = "Circle" obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",n) _Circle(obj) - obj.MakeFace = face + #obj.MakeFace = face if isinstance(radius,Part.Edge): edge = radius if DraftGeomUtils.geomType(edge) == "Circle": @@ -653,7 +653,7 @@ def makeRectangle(length, height, placement=None, face=True, support=None): obj.Length = length obj.Height = height obj.Support = support - obj.MakeFace = face + #obj.MakeFace = face if placement: obj.Placement = placement if gui: _ViewProviderRectangle(obj.ViewObject) @@ -789,7 +789,7 @@ def makeWire(pointslist,closed=False,placement=None,face=True,support=None): obj.Points = pointslist obj.Closed = closed obj.Support = support - obj.MakeFace = face + #obj.MakeFace = face if placement: obj.Placement = placement if gui: _ViewProviderWire(obj.ViewObject) @@ -810,7 +810,7 @@ def makePolygon(nfaces,radius=1,inscribed=True,placement=None,face=True,support= _Polygon(obj) obj.FacesNumber = nfaces obj.Radius = radius - obj.MakeFace = face + #obj.MakeFace = face if inscribed: obj.DrawMode = "inscribed" else: @@ -861,7 +861,7 @@ def makeBSpline(pointslist,closed=False,placement=None,face=True,support=None): obj.Closed = closed obj.Points = pointslist obj.Support = support - obj.MakeFace = face + #obj.MakeFace = face if placement: obj.Placement = placement if gui: _ViewProviderWire(obj.ViewObject) @@ -892,7 +892,7 @@ def makeBezCurve(pointslist,closed=False,placement=None,face=True,support=None,D Part.BezierCurve().MaxDegree) obj.Closed = closed obj.Support = support - obj.MakeFace = face + #obj.MakeFace = face obj.Proxy.resetcontinuity(obj) if placement: obj.Placement = placement if gui: @@ -3941,7 +3941,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyLength","FilletRadius","Draft","Radius to use to fillet the corners") obj.addProperty("App::PropertyLength","ChamferSize","Draft","Size of the chamfer to give to the corners") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) obj.Length=1 obj.Height=1 @@ -3987,7 +3987,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyAngle","LastAngle","Draft","End angle of the arc (for a full circle, give it same value as First Angle)") obj.addProperty("App::PropertyLength","Radius","Draft","Radius of the circle") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) def execute(self, obj): import Part @@ -4011,7 +4011,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyLength","MinorRadius","Draft","The minor radius of the ellipse") obj.addProperty("App::PropertyLength","MajorRadius","Draft","The major radius of the ellipse") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) def execute(self, obj): import Part @@ -4044,7 +4044,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyLength","FilletRadius","Draft","Radius to use to fillet the corners") obj.addProperty("App::PropertyLength","ChamferSize","Draft","Size of the chamfer to give to the corners") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face if this object is closed") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) obj.Closed = False def execute(self, obj): @@ -4200,7 +4200,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyLength","FilletRadius","Draft","Radius to use to fillet the corners") obj.addProperty("App::PropertyLength","ChamferSize","Draft","Size of the chamfer to give to the corners") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) obj.DrawMode = ['inscribed','circumscribed'] obj.FacesNumber = 0 obj.Radius = 1 @@ -4304,7 +4304,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyVectorList","Points","Draft", "The points of the b-spline") obj.addProperty("App::PropertyBool","Closed","Draft","If the b-spline is closed or not") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face if this spline is closed") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) obj.Closed = False obj.Points = [] @@ -4355,7 +4355,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyBool","Closed","Draft", "If the Bezier curve should be closed or not") obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face if this curve is closed") - obj.MakeFace = True + obj.MakeFace = getParam("fillmode",True) obj.Closed = False obj.Degree = 3 obj.Continuity = [] diff --git a/src/Mod/Draft/Resources/ui/userprefs-base.ui b/src/Mod/Draft/Resources/ui/userprefs-base.ui index 9a4061e15eff..74b1a83b8e98 100755 --- a/src/Mod/Draft/Resources/ui/userprefs-base.ui +++ b/src/Mod/Draft/Resources/ui/userprefs-base.ui @@ -7,7 +7,7 @@ 0 0 487 - 462 + 474 @@ -365,6 +365,9 @@ Values with differences below this value will be treated as same. Fill objects with faces whenever possible + + true + fillmode diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index 09364e0df410..9211945240d6 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -404,7 +404,7 @@ def drawPolyline(polyline,forceShape=False,num=None): ob.Closed = polyline.closed return ob else: - if polyline.closed: + if polyline.closed and dxfFillMode: w = Part.Wire(edges) return(Part.Face(w)) else: @@ -603,7 +603,7 @@ def drawSpline(spline,forceShape=False): # print(knots) sp.interpolate(verts) sh = Part.Wire(sp.toShape()) - if closed: + if closed and dxfFillMode: return Part.Face(sh) else: return sh @@ -1811,5 +1811,6 @@ def exportPageLegacy(page,filename): dxfUseStandardSize = p.GetBool("dxfStdSize",False) dxfGetColors = p.GetBool("dxfGetOriginalColors",False) dxfUseDraftVisGroups = p.GetBool("dxfUseDraftVisGroups",False) +dxfFillMode = p.GetBool("fillmode",True) dxfBrightBackground = isBrightBackground() dxfDefaultColor = getColor()