Merge pull request #4144 from mlampert/feature/suppress-warnings-preferences
Path: Feature/suppress warnings preferences
This commit is contained in:
@@ -27,11 +27,13 @@
|
||||
# include <boost/regex.hpp>
|
||||
#endif
|
||||
|
||||
#include <Base/Writer.h>
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Writer.h>
|
||||
|
||||
// KDL stuff - at the moment, not used
|
||||
//#include "Mod/Robot/App/kdl_cp/path_line.hpp"
|
||||
@@ -150,27 +152,31 @@ double Toolpath::getLength()
|
||||
double Toolpath::getCycleTime(double hFeed, double vFeed, double hRapid, double vRapid)
|
||||
{
|
||||
// check the feedrates are set
|
||||
if ((hFeed == 0) || (vFeed == 0)){
|
||||
Base::Console().Warning("Feed Rate Error: Check Tool Controllers have Feed Rates");
|
||||
if ((hFeed == 0) || (vFeed == 0)) {
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path");
|
||||
if (!hGrp->GetBool("WarningsSuppressAllSpeeds", true)) {
|
||||
Base::Console().Warning("Feed Rate Error: Check Tool Controllers have Feed Rates");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hRapid == 0){
|
||||
if (hRapid == 0) {
|
||||
hRapid = hFeed;
|
||||
}
|
||||
|
||||
if (vRapid == 0){
|
||||
if (vRapid == 0) {
|
||||
vRapid = vFeed;
|
||||
}
|
||||
|
||||
if(vpcCommands.size()==0)
|
||||
if (vpcCommands.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
double l = 0;
|
||||
double time = 0;
|
||||
bool verticalMove = false;
|
||||
Vector3d last(0,0,0);
|
||||
Vector3d next;
|
||||
for(std::vector<Command*>::const_iterator it = vpcCommands.begin();it!=vpcCommands.end();++it) {
|
||||
for (std::vector<Command*>::const_iterator it = vpcCommands.begin();it!=vpcCommands.end();++it) {
|
||||
std::string name = (*it)->Name;
|
||||
float feedrate = (*it)->getParam("F");
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ void DlgSettingsPathColor::saveSettings()
|
||||
ui->DefaultBBoxNormalColor->onSave();
|
||||
ui->DefaultSelectionStyle->onSave();
|
||||
ui->DefaultTaskPanelLayout->onSave();
|
||||
ui->WarningSuppressAllSpeeds->onSave();
|
||||
ui->WarningSuppressRapidSpeeds->onSave();
|
||||
ui->WarningSuppressSelectionMode->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsPathColor::loadSettings()
|
||||
@@ -83,6 +86,9 @@ void DlgSettingsPathColor::loadSettings()
|
||||
ui->DefaultBBoxNormalColor->onRestore();
|
||||
ui->DefaultSelectionStyle->onRestore();
|
||||
ui->DefaultTaskPanelLayout->onRestore();
|
||||
ui->WarningSuppressAllSpeeds->onRestore();
|
||||
ui->WarningSuppressRapidSpeeds->onRestore();
|
||||
ui->WarningSuppressSelectionMode->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>483</width>
|
||||
<height>536</height>
|
||||
<width>512</width>
|
||||
<height>691</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Path colors</string>
|
||||
<string>GUI</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
@@ -449,6 +449,72 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressAllSpeeds">
|
||||
<property name="toolTip">
|
||||
<string>Suppress all warnings about setting speed rates for accurate cycle time calculation</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress all missing speeds warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressAllSpeeds</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressRapidSpeeds">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress missing rapid speeds warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressRapidSpeeds</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressSelectionMode">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning whenever a Path selection mode is activated</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress selection mode warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressSelectionMode</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -472,6 +538,11 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>DefaultNormalPathColor</tabstop>
|
||||
|
||||
@@ -129,7 +129,8 @@ class PathWorkbench (Workbench):
|
||||
threedcmdgroup = ['Path_3dTools']
|
||||
FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path", '3D Operations')))
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintError("OpenCamLib is not working!\n")
|
||||
if not PathPreferences.suppressOpenCamLibWarning():
|
||||
FreeCAD.Console.PrintError("OpenCamLib is not working!\n")
|
||||
|
||||
self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Project Setup"), projcmdlist)
|
||||
self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Tool Commands"), toolcmdlist)
|
||||
@@ -167,10 +168,11 @@ class PathWorkbench (Workbench):
|
||||
def Activated(self):
|
||||
# update the translation engine
|
||||
FreeCADGui.updateLocale()
|
||||
Msg("Path workbench activated\n")
|
||||
# Msg("Path workbench activated\n")
|
||||
|
||||
def Deactivated(self):
|
||||
Msg("Path workbench deactivated\n")
|
||||
# Msg("Path workbench deactivated\n")
|
||||
pass
|
||||
|
||||
def ContextMenu(self, recipient):
|
||||
import PathScripts
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathEngraveBase as PathEngraveBase
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathOpTools as PathOpTools
|
||||
@@ -48,35 +49,44 @@ def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
def toolDepthAndOffset(width, extraDepth, tool):
|
||||
def toolDepthAndOffset(width, extraDepth, tool, printInfo):
|
||||
'''toolDepthAndOffset(width, extraDepth, tool) ... return tuple for given\n
|
||||
parameters.'''
|
||||
|
||||
if not hasattr(tool, 'Diameter'):
|
||||
raise ValueError('Deburr requires tool with diameter\n')
|
||||
|
||||
if not hasattr(tool, 'CuttingEdgeAngle'):
|
||||
angle = 180
|
||||
FreeCAD.Console.PrintMessage('The selected tool has No CuttingEdgeAngle property. Assuming Endmill\n')
|
||||
else:
|
||||
suppressInfo = False
|
||||
if hasattr(tool, 'CuttingEdgeAngle'):
|
||||
angle = float(tool.CuttingEdgeAngle)
|
||||
|
||||
if not hasattr(tool, 'FlatRadius'):
|
||||
toolOffset = float(tool.Diameter / 2)
|
||||
FreeCAD.Console.PrintMessage('The selected tool has no FlatRadius property. Using Diameter\n')
|
||||
if PathGeom.isRoughly(angle, 180) or PathGeom.isRoughly(angle, 0):
|
||||
angle = 180
|
||||
toolOffset = float(tool.Diameter) / 2
|
||||
else:
|
||||
if hasattr(tool, 'TipDiameter'):
|
||||
toolOffset = float(tool.TipDiameter) / 2
|
||||
elif hasattr(tool, 'FlatRadius'):
|
||||
toolOffset = float(tool.FlatRadius)
|
||||
else:
|
||||
toolOffset = 0.0
|
||||
if printInfo and not suppressInfo:
|
||||
FreeCAD.Console.PrintMessage(translate('PathDeburr', "The selected tool has no FlatRadius and no TipDiameter property. Assuming {}\n").format("Endmill" if angle == 180 else "V-Bit"))
|
||||
suppressInfo = True
|
||||
else:
|
||||
toolOffset = float(tool.FlatRadius)
|
||||
|
||||
if angle == 0:
|
||||
angle = 180
|
||||
toolOffset = float(tool.Diameter) / 2
|
||||
if printInfo:
|
||||
FreeCAD.Console.PrintMessage(translate('PathDeburr', 'The selected tool has no CuttingEdgeAngle property. Assuming Endmill\n'))
|
||||
suppressInfo = True
|
||||
|
||||
tan = math.tan(math.radians(angle / 2))
|
||||
|
||||
toolDepth = 0 if 0 == tan else width / tan
|
||||
toolDepth = 0 if PathGeom.isRoughly(tan, 0) else width / tan
|
||||
depth = toolDepth + extraDepth
|
||||
extraOffset = float(tool.Diameter) / 2 - width if angle == 180 else extraDepth / tan
|
||||
extraOffset = -width if angle == 180 else (extraDepth / tan)
|
||||
offset = toolOffset + extraOffset
|
||||
|
||||
return (depth, offset)
|
||||
return (depth, offset, suppressInfo)
|
||||
|
||||
|
||||
class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
@@ -110,8 +120,11 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
|
||||
def opExecute(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
if not hasattr(self, 'printInfo'):
|
||||
self.printInfo = True
|
||||
try:
|
||||
(depth, offset) = toolDepthAndOffset(obj.Width.Value, obj.ExtraDepth.Value, self.tool)
|
||||
(depth, offset, suppressInfo) = toolDepthAndOffset(obj.Width.Value, obj.ExtraDepth.Value, self.tool, self.printInfo)
|
||||
self.printInfo = not suppressInfo
|
||||
except ValueError as e:
|
||||
msg = "{} \n No path will be generated".format(e)
|
||||
raise ValueError(msg)
|
||||
|
||||
@@ -41,12 +41,8 @@ __doc__ = "Class and implementation of Mill Facing operation."
|
||||
__contributors__ = "russ4262 (Russell Johnson)"
|
||||
|
||||
|
||||
DEBUG = False
|
||||
if DEBUG:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule()
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule()
|
||||
|
||||
|
||||
# Qt translation handling
|
||||
@@ -82,7 +78,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
obj.OpStartDepth = job.Stock.Shape.BoundBox.ZMax
|
||||
|
||||
if len(obj.Base) >= 1:
|
||||
print('processing')
|
||||
PathLog.debug('processing')
|
||||
sublist = []
|
||||
for i in obj.Base:
|
||||
o = i[0]
|
||||
|
||||
@@ -27,6 +27,7 @@ from PySide import QtCore
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
from PathScripts.PathUtils import waiting_effects
|
||||
@@ -547,11 +548,11 @@ class ObjectOp(object):
|
||||
hRapidrate = tc.HorizRapid.Value
|
||||
vRapidrate = tc.VertRapid.Value
|
||||
|
||||
if hFeedrate == 0 or vFeedrate == 0:
|
||||
if (hFeedrate == 0 or vFeedrate == 0) and not PathPreferences.suppressAllSpeedsWarning():
|
||||
PathLog.warning(translate("Path", "Tool Controller feedrates required to calculate the cycle time."))
|
||||
return translate('Path', 'Feedrate Error')
|
||||
|
||||
if hRapidrate == 0 or vRapidrate == 0:
|
||||
if (hRapidrate == 0 or vRapidrate == 0) and not PathPreferences.suppressRapidSpeedsWarning():
|
||||
PathLog.warning(translate("Path", "Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times."))
|
||||
|
||||
# Get the cycle time in seconds
|
||||
|
||||
@@ -29,35 +29,39 @@ import PathScripts.PathLog as PathLog
|
||||
# PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule()
|
||||
|
||||
DefaultFilePath = "DefaultFilePath"
|
||||
DefaultJobTemplate = "DefaultJobTemplate"
|
||||
DefaultStockTemplate = "DefaultStockTemplate"
|
||||
DefaultTaskPanelLayout = "DefaultTaskPanelLayout"
|
||||
DefaultFilePath = "DefaultFilePath"
|
||||
DefaultJobTemplate = "DefaultJobTemplate"
|
||||
DefaultStockTemplate = "DefaultStockTemplate"
|
||||
DefaultTaskPanelLayout = "DefaultTaskPanelLayout"
|
||||
|
||||
PostProcessorDefault = "PostProcessorDefault"
|
||||
PostProcessorDefaultArgs = "PostProcessorDefaultArgs"
|
||||
PostProcessorBlacklist = "PostProcessorBlacklist"
|
||||
PostProcessorOutputFile = "PostProcessorOutputFile"
|
||||
PostProcessorOutputPolicy = "PostProcessorOutputPolicy"
|
||||
PostProcessorDefault = "PostProcessorDefault"
|
||||
PostProcessorDefaultArgs = "PostProcessorDefaultArgs"
|
||||
PostProcessorBlacklist = "PostProcessorBlacklist"
|
||||
PostProcessorOutputFile = "PostProcessorOutputFile"
|
||||
PostProcessorOutputPolicy = "PostProcessorOutputPolicy"
|
||||
|
||||
LastPathToolBit = "LastPathToolBit"
|
||||
LastPathToolLibrary = "LastPathToolLibrary"
|
||||
LastPathToolShape = "LastPathToolShape"
|
||||
LastPathToolTable = "LastPathToolTable"
|
||||
LastPathToolBit = "LastPathToolBit"
|
||||
LastPathToolLibrary = "LastPathToolLibrary"
|
||||
LastPathToolShape = "LastPathToolShape"
|
||||
LastPathToolTable = "LastPathToolTable"
|
||||
|
||||
LastFileToolBit = "LastFileToolBit"
|
||||
LastFileToolLibrary = "LastFileToolLibrary"
|
||||
LastFileToolShape = "LastFileToolShape"
|
||||
LastFileToolBit = "LastFileToolBit"
|
||||
LastFileToolLibrary = "LastFileToolLibrary"
|
||||
LastFileToolShape = "LastFileToolShape"
|
||||
|
||||
UseLegacyTools = "UseLegacyTools"
|
||||
UseAbsoluteToolPaths = "UseAbsoluteToolPaths"
|
||||
OpenLastLibrary = "OpenLastLibrary"
|
||||
UseLegacyTools = "UseLegacyTools"
|
||||
UseAbsoluteToolPaths = "UseAbsoluteToolPaths"
|
||||
OpenLastLibrary = "OpenLastLibrary"
|
||||
|
||||
# Linear tolerance to use when generating Paths, eg when tessellating geometry
|
||||
GeometryTolerance = "GeometryTolerance"
|
||||
LibAreaCurveAccuracy = "LibAreaCurveAccuarcy"
|
||||
GeometryTolerance = "GeometryTolerance"
|
||||
LibAreaCurveAccuracy = "LibAreaCurveAccuarcy"
|
||||
|
||||
EnableExperimentalFeatures = "EnableExperimentalFeatures"
|
||||
WarningSuppressRapidSpeeds = "WarningSuppressRapidSpeeds"
|
||||
WarningSuppressAllSpeeds = "WarningSuppressAllSpeeds"
|
||||
WarningSuppressSelectionMode = "WarningSuppressSelectionMode"
|
||||
WarningSuppressOpenCamLib = "WarningSuppressOpenCamLib"
|
||||
EnableExperimentalFeatures = "EnableExperimentalFeatures"
|
||||
|
||||
|
||||
def preferences():
|
||||
@@ -259,6 +263,18 @@ def setDefaultTaskPanelLayout(style):
|
||||
def experimentalFeaturesEnabled():
|
||||
return preferences().GetBool(EnableExperimentalFeatures, False)
|
||||
|
||||
def suppressAllSpeedsWarning():
|
||||
return preferences().GetBool(WarningSuppressAllSpeeds, True)
|
||||
|
||||
def suppressRapidSpeedsWarning():
|
||||
return suppressAllSpeedsWarning() or preferences().GetBool(WarningSuppressRapidSpeeds, True)
|
||||
|
||||
def suppressSelectionModeWarning():
|
||||
return preferences().GetBool(WarningSuppressSelectionMode, True)
|
||||
|
||||
def suppressOpenCamLibWarning():
|
||||
return preferences().GetBool(WarningSuppressOpenCamLib, True)
|
||||
|
||||
|
||||
def lastFileToolLibrary():
|
||||
filename = preferences().GetString(LastFileToolLibrary)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import math
|
||||
|
||||
@@ -286,52 +287,62 @@ class ALLGate(PathBaseGate):
|
||||
|
||||
def contourselect():
|
||||
FreeCADGui.Selection.addSelectionGate(CONTOURGate())
|
||||
FreeCAD.Console.PrintWarning("Contour Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Contour Select Mode\n")
|
||||
|
||||
|
||||
def eselect():
|
||||
FreeCADGui.Selection.addSelectionGate(EGate())
|
||||
FreeCAD.Console.PrintWarning("Edge Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Edge Select Mode\n")
|
||||
|
||||
|
||||
def drillselect():
|
||||
FreeCADGui.Selection.addSelectionGate(DRILLGate())
|
||||
FreeCAD.Console.PrintWarning("Drilling Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Drilling Select Mode\n")
|
||||
|
||||
|
||||
def engraveselect():
|
||||
FreeCADGui.Selection.addSelectionGate(ENGRAVEGate())
|
||||
FreeCAD.Console.PrintWarning("Engraving Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Engraving Select Mode\n")
|
||||
|
||||
|
||||
def fselect():
|
||||
FreeCADGui.Selection.addSelectionGate(FACEGate()) # Was PROFILEGate()
|
||||
FreeCAD.Console.PrintWarning("Profiling Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Profiling Select Mode\n")
|
||||
|
||||
|
||||
def chamferselect():
|
||||
FreeCADGui.Selection.addSelectionGate(CHAMFERGate())
|
||||
FreeCAD.Console.PrintWarning("Deburr Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Deburr Select Mode\n")
|
||||
|
||||
|
||||
def profileselect():
|
||||
FreeCADGui.Selection.addSelectionGate(PROFILEGate())
|
||||
FreeCAD.Console.PrintWarning("Profiling Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Profiling Select Mode\n")
|
||||
|
||||
|
||||
def pocketselect():
|
||||
FreeCADGui.Selection.addSelectionGate(POCKETGate())
|
||||
FreeCAD.Console.PrintWarning("Pocketing Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Pocketing Select Mode\n")
|
||||
|
||||
|
||||
def adaptiveselect():
|
||||
FreeCADGui.Selection.addSelectionGate(ADAPTIVEGate())
|
||||
FreeCAD.Console.PrintWarning("Adaptive Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Adaptive Select Mode\n")
|
||||
|
||||
|
||||
def slotselect():
|
||||
FreeCADGui.Selection.addSelectionGate(ALLGate())
|
||||
FreeCAD.Console.PrintWarning("Slot Cutter Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Slot Cutter Select Mode\n")
|
||||
|
||||
|
||||
def surfaceselect():
|
||||
@@ -339,26 +350,31 @@ def surfaceselect():
|
||||
if(MESHGate() or FACEGate()):
|
||||
gate = True
|
||||
FreeCADGui.Selection.addSelectionGate(gate)
|
||||
FreeCAD.Console.PrintWarning("Surfacing Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Surfacing Select Mode\n")
|
||||
|
||||
|
||||
def vcarveselect():
|
||||
FreeCADGui.Selection.addSelectionGate(VCARVEGate())
|
||||
FreeCAD.Console.PrintWarning("Vcarve Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Vcarve Select Mode\n")
|
||||
|
||||
|
||||
def probeselect():
|
||||
FreeCADGui.Selection.addSelectionGate(PROBEGate())
|
||||
FreeCAD.Console.PrintWarning("Probe Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Probe Select Mode\n")
|
||||
|
||||
|
||||
def customselect():
|
||||
FreeCAD.Console.PrintWarning("Custom Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Custom Select Mode\n")
|
||||
|
||||
|
||||
def turnselect():
|
||||
FreeCADGui.Selection.addSelectionGate(TURNGate())
|
||||
FreeCAD.Console.PrintWarning("Turning Select Mode\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Turning Select Mode\n")
|
||||
|
||||
|
||||
def select(op):
|
||||
@@ -392,4 +408,5 @@ def select(op):
|
||||
|
||||
def clear():
|
||||
FreeCADGui.Selection.removeSelectionGate()
|
||||
FreeCAD.Console.PrintWarning("Free Select\n")
|
||||
if not PathPreferences.suppressSelectionModeWarning():
|
||||
FreeCAD.Console.PrintWarning("Free Select\n")
|
||||
|
||||
@@ -401,7 +401,7 @@ def getToolControllers(obj, proxy=None):
|
||||
except Exception: # pylint: disable=broad-except
|
||||
job = None
|
||||
|
||||
print("op={} ({})".format(obj.Label, type(obj)))
|
||||
PathLog.debug("op={} ({})".format(obj.Label, type(obj)))
|
||||
if job:
|
||||
return [c for c in job.ToolController if proxy.isToolSupported(obj, c.Tool)]
|
||||
return []
|
||||
@@ -538,7 +538,7 @@ def arc(cx, cy, sx, sy, ex, ey, horizFeed=0, ez=None, ccw=False):
|
||||
|
||||
eps = 0.01
|
||||
if (math.sqrt((cx - sx)**2 + (cy - sy)**2) - math.sqrt((cx - ex)**2 + (cy - ey)**2)) >= eps:
|
||||
print("ERROR: Illegal arc: Start and end radii not equal")
|
||||
PathLog.error(translate("Path", "Illegal arc: Start and end radii not equal"))
|
||||
return ""
|
||||
|
||||
retstr = ""
|
||||
|
||||
@@ -324,4 +324,4 @@ def parse(pathobj):
|
||||
return out
|
||||
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -94,4 +94,4 @@ def parse(pathobj):
|
||||
out += str(c) + "\n"
|
||||
return out
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -367,4 +367,4 @@ def parse(pathobj):
|
||||
return out
|
||||
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -100,4 +100,4 @@ def parse(inputstring):
|
||||
print("done postprocessing.")
|
||||
return output
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -300,4 +300,4 @@ def parse(pathobj):
|
||||
return out
|
||||
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -570,4 +570,4 @@ def drill_translate(outstring, cmd, params):
|
||||
return trBuff
|
||||
|
||||
|
||||
print(__name__ + ": GCode postprocessor loaded.")
|
||||
# print(__name__ + ": GCode postprocessor loaded.")
|
||||
|
||||
@@ -333,4 +333,4 @@ def parse(pathobj):
|
||||
return out
|
||||
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -398,4 +398,4 @@ def parse(pathobj):
|
||||
|
||||
return out
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -434,4 +434,4 @@ def parse(pathobj):
|
||||
|
||||
return out
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -763,7 +763,7 @@ def drill_translate(outlist, cmd, params):
|
||||
return Drill.gcode
|
||||
|
||||
|
||||
print(__name__ + ': GCode postprocessor loaded.')
|
||||
# print(__name__ + ': GCode postprocessor loaded.')
|
||||
|
||||
# PEP8 format passed using: http://pep8online.com/, which primarily covers
|
||||
# indentation and line length. Some other aspects of PEP8 which have not
|
||||
|
||||
@@ -364,4 +364,4 @@ def linenumber():
|
||||
return ""
|
||||
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -256,5 +256,5 @@ def parse(inputstring):
|
||||
|
||||
return '\n'.join(output)
|
||||
|
||||
print (__name__ + " gcode postprocessor loaded.")
|
||||
# print (__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
|
||||
@@ -425,4 +425,4 @@ def parse(pathobj):
|
||||
return out
|
||||
|
||||
|
||||
print(__name__ + " gcode postprocessor loaded.")
|
||||
# print(__name__ + " gcode postprocessor loaded.")
|
||||
|
||||
@@ -38,16 +38,18 @@ class TestPathDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0
|
||||
tool.CuttingEdgeAngle = 180
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(1, 0.01, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.01, tool, True)
|
||||
self.assertRoughly(0.01, depth)
|
||||
self.assertRoughly(9, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
# legacy tools - no problem, same result
|
||||
tool.CuttingEdgeAngle = 0
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(1, 0.01, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.01, tool, True)
|
||||
self.assertRoughly(0.01, depth)
|
||||
self.assertRoughly(9, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
def test01(self):
|
||||
'''Verify chamfer depth and offset for a 90° v-bit.'''
|
||||
@@ -55,13 +57,15 @@ class TestPathDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0
|
||||
tool.CuttingEdgeAngle = 90
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(1, 0, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
self.assertRoughly(1, depth)
|
||||
self.assertRoughly(0, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(1, 0.2, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.2, tool, True)
|
||||
self.assertRoughly(1.2, depth)
|
||||
self.assertRoughly(0.2, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
def test02(self):
|
||||
'''Verify chamfer depth and offset for a 90° v-bit with non 0 flat radius.'''
|
||||
@@ -69,13 +73,15 @@ class TestPathDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0.3
|
||||
tool.CuttingEdgeAngle = 90
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(1, 0, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
self.assertRoughly(1, depth)
|
||||
self.assertRoughly(0.3, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(2, 0.2, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(2, 0.2, tool, True)
|
||||
self.assertRoughly(2.2, depth)
|
||||
self.assertRoughly(0.5, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
def test03(self):
|
||||
'''Verify chamfer depth and offset for a 60° v-bit with non 0 flat radius.'''
|
||||
@@ -85,10 +91,55 @@ class TestPathDeburr(PathTestUtils.PathTestBase):
|
||||
|
||||
td = 1.73205
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(1, 0, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
self.assertRoughly(td, depth)
|
||||
self.assertRoughly(10, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset) = PathDeburr.toolDepthAndOffset(3, 1, tool)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
self.assertRoughly(td * 3 + 1, depth)
|
||||
self.assertRoughly(10 + td, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
def test10(self):
|
||||
'''Verify missing cutting endge angle info prints only once.'''
|
||||
|
||||
class FakeEndmill(object):
|
||||
def __init__(self, dia):
|
||||
self.Diameter = dia
|
||||
|
||||
tool = FakeEndmill(10)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, True)
|
||||
self.assertRoughly(0.1, depth)
|
||||
self.assertRoughly(4, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(0.1, depth)
|
||||
self.assertRoughly(4, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(0.1, depth)
|
||||
self.assertRoughly(4, offset)
|
||||
self.assertTrue(info)
|
||||
|
||||
def test11(self):
|
||||
'''Verify missing tip diameter info prints only once.'''
|
||||
|
||||
class FakePointyBit(object):
|
||||
def __init__(self, dia, angle):
|
||||
self.Diameter = dia
|
||||
self.CuttingEdgeAngle = angle
|
||||
|
||||
tool = FakePointyBit(10, 90)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, True)
|
||||
self.assertRoughly(1.1, depth)
|
||||
self.assertRoughly(0.1, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(1.1, depth)
|
||||
self.assertRoughly(0.1, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(1.1, depth)
|
||||
self.assertRoughly(0.1, offset)
|
||||
self.assertTrue(info)
|
||||
|
||||
Reference in New Issue
Block a user