private void InitializeClamps(SetupOptions options, FeatureCAM.FMSolids fm_solids) { if (options.clamps == null) { return; } if (options.clamps.Count == 0) { return; } FeatureCAM.FMSolid temp_clamp = null; foreach (SolidInfo clamp in options.clamps) { temp_clamp = (FeatureCAM.FMSolid)fm_solids.Item(clamp.name); if (temp_clamp != null) { if (this.clamps == null) { this.clamps = new List <SolidInfo>(); } this.clamps.Add(clamp); //adding clamp obj as it has settings such as export clamp or not } } }
private void b_select_part_solid_Click(object sender, EventArgs e) { FeatureCAM.FMSolid selected_solid = null; if (Variables.doc.Solids.Count > 0) { foreach (FeatureCAM.FMSolid solid in Variables.doc.Solids) { if (solid.Selected) { if (selected_solid == null) { selected_solid = solid; } else { MessageBox.Show("More than one solid is selected in the part. Please select only one solid and try again.", Variables.prog_name); return; } } } } if (selected_solid != null) { cbox_part_solid.SelectedItem = selected_solid.Name; } else { MessageBox.Show("Couldn't find a selected solid in the part. Please select one solid and try again.", Variables.prog_name); } }
private void b_select_part_solid_Click(object sender, EventArgs e) { FeatureCAM.FMSolid selected_solid = null; if (Variables.doc.Solids.Count > 0) { foreach (FeatureCAM.FMSolid solid in Variables.doc.Solids) { if (solid.Selected) { if (selected_solid == null) { selected_solid = solid; } else { MessageDisplay.ShowError( LanguageSupport.Translate("More than one solid is selected in the part. Please select only one solid and try again.")); return; } } } } }
public SetupInfo(SetupOptions options, FeatureCAM.FMSetup setup, FeatureCAM.FMSolids fm_solids, List <UCS> doc_ucss) { this.name = setup.Name; this.enabled = setup.Enabled; this.num_features = setup.Features.Count; this.fixture_id = setup.FixtureID; this.tool_fpath = ""; this.nc_fpaths = new List <string>(); if (this.ucss == null) { this.ucss = new List <UCS>(); } this.ucss.Add(new UCS(setup.ucs)); this.first_ucs_name = setup.ucs.Name; this.attach_ucs = ""; this.attach_ucs_subspindle = ""; this.sub_spindle = (setup.Spindle == FeatureCAM.tagFMSetupSpindleType.eSST_SubSpindle ? true : false); if (options == null) { this.options = new SetupOptions(); this.options.is_subspindle = this.sub_spindle; this.options.is_export = this.enabled; this.options.is_export_nc = this.enabled; this.options.is_export_stock = this.enabled; this.options.is_export_tools = this.enabled; this.options.setup_name = this.name; this.options.clamps = new List <SolidInfo>(); setup.Activate(); this.clamps = new List <SolidInfo>(); this.options.parts = null; if (fm_solids != null) { foreach (FeatureCAM.FMSolid solid in fm_solids) { if (solid.UseAsClamp) { this.clamps.Add(new SolidInfo(solid.Name, "")); } else if (solid.UseAsPartCompareTarget) { if (this.part == null) { this.part = new List <SolidInfo>(); } this.part.Add(new SolidInfo(solid.Name, "")); } } } this.options.is_subspindle = this.sub_spindle; this.options.ucs_attach = ""; this.options.attach_ucss_to = ""; this.options.ucs_attach_subspindle = ""; this.options.attach_ucss_to_subspindle = ""; this.options.attach_stock_to = ""; this.options.attach_stock_to_subspindle = ""; this.setup_solid_x = this.setup_solid_y = this.setup_solid_z = 0; this.sub_setup_solid_x = this.sub_setup_solid_y = this.sub_setup_solid_z = 0; this.attach_stock_to = ""; this.attach_stock_to_subspindle = ""; this.attach_ucss_to = ""; this.attach_ucss_to_subspindle = ""; this.options.is_subspindle = this.sub_spindle; this.options.template_fpath = ""; } else { this.options = options; if (fm_solids != null) { InitializeClamps(options, fm_solids); if (options.parts != null) { foreach (SolidInfo part in options.parts) { FeatureCAM.FMSolid doc_part = (FeatureCAM.FMSolid)fm_solids.Item(part.name); if (doc_part != null) { if (this.part == null) { this.part = new List <SolidInfo>(); } this.part.Add(part); } } } else { foreach (FeatureCAM.FMSolid solid in fm_solids) { if (solid.UseAsPartCompareTarget) { if (this.part == null) { this.part = new List <SolidInfo>(); } this.part.Add(new SolidInfo(solid.Name, "")); } } } } this.sub_spindle = options.is_subspindle; this.attach_ucss_to = options.attach_ucss_to; this.attach_ucss_to_subspindle = options.attach_ucss_to_subspindle; if (options.ucs_attach != "" && IsUCSInDoc(doc_ucss, options.ucs_attach)) { this.attach_ucs = options.ucs_attach; } if (options.ucs_attach_subspindle != "" && IsUCSInDoc(doc_ucss, options.ucs_attach_subspindle)) { this.attach_ucs_subspindle = options.ucs_attach_subspindle; } this.attach_stock_to = options.attach_stock_to; this.attach_stock_to_subspindle = options.attach_stock_to_subspindle; if (options.fixture != "") { this.fixture_id = options.fixture; } else { this.fixture_id = setup.FixtureID; } if (options.offsets != null) { this.work_offsets = options.offsets; } } }