From f2f22e155ba1023445af19815d9a70abf69e3a06 Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Fri, 29 May 2020 20:14:17 -0500 Subject: [PATCH] Draft: rename PathArray properties `PathObj` becomes `PathObject`, `Xlate` becomes `ExtraTranslation`, and `PathSubs` becomes `PathSubelements`. Update `make_path_array` function and the Gui Command. --- src/Mod/Draft/draftguitools/gui_patharray.py | 4 +-- src/Mod/Draft/draftmake/make_patharray.py | 16 +++++------ src/Mod/Draft/draftobjects/patharray.py | 28 ++++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_patharray.py b/src/Mod/Draft/draftguitools/gui_patharray.py index 307218c86d..a21bdf8524 100644 --- a/src/Mod/Draft/draftguitools/gui_patharray.py +++ b/src/Mod/Draft/draftguitools/gui_patharray.py @@ -114,7 +114,7 @@ class PathArray(gui_base_original.Modifier): path_object = sel[1].Object count = 4 - xlate = App.Vector(0, 0, 0) + extra = App.Vector(0, 0, 0) subelements = list(sel[1].SubElementNames) align = False align_mode = "Original" @@ -136,7 +136,7 @@ class PathArray(gui_base_original.Modifier): _cmd += "App.ActiveDocument." + base_object.Name + ", " _cmd += "App.ActiveDocument." + path_object.Name + ", " _cmd += "count=" + str(count) + ", " - _cmd += "xlate=" + DraftVecUtils.toString(xlate) + ", " + _cmd += "extra=" + DraftVecUtils.toString(extra) + ", " _cmd += "subelements=" + subelements_list_str + ", " _cmd += "align=" + str(align) + ", " _cmd += "align_mode=" + "'" + align_mode + "', " diff --git a/src/Mod/Draft/draftmake/make_patharray.py b/src/Mod/Draft/draftmake/make_patharray.py index fcfa0bd491..b15c5968ec 100644 --- a/src/Mod/Draft/draftmake/make_patharray.py +++ b/src/Mod/Draft/draftmake/make_patharray.py @@ -48,7 +48,7 @@ if App.GuiUp: def make_path_array(base_object, path_object, count=4, - xlate=App.Vector(0, 0, 0), subelements=None, + extra=App.Vector(0, 0, 0), subelements=None, align=False, align_mode="Original", tan_vector=App.Vector(1, 0, 0), force_vertical=False, @@ -79,9 +79,9 @@ def make_path_array(base_object, path_object, count=4, It must be at least 2. If a `float` is provided, it will be truncated by `int(count)`. - xlate: Base.Vector3, optional + extra: Base.Vector3, optional It defaults to `App.Vector(0, 0, 0)`. - It translates each copy by the value of `xlate`. + It translates each copy by the value of `extra`. This is useful to adjust for the difference between shape centre and shape reference point. @@ -189,9 +189,9 @@ def make_path_array(base_object, path_object, count=4, return None count = int(count) - _msg("xlate: {}".format(xlate)) + _msg("extra: {}".format(extra)) try: - utils.type_check([(xlate, App.Vector)], + utils.type_check([(extra, App.Vector)], name=_name) except TypeError: _err(_tr("Wrong input: must be a vector.")) @@ -277,10 +277,10 @@ def make_path_array(base_object, path_object, count=4, PathArray(new_obj) new_obj.Base = base_object - new_obj.PathObj = path_object + new_obj.PathObject = path_object new_obj.Count = count - new_obj.Xlate = xlate - new_obj.PathSubs = sub_list + new_obj.ExtraTranslation = extra + new_obj.PathSubelements = sub_list new_obj.Align = align new_obj.AlignMode = align_mode new_obj.TangentVector = tan_vector diff --git a/src/Mod/Draft/draftobjects/patharray.py b/src/Mod/Draft/draftobjects/patharray.py index 37646f0bd6..f2f5dc35cc 100644 --- a/src/Mod/Draft/draftobjects/patharray.py +++ b/src/Mod/Draft/draftobjects/patharray.py @@ -139,27 +139,27 @@ class PathArray(DraftLink): _tip) obj.Base = None - if "PathObj" not in properties: + if "PathObject" not in properties: _tip = _tr("The object along which " "the copies will be distributed. " "It must contain 'Edges'.") obj.addProperty("App::PropertyLinkGlobal", - "PathObj", + "PathObject", "Objects", _tip) - obj.PathObj = None + obj.PathObject = None - if "PathSubs" not in properties: + if "PathSubelements" not in properties: _tip = _tr("List of connected edges in the 'Path Object'.\n" "If these are present, the copies will be created " "along these subelements only.\n" "Leave this property empty to create copies along " "the entire 'Path Object'.") obj.addProperty("App::PropertyLinkSubListGlobal", - "PathSubs", + "PathSubelements", "Objects", _tip) - obj.PathSubs = [] + obj.PathSubelements = [] if "Count" not in properties: _tip = _tr("Number of copies to create") @@ -181,16 +181,16 @@ class PathArray(DraftLink): def set_align_properties(self, obj, properties): """Set general properties only if they don't exist.""" - if "Xlate" not in properties: + if "ExtraTranslation" not in properties: _tip = _tr("Additional translation " "that will be applied to each copy.\n" "This is useful to adjust for the difference " "between shape centre and shape reference point.") obj.addProperty("App::PropertyVectorDistance", - "Xlate", + "ExtraTranslation", "Alignment", _tip) - obj.Xlate = App.Vector(0, 0, 0) + obj.ExtraTranslation = App.Vector(0, 0, 0) if "TangentVector" not in properties: _tip = _tr("Alignment vector for 'Tangent' mode") @@ -256,15 +256,15 @@ class PathArray(DraftLink): def execute(self, obj): """Execute when the object is created or recomputed.""" - if not obj.Base or not obj.PathObj: + if not obj.Base or not obj.PathObject: return # placement of entire PathArray object array_placement = obj.Placement - w = self.get_wires(obj.PathObj, obj.PathSubs) + w = self.get_wires(obj.PathObject, obj.PathSubelements) if not w: - _err(obj.PathObj.Label + _err(obj.PathObject.Label + _tr(", path object doesn't have 'Edges'.")) return @@ -282,7 +282,7 @@ class PathArray(DraftLink): copy_placements = placements_on_path(final_rotation, w, obj.Count, - obj.Xlate, + obj.ExtraTranslation, obj.Align, obj.AlignMode, obj.ForceVertical, obj.VerticalVector) @@ -305,7 +305,7 @@ class PathArray(DraftLink): return w def get_wire_from_subelements(self, subelements): - """Make a wire from PathObj subelements.""" + """Make a wire from the path object subelements.""" sl = [] for sub in subelements: edgeNames = sub[1]