示例#1
0
        public CustomCodeGroups()
        {
            // Obtain references to the main application's objects, devices and members. (See MCF Dev Guide.)
            FCodeGroupFolder gcodes = (FCodeGroupFolder)FObject.GetRef("GCodes");
            FCodeGroupFolder mcodes = (FCodeGroupFolder)FObject.GetRef("MCodes");

            controller = FDevice.GetRef("Controller");

            MainProgram          = FFile.GetRef("NcFile.MainProgram");
            MainProgram.Changed += MainProgram_Changed;  // Hint: tab twice after you type the "+=" for some VS magic!

            theIniFile.TheFile = g.ApplicationDirectory + @"\PowerPmacNC.ini";

            // Add G-code groups:
            // - the order of items below will determine the order they display in the Machine View list of Gcode Groups
            //new FCodeGroup<ECustomGGroup>(gcodes, controller, "CustomGGroup", "Custom G-code group", ECustomGGroup.None);

            // Add M-code groups:
            // - the order of items below will determine the order they display in the Machine View list of Mcode Groups
            //new FCodeGroup<ECustomMGroup>(mcodes, controller, "CustomMGroup", "Custom M-code group", ECustomMGroup.M200);
            OutfileLoggingGroup = new FCodeGroup <EOutfileLoggingGroup>(mcodes, controller, "OutfileLoggingGroup", "Locator Pins M-code group", EOutfileLoggingGroup.M31);
            HoldDownsGroup      = new FCodeGroup <EHoldDownsGroup>(mcodes, controller, "HoldDownsGroup", "Hold Downs M-code group", EHoldDownsGroup.M41);
            LocatorPinsGroup    = new FCodeGroup <ELocatorPinsGroup>(mcodes, controller, "LocatorPinsGroup", "Locator Pins M-code group", ELocatorPinsGroup.M51);

            // Handlers (if needed) to react to a G-Mcode group changing
            //HoldDownsGroup.Changed += HoldDownsGroup_Changed;  // add a Changed handler
            OutfileLoggingGroup.Changed += OutfileLoggingGroup_Changed;  // add a Changed handler

            //go to INI file to get user set parameters for Outfile processing
            // - these are in the "PowerPmacNC.ini" file on the main NC14 application
            // - these are in the section [Router_Addin] of Ini file
            OutfilePath       = theIniFile.GetValue("Router_Addin", "OutfilePath", "C:\\Outfile\\");
            OutfileName       = theIniFile.GetValue("Router_Addin", "OutfileName", "Outfile.txt");
            OutfileDelimiter  = theIniFile.GetValue("Router_Addin", "OutfileDelimiter", ",");
            MachineName       = theIniFile.GetValue("Router_Addin", "MachineName", "Watoga");
            AvgFeedrateEnable = theIniFile.GetValue("Router_Addin", "AvgFeedrateEnable", "1");
            AvgOverideEnable  = theIniFile.GetValue("Router_Addin", "AvgOverideEnable", "1");


            //Key Down Handler defined
            g.theMachine.KeyDown += OnKeyDown;
        }