Path: implement jointype for contour and profile fix #3116
Not implemented in the task panel. Settings are only available in the property pane.
This commit is contained in:
committed by
Yorik van Havre
parent
75121febf0
commit
9a15fed386
@@ -36,7 +36,7 @@ from PathScripts.PathUtils import depth_params
|
||||
|
||||
FreeCAD.setLogLevel('Path.Area', 0)
|
||||
|
||||
if False:
|
||||
if True:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
else:
|
||||
@@ -85,6 +85,11 @@ class ObjectContour:
|
||||
|
||||
obj.addProperty("App::PropertyDistance", "OffsetExtra", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property", "Extra value to stay away from final Contour- good for roughing toolpath"))
|
||||
|
||||
obj.addProperty("App::PropertyEnumeration", "JoinType", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property", "Controls how tool moves around corners. Default=Round"))
|
||||
obj.JoinType = ['Round', 'Square', 'Miter'] # this is the direction that the Contour runs
|
||||
obj.addProperty("App::PropertyFloat", "MiterLimit", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property", "Maximum distance before a miter join is truncated"))
|
||||
obj.setEditorMode('MiterLimit', 2)
|
||||
|
||||
# Debug Parameters
|
||||
obj.addProperty("App::PropertyString", "AreaParams", "Path")
|
||||
obj.setEditorMode('AreaParams', 2) # hide
|
||||
@@ -104,6 +109,10 @@ class ObjectContour:
|
||||
if prop in ['AreaParams', 'PathParams', 'removalshape']:
|
||||
obj.setEditorMode(prop, 2)
|
||||
|
||||
obj.setEditorMode('MiterLimit', 2)
|
||||
if obj.JoinType == 'Miter':
|
||||
obj.setEditorMode('MiterLimit', 0)
|
||||
|
||||
def __getstate__(self):
|
||||
PathLog.track()
|
||||
return None
|
||||
@@ -148,6 +157,12 @@ class ObjectContour:
|
||||
else:
|
||||
profileparams['Offset'] = self.radius+obj.OffsetExtra.Value
|
||||
|
||||
jointype = ['Round', 'Square', 'Miter']
|
||||
profileparams['JoinType'] = jointype.index(obj.JoinType)
|
||||
|
||||
if obj.JoinType == 'Miter':
|
||||
profileparams['MiterLimit'] = obj.MiterLimit
|
||||
|
||||
heights = [i for i in self.depthparams]
|
||||
PathLog.debug('depths: {}'.format(heights))
|
||||
profile.setParams(**profileparams)
|
||||
@@ -370,6 +385,8 @@ class CommandPathContour:
|
||||
FreeCADGui.doCommand('obj.OffsetExtra = 0.0')
|
||||
FreeCADGui.doCommand('obj.Direction = "CW"')
|
||||
FreeCADGui.doCommand('obj.UseComp = True')
|
||||
FreeCADGui.doCommand('obj.JoinType = "Round"')
|
||||
FreeCADGui.doCommand('obj.MiterLimit =' + str(0.1))
|
||||
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
|
||||
FreeCADGui.doCommand('PathScripts.PathContour.ObjectContour.setDepths(obj.Proxy, obj)')
|
||||
|
||||
Reference in New Issue
Block a user