Beispiel #1
0
    def Initialize(self):
        """ Run at start of FreeCAD.
        """
        import WF
        try:
            import WF_general
            import WF_centerLinePoint
            import WF_extremaLinePoint
            import WF_alongLinePoint
            import WF_nPointsPoint
            # import WF_centerCirclePoint
            import WF_centerFacePoint
            import WF_projectedPoint
            # import WF_pointFacePoint
            # import WF_lineFacePoint

            import WF_twoPointsLine
            import WF_nPointsLine

            import WF_threePointsPlane
            import WF_linePointPlane
            # import WF_perpendicularLinePointPlane
        except ImportError:
            m_error = "Error: One of WF_ module not found,"
            m_error += "WorkFeature workbench will be disabled.\n"
            App.Console.PrintWarning(m_error)
            m_error = "Error: Unknown error while trying"
            m_error += "to load one of WF_ module !\n"
            App.Console.PrintWarning(m_error)

        # Set menu and commands for Points
        self.General_menu = ["Work Feature", "General"]
        self.General_commands_list = [
            "ShowHideDynamic",
            "ShowHideInteractive",
            "ShowHideNo",
            "Refresh",
        ]
        self.appendCommandbar("General", self.General_commands_list)
        self.appendMenu(self.General_menu, self.General_commands_list)
        self.appendToolbar("WF General", self.General_commands_list)

        # Set menu and commands for Points
        self.Point_menu = ["Work Feature", "Points"]
        self.Point_commands_list = [
            "CenterLinePoint",  # done but to test
            "ExtremaLinePoint",  # done but to test
            "AlongLinePoint",  # done but to test
            "NPointsPoint",  # done but to test
            # "CenterCirclePoint",
            "CenterFacePoint",
            # "PointFacePoint",
            # "LineFacePoint",
            "ProjectedPoint"
        ]
        self.appendCommandbar("Points", self.Point_commands_list)
        self.appendMenu(self.Point_menu, self.Point_commands_list)
        self.appendToolbar("WF Points", self.Point_commands_list)

        # Set menu and commands for Lines
        self.m_Line_menu = ["Work Feature", "Lines"]
        self.m_Line_commands_list = [
            "TwoPointsLine",  # done but to test
            "NPointsLine",  # done but to test
        ]
        self.appendCommandbar("Lines", self.m_Line_commands_list)
        self.appendMenu(self.m_Line_menu, self.m_Line_commands_list)
        self.appendToolbar("WF Lines", self.m_Line_commands_list)

        # Set menu and commands for Planes
        self.m_Plane_menu = ["Work Feature", "Planes"]
        self.m_Plane_commands_list = [
            "ThreePointsPlane",  # done but to test
            "LinePointPlane",  # done but to test
            # "PerpendicularLinePointPlane",
        ]
        self.appendCommandbar("Planes", self.m_Plane_commands_list)
        self.appendMenu(self.m_Plane_menu, self.m_Plane_commands_list)
        self.appendToolbar("WF Planes", self.m_Plane_commands_list)

        # m_submenu = ['WorkFeature.pdf']
        # self.appendMenu(["Work Feature", "Help"], m_submenu)

        Gui.addIconPath(PATH_WF_ICONS)
        Gui.addResourcePath(PATH_WF_ICONS)
        Gui.addPreferencePage(PATH_WF_UI + "/WorkFeature_prefs.ui",
                              "Work Feature")

        WF.set_release(WF_Release)
        Log('Loading WorkFeature workbench...done\n')
        if M_DEBUG:
            print("DEBUG : WF_Release is " + str(WF_Release))