//--------------------------建模阶段------------------------------ public double modeling(double Height, iPartDoc oiPartDoc) { if (ShaftType.Text != "(请选择轴段类型)") { if (ShaftType.Text == "普通轴段")//普通轴段 { shaft_section oshaft_section = new shaft_section(); oshaft_section.SetValues(dB, 轴段直径.consult()); oshaft_section.modeling(Height, oiPartDoc); } else if (ShaftType.Text == "圆柱直/斜齿轮")//圆柱齿轮 { cyl_gear ocyl_gear = new cyl_gear(); ocyl_gear.SetValues(dB, 圆柱齿轮齿数.consult(), 圆柱齿轮模数.consult(), 圆柱齿轮压力角.consult(), dBeta, iB_flat); ocyl_gear.modeling(Height, oiPartDoc); } else//圆锥齿轮 { bev_gear obev_gear = new bev_gear(); if (GearFace.Text == "(请选择锥面朝向)") { MessageBox.Show("未选择锥面朝向"); return(-1); } obev_gear.SetValues(齿胚厚.consult(), 锥齿轮齿宽.consult(), 齿槽深.consult(), 锥齿轮齿数.consult(), 大端模数.consult(), 锥齿轮压力角.consult(), 分锥角.consult(), bFace); obev_gear.modeling(Height, oiPartDoc); } } else { return(-1); } return(dB); }
//----------------生成零件阶段------------------------ private void Generate_Click(object sender, System.EventArgs e) { this.Generate.Enabled = false; int a = Ftrlist.Count, i = 0; iPartDoc oiPartDoc = new iPartDoc();//生成零件实例 double H = 0.0, H1 = 0.0; for (; i < a; i++) { H1 = Ftrlist[i].modeling(H, oiPartDoc); if (H1 < 0) { MessageBox.Show("第" + (i + 1) + "项轴特征未定义"); break; } else { H += H1; } } this.Generate.Enabled = true; }