예제 #1
0
        public UCS(FeatureCAM.FMUcs fc_ucs)
        {
            this.ucs  = fc_ucs;
            this.name = fc_ucs.Name;
            this.ucs.GetLocation(out x, out y, out z);
            this.ucs.GetVectors(out x1, out x2, out x3, out y1, out y2, out y3, out z1, out z2, out z3);

            ComputeEulerAngles(this.x1, this.y1, this.z1, this.x2, this.y2, this.z2, this.x3, this.y3, this.z3,
                               out this.i, out this.j, out this.k);
        }
예제 #2
0
        private void GetDataFromFormAndExport()
        {
            Variables.doc_options.is_export_project = (tb_proj_template_fpath.Text != "");

            if (Variables.doc_options.output_dirpath == "")
            {
                MessageDisplay.ShowError(
                    LanguageSupport.Translate("Output directory path must be set. Please fix it and try again."));
                return;
            }
            else
            {
                Variables.doc_options.output_dirpath = tb_output_dir.Text;
            }
            if (Variables.fname_no_ext == "")
            {
                MessageDisplay.ShowError(
                    LanguageSupport.Translate("Output file name must be set. Please fix it and try again."));
                return;
            }
            if (Variables.doc_options.is_export_project && Variables.doc_options.vc_template_proj_fpath == "")
            {
                MessageDisplay.ShowError(
                    LanguageSupport.Translate("If exporting VERICUT project file, template file path must be set. Please fix it and try again."));
                return;
            }
            if (Variables.doc_options.is_export_project && !File.Exists(Variables.doc_options.vc_template_proj_fpath))
            {
                MessageDisplay.ShowError(
                    LanguageSupport.Translate("If exporting VERICUT project file, template file path must exist. File {0} doesn't exist. Please select existing file and try again."), Variables.doc_options.vc_template_proj_fpath);
                return;
            }

            FeatureCAM.FMSetup world = Variables.doc.Setups.Item("STOCK");
            if (Variables.setups_info[cb_setups.SelectedIndex].attach_ucs == null ||
                Variables.setups_info[cb_setups.SelectedIndex].attach_ucs == "")
            {
                MessageDisplay.ShowError(
                    LanguageSupport.Translate("If using UCS for specifying the location of the bottom most clamp, UCS has to be selected. Please select existing UCS and try again."));
                return;
            }
            for (int si = 0; si < Variables.setups_info.Count; si++)
            {
                if (!Variables.setups_info[si].enabled)
                {
                    continue;
                }
                /* Main spindle */
                FeatureCAM.FMUcs ucs = Variables.doc.UCSs.Item(Variables.setups_info[si].attach_ucs);
                Variables.setups_info[si].options.ucs_attach = ucs.Name;
                if (ucs != null)
                {
                    FeatureCAM.FMSetup temp_setup = Variables.doc.AddSetup(ucs.Name + "_temp_setup", FeatureCAM.tagFMSetupType.eST_Milling, null, ucs.Name, Type.Missing);
                    temp_setup.Enabled = false;
                    Variables.all_ucss[0].ComputeCoordinatesInRelationToSetup(temp_setup,
                                                                              out Variables.setups_info[si].setup_solid_x, out Variables.setups_info[si].setup_solid_y, out Variables.setups_info[si].setup_solid_z,
                                                                              out Variables.setups_info[si].setup_solid_i, out Variables.setups_info[si].setup_solid_j, out Variables.setups_info[si].setup_solid_k);
                    FeatureCAM.FMUcs temp_setup_ucs = temp_setup.ucs;
                    temp_setup.Delete();
                    temp_setup_ucs.Delete();
                }
                if (world != null && ucs != null)
                {
                    double ucs_x, ucs_y, ucs_z;
                    ucs.GetLocation(out ucs_x, out ucs_y, out ucs_z);
                    world.MapWorldToSetup(ref ucs_x, ref ucs_y, ref ucs_z);
                }
                /* Subspindle */
                if (!String.IsNullOrEmpty(Variables.setups_info[si].attach_ucs_subspindle))
                {
                    ucs = Variables.doc.UCSs.Item(Variables.setups_info[si].attach_ucs_subspindle);
                    Variables.setups_info[si].options.ucs_attach_subspindle = ucs.Name;
                    if (ucs != null)
                    {
                        FeatureCAM.FMSetup temp_setup = Variables.doc.AddSetup(ucs.Name + "_temp_setup_sub", FeatureCAM.tagFMSetupType.eST_Milling, null, ucs.Name, Type.Missing);
                        temp_setup.Enabled = false;
                        Variables.all_ucss[0].ComputeCoordinatesInRelationToSetup(temp_setup,
                                                                                  out Variables.setups_info[si].sub_setup_solid_x, out Variables.setups_info[si].sub_setup_solid_y, out Variables.setups_info[si].sub_setup_solid_z,
                                                                                  out Variables.setups_info[si].sub_setup_solid_i, out Variables.setups_info[si].sub_setup_solid_j, out Variables.setups_info[si].sub_setup_solid_k);
                        FeatureCAM.FMUcs temp_setup_ucs = temp_setup.ucs;
                        temp_setup.Delete();
                        temp_setup_ucs.Delete();
                    }
                }
            }
            Close();
            Exporter.Export();
        }