|
tak ja sem pridam moje dielo , ziadna slava , ale cozeby som sa nepochvalil :) ... zacalo sa to ze som si jedneho krasneho dna povedal v praci ze namiesto tabuliek v exceli si spravim program v builderi c++ ... kedze to bol prvy program s ktorym som sa stretol a v nom sa dalo robit jednoducho windowsacke okno ... sice ziadna znalost v programovani , ale co by som si neporadil a neskusil googlit :) ... a na youtube je vcelku toho dost a hlavne mi pomohlo "programovanie v c++" kde to priam vyucuju v tom prostredi ... potom som natrafil na ms visual a C# , tak som si povedal ze to skusim prerobit z c++ do c# ... a tu je vysledok :)
tu je k nahliadnutiu moj amatersky kod ... using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO;
namespace vypocty { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) // vyber pocet ohybov { if (comboBox1.Text != "") { label2.Visible = true; label3.Visible = true; label4.Visible = true; label5.Visible = true; label7.Visible = true; label8.Visible = true; label14.Visible = true; label20.Visible = true; label21.Visible = true; label22.Visible = true; label23.Visible = true; label24.Visible = true; Hrubka.Visible = true; Polomer.Visible = true; Rozvin.Visible = true; button1.Visible = true; dlzkaO.Visible = true; dlzkaO.Text = "dľžka oblúku"; os1.Text = ""; os2.Text = ""; os3.Text = ""; os4.Text = ""; os5.Text = ""; os6.Text = ""; dlzkaA.Text = ""; dlzkaB.Text = ""; dlzkaC.Text = ""; dlzkaD.Text = ""; dlzkaE.Text = ""; dlzkaF.Text = ""; dlzkaG.Text = ""; logoES.Visible = true; pictureBox6.Visible = false; } ohyb6.Visible = (comboBox1.Text == "6 ohybov") ? true : false; ohyb5.Visible = (comboBox1.Text == "5 ohybov") ? true : false; ohyb4.Visible = (comboBox1.Text == "4 ohyby") ? true : false; ohyb3.Visible = (comboBox1.Text == "3 ohyby") ? true : false; ohyb2.Visible = (comboBox1.Text == "2 ohyby") ? true : false; ohyb1.Visible = (comboBox1.Text == "1 ohyb") ? true : false; if (comboBox1.Text == "1 ohyb") { dlzkaG.Visible = false; dlzkaF.Visible = false; dlzkaE.Visible = false; dlzkaD.Visible = false; dlzkaC.Visible = false; dlzkaB.Visible = true; dlzkaA.Visible = true; uhol1.Visible = true; uhol2.Visible = false; uhol3.Visible = false; uhol4.Visible = false; uhol5.Visible = false; uhol6.Visible = false; uhol1.Text = "90"; uhol2.Text = "180"; uhol3.Text = "180"; uhol4.Text = "180"; uhol5.Text = "180"; uhol6.Text = "180"; label9.Visible = false; label10.Visible = false; label11.Visible = false; label12.Visible = false; label13.Visible = false; label19.Visible = false; label18.Visible = false; label17.Visible = false; label16.Visible = false; label15.Visible = false; os2.Visible = false; os3.Visible = false; os4.Visible = false; os5.Visible = false; os6.Visible = false; } if (comboBox1.Text == "2 ohyby") { dlzkaG.Visible = false; dlzkaF.Visible = false; dlzkaE.Visible = false; dlzkaD.Visible = false; dlzkaC.Visible = true; dlzkaB.Visible = true; dlzkaA.Visible = true; uhol1.Visible = true; uhol2.Visible = true; uhol3.Visible = false; uhol4.Visible = false; uhol5.Visible = false; uhol6.Visible = false; uhol1.Text = "90"; uhol2.Text = "90"; uhol3.Text = "180"; uhol4.Text = "180"; uhol5.Text = "180"; uhol6.Text = "180"; label9.Visible = true; label10.Visible = false; label11.Visible = false; label12.Visible = false; label13.Visible = false; label19.Visible = true; label18.Visible = false; label17.Visible = false; label16.Visible = false; label15.Visible = false; os2.Visible = true; os3.Visible = false; os4.Visible = false; os5.Visible = false; os6.Visible = false; } if (comboBox1.Text == "3 ohyby") { dlzkaG.Visible = false; dlzkaF.Visible = false; dlzkaE.Visible = false; dlzkaD.Visible = true; dlzkaC.Visible = true; dlzkaB.Visible = true; dlzkaA.Visible = true; uhol1.Visible = true; uhol2.Visible = true; uhol3.Visible = true; uhol4.Visible = false; uhol5.Visible = false; uhol6.Visible = false; uhol1.Text = "90"; uhol2.Text = "90"; uhol3.Text = "90"; uhol4.Text = "180"; uhol5.Text = "180"; uhol6.Text = "180"; label9.Visible = true; label10.Visible = true; label11.Visible = false; label12.Visible = false; label13.Visible = false; label19.Visible = true; label18.Visible = true; label17.Visible = false; label16.Visible = false; label15.Visible = false; os2.Visible = true; os3.Visible = true; os4.Visible = false; os5.Visible = false; os6.Visible = false; } if (comboBox1.Text == "4 ohyby") { dlzkaG.Visible = false; dlzkaF.Visible = false; dlzkaE.Visible = true; dlzkaD.Visible = true; dlzkaC.Visible = true; dlzkaB.Visible = true; dlzkaA.Visible = true; uhol1.Visible = true; uhol2.Visible = true; uhol3.Visible = true; uhol4.Visible = true; uhol5.Visible = false; uhol6.Visible = false; uhol1.Text = "90"; uhol2.Text = "90"; uhol3.Text = "90"; uhol4.Text = "90"; uhol5.Text = "180"; uhol6.Text = "180"; label9.Visible = true; label10.Visible = true; label11.Visible = true; label12.Visible = false; label13.Visible = false; label19.Visible = true; label18.Visible = true; label17.Visible = true; label16.Visible = false; label15.Visible = false; os2.Visible = true; os3.Visible = true; os4.Visible = true; os5.Visible = false; os6.Visible = false; } if (comboBox1.Text == "5 ohybov") { dlzkaG.Visible = false; dlzkaF.Visible = true; dlzkaE.Visible = true; dlzkaD.Visible = true; dlzkaC.Visible = true; dlzkaB.Visible = true; dlzkaA.Visible = true; uhol1.Visible = true; uhol2.Visible = true; uhol3.Visible = true; uhol4.Visible = true; uhol5.Visible = true; uhol6.Visible = false; uhol1.Text = "90"; uhol2.Text = "90"; uhol3.Text = "90"; uhol4.Text = "90"; uhol5.Text = "90"; uhol6.Text = "180"; label9.Visible = true; label10.Visible = true; label11.Visible = true; label12.Visible = true; label13.Visible = false; label19.Visible = true; label18.Visible = true; label17.Visible = true; label16.Visible = true; label15.Visible = false; os2.Visible = true; os3.Visible = true; os4.Visible = true; os5.Visible = true; os6.Visible = false; } if (comboBox1.Text == "6 ohybov") { dlzkaG.Visible = true; dlzkaF.Visible = true; dlzkaE.Visible = true; dlzkaD.Visible = true; dlzkaC.Visible = true; dlzkaB.Visible = true; dlzkaA.Visible = true; uhol1.Visible = true; uhol2.Visible = true; uhol3.Visible = true; uhol4.Visible = true; uhol5.Visible = true; uhol6.Visible = true; uhol1.Text = "90"; uhol2.Text = "90"; uhol3.Text = "90"; uhol4.Text = "90"; uhol5.Text = "90"; uhol6.Text = "90"; label9.Visible = true; label10.Visible = true; label11.Visible = true; label12.Visible = true; label13.Visible = true; label19.Visible = true; label18.Visible = true; label17.Visible = true; label16.Visible = true; label15.Visible = true; os2.Visible = true; os3.Visible = true; os4.Visible = true; os5.Visible = true; os6.Visible = true; } } private void button1_Click(object sender, EventArgs e) // vypocet rozvinu { double hrubka, polomer, d1, d2, d3, d4, d5, d6, d7, u1, u2, u3, u4, u5, u6, k1, k2, k3, k4, k5, k6, o1, o2, o3, o4, o5, o6, obluk1, rozvin;
hrubka = (Hrubka.Text == "") ? 0 : Convert.ToDouble(Hrubka.Text); polomer = (Polomer.Text == "") ? 0 : Convert.ToDouble(Polomer.Text); d1 = (dlzkaA.Text == "") ? 0 : Convert.ToDouble(dlzkaA.Text); d2 = (dlzkaB.Text == "") ? 0 : Convert.ToDouble(dlzkaB.Text); d3 = (dlzkaC.Text == "") ? 0 : Convert.ToDouble(dlzkaC.Text); d4 = (dlzkaD.Text == "") ? 0 : Convert.ToDouble(dlzkaD.Text); d5 = (dlzkaE.Text == "") ? 0 : Convert.ToDouble(dlzkaE.Text); d6 = (dlzkaF.Text == "") ? 0 : Convert.ToDouble(dlzkaF.Text); d7 = (dlzkaG.Text == "") ? 0 : Convert.ToDouble(dlzkaG.Text); u1 = (uhol1.Text == "") ? 0 : Convert.ToDouble(uhol1.Text); u2 = (uhol2.Text == "") ? 0 : Convert.ToDouble(uhol2.Text); u3 = (uhol3.Text == "") ? 0 : Convert.ToDouble(uhol3.Text); u4 = (uhol4.Text == "") ? 0 : Convert.ToDouble(uhol4.Text); u5 = (uhol5.Text == "") ? 0 : Convert.ToDouble(uhol5.Text); u6 = (uhol6.Text == "") ? 0 : Convert.ToDouble(uhol6.Text); obluk1 = 0; k1 = 0; k2 = 0; k3 = 0; k4 = 0; k5 = 0; k6 = 0;
if (u1 < 70 || u1 > 180) MessageBox.Show("Nevhodný prvý uhol", "Upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Information); //vypocet dlžky oblúku if (u1 == 90) obluk1 = (1.57 * polomer + 0.5236 * hrubka); if (u1 < 90) obluk1 = 0.01745 * (polomer + hrubka / 3) * (180 - u1); if (u1 > 90) obluk1 = 0.01745 * (polomer + hrubka / 2) * (180 - u1);
//vypocet skratenia if (u1 == 90) k1 = (0.4292 * polomer + 1.476 * hrubka) * -1; if (u1 < 90) k1 = 0.01745 * (polomer + hrubka / 3) * (180 - u1) - 2 * (polomer + hrubka); if (u1 > 90) k1 = 0.01745 * (polomer + hrubka / 2) * (180 - u1) - 2 * (polomer + hrubka) * Math.Tan(((180 - u1) / 2) * Math.PI / 180);
if (u2 < 70 || u2 > 180) MessageBox.Show("Nevhodný druhý uhol", "Upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Information); if (u2 == 0 || u2 == 180) k2 = 0; if (u2 == 90) k2 = (0.4292 * polomer + 1.476 * hrubka) * -1; if (u2 < 90) k2 = 0.01745 * (polomer + hrubka / 3) * (180 - u2) - 2 * (polomer + hrubka); if (u2 > 90) k2 = 0.01745 * (polomer + hrubka / 2) * (180 - u2) - 2 * (polomer + hrubka) * Math.Tan(((180 - u2) / 2) * Math.PI / 180);
if (u3 < 70 || u3 > 180) MessageBox.Show("Nevhodný tretí uhol", "Upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Information); if (u3 == 0 || u3 == 180) k3 = 0; if (u3 == 90) k3 = (0.4292 * polomer + 1.476 * hrubka) * -1; if (u3 < 90) k3 = 0.01745 * (polomer + hrubka / 3) * (180 - u3) - 2 * (polomer + hrubka); if (u3 > 90) k3 = 0.01745 * (polomer + hrubka / 2) * (180 - u3) - 2 * (polomer + hrubka) * Math.Tan(((180 - u3) / 2) * Math.PI / 180);
if (u4 < 70 || u4 > 180) MessageBox.Show("Nevhodný štvrtý uhol", "Upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Information); if (u4 == 0 || u4 == 180) k4 = 0; if (u4 == 90) k4 = (0.4292 * polomer + 1.476 * hrubka) * -1; if (u4 < 90) k4 = 0.01745 * (polomer + hrubka / 3) * (180 - u4) - 2 * (polomer + hrubka); if (u4 > 90) k4 = 0.01745 * (polomer + hrubka / 2) * (180 - u4) - 2 * (polomer + hrubka) * Math.Tan(((180 - u4) / 2) * Math.PI / 180);
if (u5 < 70 || u5 > 180) MessageBox.Show("Nevhodný piaty uhol", "Upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Information); if (u5 == 0 || u5 == 180) k5 = 0; if (u5 == 90) k5 = (0.4292 * polomer + 1.476 * hrubka) * -1; if (u5 < 90) k5 = 0.01745 * (polomer + hrubka / 3) * (180 - u5) - 2 * (polomer + hrubka); if (u5 > 90) k5 = 0.01745 * (polomer + hrubka / 2) * (180 - u5) - 2 * (polomer + hrubka) * Math.Tan(((180 - u5) / 2) * Math.PI / 180);
if (u6 < 70 || u6 > 180) MessageBox.Show("Nevhodný šiesty uhol", "Upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Information); if (u6 == 0 || u6 == 180) k6 = 0; if (u6 == 90) k6 = (0.4292 * polomer + 1.476 * hrubka) * -1; if (u6 < 90) k6 = 0.01745 * (polomer + hrubka / 3) * (180 - u6) - 2 * (polomer + hrubka); if (u6 > 90) k6 = 0.01745 * (polomer + hrubka / 2) * (180 - u6) - 2 * (polomer + hrubka) * Math.Tan(((180 - u6) / 2) * Math.PI / 180);
o1 = d1 + k1 / 2; o2 = o1 + d2 + k1 / 2 + k2 / 2; o3 = o2 + d3 + k2 / 2 + k3 / 2; o4 = o3 + d4 + k3 / 2 + k4 / 2; o5 = o4 + d5 + k4 / 2 + k5 / 2; o6 = o5 + d6 + k5 / 2 + k6 / 2;
os1.Text = string.Format("{0:0.###}", o1); os2.Text = string.Format("{0:0.###}", o2); os3.Text = string.Format("{0:0.###}", o3); os4.Text = string.Format("{0:0.###}", o4); os5.Text = string.Format("{0:0.###}", o5); os6.Text = string.Format("{0:0.###}", o6);
rozvin = (d1 + d2 + d3 + d4 + d5 + d6 + d7 + k1 + k2 + k3 + k4 + k5 + k6);
dlzkaO.Text = string.Format("{0:dľžka oblúku je 0.### mm}", obluk1); Rozvin.Text = string.Format("{0:0.###}", rozvin);
} private void ukazka3_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
}
private void radioButton1_CheckedChanged(object sender, EventArgs e) // ukazky ohybov { ukazka1.Visible = (radioButton1.Checked) ? true : false; // prva ukazka }
private void radioButton4_CheckedChanged(object sender, EventArgs e) { ukazky4.Visible = (radioButton4.Checked) ? true : false; // stvrta ukazka ukazka1.Visible = false; }
private void radioButton3_CheckedChanged(object sender, EventArgs e) { ukazka3.Visible = (radioButton3.Checked) ? true : false; // tretia ukazka ukazka1.Visible = false; }
private void radioButton2_CheckedChanged(object sender, EventArgs e) // ukazky ohybov { ukazka2.Visible = (radioButton2.Checked) ? true : false; // druha ukazka ukazka1.Visible = false; }
private void pictureBox3_Click(object sender, EventArgs e) { Form2 f = new Form2(); f.ShowDialog(); }
private void label26_Click(object sender, EventArgs e) { Form3 f = new Form3(); f.Show(); }
private void button2_Click(object sender, EventArgs e) // vypocet tlacnej sily { double h, d, p, s, v;
h = (textBox1.Text == "") ? 0 : Convert.ToDouble(textBox1.Text); //hrubka mat. d = (textBox2.Text == "") ? 0 : Convert.ToDouble(textBox2.Text); //dlzka ohybu p = (textBox3.Text == "") ? 0 : Convert.ToDouble(textBox3.Text); //pevnost v tahu s = (sirkaM.Text == "") ? 0 : Convert.ToDouble(sirkaM.Text); //sirka matrice
v = 1.33 * d * p * h * h / s / 1000; textBox5.Text = string.Format("{0:0., kN}",v); } // *************************************************************************************************** private void button4_Click(object sender, EventArgs e) // vypocet hmotnosti materialu { double meter, hr, si, dl, hmP, ks, hmKG, hmT, cena1, cena2; meter = (stvorcovymeter.Text == "") ? 0 : Convert.ToDouble(stvorcovymeter.Text); if (meter == 0) MessageBox.Show("nie je zadaná hmotnosť za meter štovcový\n pre oceľ je to 7,85 kg", "upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Warning); hr = (hrubkaP.Text == "") ? 0 : Convert.ToDouble(hrubkaP.Text); si = (sirkaP.Text == "") ? 0 : Convert.ToDouble(sirkaP.Text); dl = (dlzkaP.Text == "") ? 0 : Convert.ToDouble(dlzkaP.Text); ks = (pocetTabul.Text == "") ? 0 : Convert.ToDouble(pocetTabul.Text); cena1 = (cenaKG.Text == "") ? 0 : Convert.ToDouble(cenaKG.Text);
hmP = hr * meter * si / 1000 * dl / 1000; // vypocita hmotnost rozmeru hmKG = hmP * ks; hmT = hmKG / 1000; cena2 = cena1 * hmKG; hmotnostP.Text = string.Format("{0:#,0.##, kg}", hmP); hmotnostKG.Text = string.Format("{0:#,0.##, kg}", hmKG); hmotnostT.Text = string.Format("{0:0.###, ton}", hmT); cenaMat.Text = string.Format("{0:#,0.00 eur}", cena2); label34.Text = "cena materialu za " + string.Format("{0:#,0.##, kg}", hmKG); // **************************************************************************** // vypocet norma double ac, pl, la, lisT, lisS, obr, tr, ine; double accas, plcas, lacas, lisTcas, lisScas, obrcas, trcas, inecas; double accena, plcena, lacena, lisTcena, lisScena, obcena, trcena, inecena; double cenas, cenabez; ac = (textBox13.Text == "") ? 0 : Convert.ToDouble(textBox13.Text); if (ac == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre palenie acetylénom", "upozornenie"); pl = (textBox14.Text == "") ? 0 : Convert.ToDouble(textBox14.Text); if (pl == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre palenie plazmou", "upozornenie"); la = (textBox15.Text == "") ? 0 : Convert.ToDouble(textBox15.Text); if (la == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre palenie laserom", "upozornenie"); lisT = (textBox16.Text == "") ? 0 : Convert.ToDouble(textBox16.Text); if (lisT == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre prácu na NC lise (TRUMPF)", "upozornenie"); lisS = (textBox17.Text == "") ? 0 : Convert.ToDouble(textBox17.Text); if (lisS == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre prácu na starom lise", "upozornenie"); obr = (textBox18.Text == "") ? 0 : Convert.ToDouble(textBox18.Text); if (obr == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre obrusovanie", "upozornenie"); tr = (textBox19.Text == "") ? 0 : Convert.ToDouble(textBox19.Text); if (tr == 0) MessageBox.Show("nie je zadaná hodinová sadzba\n\n pre otrieskavanie kusov/materialu", "upozornenie"); ine = (textBox20.Text == "") ? 0 : Convert.ToDouble(textBox20.Text); accas = (textBox21.Text == "") ? 0 : Convert.ToDouble(textBox21.Text); plcas = (textBox22.Text == "") ? 0 : Convert.ToDouble(textBox22.Text); lacas = (textBox23.Text == "") ? 0 : Convert.ToDouble(textBox23.Text); lisTcas = (textBox24.Text == "") ? 0 : Convert.ToDouble(textBox24.Text); lisScas = (textBox25.Text == "") ? 0 : Convert.ToDouble(textBox25.Text); obrcas = (textBox26.Text == "") ? 0 : Convert.ToDouble(textBox26.Text); trcas = (textBox27.Text == "") ? 0 : Convert.ToDouble(textBox27.Text); inecas = (textBox28.Text == "") ? 0 : double.Parse(textBox28.Text);
accena = ac * accas / 60; plcena = pl * plcas / 60; lacena = la * lacas / 60; lisTcena = lisT * lisTcas / 60; lisScena = lisS * lisScas / 60; obcena = obr * obrcas / 60; trcena = tr * trcas / 60; inecena = ine * inecas / 60;
cenabez = accena + plcena + lacena + lisTcena + lisScena + obcena + trcena + inecena; cenas = cenabez + cena2;
textBox29.Text = string.Format("{0:0.00}", accena); textBox30.Text = string.Format("{0:0.00}", plcena); textBox31.Text = string.Format("{0:0.00}", lacena); textBox32.Text = string.Format("{0:0.00}", lisTcena); textBox33.Text = string.Format("{0:0.00}", lisScena); textBox34.Text = string.Format("{0:0.00}", obcena); textBox35.Text = string.Format("{0:0.00}", trcena); textBox36.Text = string.Format("{0:0.00}",inecena); textBox37.Text = string.Format("{0:0.00 eur}", cenabez); textBox38.Text = string.Format("{0:0.00 eur}", cenas); // ****************************************************** // výpočet ceny - ohýbanie double h, s, d, po, kusy, infohm, infocas, Nm, cenaks, cenavsetky, kf, co, dlo; h = (textBox39.Text == "") ? 0 : double.Parse(textBox39.Text); s = (textBox40.Text == "") ? 0 : double.Parse(textBox40.Text); d = (textBox41.Text == "") ? 0 : double.Parse(textBox41.Text); po = (textBox42.Text == "") ? 0 : double.Parse(textBox42.Text); kusy = (textBox43.Text == "") ? 0 : double.Parse(textBox43.Text); kf = (textBox46.Text == "") ? 0 : double.Parse(textBox46.Text); dlo = 0; co = 0;
infohm = h * 7.85 * s / 1000 * d / 1000;
if (infohm <= 300) co = 7.5; if (infohm <= 200) co = 6.5; if (infohm <= 100) co = 5; if (infohm <= 70) co = 3; if (infohm <= 50) co = 2.9; if (infohm <= 35) co = 1.9; if (infohm <= 30) co = 1.6; if (infohm <= 25) co = 1.45; if (infohm <= 20) co = 1.3; if (infohm <= 15) co = 1.15; if (infohm <= 10) co = 1; if (infohm <= 5) co = 0.85; if (infohm <= 2) co = 0.7;
if (d <= 4000) dlo = 32; if (d <= 3500) dlo = 28; if (d <= 3000) dlo = 24; if (d <= 2500) dlo = 20; if (d <= 2000) dlo = 16; if (d <= 1500) dlo = 12; if (d <= 1000) dlo = 8; if (d <= 500) dlo = 4;
Nm = (checkBox1.Checked==false) ? ((3 * po + dlo) / kusy + (co * po)) * kf : ((3 + dlo) / kusy + (co * po)) * kf; infocas = Nm * kusy; cenaks = Nm / 60 * 20; cenavsetky = cenaks * kusy;
label36.Text = "info. hmotnosť kusa : " + string.Format("{0:0.##}", infohm) + " kg"; label37.Text = "info. čas spolu : " + string.Format("{0:0.## min.}", infocas)+" / "+string.Format("{0:0.# hod.}", infocas/60); label39.Text = "cena za všetky kusy : " + string.Format("{0:#,0.00 eur}", cenavsetky); textBox44.Text = string.Format("{0:0.## Nmin/ks}", Nm); textBox45.Text = string.Format("{0:0.00 eur/ks}", cenaks); // ********************************************************** // vypocet Nhodiny obchod double praca, rezia, davka, mno, nm, eur;
praca = (Praca.Text == "") ? 0 : double.Parse(Praca.Text); rezia = (Rezia.Text == "") ? 6.5 : double.Parse(Rezia.Text); davka = (Davka.Text == "") ? 0 : double.Parse(Davka.Text); mno = (Mnozstvo.Text == "") ? 0 : double.Parse(Mnozstvo.Text); nm = (praca + davka / mno) * 60; eur = (praca + davka / mno) * 4.06 * rezia;
Nminuta.Text = string.Format("{0:0.00 Nmin/ks}", nm); Eurks.Text = string.Format("{0:0.00 eur/ks}", eur); // ******************************************************************** }
void vymazatNmobchod() { Praca.Text = ""; Rezia.Text = "6,5"; Davka.Text = ""; Mnozstvo.Text = ""; Nminuta.Text = "Nmin/ks"; Eurks.Text = "eur/ks"; }
void vymazatHM() { stvorcovymeter.Text = "7,85"; hrubkaP.Text = ""; sirkaP.Text = ""; dlzkaP.Text = ""; pocetTabul.Text = ""; hmotnostP.Text = ""; hmotnostKG.Text = ""; label34.Text = "cena materialu za ... kg"; hmotnostT.Text = ""; cenaKG.Text = ""; cenaMat.Text = ""; }
private void nulovatHM_Click(object sender, EventArgs e) // vynulovanie hmotnost { vymazatHM(); }
private void button3_Click(object sender, EventArgs e) // vypocet kuzel { double d1, d2, vyska, obd1, obd2, R1, R2, obR1, obR2, uholA, uholB, Lstena, radian, sinA, cosA;
d1 = (priemer1.Text == "") ? 0 : Convert.ToDouble(priemer1.Text); d2 = (priemer2.Text == "") ? 0 : Convert.ToDouble(priemer2.Text); vyska = (vyskaH.Text == "") ? 0 : Convert.ToDouble(vyskaH.Text); radian = 57.296; // 1 radián = 57,2958 stupňov obd1 = d1 * Math.PI; obd2 = d2 * Math.PI; uholA = (Math.Atan(vyska / ((d2 - d1) / 2))) * radian; sinA = Math.Sin(uholA / radian); cosA = Math.Cos(uholA / radian); R1 = (d1 / cosA) / 2; R2 = (d2 / cosA) / 2; Lstena = R2 - R1; obR1 = 2 * R1 * Math.PI; obR2 = 2 * R2 * Math.PI; uholB = 360 * (obd2 / obR2);
obvodD1.Text = string.Format("{0:0.###}", obd1); obvodD2.Text = string.Format("{0:0.###}", obd2); polomeR1.Text = string.Format("{0:0.###}", R1); polomeR2.Text = string.Format("{0:0.###}", R2); obvodR1.Text = string.Format("{0:0.##}", obR1); obvodR2.Text = string.Format("{0:0.##}", obR2); dlzkaSteny.Text = string.Format("{0:0.###}", Lstena); uholAlfa.Text = string.Format("{0:0.##}", 90-uholA); uholBeta.Text = string.Format("{0:0.##}", uholB); }
private void button5_Click(object sender, EventArgs e) // ihlan { double n, R, r, L, a, b, c, uh1, uh2, uh3, uh4, radian, Rr2, L2, ab2; radian = 57.296; n = (pocetHran.Text == "") ? 0 : Convert.ToDouble(pocetHran.Text); R = (polomerVelkeR.Text == "") ? 0 : Convert.ToDouble(polomerVelkeR.Text); r = (polomerMaler.Text == "") ? 0 : Convert.ToDouble(polomerMaler.Text); L = (vyskaIhlana.Text == "") ? 0 : Convert.ToDouble(vyskaIhlana.Text);
a = 2 * R * (Math.Sin((360 / (2 * n)) / radian)); b = 2 * r * (Math.Sin((360 / (2 * n)) / radian)); Rr2 = (R - r) * (R - r); // (R-r) na druhu L2 = L * L; // L na druhu ab2 = ((a - b) / 2) * ((a - b) / 2); // ((a-b)/2) na druhu c = Math.Sqrt((Rr2 + L2) - ab2); uh1 = Math.Atan(((a - b) / 2) / c)*radian; uh2 = uh1 * 2; uh3 = uh1 * 4; uh4 = 180 - uh2;
hranaA.Text = string.Format("{0:0.###}", a); hranaB.Text = string.Format("{0:0.###}", b); dlzkaBocHrany.Text = string.Format("{0:0.###}", c); uholIhlanA.Text = string.Format("{0:0.###}", uh1); uholIhlanB.Text = string.Format("{0:0.###}", uh2); uholIhlanC.Text = string.Format("{0:0.###}", uh3); uholIhlanD.Text = string.Format("{0:0.###}", uh4); }
private void radioButton6_CheckedChanged(object sender, EventArgs e) { kuzel.Visible = false; button3.Visible = false; priemer1.Visible = false; priemer2.Visible = false; vyskaH.Visible = false; obvodD1.Visible = false; obvodD2.Visible = false; obvodR1.Visible = false; obvodR2.Visible = false; polomeR1.Visible = false; polomeR2.Visible = false; uholAlfa.Visible = false; uholBeta.Visible = false; dlzkaSteny.Visible = false; }
private void radioButton5_CheckedChanged(object sender, EventArgs e) { kuzel.Visible = true; button3.Visible = true; priemer1.Visible = true; priemer2.Visible = true; vyskaH.Visible = true; obvodD1.Visible = true; obvodD2.Visible = true; obvodR1.Visible = true; obvodR2.Visible = true; polomeR1.Visible = true; polomeR2.Visible = true; uholAlfa.Visible = true; uholBeta.Visible = true; dlzkaSteny.Visible = true; } // *********************************************************************************************************************************** void tabulka(int x) // typ retaze - tabulka { //string[] P = { "9,525", "12,700", "15,875", "19,050", "25,400", "31,750", "38,100", "44,450", "50,800", "63,500", "76,200" }; double[] valcek = { 6.38, 8.51, 10.16, 12.07, 15.88, 19.05, 25.40, 27.94, 29.21, 39.37, 48.26 }; string[] iso = { "06B", "08B", "10B", "12B", "16B", "20B", "24B", "28B", "32B", "40B", "48B" }; string[] c = { "3,28", "4,45", "5,08", "5,72", "8,28", "10,19", "14,63", "15,90", "17,81", "22,89", "29,24" }; string[] F = { "8,2", "11,8", "14,7", "14,7", "21,0", "26,0", "33,4", "36,6", "41,8", "52,0", "63,4" }; string[] D = { "13,5", "17,0", "19,6", "22,7", "36,1", "41,2", "53,4", "65,0", "65,2", "80,4", "99,1" }; string[] B = { "5,72", "7,75", "9,65", "11,68", "17,02", "19,56", "25,40", "30,99", "30,99", "38,10", "45,72" }; string[] g = { "1,30", "1,60", "1,60", "1,80", "4,00", "4,50", "6,00", "7,00", "7,00", "8,00", "12,00" }; Valcek.Text = valcek[x].ToString(); ISO.Text = iso[x].ToString(); textBox4.Text = c[x].ToString(); textBox6.Text = F[x].ToString(); textBox7.Text = D[x].ToString(); textBox8.Text = B[x].ToString(); textBox9.Text = g[x].ToString(); }
private void rozostupR_SelectedIndexChanged(object sender, EventArgs e) { string[] P = { "9,525", "12,700", "15,875", "19,050", "25,400", "31,750", "38,100", "44,450", "50,800", "63,500", "76,200" }; int x;
for (int i = 0; i < 11; i++) if (rozostup.Text == P[i].ToString()) tabulka(x = i); //if (rozostup.Text == P[1].ToString()) //{ // tabulka(x = 1); //} //if (rozostup.Text == P[2].ToString()) //{ // tabulka(x = 2); //} //if (rozostup.Text == P[3].ToString()) //{ // tabulka(x = 3); //} //if (rozostup.Text == P[4].ToString()) //{ // tabulka(x = 4); //} //if (rozostup.Text == P[5].ToString()) //{ // tabulka(x = 5); //} //if (rozostup.Text == P[6].ToString()) //{ // tabulka(x = 6); //} //if (rozostup.Text == P[7].ToString()) //{ // tabulka(x = 7); //} //if (rozostup.Text == P[8].ToString()) //{ // tabulka(x = 8); //} //if (rozostup.Text == P[9].ToString()) //{ // tabulka(x = 9); //} //if (rozostup.Text == P[10].ToString()) //{ // tabulka(x = 10); //} }
private void button6_Click(object sender, EventArgs e) // výpočet kružníc ozubených kolies { int zuby,uholzuba; double R1, R2, u, h, roz, valcek, dt, da, df;
roz = (rozostup.Text == "") ? 0 : Convert.ToDouble(rozostup.Text); valcek = (Valcek.Text == "") ? 0 : Convert.ToDouble(Valcek.Text); zuby = (pocetZubov.Text == "") ? 0 : Convert.ToInt32(pocetZubov.Text); if (pocetZubov.Text == "") MessageBox.Show("nie je zadaný počet zubov", "upozornenie", MessageBoxButtons.OK, MessageBoxIcon.Warning); uholzuba = (zuby <= 16) ? 72 : 60; if (zuby > 41) uholzuba = 50;
R1 = 0.503 * valcek; R2 = 1.3 * valcek; u = 0.02 * roz; h = 0.18 * valcek; dt = roz / (Math.Sin(Math.PI / zuby)); df = dt - valcek; da = (zuby > 16) ? dt + 0.6 * valcek : dt + 0.5 * valcek;
uholZuba.Text = uholzuba.ToString(); polomerDnaR1.Text = string.Format("{0:0.###}", R1); polomerPrechodR2.Text = string.Format("{0:0.###}", R2); dnoZuba.Text = string.Format("{0:0.###}", u); R1R2.Text = string.Format("{0:0.###}", h); textBox10.Text = string.Format("{0:0.###}", dt); textBox11.Text = string.Format("{0:0.###}", da); textBox12.Text = string.Format("{0:0.###}", df); }
private void radioButton7_CheckedChanged(object sender, EventArgs e) // zobrazit výpočet cien hodinových sadzieb { groupBox3.Visible = true; groupBox4.Visible = false; }
private void radioButton8_CheckedChanged(object sender, EventArgs e) // zobrazit výpočet ohýbania NC lisom (TRUMPF) { groupBox3.Visible = false; groupBox4.Visible = true; }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) // normo hodiny inych operacii { int[] ineNh = { 12, 13, 15, 17, 18, 20, 23, 27, 30 };
if (comboBox2.Text=="stehovanie ustavenie") textBox20.Text=ineNh[4].ToString(); if (comboBox2.Text == "oblúkové zváranie") textBox20.Text = ineNh[4].ToString(); if (comboBox2.Text == "obl. zváranie so š.s") textBox20.Text = ineNh[5].ToString(); if (comboBox2.Text == "zámočnícke práce") textBox20.Text = ineNh[2].ToString(); if (comboBox2.Text == "sústruženie klasika") textBox20.Text = ineNh[3].ToString(); if (comboBox2.Text == "sústruženie NC") textBox20.Text = ineNh[5].ToString(); if (comboBox2.Text == "frézovanie klasika") textBox20.Text = ineNh[2].ToString(); if (comboBox2.Text == "vŕtanie") textBox20.Text = ineNh[1].ToString(); if (comboBox2.Text == "horizontka klasika") textBox20.Text = ineNh[6].ToString(); if (comboBox2.Text == "horizontka NC") textBox20.Text = ineNh[7].ToString(); if (comboBox2.Text == "brúsenie") textBox20.Text = ineNh[3].ToString(); if (comboBox2.Text == "pílenie materiálu") textBox20.Text = ineNh[0].ToString(); }
void vymazatCHS() { textBox13.Text = "22"; textBox14.Text = "32"; textBox15.Text = "63"; textBox16.Text = "20"; textBox17.Text = "17"; textBox18.Text = "10"; textBox19.Text = "13"; textBox20.Text = ""; textBox21.Text = ""; textBox22.Text = ""; textBox23.Text = ""; textBox24.Text = ""; textBox25.Text = ""; textBox26.Text = ""; textBox27.Text = ""; textBox28.Text = ""; textBox29.Text = ""; textBox30.Text = ""; textBox31.Text = ""; textBox32.Text = ""; textBox33.Text = ""; textBox34.Text = ""; textBox35.Text = ""; textBox36.Text = ""; textBox37.Text = "0,00 eur"; textBox38.Text = "0,00 eur"; }
void vymazatNClis() { textBox39.Text = ""; textBox40.Text = ""; textBox41.Text = ""; textBox42.Text = ""; textBox43.Text = ""; textBox44.Text = ""; textBox45.Text = ""; textBox46.Text = "1,3"; label36.Text = "info. hmotnosť kusa : "; label37.Text = "info. čas spolu : "; label39.Text = "cena za všetky kusy : "; }
private void nulovatCHS_Click(object sender, EventArgs e) // vynulovat výpočet cien hodinových sadzieb { vymazatCHS(); }
private void nulujNClis_Click(object sender, EventArgs e) // vynulovat výpočet ohýbania NC lisom (TRUMPF) { vymazatNClis(); }
private void checkBox2_CheckedChanged(object sender, EventArgs e) { if (NhodinyObchod.Checked) groupBox5.Visible = true; // zobrazit / skryt vypocet normohodin obchod else groupBox5.Visible = false; }
private void nulujvsetko_Click(object sender, EventArgs e) { vymazatHM(); vymazatCHS(); vymazatNClis(); vymazatNmobchod(); }
private void DXF_Click(object sender, EventArgs e) { SaveFileDialog dxf = new SaveFileDialog(); dxf.Filter = "nazov|*.dxf"; dxf.FileName = "ozubene koleso"; dxf.Title = "uložiť ozubené koleso"; if (dxf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string cesta = dxf.FileName; StreamWriter z = new StreamWriter(File.Create(cesta)); z.Write("0\nSECTION\n2\nTABLES\n0\nTABLE\n2\nLTYPE\n0\nLTYPE\n2\nMTC_DASHDOT\n3\nAxis_line\n72\n65\n73\n4\n40\n11.7\n49\n5.0\n49\n-3.0\n49\n0.7\n49\n-3.0\n70\n0\n0\nLTYPE\n2\nMTC_DASH\n3\nInvisible_line\n72\n65\n73\n2\n40\n11.0\n49\n8.0\n49\n-3.0\n70\n0\n0\nLTYPE\n2\nMTC_SOLID\n3\nSolid_line\n72\n65\n73\n0\n40\n0.0\n70\n0\n0\nENDTAB\n0\nTABLE\n2\nLAYER\n0\nLAYER\n2\nMTC_OUTLINE\n62\n7\n6\nMTC_SOLID\n70\n0\n0\nLAYER\n2\nMTC_TEXTN\n62\n8\n6\nMTC_SOLID\n70\n0\n0\nLAYER\n2\nMTC_TEXTB\n62\n5\n6\nMTC_SOLID\n70\n0\n0\nLAYER\n2\nMTC_THIN\n62\n8\n6\nMTC_SOLID\n70\n0\n0\nLAYER\n2\nMTC_AXIS\n62\n1\n6\nMTC_DASHDOT\n70\n0\n0\nLAYER\n2\nMTC_INVISIBLE\n62\n8\n6\nMTC_DASH\n70\n0\n0\nENDTAB\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n"); // hlava DXF // 0 LINE 8 0 10(x) = -2.0 20(y) = -2.0 30(z) = 0.0 11(x2) = 68.0 21(y2) = -2.0 31(z2) = 0.0 // 0 ARC 8 0 10 = 118.0 20 = 6.0 30 = 0.0 40(r) = 13.0 50(uhol1) = -138.0 51(uhol2) = -120 z.WriteLine("0\nTEXT\n8\n0\n10\n-20.0\n20\n1.0\n30\n0.0\n40\n2.0\n1\nOZUBENE KOLESO"); // text z.WriteLine("0\nCIRCLE\n8\n0\n10\n0.0\n20\n0.0\n30\n0.0\n40\n25.0\n6\nCONTINUE"); // kruh z.WriteLine("0\nARC\n8\n0\n10\n118.0\n20\n6.0\n30\n0.0\n40\n13.0\n50\n-138.0\n51\n-120\n6\nCONTINUE"); // obluk z.WriteLine("0\nLINE\n8\n0\n10\n-30.0\n20\n0.0\n30\n0.0\n11\n30.0\n21\n0.0\n31\n0.0"); // ciara z.WriteLine("0\nENDSEC\n0\nEOF"); // koniec DXF z.Dispose(); } }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { int D = Convert.ToInt16(comboBox3.Text); if (D < 15) textBox47.Text = "25"; else if (D < 18) textBox47.Text = "35"; else if (D < 24) textBox47.Text = "40"; else if (D < 28) textBox47.Text = "60"; else textBox47.Text = "70"; } } } o programovani som nevedel absolutne nic akurat jednu funciu som vedel pouzit a to IF :) |
|