Esempio n. 1
0
        private static void InitializeVariables()
        {
            FeatureCAM.FMSetup setup = null;

            Variables.ncsimul_path = FCToNCSIMUL.GetNCDelcamPath();
            if (Variables.ncsimul_md_files_dir == "")
            {
                Variables.ncsimul_md_files_dir = @"C:\Data\Spring Technologies\NCSimul8\Users\Demo\Machines";
            }

            if (fc != null)
            {
                Variables.doc = (FeatureCAM.FMDocument)fc.ActiveDocument;
            }
            if (Variables.doc == null)
            {
                Variables.prev_doc_name  = "";
                Variables.output_dirpath = "";
            }
            else
            {
                Variables.stock       = Variables.doc.Stock;
                Variables.setup_names = new List <string>();
                for (int i = 1; i <= Variables.doc.Setups.Count; i++)
                {
                    setup = (FeatureCAM.FMSetup)Variables.doc.Setups.Item(i);
                    if (setup != null)
                    {
                        Variables.setup_names.Add(setup.Name);
                        /* Have to subtract 1 b/c setups are 1-based and combobox values are 0-based */
                        if (Variables.doc.ActiveSetup.Name == setup.Name)
                        {
                            Variables.selected_setup_id = i - 1;
                        }
                        if (setup.Type != FeatureCAM.tagFMSetupType.eST_Milling)
                        {
                            Variables.are_all_setups_milling = false;
                        }
                    }
                }
                Variables.file_dirpath = Variables.doc.path;

                Variables.orig_single_stock = Variables.stock.SingleProgramWithProgramStop;

                if (Variables.prev_doc_name != Variables.doc.Name)
                {
                    Variables.doc.ActiveSetup.GetMachineSimLocation(out Variables.offset_x, out Variables.offset_y, out Variables.offset_z);
                }
                Variables.clamps = new List <SolidInfo>();
                foreach (FeatureCAM.FMSolid solid in Variables.doc.Solids)
                {
                    Variables.clamps.Add(new SolidInfo(solid, solid.UseAsClamp));
                }

                Variables.prev_doc_name = Variables.doc.Name;
            }
        }
Esempio n. 2
0
        private void b_export_Click(object sender, EventArgs e)
        {
            Variables.output_dirpath = ConstructOutputDirPath();
            if (Variables.output_dirpath == "")
            {
                MessageBox.Show(LanguageSupport.Translate(Properties.Resources.msg_no_output_folder_set), LanguageSupport.Translate(Properties.Resources.str_prog_name));
                return;
            }
            if (Settings.ncsimul_md_fpath.Trim() == "")
            {
                MessageBox.Show(LanguageSupport.Translate(Properties.Resources.msg_no_machine_set), LanguageSupport.Translate(Properties.Resources.str_prog_name));
                return;
            }
            if (Settings.ncsimul_md_fpath.Trim() != "")
            {
                if (!File.Exists(Settings.ncsimul_md_fpath))
                {
                    MessageBox.Show(String.Format(LanguageSupport.Translate(Properties.Resources.msg_machine_file_doesnot_exist), Settings.ncsimul_md_fpath),
                                    LanguageSupport.Translate(Properties.Resources.str_prog_name));
                    return;
                }
            }
            if (Variables.clamps != null)
            {
                foreach (SolidInfo solid_info in Variables.clamps)
                {
                    solid_info.is_export = false;
                }

                foreach (string item in lb_clamps.CheckedItems)
                {
                    foreach (SolidInfo solid_info in Variables.clamps)
                    {
                        if (solid_info.solid.Name.Equals(item, StringComparison.OrdinalIgnoreCase))
                        {
                            solid_info.is_export = true;
                        }
                    }
                }
            }
            this.Close();
            FCToNCSIMUL.main_form = null;

            if (Variables.offset_pt != null)
            {
                Variables.offset_pt.Delete(false);
            }
            if (p_lmss.Visible)
            {
                Variables.lmss.available       = true;
                Variables.lmss.is_milling_head = rb_lmss_milling_head.Checked;
            }
            if (p_lsss.Visible)
            {
                Variables.lsss.available       = true;
                Variables.lsss.is_milling_head = rb_lsss_milling_head.Checked;
            }
            if (p_umss.Visible)
            {
                Variables.umss.available       = true;
                Variables.umss.is_milling_head = rb_umss_milling_head.Checked;
            }
            if (p_usss.Visible)
            {
                Variables.usss.available       = true;
                Variables.usss.is_milling_head = rb_usss_milling_head.Checked;
            }

            FCToNCSIMUL.Convert();
        }