コード例 #1
0
        public void RunMacroAsSingleCommandTest()
        {
            File macFile = File.CreateTemporaryFile("mac");

            TestFiles.TestMacro2File.Copy(macFile);
            TestFiles.TestMacro3File.Copy(new File(macFile.ParentDirectory, TestFiles.TestMacro3File.Name));
            _powerMILL.SubstitutionTokens.Add(new PMSubstitutionToken("{MACROPATH}", macFile.ParentDirectory.Path));

            PMMacro mainMac = _powerMILL.LoadMacro(macFile);

            int nLines = mainMac.TotalCount; //This should include sub macro lines
            MacroEventCatcher catcher = new MacroEventCatcher(mainMac);

            catcher.Run();
            int nCatcherEventCaptured = catcher.DataList.Count;

            Assert.AreEqual(nLines, nCatcherEventCaptured, "Not run as embedded macro");

            PMMacro macro2 = _powerMILL.LoadMacro(macFile);

            macro2.RunSubMacrosOption = PMMacro.SubMacroRunOptions.RunAsSingleLine;
            int nLines2 = macro2.TotalCount; //This should include sub macro as 1 line

            catcher = new MacroEventCatcher(macro2);
            catcher.Run();

            Assert.AreEqual(nLines2, catcher.DataList.Count, "Not run as single line macro");
            Assert.AreNotEqual(nLines, nLines2, "Should not have the same number of commands ran");
        }
コード例 #2
0
        public void MacroStepEventFired()
        {
            _powerMILL.IssueEchoOffCommands = true;

            Directory existingPM = LoadCopyOfPowerMillProject(TestFiles.PMwithNcProgram1, true);

            _TmpFoldersToDelete.Add(existingPM);
            File macFile = TestFiles.TestMacroStepEventFires;

            _powerMILL.LoadProject(existingPM);

            PMMacro           myMac   = _powerMILL.LoadMacro(macFile);
            MacroEventCatcher catcher = new MacroEventCatcher(myMac);

            catcher.Run();

            Assert.Greater(catcher.DataList.Count, 0, "Expecting more than 0 events");
            Assert.AreEqual(catcher.DataList.Count, 24, "Expected 24 events!");
        }
コード例 #3
0
        //String macroPath = "L:/CAM-Library/Niigata/NiigataMacros/CreateToolPathMacros/MultiSideMacros/"

        //Method to run Macros
        public void runMacroAB(String path, PMAutomation projectUse)
        {
            PMMacro macro = projectUse.LoadMacro(new Autodesk.FileSystem.File(path));

            macro.RunComplete();
        }
コード例 #4
0
        public MacroEventCatcher(PMMacro macro)
        {
            Macro = macro;

            Macro.StepProcessed += Macro_StepProcessed;
        }