Path rename dressup

for name standard compliance
This commit is contained in:
sliptonic
2018-02-07 10:15:13 -06:00
committed by Yorik van Havre
parent f933570035
commit bf51263a2b
3 changed files with 19 additions and 15 deletions

View File

@@ -21,13 +21,13 @@ SET(PathScripts_SRCS
PathCommands.py
PathScripts/PathAreaOp.py
PathScripts/PathArray.py
PathScripts/AxisMapDressup.py
PathScripts/PathCircularHoleBase.py
PathScripts/PathCircularHoleBaseGui.py
PathScripts/PathComment.py
PathScripts/PathCopy.py
PathScripts/PathCustom.py
PathScripts/PathDressup.py
PathScripts/PathDressupAxisMap.py
PathScripts/PathDressupDogbone.py
PathScripts/PathDressupDragknife.py
PathScripts/PathDressupHoldingTags.py

View File

@@ -46,10 +46,10 @@ class PathWorkbench (Workbench):
FreeCADGui.addLanguagePath(":/translations")
FreeCADGui.addIconPath(":/icons")
# load python modules
from PathScripts import AxisMapDressup.py
from PathScripts import PathArray
from PathScripts import PathComment
from PathScripts import PathCustom
from PathScripts import PathDressupAxisMap
from PathScripts import PathDressupDogbone
from PathScripts import PathDressupDragknife
from PathScripts import PathDressupRampEntry
@@ -85,7 +85,7 @@ class PathWorkbench (Workbench):
twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_Engrave", "Path_MillFace", "Path_Helix"]
threedopcmdlist = ["Path_Pocket_3D"]
modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy" ]
dressupcmdlist = ["Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag"]
dressupcmdlist = ["Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag", "Path_DressupAxisMap"]
extracmdlist = []
#modcmdmore = ["Path_Hop",]
#remotecmdlist = ["Path_Remote"]

View File

@@ -50,7 +50,7 @@ class ObjectDressup:
maplist = ["X->A", "Y->A", "X->B", "Y->B", "X->C", "Y->C"]
obj.addProperty("App::PropertyLink", "Base","Path", "The base path to modify")
obj.addProperty("App::PropertyEnumeration", "axisMap", "Path", "The input mapping axis")
obj.addProperty("App::PropertyValue", "radius", "Path", "The radius of the wrapped axis")
obj.addProperty("App::PropertyDistance", "radius", "Path", "The radius of the wrapped axis")
obj.axisMap = maplist
obj.Proxy = self
@@ -68,7 +68,7 @@ class ObjectDressup:
def execute(self, obj):
inAxis = obj.axisMap[0]
outAxis = obj.axisMap[2]
outAxis = obj.axisMap[3]
if obj.Base:
if obj.Base.isDerivedFrom("Path::Feature"):
@@ -77,15 +77,18 @@ class ObjectDressup:
newcommandlist = []
for c in obj.Base.Path.Commands:
newparams = dict(c.Parameters)
remapvar = newparams.pop(obj.inAxis, None)
remapvar = newparams.pop(inAxis, None)
if remapvar is not None:
newparams[obj.outAxis] = remapvar
newparams[outAxis] = self._linear2angular(obj.radius, remapvar)
newcommand = Path.Command(c.Name, newparams)
newcommandlist.append(newcommand)
else:
newcommandlist.append(c)
obj.Base.Path.Commands = newcommandlist
path = Path.Path(newcommandlist)
obj.Path = path
# obj.Path.Commands = newcommandlist
class ViewProviderDressup:
@@ -123,9 +126,9 @@ class CommandPathDressup:
def GetResources(self):
return {'Pixmap': 'Path-Dressup',
'MenuText': QtCore.QT_TRANSLATE_NOOP("AxisMap_Dressup", "Axis Map Dress-up"),
'Accel': "P, S",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("AxisMap_Dressup", "Remap one axis to another.")}
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_DressupAxisMap", "Axis Map Dress-up"),
'Accel': "",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_DressupAxisMap", "Remap one axis to another.")}
def IsActive(self):
if FreeCAD.ActiveDocument is not None:
@@ -150,12 +153,13 @@ class CommandPathDressup:
# everything ok!
FreeCAD.ActiveDocument.openTransaction(translate("Path_Dressup", "Create Dress-up"))
FreeCADGui.addModule("PathScripts.AxisMapDressup")
FreeCADGui.addModule("PathScripts.PathDressupAxisMap")
FreeCADGui.addModule("PathScripts.PathUtils")
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "AxisMapDressup")')
FreeCADGui.doCommand('PathScripts.AxisMapDressup.ObjectDressup(obj)')
FreeCADGui.doCommand('PathScripts.PathDressupAxisMap.ObjectDressup(obj)')
FreeCADGui.doCommand('obj.Base = FreeCAD.ActiveDocument.' + selection[0].Name)
FreeCADGui.doCommand('PathScripts.AxisMapDressup.ViewProviderDressup(obj.ViewObject)')
FreeCADGui.doCommand('obj.radius = 45')
FreeCADGui.doCommand('PathScripts.PathDressupAxisMap.ViewProviderDressup(obj.ViewObject)')
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
FreeCADGui.doCommand('Gui.ActiveDocument.getObject(obj.Base.Name).Visibility = False')
FreeCAD.ActiveDocument.commitTransaction()
@@ -164,6 +168,6 @@ class CommandPathDressup:
if FreeCAD.GuiUp:
# register the FreeCAD command
FreeCADGui.addCommand('AxisMap_Dressup', CommandPathDressup())
FreeCADGui.addCommand('Path_DressupAxisMap', CommandPathDressup())
FreeCAD.Console.PrintLog("Loading PathDressup... done\n")