Пример #1
0
        private void DatabaseTag_Click(object sender, RoutedEventArgs e)
        {
            string TemplateFolder    = "";
            string Path              = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Substring(8, System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Length - 8);
            string directory         = System.IO.Path.GetDirectoryName(Path);
            string RenameMacro       = directory + "\\Rename.mac";
            string EndOfTagging      = directory + "\\EndOfTagging.mac";
            double Tolerance         = 0;
            bool   UseMethod         = false;
            bool   DepthFromTop      = false;
            bool   AllowTagDuplicate = true;
            List <RecognizedHoles> RecognizedHolesList = null;

            if (NCProgramListDB.Text == "")
            {
                MessageBox.Show("Please select a Featureset", "Error");
                return;
            }

            //Get the template from the option page

            TagHoles.ExtractINIData(out MachineCells);
            TagHoles.GetActiveMachineCellInfos(MachineCell_Drop.Text, MachineCells, out CSVPath, out TemplateFolder, out Tolerance, out UseMethod, out DepthFromTop, out AllowTagDuplicate);

            PowerMILLAutomation.ExecuteEx("ACTIVATE Featureset '" + NCProgramListDB.Text + "'");
            PowerMILLAutomation.ExecuteEx("MACRO '" + RenameMacro + "'");
            TagHoles.ExtractFeatureSetData(CSVPath, DepthFromTop, out HoleData, out List <DBHoleInfos> DBHoleData);
            TagHoles.MatchAndRenameHolesNew(NCProgramListDB.Text, HoleData, DBHoleData, Tolerance, out RecognizedHolesList, out UnRecognizedHolesList);
            FillUnrecognizedHolePullDown();
            PowerMILLAutomation.ExecuteEx("MACRO '" + EndOfTagging + "'");
        }
Пример #2
0
        private void Generate_Click(object sender, RoutedEventArgs e)
        {
            string TemplateFolder    = "";
            string Path              = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Substring(8, System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Length - 8);
            string directory         = System.IO.Path.GetDirectoryName(Path);
            string RenameMacro       = directory + "\\Rename.mac";
            string EndOfTagging      = directory + "\\EndOfTagging.mac";
            double Tolerance         = 0;
            bool   UseMethod         = false;
            bool   AllowTagDuplicate = true;
            List <RecognizedHoles> RecognizedHolesList = null;


            //Get the template from the option page
            TagHoles.ExtractINIData(out MachineCells);
            TagHoles.GetActiveMachineCellInfos(MachineCell_Drop.Text, MachineCells, out CSVPath, out TemplateFolder, out Tolerance, out UseMethod, out bool DepthFromTop, out AllowTagDuplicate);


            foreach (string FeatureSet in listHoleFeatureSetSelected.Items)
            {
                PowerMILLAutomation.ExecuteEx("ACTIVATE Featureset '" + FeatureSet + "'");

                if (TagOnly.IsChecked == true || TagAndTP.IsChecked == true)
                {
                    PowerMILLAutomation.ExecuteEx("MACRO '" + RenameMacro + "'");
                    TagHoles.ExtractFeatureSetData(CSVPath, DepthFromTop, out HoleData, out List <DBHoleInfos> DBHoleData);
                    TagHoles.MatchAndRenameHolesNew(FeatureSet, HoleData, DBHoleData, Tolerance, out RecognizedHolesList, out UnRecognizedHolesList);
                    PowerMILLAutomation.ExecuteEx("MACRO '" + EndOfTagging + "'");
                }
                if (TPOnly.IsChecked == true || TagAndTP.IsChecked == true)
                {
                    TagHoles.GenerateToolpaths(directory, TemplateFolder, UseMethod);
                }

                MessageBox.Show("Process completed", "Hole Tagging Plugin");
            }
        }