Added operation setting support to profile ops.

This commit is contained in:
Markus Lampert
2018-08-25 19:14:19 -07:00
parent 3962519087
commit 4dcf6b88a3
7 changed files with 37 additions and 9 deletions

View File

@@ -145,3 +145,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
obj.JoinType = "Round"
obj.MiterLimit = 0.1
def SetupProperties():
setup = []
setup.append('Side')
setup.append('OffsetExtra')
setup.append('Direction')
setup.append('UseComp')
setup.append('JoinType')
setup.append('MiterLimit')
return setup

View File

@@ -108,9 +108,13 @@ class ObjectContour(PathProfileBase.ObjectProfile):
obj.OpStartDepth = obj.OpStockZMax
obj.OpFinalDepth = obj.OpStockZMin
def SetupProperties():
return [p for p in PathProfileBase.SetupProperties() if p != 'Side']
def Create(name):
def Create(name, obj=None):
'''Create(name) ... Creates and returns a Contour operation.'''
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
if obj is None:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
proxy = ObjectContour(obj, name)
return obj

View File

@@ -46,6 +46,7 @@ Command = PathOpGui.SetupOperation('Contour',
TaskPanelOpPage,
'Path-Contour',
QtCore.QT_TRANSLATE_NOOP("PathProfileContour", "Contour"),
QtCore.QT_TRANSLATE_NOOP("PathProfileContour", "Creates a Contour Path for the Base Object "))
QtCore.QT_TRANSLATE_NOOP("PathProfileContour", "Creates a Contour Path for the Base Object "),
PathProfileContour.SetupProperties)
FreeCAD.Console.PrintLog("Loading PathProfileContourGui... done\n")

View File

@@ -100,8 +100,12 @@ class ObjectProfile(PathProfileBase.ObjectProfile):
shapes.append((env, False))
return shapes
def Create(name):
def SetupProperties():
return PathProfileBase.SetupProperties()
def Create(name, obj = None):
'''Create(name) ... Creates and returns a Profile based on edges operation.'''
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
if obj is None:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
proxy = ObjectProfile(obj, name)
return obj

View File

@@ -47,6 +47,7 @@ Command = PathOpGui.SetupOperation('Profile Edges',
TaskPanelOpPage,
'Path-Profile-Edges',
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Edge Profile"),
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on edges"))
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on edges"),
PathProfileEdges.SetupProperties)
FreeCAD.Console.PrintLog("Loading PathProfileEdgesGui... done\n")

View File

@@ -138,8 +138,16 @@ class ObjectProfile(PathProfileBase.ObjectProfile):
obj.processCircles = False
obj.processPerimeter = True
def Create(name):
def SetupProperties():
setup = []
setup.append("processHoles")
setup.append("processPerimeter")
setup.append("processCircles")
return PathProfileBase.SetupProperties() + setup
def Create(name, obj = None):
'''Create(name) ... Creates and returns a Profile based on faces operation.'''
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
if obj is None:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
proxy = ObjectProfile(obj, name)
return obj

View File

@@ -47,6 +47,7 @@ Command = PathOpGui.SetupOperation('Profile Faces',
TaskPanelOpPage,
'Path-Profile-Face',
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Face Profile"),
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on face or faces"))
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on face or faces"),
PathProfileFaces.SetupProperties)
FreeCAD.Console.PrintLog("Loading PathProfileFacesGui... done\n")