Draft: Made initial Face mode dependent on fill mode pref setting - fixes #1812

This commit is contained in:
Yorik van Havre 2015-01-02 19:53:39 -02:00
parent 08828e5dc0
commit 77882051fa
3 changed files with 20 additions and 16 deletions

View File

@ -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 @@ class _Rectangle(_DraftObject):
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 @@ class _Circle(_DraftObject):
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 @@ class _Ellipse(_DraftObject):
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 @@ class _Wire(_DraftObject):
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 @@ class _Polygon(_DraftObject):
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 @@ class _BSpline(_DraftObject):
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 @@ class _BezCurve(_DraftObject):
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 = []

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
<height>462</height>
<height>474</height>
</rect>
</property>
<property name="windowTitle">
@ -365,6 +365,9 @@ Values with differences below this value will be treated as same.</string>
<property name="text">
<string>Fill objects with faces whenever possible</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>fillmode</cstring>
</property>

View File

@ -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 @@ dxfImportHatches = p.GetBool("importDxfHatches",False)
dxfUseStandardSize = p.GetBool("dxfStdSize",False)
dxfGetColors = p.GetBool("dxfGetOriginalColors",False)
dxfUseDraftVisGroups = p.GetBool("dxfUseDraftVisGroups",False)
dxfFillMode = p.GetBool("fillmode",True)
dxfBrightBackground = isBrightBackground()
dxfDefaultColor = getColor()