CAM: AxisMap Dressup - Invert axis
This commit is contained in:
@@ -68,6 +68,12 @@ class ObjectDressup:
|
||||
"Path",
|
||||
QT_TRANSLATE_NOOP("App::Property", "The radius of the wrapped axis"),
|
||||
)
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"Reverse",
|
||||
"Path",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Reverse rotary axis direction"),
|
||||
)
|
||||
obj.AxisMap = ("X->A", "Y->A", "X->B", "Y->B", "X->C", "Y->C")
|
||||
obj.AxisMap = "Y->A"
|
||||
obj.Radius = 45
|
||||
@@ -88,6 +94,15 @@ class ObjectDressup:
|
||||
if prop == "Path" and obj.ViewObject:
|
||||
obj.ViewObject.signalChangeIcon()
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
if not hasattr(obj, "Reverse"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"Reverse",
|
||||
"Path",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Reverse rotary axis direction"),
|
||||
)
|
||||
|
||||
def execute(self, obj):
|
||||
|
||||
inAxis = obj.AxisMap[0]
|
||||
@@ -113,6 +128,8 @@ class ObjectDressup:
|
||||
newparams = dict(cmd.Parameters)
|
||||
remapvar = newparams.pop(inAxis, None)
|
||||
if remapvar is not None:
|
||||
if obj.Reverse:
|
||||
remapvar = -remapvar
|
||||
newparams[outAxis] = math.degrees(remapvar / obj.Radius.Value)
|
||||
locdiff = dict(set(newparams.items()) - set(lastPar.items()))
|
||||
if len(locdiff) == 1 and outAxis in locdiff:
|
||||
|
||||
Reference in New Issue
Block a user