コード例 #1
0
    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')
コード例 #2
0
    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")
コード例 #3
0
ファイル: InitGui.py プロジェクト: Roy-043/FreeCAD
    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)
コード例 #4
0
    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")
        # load python modules
        from PathScripts import PathArray
        from PathScripts import PathComment
        from PathScripts import PathCustom
        from PathScripts import PathDeburrGui
        from PathScripts import PathDressupAxisMap
        from PathScripts import PathDressupDogbone
        from PathScripts import PathDressupDragknife
        from PathScripts import PathDressupRampEntry
        from PathScripts import PathDressupTagGui
        from PathScripts import PathDressupLeadInOut
        from PathScripts import PathDrillingGui
        from PathScripts import PathEngraveGui
        from PathScripts import PathFixture
        from PathScripts import PathHelixGui
        from PathScripts import PathHop
        from PathScripts import PathInspect
        from PathScripts import PathJobCmd
        from PathScripts import PathMillFaceGui
        from PathScripts import PathPocketGui
        from PathScripts import PathPocketShapeGui
        from PathScripts import PathPost
        from PathScripts import PathProfileContourGui
        from PathScripts import PathProfileEdgesGui
        from PathScripts import PathProfileFacesGui
        from PathScripts import PathSanity
        from PathScripts import PathSetupSheetGui
        from PathScripts import PathSimpleCopy
        from PathScripts import PathStop
        from PathScripts import PathSurfaceGui
        from PathScripts import PathToolController
        from PathScripts import PathToolLibraryManager
        from PathScripts import PathSimulatorGui
        from PathScripts import PathAdaptiveGui
        import PathCommands

        # build commands list
        projcmdlist = ["Path_Job", "Path_Post"]
        toolcmdlist = ["Path_Inspect", "Path_Simulator", "Path_ToolLibraryEdit", "Path_SelectLoop"]
        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" ]
        threedopcmdlist = ["Path_Pocket_3D"]
        engravecmdlist = ["Path_Engrave"]
        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"]

        if PathPreferences.experimentalFeaturesEnabled():
            projcmdlist.append("Path_Sanity")
            prepcmdlist.append("Path_Shape")
            extracmdlist.extend(["Path_Area", "Path_Area_Workplane"])

            engravecmdlist = sorted(engravecmdlist + ['Path_Deburr'])
            engravecmdgroup = ['Path_EngraveTools']
            FreeCADGui.addCommand('Path_EngraveTools', PathCommandGroup(engravecmdlist, QtCore.QT_TRANSLATE_NOOP("Path", 'Engraving Operations')))

            threedopcmdlist.append("Path_Surface")
            threedcmdgroup = ['Path_3dTools']
            FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path",'3D Operations')))

            twodopcmdlist.append("Path_Adaptive")
        else:
            engravecmdgroup = engravecmdlist
            threedcmdgroup = threedopcmdlist

        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(curveAccuracy)

        Log('Loading Path workbench... done\n')
コード例 #5
0
    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')))

        if PathPreferences.experimentalFeaturesEnabled():
            projcmdlist.append("Path_Sanity")
            prepcmdlist.append("Path_Shape")
            extracmdlist.extend(["Path_Area", "Path_Area_Workplane"])

            threedopcmdlist.append("Path_Surface")
            threedcmdgroup = ['Path_3dTools']
            FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path",'3D Operations')))

        else:
            threedcmdgroup = threedopcmdlist

        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')
コード例 #6
0
ファイル: InitGui.py プロジェクト: sandvikcode/FreeCAD
    def Initialize(self):
        # 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 QtGui
        FreeCADGui.addLanguagePath(":/translations")
        FreeCADGui.addIconPath(":/icons")
        # load python modules
        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
        from PathScripts import PathDressupTagGui
        from PathScripts import PathDressupLeadInOut
        from PathScripts import PathDrillingGui
        from PathScripts import PathEngraveGui
        from PathScripts import PathFixture
        from PathScripts import PathHelixGui
        from PathScripts import PathHop
        from PathScripts import PathInspect
        from PathScripts import PathJobCmd
        from PathScripts import PathMillFaceGui
        from PathScripts import PathPocketGui
        from PathScripts import PathPocketShapeGui
        from PathScripts import PathPost
        from PathScripts import PathProfileContourGui
        from PathScripts import PathProfileEdgesGui
        from PathScripts import PathProfileFacesGui
        from PathScripts import PathSanity
        from PathScripts import PathSimpleCopy
        from PathScripts import PathStop
        from PathScripts import PathSurfaceGui
        from PathScripts import PathToolController
        from PathScripts import PathToolLibraryManager
        from PathScripts import PathSimulatorGui
        import PathCommands

        # build commands list
        projcmdlist = ["Path_Job", "Path_Post"]
        toolcmdlist = [
            "Path_Inspect", "Path_Simulator", "Path_ToolLibraryEdit",
            "Path_SelectLoop"
        ]
        prepcmdlist = [
            "Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom"
        ]
        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_DressupAxisMap", "Path_DressupDogbone",
            "Path_DressupDragKnife", "Path_DressupLeadInOut",
            "Path_DressupRampEntry", "Path_DressupTag"
        ]
        extracmdlist = []

        #modcmdmore = ["Path_Hop",]
        #remotecmdlist = ["Path_Remote"]

        # Add commands to menu and toolbar
        def QT_TRANSLATE_NOOP(scope, text):
            return text

        class ThreeDCommandGroup:
            def GetCommands(self):
                return tuple(threedopcmdlist)

            def GetResources(self):
                return {
                    'MenuText': QT_TRANSLATE_NOOP("Path", '3D Operations'),
                    'ToolTip': QT_TRANSLATE_NOOP("Path", '3D Operations')
                }

            def IsActive(self):
                if FreeCAD.ActiveDocument is not None:
                    for o in FreeCAD.ActiveDocument.Objects:
                        if o.Name[:3] == "Job":
                            return True
                return False

        if PathPreferences.experimentalFeaturesEnabled():
            projcmdlist.append("Path_Sanity")
            prepcmdlist.append("Path_Shape")
            threedopcmdlist.append("Path_Surface")
            extracmdlist.extend(["Path_Area", "Path_Area_Workplane"])
            FreeCADGui.addCommand('Path_3dTools', ThreeDCommandGroup())
            threedcmdgroup = ['Path_3dTools']
        else:
            threedcmdgroup = threedopcmdlist

        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 + 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 + ["Separator"] + twodopcmdlist +
                        ["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 extracmdlist:
            self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path")], extracmdlist)

        self.dressupcmds = dressupcmdlist

        curveAccuracy = PathPreferences.defaultLibAreaCurveAccuracy()
        if curveAccuracy:
            Path.Area.setDefaultParams(curveAccuracy)

        Log('Loading Path workbench... done\n')