コード例 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static public void FeatureCAMToVericut()
        {
            LanguageSupport.InitializeTranslation(fc.CurrentLanguage, @"Localization");
            CheckTLBCompatibility();
            if (!IsLicensedProperly())
            {
                return;
            }

            Variables.doc = (FeatureCAM.FMDocument)fc.ActiveDocument;
            if (Variables.doc == null)
            {
                MessageDisplay.ShowError(
                    LanguageSupport.Translate("No files are open"));
                return;
            }

            if (File.Exists(@"C:\ProgramData\FeatureCAM\vericut_addin.ini"))
            {
                Variables.vericut_fpath = File.ReadAllText(@"C:\ProgramData\FeatureCAM\vericut_addin.ini").Replace("VERICUT_PATH=", "").Trim();
            }

            if (Variables.doc.path != "")
            {
                Variables.doc_ini_fpath = Variables.doc.FullName + ".fcvini";
                LogFile.SetLogFilePath(Variables.doc.FullName + ".log");
                if (File.Exists(Variables.doc_ini_fpath))
                {
                    Variables.doc_options = GetSavedOptions("", Variables.doc_ini_fpath);
                    Variables.doc_options.read_from_file = true;
                }
            }

            Init.InitializeVariables();

            // helper function to force a single instance of plugin form
            if (main_form != null)
            {
                main_form.BringToFront();
            }
            else
            {
                LogFile.Write("Initialize form");
                main_form = new MainForm();
                LogFile.Write("Display form");
                main_form.Show();
                main_form.TopLevel = true;
                main_form.TopMost  = true;
                System.Windows.Forms.Application.Run(main_form);
            }
        }