diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 67089cfd3f..4eb01e311a 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -54,28 +54,6 @@ from draftutils.todo import todo from draftutils.translate import translate from draftutils.units import display_external -translate("draft", "Relative") -translate("draft", "Global") -translate("draft", "Continue") -translate("draft", "Close") -translate("draft", "Copy") -translate("draft", "Subelement mode") -translate("draft", "Fill") -translate("draft", "Exit") -translate("draft", "Snap On/Off") -translate("draft", "Increase snap radius") -translate("draft", "Decrease snap radius") -translate("draft", "Restrict X") -translate("draft", "Restrict Y") -translate("draft", "Restrict Z") -translate("draft", "Select edge") -translate("draft", "Add custom snap point") -translate("draft", "Length mode") -translate("draft", "Wipe") -translate("draft", "Set Working Plane") -translate("draft", "Cycle snap object") -translate("draft", "Undo last segment") - def _get_incmd_shortcut(itm): return params.get_param("inCommandShortcut" + itm).upper() @@ -184,7 +162,7 @@ class DraftToolBar: self.textbuffer = [] self.crossedViews = [] self.isTaskOn = False - self.fillmode = True + self.makeFaceMode = True self.mask = None self.alock = False self.x = 0 # coord of the point as displayed in the task panel (global/local and relative/absolute) @@ -411,7 +389,7 @@ class DraftToolBar: # update modes from parameters: self.relativeMode = params.get_param("RelativeMode") self.globalMode = params.get_param("GlobalMode") - self.fillmode = params.get_param("fillmode") + self.makeFaceMode = params.get_param("MakeFaceMode") self.continueMode = params.get_param("ContinueMode") # Note: The order of the calls to self._checkbox() below controls @@ -420,7 +398,7 @@ class DraftToolBar: # update checkboxes with parameters and internal modes: self.isRelative = self._checkbox("isRelative", self.layout, checked=self.relativeMode) self.isGlobal = self._checkbox("isGlobal", self.layout, checked=self.globalMode) - self.hasFill = self._checkbox("hasFill", self.layout, checked=self.fillmode) + self.makeFace = self._checkbox("makeFace", self.layout, checked=self.makeFaceMode) self.continueCmd = self._checkbox("continueCmd", self.layout, checked=self.continueMode) # update checkboxes without parameters and without internal modes: @@ -477,7 +455,7 @@ class DraftToolBar: QtCore.QObject.connect(self.isRelative,QtCore.SIGNAL("stateChanged(int)"),self.setRelative) QtCore.QObject.connect(self.isGlobal,QtCore.SIGNAL("stateChanged(int)"),self.setGlobal) - QtCore.QObject.connect(self.hasFill,QtCore.SIGNAL("stateChanged(int)"),self.setFill) + QtCore.QObject.connect(self.makeFace,QtCore.SIGNAL("stateChanged(int)"),self.setMakeFace) QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("resized()"),self.relocate) QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("retranslate()"),self.retranslateUi) @@ -557,12 +535,11 @@ class DraftToolBar: self.isGlobal.setToolTip(translate( "draft", "Coordinates relative to global coordinate system." + "\nUncheck to use working plane coordinate system")) - self.hasFill.setText(translate( - "draft", "Filled") + " (" + _get_incmd_shortcut("Fill") + ")") - self.hasFill.setToolTip(translate( - "draft", "Check this if the object should appear as filled, " - + "otherwise it will appear as wireframe.\nNot available if " - + "Draft preference option 'Use Part Primitives' is enabled")) + self.makeFace.setText(translate( + "draft", "Make face") + " (" + _get_incmd_shortcut("MakeFace") + ")") + self.makeFace.setToolTip(translate( + "draft", "If checked, the object will be filled with a face." + + "\nNot available if the 'Use Part Primitives' preference is enabled")) self.finishButton.setText(translate( "draft", "Finish") + " (" + _get_incmd_shortcut("Exit") + ")") self.finishButton.setToolTip(translate( @@ -710,10 +687,10 @@ class DraftToolBar: self.xValue.setEnabled(True) self.yValue.setEnabled(True) if params.get_param("UsePartPrimitives"): - self.hasFill.setEnabled(False) + self.makeFace.setEnabled(False) else: - self.hasFill.setEnabled(True) - self.hasFill.show() + self.makeFace.setEnabled(True) + self.makeFace.show() self.finishButton.show() self.closeButton.show() self.wipeButton.show() @@ -863,10 +840,10 @@ class DraftToolBar: def extUi(self): if params.get_param("UsePartPrimitives"): - self.hasFill.setEnabled(False) + self.makeFace.setEnabled(False) else: - self.hasFill.setEnabled(True) - self.hasFill.show() + self.makeFace.setEnabled(True) + self.makeFace.show() self.continueCmd.show() def modUi(self): @@ -981,9 +958,9 @@ class DraftToolBar: self.displayPoint(self.new_point, self.get_last_point()) self.updateSnapper() - def setFill(self, val): - params.set_param("fillmode", bool(val)) - self.fillmode = bool(val) + def setMakeFace(self, val): + params.set_param("MakeFaceMode", bool(val)) + self.makeFaceMode = bool(val) def setCopymode(self, val): # special value for offset command @@ -1154,9 +1131,9 @@ class DraftToolBar: elif txt == _get_incmd_shortcut("Snap"): self.togglesnap() spec = True - elif txt == _get_incmd_shortcut("Fill"): - if self.hasFill.isVisible(): - self.hasFill.setChecked(not self.hasFill.isChecked()) + elif txt == _get_incmd_shortcut("MakeFace"): + if self.makeFace.isVisible(): + self.makeFace.setChecked(not self.makeFace.isChecked()) spec = True elif txt == _get_incmd_shortcut("Continue"): if self.continueCmd.isVisible(): diff --git a/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui b/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui index 809a597c2b..a24b7d0670 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui @@ -165,14 +165,14 @@ - + - Fill + Make face - + 25 @@ -189,7 +189,7 @@ false - inCommandShortcutFill + inCommandShortcutMakeFace Mod/Draft diff --git a/src/Mod/Draft/draftguitools/gui_base_original.py b/src/Mod/Draft/draftguitools/gui_base_original.py index ed3ab5cba6..b2e4ffbf3c 100644 --- a/src/Mod/Draft/draftguitools/gui_base_original.py +++ b/src/Mod/Draft/draftguitools/gui_base_original.py @@ -212,8 +212,8 @@ class DraftTool: * the current working plane rotation quaternion as a string * the support object if available as a string * the list of nodes inside the `node` attribute as a string - * the string `'True'` or `'False'` depending on the fill mode - of the current tool + * the string `'True'` or `'False'` depending on the make face + setting """ # Current plane rotation as a string qr = self.wp.get_placement().Rotation.Q @@ -234,13 +234,13 @@ class DraftTool: points += DraftVecUtils.toString(n) points += ']' - # Fill mode + # Make face if self.ui: - fil = str(bool(self.ui.fillmode)) + make_face = str(bool(self.ui.makeFace)) else: - fil = "True" + make_face = "True" - return qr, sup, points, fil + return qr, sup, points, make_face class Creator(DraftTool): diff --git a/src/Mod/Draft/draftguitools/gui_lines.py b/src/Mod/Draft/draftguitools/gui_lines.py index 49c8a3279f..fa5664e93a 100644 --- a/src/Mod/Draft/draftguitools/gui_lines.py +++ b/src/Mod/Draft/draftguitools/gui_lines.py @@ -75,7 +75,7 @@ class Line(gui_base_original.Creator): elif self.mode == "leader": self.ui.wireUi(title=title, icon=icon) self.ui.closeButton.hide() - self.ui.hasFill.hide() + self.ui.makeFace.hide() else: self.ui.lineUi(title=title, icon=icon) diff --git a/src/Mod/Draft/draftguitools/gui_rotate.py b/src/Mod/Draft/draftguitools/gui_rotate.py index b8583419a9..4a925479e6 100644 --- a/src/Mod/Draft/draftguitools/gui_rotate.py +++ b/src/Mod/Draft/draftguitools/gui_rotate.py @@ -176,7 +176,7 @@ class Rotate(gui_base_original.Modifier): self.node = [self.point] self.ui.radiusUi() self.ui.radiusValue.setText(U.Quantity(0, U.Angle).UserString) - self.ui.hasFill.hide() + self.ui.makeFace.hide() self.ui.labelRadius.setText(translate("draft", "Base angle")) self.ui.radiusValue.setToolTip(translate("draft", "The base angle you wish to start the rotation from")) self.arctrack.setCenter(self.center) @@ -291,7 +291,7 @@ class Rotate(gui_base_original.Modifier): for ghost in self.ghosts: ghost.center(self.center) self.ui.radiusUi() - self.ui.hasFill.hide() + self.ui.makeFace.hide() self.ui.labelRadius.setText(translate("draft", "Base angle")) self.ui.radiusValue.setToolTip(translate("draft", "The base angle you wish to start the rotation from")) self.ui.radiusValue.setText(U.Quantity(0, U.Angle).UserString) diff --git a/src/Mod/Draft/draftobjects/bezcurve.py b/src/Mod/Draft/draftobjects/bezcurve.py index 22d12041ed..cca52aa9ba 100644 --- a/src/Mod/Draft/draftobjects/bezcurve.py +++ b/src/Mod/Draft/draftobjects/bezcurve.py @@ -69,7 +69,7 @@ class BezCurve(DraftObject): "The area of this object") obj.addProperty("App::PropertyArea", "Area", "Draft", _tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") obj.Closed = False obj.Degree = 3 obj.Continuity = [] diff --git a/src/Mod/Draft/draftobjects/bspline.py b/src/Mod/Draft/draftobjects/bspline.py index 2b36d20a89..48e43938e2 100644 --- a/src/Mod/Draft/draftobjects/bspline.py +++ b/src/Mod/Draft/draftobjects/bspline.py @@ -56,7 +56,7 @@ class BSpline(DraftObject): _tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object") obj.addProperty("App::PropertyArea","Area", "Draft", _tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") obj.Closed = False obj.Points = [] self.assureProperties(obj) diff --git a/src/Mod/Draft/draftobjects/circle.py b/src/Mod/Draft/draftobjects/circle.py index 2d6de67275..886aaeaf17 100644 --- a/src/Mod/Draft/draftobjects/circle.py +++ b/src/Mod/Draft/draftobjects/circle.py @@ -62,7 +62,7 @@ class Circle(DraftObject): obj.addProperty("App::PropertyArea", "Area", "Draft", _tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") def onDocumentRestored(self, obj): super().onDocumentRestored(obj) diff --git a/src/Mod/Draft/draftobjects/ellipse.py b/src/Mod/Draft/draftobjects/ellipse.py index 810d8f5e2d..a909a8b141 100644 --- a/src/Mod/Draft/draftobjects/ellipse.py +++ b/src/Mod/Draft/draftobjects/ellipse.py @@ -60,7 +60,7 @@ class Ellipse(DraftObject): _tip = QT_TRANSLATE_NOOP("App::Property","Area of this object") obj.addProperty("App::PropertyArea", "Area","Draft", _tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") def onDocumentRestored(self, obj): super().onDocumentRestored(obj) diff --git a/src/Mod/Draft/draftobjects/polygon.py b/src/Mod/Draft/draftobjects/polygon.py index 2dc06e6915..306065a7d8 100644 --- a/src/Mod/Draft/draftobjects/polygon.py +++ b/src/Mod/Draft/draftobjects/polygon.py @@ -71,7 +71,7 @@ class Polygon(DraftObject): "The area of this object") obj.addProperty("App::PropertyArea", "Area", "Draft", _tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") obj.DrawMode = ['inscribed','circumscribed'] obj.FacesNumber = 0 obj.Radius = 1 diff --git a/src/Mod/Draft/draftobjects/rectangle.py b/src/Mod/Draft/draftobjects/rectangle.py index 779d78aacf..7865efef2b 100644 --- a/src/Mod/Draft/draftobjects/rectangle.py +++ b/src/Mod/Draft/draftobjects/rectangle.py @@ -66,7 +66,7 @@ class Rectangle(DraftObject): _tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object") obj.addProperty("App::PropertyArea", "Area", "Draft", _tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") obj.Length=1 obj.Height=1 obj.Rows=1 diff --git a/src/Mod/Draft/draftobjects/wire.py b/src/Mod/Draft/draftobjects/wire.py index f0ead02b15..7808198887 100644 --- a/src/Mod/Draft/draftobjects/wire.py +++ b/src/Mod/Draft/draftobjects/wire.py @@ -92,7 +92,7 @@ class Wire(DraftObject): "The area of this object") obj.addProperty("App::PropertyArea","Area", "Draft",_tip) - obj.MakeFace = params.get_param("fillmode") + obj.MakeFace = params.get_param("MakeFaceMode") obj.Closed = False def onDocumentRestored(self, obj): diff --git a/src/Mod/Draft/drafttests/test_modification.py b/src/Mod/Draft/drafttests/test_modification.py index 69c655a056..066510a7ab 100644 --- a/src/Mod/Draft/drafttests/test_modification.py +++ b/src/Mod/Draft/drafttests/test_modification.py @@ -293,7 +293,7 @@ class DraftModification(test_base.DraftTestCaseDoc): Draft.upgrade(obj3[0], delete=True) # when draftifying, upgrade doesn't return a new object wire = self.doc.ActiveObject - wire.MakeFace = True # make test independent of fillmode parameter + wire.MakeFace = True # make test independent of MakeFaceMode parameter self.doc.recompute() _msg(" 4: Result '{0}' ({1})".format(wire.Proxy.Type, wire.TypeId)) self.assertTrue(bool(wire), "'{}' failed".format(operation)) @@ -315,7 +315,7 @@ class DraftModification(test_base.DraftTestCaseDoc): _msg(" a={0}, b={1}".format(a, b)) _msg(" c={0}, a={1}".format(c, a)) wire = Draft.make_wire([a, b, c, a]) - wire.MakeFace = True # make test independent of fillmode parameter + wire.MakeFace = True # make test independent of MakeFaceMode parameter self.doc.recompute() # downgrade to face diff --git a/src/Mod/Draft/draftutils/params.py b/src/Mod/Draft/draftutils/params.py index a1a6b50fa7..51bf6b9983 100644 --- a/src/Mod/Draft/draftutils/params.py +++ b/src/Mod/Draft/draftutils/params.py @@ -393,7 +393,6 @@ def _get_param_dictionary(): "FilletRadius": ("float", 100.0), "FilletChamferMode": ("bool", False), "FilletDeleteMode": ("bool", False), - "fillmode": ("bool", True), "GlobalMode": ("bool", False), "GridHideInOtherWorkbenches": ("bool", True), "HatchPatternFile": ("string", hatch_pattern_file), @@ -404,6 +403,7 @@ def _get_param_dictionary(): "labeltype": ("string", "Custom"), "LayersManagerHeight": ("int", 320), "LayersManagerWidth": ("int", 640), + "MakeFaceMode": ("bool", True), "maxSnapEdges": ("int", 0), "OffsetCopyMode": ("bool", False), "Offset_OCC": ("bool", False), diff --git a/src/Mod/Draft/draftutils/utils.py b/src/Mod/Draft/draftutils/utils.py index 6a83c38790..a3b864bc31 100644 --- a/src/Mod/Draft/draftutils/utils.py +++ b/src/Mod/Draft/draftutils/utils.py @@ -216,7 +216,7 @@ def get_param_type(param): "LineSpacing", "DefaultAnnoScaleMultiplier"): return "float" elif param in ("selectBaseObjects", "alwaysSnap", "grid", - "fillmode", "DimShowLine", + "MakeFaceMode", "DimShowLine", "SvgLinesBlack", "dxfStdSize", "SnapBarShowOnlyDuringCommands", "alwaysShowGrid", "renderPolylineWidth", "showPlaneTracker", "UsePartPrimitives", diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index 1c3e5933c6..c0009af83f 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -859,7 +859,7 @@ def drawPolyline(polyline, forceShape=False, num=None): `dxfCreateDraft` or `dxfCreateSketch` are set, and `forceShape` is `False` it creates a straight `Draft Wire`. - If the polyline is closed, and the global variable `dxfFillMode` + If the polyline is closed, and the global variable `dxfMakeFaceMode` is set, it will return a `Part.Face`, otherwise it will return a `Part.Wire`. @@ -940,7 +940,7 @@ def drawPolyline(polyline, forceShape=False, num=None): ob.Placement = placementFromDXFOCS(polyline) return ob else: - if polyline.closed and dxfFillMode: + if polyline.closed and dxfMakeFaceMode: w = Part.Wire(edges) w.Placement = placementFromDXFOCS(polyline) return Part.Face(w) @@ -1116,11 +1116,7 @@ def drawEllipse(ellipse, forceShape=False): def drawFace(face): - """Return a Part face (filled) from a list of points. - - It takes the points in a `face` and places them in a list, - then appends the first point again to the end. - Only in this way the shape returned appears filled. + """Return a Part face from a list of points. Parameters ---------- @@ -1282,7 +1278,7 @@ def drawSplineIterpolation(verts, closed=False, forceShape=False, closed : bool, optional It defaults to `False`. If it is `True` it will create a closed - Wire, closed BSpline, or a filled Face. + Wire, closed BSpline, or a Face. forceShape : bool, optional It defaults to `False`. If it is `True` it will try to produce @@ -1307,7 +1303,7 @@ def drawSplineIterpolation(verts, closed=False, forceShape=False, Otherwise it tries producing a `Part.Edge` (`dxfDiscretizeCurves` or `alwaysDiscretize` are `True`) or `Part.Face` - if `closed` and the global variable `dxfFillMode` are `True`. + if `closed` and the global variable `dxfMakeFaceMode` are `True`. To do ----- @@ -1328,7 +1324,7 @@ def drawSplineIterpolation(verts, closed=False, forceShape=False, # print(knots) sp.interpolate(verts) sh = Part.Wire(sp.toShape()) - if closed and dxfFillMode: + if closed and dxfMakeFaceMode: return Part.Face(sh) else: return sh @@ -4157,7 +4153,7 @@ def readPreferences(): `dxfDiscretizeCurves`, `dxfStarBlocks`, `dxfMakeBlocks`, `dxfJoin`, `dxfRenderPolylineWidth`, `dxfImportTexts`, `dxfImportLayouts`, `dxfImportPoints`, `dxfImportHatches`, `dxfUseStandardSize`, - `dxfGetColors`, `dxfUseDraftVisGroups`, `dxfFillMode`, + `dxfGetColors`, `dxfUseDraftVisGroups`, `dxfMakeFaceMode`, `dxfBrightBackground`, `dxfDefaultColor`, `dxfUseLegacyImporter`, `dxfExportBlocks`, `dxfScaling`, `dxfUseLegacyExporter` @@ -4176,7 +4172,7 @@ def readPreferences(): global dxfImportTexts, dxfImportLayouts global dxfImportPoints, dxfImportHatches, dxfUseStandardSize global dxfGetColors, dxfUseDraftVisGroups - global dxfFillMode, dxfBrightBackground, dxfDefaultColor + global dxfMakeFaceMode, dxfBrightBackground, dxfDefaultColor global dxfUseLegacyImporter, dxfExportBlocks, dxfScaling global dxfUseLegacyExporter dxfCreatePart = params.get_param("dxfCreatePart") @@ -4194,7 +4190,7 @@ def readPreferences(): dxfUseStandardSize = params.get_param("dxfStdSize") dxfGetColors = params.get_param("dxfGetOriginalColors") dxfUseDraftVisGroups = params.get_param("dxfUseDraftVisGroups") - dxfFillMode = params.get_param("fillmode") + dxfMakeFaceMode = params.get_param("MakeFaceMode") dxfUseLegacyImporter = params.get_param("dxfUseLegacyImporter") dxfUseLegacyExporter = params.get_param("dxfUseLegacyExporter") dxfBrightBackground = isBrightBackground()