Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
wmayer 2014-05-08 17:32:37 +02:00
commit d907d372a4
6 changed files with 128 additions and 68 deletions

View File

@ -573,6 +573,7 @@ def makeCircle(radius, placement=None, face=True, startangle=None, endangle=None
n = "Circle" n = "Circle"
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",n) obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",n)
_Circle(obj) _Circle(obj)
obj.MakeFace = face
if isinstance(radius,Part.Edge): if isinstance(radius,Part.Edge):
edge = radius edge = radius
if DraftGeomUtils.geomType(edge) == "Circle": if DraftGeomUtils.geomType(edge) == "Circle":
@ -598,7 +599,6 @@ def makeCircle(radius, placement=None, face=True, startangle=None, endangle=None
if placement: obj.Placement = placement if placement: obj.Placement = placement
if gui: if gui:
_ViewProviderDraft(obj.ViewObject) _ViewProviderDraft(obj.ViewObject)
if not face: obj.ViewObject.DisplayMode = "Wireframe"
formatObject(obj) formatObject(obj)
select(obj) select(obj)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
@ -616,10 +616,10 @@ def makeRectangle(length, height, placement=None, face=True, support=None):
obj.Length = length obj.Length = length
obj.Height = height obj.Height = height
obj.Support = support obj.Support = support
obj.MakeFace = face
if placement: obj.Placement = placement if placement: obj.Placement = placement
if gui: if gui:
_ViewProviderRectangle(obj.ViewObject) _ViewProviderRectangle(obj.ViewObject)
if not face: obj.ViewObject.DisplayMode = "Wireframe"
formatObject(obj) formatObject(obj)
select(obj) select(obj)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
@ -752,10 +752,10 @@ def makeWire(pointslist,closed=False,placement=None,face=True,support=None):
obj.Points = pointslist obj.Points = pointslist
obj.Closed = closed obj.Closed = closed
obj.Support = support obj.Support = support
obj.MakeFace = face
if placement: obj.Placement = placement if placement: obj.Placement = placement
if gui: if gui:
_ViewProviderWire(obj.ViewObject) _ViewProviderWire(obj.ViewObject)
if not face: obj.ViewObject.DisplayMode = "Wireframe"
formatObject(obj) formatObject(obj)
select(obj) select(obj)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
@ -773,6 +773,7 @@ def makePolygon(nfaces,radius=1,inscribed=True,placement=None,face=True,support=
_Polygon(obj) _Polygon(obj)
obj.FacesNumber = nfaces obj.FacesNumber = nfaces
obj.Radius = radius obj.Radius = radius
obj.MakeFace = face
if inscribed: if inscribed:
obj.DrawMode = "inscribed" obj.DrawMode = "inscribed"
else: else:
@ -781,7 +782,6 @@ def makePolygon(nfaces,radius=1,inscribed=True,placement=None,face=True,support=
if placement: obj.Placement = placement if placement: obj.Placement = placement
if gui: if gui:
_ViewProviderDraft(obj.ViewObject) _ViewProviderDraft(obj.ViewObject)
if not face: obj.ViewObject.DisplayMode = "Wireframe"
formatObject(obj) formatObject(obj)
select(obj) select(obj)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
@ -824,16 +824,16 @@ def makeBSpline(pointslist,closed=False,placement=None,face=True,support=None):
obj.Closed = closed obj.Closed = closed
obj.Points = pointslist obj.Points = pointslist
obj.Support = support obj.Support = support
obj.MakeFace = face
if placement: obj.Placement = placement if placement: obj.Placement = placement
if gui: if gui:
_ViewProviderWire(obj.ViewObject) _ViewProviderWire(obj.ViewObject)
if not face: obj.ViewObject.DisplayMode = "Wireframe"
formatObject(obj) formatObject(obj)
select(obj) select(obj)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
return obj return obj
def makeBezCurve(pointslist,closed=False,placement=None,support=None,Degree=None): def makeBezCurve(pointslist,closed=False,placement=None,face=True,support=None,Degree=None):
'''makeBezCurve(pointslist,[closed],[placement]): Creates a Bezier Curve object '''makeBezCurve(pointslist,[closed],[placement]): Creates a Bezier Curve object
from the given list of vectors. Instead of a pointslist, you can also pass a Part Wire.''' from the given list of vectors. Instead of a pointslist, you can also pass a Part Wire.'''
if not isinstance(pointslist,list): if not isinstance(pointslist,list):
@ -855,12 +855,13 @@ def makeBezCurve(pointslist,closed=False,placement=None,support=None,Degree=None
Part.BezierCurve().MaxDegree) Part.BezierCurve().MaxDegree)
obj.Closed = closed obj.Closed = closed
obj.Support = support obj.Support = support
obj.MakeFace = face
obj.Proxy.resetcontinuity(obj) obj.Proxy.resetcontinuity(obj)
if placement: obj.Placement = placement if placement: obj.Placement = placement
if gui: if gui:
_ViewProviderWire(obj.ViewObject) _ViewProviderWire(obj.ViewObject)
# if not face: obj.ViewObject.DisplayMode = "Wireframe" # if not face: obj.ViewObject.DisplayMode = "Wireframe"
obj.ViewObject.DisplayMode = "Wireframe" # obj.ViewObject.DisplayMode = "Wireframe"
formatObject(obj) formatObject(obj)
select(obj) select(obj)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
@ -3095,6 +3096,7 @@ class _ViewProviderDimension(_ViewProviderDraft):
def updateData(self, obj, prop): def updateData(self, obj, prop):
"called when the base object is changed" "called when the base object is changed"
import DraftGui
if prop in ["Start","End","Dimline","Direction"]: if prop in ["Start","End","Dimline","Direction"]:
if obj.Start == obj.End: if obj.Start == obj.End:
@ -3199,10 +3201,9 @@ class _ViewProviderDimension(_ViewProviderDraft):
# set text value # set text value
l = self.p3.sub(self.p2).Length l = self.p3.sub(self.p2).Length
if hasattr(obj.ViewObject,"Decimals"): if hasattr(obj.ViewObject,"Decimals"):
fstring = "%." + str(obj.ViewObject.Decimals) + "f" self.string = DraftGui.displayExternal(l,obj.ViewObject.Decimals,'Length')
else: else:
fstring = "%." + str(getParam("dimPrecision",2)) + "f" self.string = DraftGui.displayExternal(l,getParam("dimPrecision",2),'Length')
self.string = (fstring % l)
if hasattr(obj.ViewObject,"Override"): if hasattr(obj.ViewObject,"Override"):
if obj.ViewObject.Override: if obj.ViewObject.Override:
try: try:
@ -3684,6 +3685,8 @@ class _Rectangle(_DraftObject):
obj.addProperty("App::PropertyDistance","Height","Draft","Height of the rectange") obj.addProperty("App::PropertyDistance","Height","Draft","Height of the rectange")
obj.addProperty("App::PropertyLength","FilletRadius","Draft","Radius to use to fillet the corners") 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::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.Length=1 obj.Length=1
obj.Height=1 obj.Height=1
@ -3706,7 +3709,11 @@ class _Rectangle(_DraftObject):
w = DraftGeomUtils.filletWire(shape,obj.FilletRadius.Value) w = DraftGeomUtils.filletWire(shape,obj.FilletRadius.Value)
if w: if w:
shape = w shape = w
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
obj.Shape = shape obj.Shape = shape
obj.Placement = plm obj.Placement = plm
@ -3724,6 +3731,8 @@ class _Circle(_DraftObject):
obj.addProperty("App::PropertyAngle","FirstAngle","Draft","Start angle of the arc") obj.addProperty("App::PropertyAngle","FirstAngle","Draft","Start angle of the arc")
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::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::PropertyLength","Radius","Draft","Radius of the circle")
obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face")
obj.MakeFace = True
def execute(self, obj): def execute(self, obj):
import Part import Part
@ -3731,7 +3740,11 @@ class _Circle(_DraftObject):
shape = Part.makeCircle(obj.Radius.Value,Vector(0,0,0),Vector(0,0,1),obj.FirstAngle.Value,obj.LastAngle.Value) shape = Part.makeCircle(obj.Radius.Value,Vector(0,0,0),Vector(0,0,1),obj.FirstAngle.Value,obj.LastAngle.Value)
if obj.FirstAngle.Value == obj.LastAngle.Value: if obj.FirstAngle.Value == obj.LastAngle.Value:
shape = Part.Wire(shape) shape = Part.Wire(shape)
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
obj.Shape = shape obj.Shape = shape
obj.Placement = plm obj.Placement = plm
@ -3742,6 +3755,8 @@ class _Ellipse(_DraftObject):
_DraftObject.__init__(self,obj,"Ellipse") _DraftObject.__init__(self,obj,"Ellipse")
obj.addProperty("App::PropertyLength","MinorRadius","Draft","The minor radius of the ellipse") 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::PropertyLength","MajorRadius","Draft","The major radius of the ellipse")
obj.addProperty("App::PropertyBool","MakeFace","Draft","Create a face")
obj.MakeFace = True
def execute(self, obj): def execute(self, obj):
import Part import Part
@ -3752,7 +3767,11 @@ class _Ellipse(_DraftObject):
if obj.MajorRadius.Value and obj.MinorRadius.Value: if obj.MajorRadius.Value and obj.MinorRadius.Value:
shape = Part.Ellipse(Vector(0,0,0),obj.MajorRadius.Value,obj.MinorRadius.Value).toShape() shape = Part.Ellipse(Vector(0,0,0),obj.MajorRadius.Value,obj.MinorRadius.Value).toShape()
shape = Part.Wire(shape) shape = Part.Wire(shape)
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
obj.Shape = shape obj.Shape = shape
obj.Placement = plm obj.Placement = plm
@ -3769,6 +3788,8 @@ class _Wire(_DraftObject):
obj.addProperty("App::PropertyVector","End","Draft","The end point of this line") obj.addProperty("App::PropertyVector","End","Draft","The end point of this line")
obj.addProperty("App::PropertyLength","FilletRadius","Draft","Radius to use to fillet the corners") 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::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.Closed = False obj.Closed = False
def execute(self, obj): def execute(self, obj):
@ -3778,7 +3799,11 @@ class _Wire(_DraftObject):
if obj.Base.isDerivedFrom("Sketcher::SketchObject"): if obj.Base.isDerivedFrom("Sketcher::SketchObject"):
shape = obj.Base.Shape.copy() shape = obj.Base.Shape.copy()
if obj.Base.Shape.isClosed(): if obj.Base.Shape.isClosed():
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
obj.Shape = shape obj.Shape = shape
elif obj.Base and obj.Tool: elif obj.Base and obj.Tool:
if obj.Base.isDerivedFrom("Part::Feature") and obj.Tool.isDerivedFrom("Part::Feature"): if obj.Base.isDerivedFrom("Part::Feature") and obj.Tool.isDerivedFrom("Part::Feature"):
@ -3804,7 +3829,11 @@ class _Wire(_DraftObject):
if w: if w:
shape = w shape = w
try: try:
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
except: except:
pass pass
else: else:
@ -3915,6 +3944,8 @@ class _Polygon(_DraftObject):
obj.addProperty("App::PropertyEnumeration","DrawMode","Draft","How the polygon must be drawn from the control circle") obj.addProperty("App::PropertyEnumeration","DrawMode","Draft","How the polygon must be drawn from the control circle")
obj.addProperty("App::PropertyLength","FilletRadius","Draft","Radius to use to fillet the corners") 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::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.DrawMode = ['inscribed','circumscribed'] obj.DrawMode = ['inscribed','circumscribed']
obj.FacesNumber = 0 obj.FacesNumber = 0
obj.Radius = 1 obj.Radius = 1
@ -3944,7 +3975,11 @@ class _Polygon(_DraftObject):
w = DraftGeomUtils.filletWire(shape,obj.FilletRadius.Value) w = DraftGeomUtils.filletWire(shape,obj.FilletRadius.Value)
if w: if w:
shape = w shape = w
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
obj.Shape = shape obj.Shape = shape
obj.Placement = plm obj.Placement = plm
@ -4002,6 +4037,8 @@ class _BSpline(_DraftObject):
_DraftObject.__init__(self,obj,"BSpline") _DraftObject.__init__(self,obj,"BSpline")
obj.addProperty("App::PropertyVectorList","Points","Draft", "The points of the b-spline") 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","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.Closed = False obj.Closed = False
obj.Points = [] obj.Points = []
@ -4021,7 +4058,11 @@ class _BSpline(_DraftObject):
# Creating a face from a closed spline cannot be expected to always work # Creating a face from a closed spline cannot be expected to always work
# Usually, if the spline is not flat the call of Part.Face() fails # Usually, if the spline is not flat the call of Part.Face() fails
try: try:
shape = Part.Face(shape) if hasattr(obj,"MakeFace"):
if obj.MakeFace:
shape = Part.Face(shape)
else:
shape = Part.Face(shape)
except: except:
pass pass
obj.Shape = shape obj.Shape = shape
@ -4047,6 +4088,8 @@ class _BezCurve(_DraftObject):
"Continuity") "Continuity")
obj.addProperty("App::PropertyBool","Closed","Draft", obj.addProperty("App::PropertyBool","Closed","Draft",
"If the Bezier curve should be closed or not") "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.Closed = False obj.Closed = False
obj.Degree = 3 obj.Degree = 3
obj.Continuity = [] obj.Continuity = []
@ -4106,7 +4149,11 @@ class _BezCurve(_DraftObject):
w = Part.Wire(edges) w = Part.Wire(edges)
if fp.Closed and w.isClosed(): if fp.Closed and w.isClosed():
try: try:
w = Part.Face(w) if hasattr(fp,"MakeFace"):
if fp.MakeFace:
w = Part.Face(w)
else:
w = Part.Face(w)
except: except:
pass pass
fp.Shape = w fp.Shape = w
@ -4653,8 +4700,8 @@ class _ShapeString(_DraftObject):
_DraftObject.__init__(self,obj,"ShapeString") _DraftObject.__init__(self,obj,"ShapeString")
obj.addProperty("App::PropertyString","String","Draft","Text string") obj.addProperty("App::PropertyString","String","Draft","Text string")
obj.addProperty("App::PropertyFile","FontFile","Draft","Font file name") obj.addProperty("App::PropertyFile","FontFile","Draft","Font file name")
obj.addProperty("App::PropertyFloat","Size","Draft","Height of text") obj.addProperty("App::PropertyLength","Size","Draft","Height of text")
obj.addProperty("App::PropertyFloat","Tracking","Draft", obj.addProperty("App::PropertyLength","Tracking","Draft",
"Inter-character spacing") "Inter-character spacing")
def execute(self, obj): def execute(self, obj):

View File

@ -130,23 +130,24 @@ def makeFormatSpec(decimals=4,dim='Length'):
return fmtSpec return fmtSpec
def displayExternal(internValue,decimals=4,dim='Length'): def displayExternal(internValue,decimals=4,dim='Length'):
'''return an internal value (ie mm) Length converted for display according '''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use.''' to Units Schema in use.'''
from FreeCAD import Units from FreeCAD import Units
if dim == 'Length': if dim == 'Length':
qty = FreeCAD.Units.Quantity(internValue,FreeCAD.Units.Length) qty = FreeCAD.Units.Quantity(1.0,FreeCAD.Units.Length)
parts = (qty.getUserPreferred()[0]).split() pref = qty.getUserPreferred()
conversion = pref[1]
uom = pref[2]
elif dim == 'Angle': elif dim == 'Angle':
qty = FreeCAD.Units.Quantity(internValue,FreeCAD.Units.Angle) qty = FreeCAD.Units.Quantity(1.0,FreeCAD.Units.Angle)
pref=qty.getUserPreferred() pref=qty.getUserPreferred()
parts = (qty.getUserPreferred()[0]).split() conversion = pref[1]
val = (qty.getUserPreferred()[0]).split()[0] uom = pref[2].decode('latin-1')
um = parts[1].decode('latin-1')
parts = (val,um)
else: else:
parts = (internValue,'??') conversion = 1.0
fmt = "{0:."+ str(decimals) + "f} "+ parts[1] uom = "??"
displayExt = fmt.format(float(parts[0])) fmt = "{0:."+ str(decimals) + "f} "+ uom
displayExt = fmt.format(float(internValue) / float(conversion))
return displayExt return displayExt
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -380,11 +381,11 @@ class DraftToolBar:
# shapestring # shapestring
self.labelSSize = self._label("labelSize", self.layout) self.labelSSize = self._label("labelSize", self.layout)
self.SSizeValue = self._lineedit("SSizeValue", self.layout, width=60) self.SSizeValue = self._inputfield("SSizeValue", self.layout) #, width=60)
self.SSizeValue.setText("200.0") self.SSizeValue.setText(self.FORMAT % 1.0)
self.labelSTrack = self._label("labelTracking", self.layout) self.labelSTrack = self._label("labelTracking", self.layout)
self.STrackValue = self._lineedit("STrackValue", self.layout, width=60) self.STrackValue = self._inputfield("STrackValue", self.layout) #, width=60)
self.STrackValue.setText("0") self.STrackValue.setText(self.FORMAT % 0)
self.labelSString = self._label("labelString", self.layout) self.labelSString = self._label("labelString", self.layout)
self.SStringValue = self._lineedit("SStringValue", self.layout) self.SStringValue = self._lineedit("SStringValue", self.layout)
self.SStringValue.setText("") self.SStringValue.setText("")
@ -392,6 +393,8 @@ class DraftToolBar:
self.FFileValue = self._lineedit("FFileValue", self.layout) self.FFileValue = self._lineedit("FFileValue", self.layout)
self.chooserButton = self._pushbutton("chooserButton", self.layout, width=26) self.chooserButton = self._pushbutton("chooserButton", self.layout, width=26)
self.chooserButton.setText("...") self.chooserButton.setText("...")
self.SSize = 1
self.STrack = 0
# options # options
fl = QtGui.QHBoxLayout() fl = QtGui.QHBoxLayout()
@ -481,8 +484,10 @@ class DraftToolBar:
QtCore.QObject.connect(self.radiusValue,QtCore.SIGNAL("escaped()"),self.escape) QtCore.QObject.connect(self.radiusValue,QtCore.SIGNAL("escaped()"),self.escape)
QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("resized()"),self.relocate) QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("resized()"),self.relocate)
QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("retranslate()"),self.retranslateUi) QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("retranslate()"),self.retranslateUi)
QtCore.QObject.connect(self.SSizeValue,QtCore.SIGNAL("valueChanged(double)"),self.changeSSizeValue)
QtCore.QObject.connect(self.SSizeValue,QtCore.SIGNAL("returnPressed()"),self.validateSNumeric) QtCore.QObject.connect(self.SSizeValue,QtCore.SIGNAL("returnPressed()"),self.validateSNumeric)
QtCore.QObject.connect(self.SSizeValue,QtCore.SIGNAL("escaped()"),self.escape) QtCore.QObject.connect(self.SSizeValue,QtCore.SIGNAL("escaped()"),self.escape)
QtCore.QObject.connect(self.STrackValue,QtCore.SIGNAL("valueChanged(double)"),self.changeSTrackValue)
QtCore.QObject.connect(self.STrackValue,QtCore.SIGNAL("returnPressed()"),self.validateSNumeric) QtCore.QObject.connect(self.STrackValue,QtCore.SIGNAL("returnPressed()"),self.validateSNumeric)
QtCore.QObject.connect(self.STrackValue,QtCore.SIGNAL("escaped()"),self.escape) QtCore.QObject.connect(self.STrackValue,QtCore.SIGNAL("escaped()"),self.escape)
QtCore.QObject.connect(self.SStringValue,QtCore.SIGNAL("returnPressed()"),self.validateSString) QtCore.QObject.connect(self.SStringValue,QtCore.SIGNAL("returnPressed()"),self.validateSString)
@ -846,7 +851,7 @@ class DraftToolBar:
self.SStringValue.hide() self.SStringValue.hide()
self.continueCmd.hide() self.continueCmd.hide()
self.labelSSize.show() self.labelSSize.show()
self.SSizeValue.setText('200.0') self.SSizeValue.setText(self.FORMAT % 1.0)
self.SSizeValue.show() self.SSizeValue.show()
self.SSizeValue.setFocus() self.SSizeValue.setFocus()
@ -855,7 +860,7 @@ class DraftToolBar:
self.labelSSize.hide() self.labelSSize.hide()
self.SSizeValue.hide() self.SSizeValue.hide()
self.labelSTrack.show() self.labelSTrack.show()
self.STrackValue.setText('0') self.STrackValue.setText(self.FORMAT % 0)
self.STrackValue.show() self.STrackValue.show()
self.STrackValue.setFocus() self.STrackValue.setFocus()
@ -1136,20 +1141,20 @@ class DraftToolBar:
if self.sourceCmd: if self.sourceCmd:
if (self.labelSSize.isVisible()): if (self.labelSSize.isVisible()):
try: try:
SSize=float(self.SSizeValue.text()) SSize=float(self.SSize)
except ValueError: except ValueError:
FreeCAD.Console.PrintMessage(translate("draft", "Invalid Size value. Using 200.0.")) FreeCAD.Console.PrintMessage(translate("draft", "Invalid Size value. Using 200.0."))
self.sourceCmd.numericSSize(unicode("200.0")) self.sourceCmd.numericSSize(200.0)
else: else:
self.sourceCmd.numericSSize(unicode(SSize)) self.sourceCmd.numericSSize(SSize)
elif (self.labelSTrack.isVisible()): elif (self.labelSTrack.isVisible()):
try: try:
track=int(self.STrackValue.text()) track=int(self.STrack)
except ValueError: except ValueError:
FreeCAD.Console.PrintMessage(translate("draft", "Invalid Tracking value. Using 0.")) FreeCAD.Console.PrintMessage(translate("draft", "Invalid Tracking value. Using 0."))
self.sourceCmd.numericSTrack(unicode("0")) self.sourceCmd.numericSTrack(0)
else: else:
self.sourceCmd.numericSTrack(unicode(track)) self.sourceCmd.numericSTrack(track)
def validateSString(self): def validateSString(self):
''' send a valid text string to ShapeString as unicode ''' ''' send a valid text string to ShapeString as unicode '''
@ -1586,6 +1591,12 @@ class DraftToolBar:
def changeOffsetValue(self,d): def changeOffsetValue(self,d):
self.offset = d self.offset = d
def changeSSizeValue(self,d):
self.SSize = d
def changeSTrackValue(self,d):
self.STrack = d
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# TaskView operations # TaskView operations
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>487</width> <width>487</width>
<height>455</height> <height>462</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -355,6 +355,26 @@ Values with differences below this value will be treated as same.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_6">
<property name="toolTip">
<string>If this is checked, objects will appear as filled as default. Otherwise, they will appear as wireframe</string>
</property>
<property name="text">
<string>Fill objects with faces whenever possible</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>fillmode</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -227,26 +227,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_6">
<property name="toolTip">
<string>If this is checked, objects will appear as filled as default. Otherwise, they will appear as wireframe</string>
</property>
<property name="text">
<string>Fill objects by default</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>fillmode</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_11"> <layout class="QHBoxLayout" name="horizontalLayout_11">
<item> <item>

View File

@ -1506,6 +1506,8 @@ def getArcData(edge):
a2 = -DraftVecUtils.angle(ve2.sub(ce)) a2 = -DraftVecUtils.angle(ve2.sub(ce))
if round(a1,Draft.precision()) == round(a2,Draft.precision()): if round(a1,Draft.precision()) == round(a2,Draft.precision()):
return None,None, None, None return None,None, None, None
if edge.Curve.Axis.z < 0.0:
ang1, ang2 = ang2, ang1
pseudoarc = Part.ArcOfCircle(edge.Curve,a1,a2).toShape() pseudoarc = Part.ArcOfCircle(edge.Curve,a1,a2).toShape()
if round(pseudoarc.Length,Draft.precision()) != round(edge.Length,Draft.precision()): if round(pseudoarc.Length,Draft.precision()) != round(edge.Length,Draft.precision()):
ang1, ang2 = ang2, ang1 ang1, ang2 = ang2, ang1