def Initialize(self): global PathCommandGroup # Add preferences pages - before loading PathGui to properly order pages of Path group from PathScripts import PathPreferencesPathJob, PathPreferencesPathDressup FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, "Path") FreeCADGui.addPreferencePage( PathPreferencesPathDressup.DressupPreferencesPage, "Path" ) # Check enablement of experimental features from PathScripts import PathPreferences # load the builtin modules import Path import PathScripts import PathGui from PySide import QtCore, QtGui FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") from PathScripts import PathGuiInit from PathScripts import PathJobCmd from PathScripts import PathToolBitCmd from PathScripts import PathToolBitLibraryCmd from PySide.QtCore import QT_TRANSLATE_NOOP import PathCommands PathGuiInit.Startup() # build commands list projcmdlist = ["Path_Job", "Path_Post"] toolcmdlist = [ "Path_Inspect", "Path_Simulator", "Path_SelectLoop", "Path_OpActiveToggle", ] prepcmdlist = [ "Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom", "Path_Probe", ] twodopcmdlist = [ "Path_Profile", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix", "Path_Adaptive", ] threedopcmdlist = ["Path_Pocket3D"] engravecmdlist = ["Path_Engrave", "Path_Deburr", "Path_Vcarve"] modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy"] dressupcmdlist = [ "Path_DressupAxisMap", "Path_DressupPathBoundary", "Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag", "Path_DressupZCorrect", ] extracmdlist = [] # modcmdmore = ["Path_Hop",] # remotecmdlist = ["Path_Remote"] specialcmdlist = [] if PathPreferences.toolsUseLegacyTools(): toolcmdlist.append("Path_ToolLibraryEdit") toolbitcmdlist = [] else: toolcmdlist.extend(PathToolBitLibraryCmd.BarList) toolbitcmdlist = PathToolBitLibraryCmd.MenuList engravecmdgroup = ["Path_EngraveTools"] FreeCADGui.addCommand( "Path_EngraveTools", PathCommandGroup( engravecmdlist, QT_TRANSLATE_NOOP("Path_EngraveTools", "Engraving Operations") ), ) threedcmdgroup = threedopcmdlist if PathPreferences.experimentalFeaturesEnabled(): projcmdlist.append("Path_Sanity") prepcmdlist.append("Path_Shape") extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) specialcmdlist.append("Path_ThreadMilling") twodopcmdlist.append("Path_Slot") if PathPreferences.advancedOCLFeaturesEnabled(): try: import ocl # pylint: disable=unused-variable from PathScripts import PathSurfaceGui from PathScripts import PathWaterlineGui threedopcmdlist.extend(["Path_Surface", "Path_Waterline"]) threedcmdgroup = ["Path_3dTools"] FreeCADGui.addCommand( "Path_3dTools", PathCommandGroup( threedopcmdlist, QT_TRANSLATE_NOOP("Path_3dTools", "3D Operations"), ), ) except ImportError: if not PathPreferences.suppressOpenCamLibWarning(): FreeCAD.Console.PrintError("OpenCamLib is not working!\n") self.appendToolbar( QT_TRANSLATE_NOOP("Path", "Project Setup"), projcmdlist ) self.appendToolbar( QT_TRANSLATE_NOOP("Path", "Tool Commands"), toolcmdlist ) self.appendToolbar( QT_TRANSLATE_NOOP("Path", "New Operations"), twodopcmdlist + engravecmdgroup + threedcmdgroup, ) self.appendToolbar( QT_TRANSLATE_NOOP("Path", "Path Modification"), modcmdlist ) if extracmdlist: self.appendToolbar( QT_TRANSLATE_NOOP("Path", "Helpful Tools"), extracmdlist ) self.appendMenu( [QT_TRANSLATE_NOOP("Path", "&Path")], projcmdlist + ["Path_ExportTemplate", "Separator"] + toolcmdlist + toolbitcmdlist + ["Separator"] + twodopcmdlist + engravecmdlist + ["Separator"] + threedopcmdlist + ["Separator"], ) self.appendMenu( [ QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP("Path", "Path Dressup"), ], dressupcmdlist, ) self.appendMenu( [ QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP("Path", "Supplemental Commands"), ], prepcmdlist, ) self.appendMenu( [ QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP("Path", "Path Modification"), ], modcmdlist, ) if specialcmdlist: self.appendMenu( [ QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP("Path", "Specialty Operations"), ], specialcmdlist, ) if extracmdlist: self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path")], extracmdlist) self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path")], ["Separator"]) self.appendMenu( [ QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP("Path", "Utils"), ], ["Path_PropertyBag"], ) self.dressupcmds = dressupcmdlist curveAccuracy = PathPreferences.defaultLibAreaCurveAccuracy() if curveAccuracy: Path.Area.setDefaultParams(Accuracy=curveAccuracy) # keep this one the last entry in the preferences import PathScripts.PathPreferencesAdvanced as PathPreferencesAdvanced FreeCADGui.addPreferencePage( PathPreferencesAdvanced.AdvancedPreferencesPage, "Path" ) Log("Loading Path workbench... done\n")
def Initialize(self): global PathCommandGroup # Add preferences pages - before loading PathGui to properly order pages of Path group from PathScripts import PathPreferencesPathJob, PathPreferencesPathDressup FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, "Path") FreeCADGui.addPreferencePage( PathPreferencesPathDressup.DressupPreferencesPage, "Path") # Check enablement of experimental features from PathScripts import PathPreferences # load the builtin modules import Path import PathScripts import PathGui from PySide import QtCore, QtGui FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") from PathScripts import PathGuiInit from PathScripts import PathJobCmd import PathCommands PathGuiInit.Startup() # build commands list projcmdlist = ["Path_Job", "Path_Post"] toolcmdlist = [ "Path_Inspect", "Path_Simulator", "Path_ToolLibraryEdit", "Path_SelectLoop", "Path_OpActiveToggle" ] prepcmdlist = [ "Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom" ] twodopcmdlist = [ "Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix", "Path_Adaptive" ] threedopcmdlist = ["Path_Pocket_3D"] engravecmdlist = ["Path_Engrave", "Path_Deburr"] modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy"] dressupcmdlist = [ "Path_DressupAxisMap", "Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag" ] extracmdlist = [] #modcmdmore = ["Path_Hop",] #remotecmdlist = ["Path_Remote"] engravecmdgroup = ['Path_EngraveTools'] FreeCADGui.addCommand( 'Path_EngraveTools', PathCommandGroup( engravecmdlist, QtCore.QT_TRANSLATE_NOOP("Path", 'Engraving Operations'))) threedcmdgroup = threedopcmdlist if PathPreferences.experimentalFeaturesEnabled(): projcmdlist.append("Path_Sanity") prepcmdlist.append("Path_Shape") extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) try: import ocl # pylint: disable=unused-variable from PathScripts import PathSurfaceGui threedopcmdlist.append("Path_Surface") 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") self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Project Setup"), projcmdlist) self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Tool Commands"), toolcmdlist) self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "New Operations"), twodopcmdlist + engravecmdgroup + threedcmdgroup) self.appendToolbar( QtCore.QT_TRANSLATE_NOOP("Path", "Path Modification"), modcmdlist) if extracmdlist: self.appendToolbar( QtCore.QT_TRANSLATE_NOOP("Path", "Helpful Tools"), extracmdlist) self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path")], projcmdlist + ["Path_ExportTemplate", "Separator"] + toolcmdlist + ["Separator"] + twodopcmdlist + engravecmdlist + ["Separator"] + threedopcmdlist + ["Separator"]) self.appendMenu([ QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP("Path", "Path Dressup") ], dressupcmdlist) self.appendMenu([ QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP("Path", "Supplemental Commands") ], prepcmdlist) self.appendMenu([ QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP("Path", "Path Modification") ], modcmdlist) if extracmdlist: self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path")], extracmdlist) self.dressupcmds = dressupcmdlist curveAccuracy = PathPreferences.defaultLibAreaCurveAccuracy() if curveAccuracy: Path.Area.setDefaultParams(Accuracy=curveAccuracy) Log('Loading Path workbench... done\n')
def Initialize(self): global PathCommandGroup # Add preferences pages - before loading PathGui to properly order pages of Path group from PathScripts import PathPreferencesPathJob, PathPreferencesPathDressup translate = FreeCAD.Qt.translate FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, "Path") FreeCADGui.addPreferencePage( PathPreferencesPathDressup.DressupPreferencesPage, "Path") # Check enablement of experimental features from PathScripts import PathPreferences # load the builtin modules import Path import PathScripts import PathGui from PySide import QtCore, QtGui FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") from PathScripts import PathGuiInit from PathScripts import PathJobCmd from PathScripts import PathToolBitCmd from PathScripts import PathToolBitLibraryCmd from PySide.QtCore import QT_TRANSLATE_NOOP import PathCommands PathGuiInit.Startup() # build commands list projcmdlist = ["Path_Job", "Path_Post"] toolcmdlist = [ "Path_Inspect", "Path_Simulator", "Path_SelectLoop", "Path_OpActiveToggle", ] prepcmdlist = [ "Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom", "Path_Probe", ] twodopcmdlist = [ "Path_Profile", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix", "Path_Adaptive", ] threedopcmdlist = ["Path_Pocket3D"] engravecmdlist = ["Path_Engrave", "Path_Deburr", "Path_Vcarve"] modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy"] dressupcmdlist = [ "Path_DressupAxisMap", "Path_DressupPathBoundary", "Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag", "Path_DressupZCorrect", ] extracmdlist = [] # modcmdmore = ["Path_Hop",] # remotecmdlist = ["Path_Remote"] specialcmdlist = [] if PathPreferences.toolsUseLegacyTools(): toolcmdlist.append("Path_ToolLibraryEdit") toolbitcmdlist = [] else: toolcmdlist.extend(PathToolBitLibraryCmd.BarList) toolbitcmdlist = PathToolBitLibraryCmd.MenuList engravecmdgroup = ["Path_EngraveTools"] FreeCADGui.addCommand( "Path_EngraveTools", PathCommandGroup( engravecmdlist, QT_TRANSLATE_NOOP("Path_EngraveTools", "Engraving Operations"), ), ) threedcmdgroup = threedopcmdlist if PathPreferences.experimentalFeaturesEnabled(): projcmdlist.append("Path_Sanity") prepcmdlist.append("Path_Shape") extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) specialcmdlist.append("Path_ThreadMilling") twodopcmdlist.append("Path_Slot") if PathPreferences.advancedOCLFeaturesEnabled(): try: import ocl from PathScripts import PathSurfaceGui from PathScripts import PathWaterlineGui threedopcmdlist.extend(["Path_Surface", "Path_Waterline"]) threedcmdgroup = ["Path_3dTools"] FreeCADGui.addCommand( "Path_3dTools", PathCommandGroup( threedopcmdlist, QT_TRANSLATE_NOOP("Path_3dTools", "3D Operations"), ), ) except ImportError: if not PathPreferences.suppressOpenCamLibWarning(): FreeCAD.Console.PrintError("OpenCamLib is not working!\n") self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Project Setup"), projcmdlist) self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Tool Commands"), toolcmdlist) self.appendToolbar( QT_TRANSLATE_NOOP("Workbench", "New Operations"), twodopcmdlist + engravecmdgroup + threedcmdgroup, ) self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Path Modification"), modcmdlist) if extracmdlist: self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Helpful Tools"), extracmdlist) self.appendMenu( [QT_TRANSLATE_NOOP("Workbench", "&Path")], projcmdlist + ["Path_ExportTemplate", "Separator"] + toolcmdlist + toolbitcmdlist + ["Separator"] + twodopcmdlist + engravecmdlist + ["Separator"] + threedopcmdlist + ["Separator"], ) self.appendMenu( [ QT_TRANSLATE_NOOP("Workbench", "&Path"), QT_TRANSLATE_NOOP("Workbench", "Path Dressup"), ], dressupcmdlist, ) self.appendMenu( [ QT_TRANSLATE_NOOP("Workbench", "&Path"), QT_TRANSLATE_NOOP("Workbench", "Supplemental Commands"), ], prepcmdlist, ) self.appendMenu( [ QT_TRANSLATE_NOOP("Workbench", "&Path"), QT_TRANSLATE_NOOP("Workbench", "Path Modification"), ], modcmdlist, ) if specialcmdlist: self.appendMenu( [ QT_TRANSLATE_NOOP("Workbench", "&Path"), QT_TRANSLATE_NOOP("Workbench", "Specialty Operations"), ], specialcmdlist, ) if extracmdlist: self.appendMenu([QT_TRANSLATE_NOOP("Workbench", "&Path")], extracmdlist) self.appendMenu([QT_TRANSLATE_NOOP("Workbench", "&Path")], ["Separator"]) self.appendMenu( [ QT_TRANSLATE_NOOP("Workbench", "&Path"), QT_TRANSLATE_NOOP("Workbench", "Utils"), ], ["Path_PropertyBag"], ) self.dressupcmds = dressupcmdlist curveAccuracy = PathPreferences.defaultLibAreaCurveAccuracy() if curveAccuracy: Path.Area.setDefaultParams(Accuracy=curveAccuracy) # keep this one the last entry in the preferences import PathScripts.PathPreferencesAdvanced as PathPreferencesAdvanced from PathScripts.PathPreferences import preferences FreeCADGui.addPreferencePage( PathPreferencesAdvanced.AdvancedPreferencesPage, "Path") Log("Loading Path workbench... done\n") # Warn user if current schema doesn't use minute for time in velocity if not PathPreferences.suppressVelocity(): velString = FreeCAD.Units.Quantity( 1, FreeCAD.Units.Velocity).getUserPreferred()[2][3:] if velString != "min": current_schema = FreeCAD.Units.listSchemas( FreeCAD.Units.getSchema()) msg = translate( "Path", f"The currently selected unit schema: \n '{current_schema}'\n Does not use 'minutes' for velocity values. \n \nCNC machines require feed rate to be expressed in \nunit/minute. To ensure correct gcode: \nSelect a minute-based schema in preferences.\nFor example:\n 'Metric, Small Parts & CNC'\n 'US Customary'\n 'Imperial Decimal'", ) header = translate("Path", "Warning") msgbox = QtGui.QMessageBox(QtGui.QMessageBox.Warning, header, msg) msgbox.addButton(translate("Path", "Ok"), QtGui.QMessageBox.AcceptRole) msgbox.addButton(translate("Path", "Don't Show This Anymore"), QtGui.QMessageBox.ActionRole) if msgbox.exec_() == 1: preferences().SetBool("WarningSuppressVelocity", True)