Draft: rename PathArray properties
`PathObj` becomes `PathObject`, `Xlate` becomes `ExtraTranslation`, and `PathSubs` becomes `PathSubelements`. Update `make_path_array` function and the Gui Command.
This commit is contained in:
@@ -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 + "', "
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user