Skip to content

Commit

Permalink
Draft: Made initial Face mode dependent on fill mode pref setting - f…
Browse files Browse the repository at this point in the history
…ixes #1812
  • Loading branch information
yorikvanhavre committed Jan 2, 2015
1 parent 08828e5 commit 7788205
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
26 changes: 13 additions & 13 deletions src/Mod/Draft/Draft.py
Expand Up @@ -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":
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = []

Expand Down Expand Up @@ -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 = []
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/Draft/Resources/ui/userprefs-base.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
<height>462</height>
<height>474</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -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>
Expand Down
5 changes: 3 additions & 2 deletions src/Mod/Draft/importDXF.py
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 7788205

Please sign in to comment.