Exemplo n.º 1
0
 private void buttonCalcular_Click(object sender, EventArgs e)
 {
     if ((txtCargaAdicional.Text != "") && (textBoxCarga.Text != "") && (txtInclinacion.Text != ""))
     {
         Carga car = new Carga();
         car.Hinclinacion    = Convert.ToDouble(txtInclinacion.Text);
         car.Xy              = Convert.ToString(comboBoxXY.SelectedItem);
         car.Carga_adicional = Convert.ToDouble(txtCargaAdicional.Text);
         car.Carga_viva      = Convert.ToDouble(cargaV);
         DatabaseLosa.Losa l  = cp.losas[cmbLosas.SelectedIndex];
         CalculosLosa      cl = cp.calculosLosas[cmbLosas.SelectedIndex];
         car.Id_losa = l.Id;
         CalculoCarga caca = new CalculoCarga(l, cl, project, car);
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[2].Value = Convert.ToString(car.Hinclinacion) + " " + car.Xy;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[3].Value = caca.angulo;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[4].Value = caca.cargaMuerta;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[5].Value = caca.cargaViva;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[6].Value = car.Carga_adicional;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[7].Value = caca.cargaUltima;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[8].Value = caca.reaccion;
         dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[9].Value = caca.reaccionAng;
     }
     else
     {
         MessageBox.Show("Hay campos vacios", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        //
        public CalculoCarga(DatabaseLosa.Losa l, CalculosLosa cl, Proyecto p, Carga ca)
        {
            double lc = 0.0;
            double ll = 0.0;

            if ((l.Lx) <= (l.Ly))
            {
                ll = l.Ly;
                lc = l.Lx;
            }
            else
            {
                ll = l.Lx;
                lc = l.Ly;
            }
            angulo      = Math.Atan(ca.Hinclinacion / lc);
            cargaMuerta = 1.2 * Convert.ToDouble(cl.T) * p.Peso_concreto * Math.Cos(angulo);

            cargaViva   = ca.Carga_viva;
            cargaUltima = 1.2 * Math.Cos(ca.Hinclinacion) * cargaMuerta + 1.6 * cargaViva;

            double alfa = (3 - (lc / ll) * (lc / ll)) / 2;

            reaccion    = (cargaUltima * lc) / 3;
            reaccionAng = reaccion * alfa;
        }
Exemplo n.º 3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            bool check = true;

            foreach (DataGridViewRow r in dataGridView1.Rows)
            {
                for (int i = 0; i <= 12; i++)
                {
                    if (r.Cells[i].Value == null)
                    {
                        check = false;
                    }
                }
            }

            if (check == true)
            {
                CuantificaciondeCargasForm ccf = new CuantificaciondeCargasForm();
                ccf.project           = project;
                project.Fc            = Convert.ToDouble(txtFx.Text);
                project.Fy            = Convert.ToDouble(txtFy.Text);
                project.Recubrimiento = Convert.ToDouble(txtRecublimiento.Text);
                project.Estado        = "En proceso";
                Broker b = new Broker();
                b.InsertProyecto(project);

                for (int i = 0; i < cmbLosas.Items.Count; i++)
                {
                    DatabaseLosa.Losa los = new DatabaseLosa.Losa();
                    cmbLosas.SelectedIndex = i;
                    los.Nombre             = "Losa " + Convert.ToString(cmbLosas.SelectedIndex + 1);//Convert.ToString(dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[0].Value);
                    los.Lx         = Convert.ToDouble(dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[1].Value);
                    los.Ly         = Convert.ToDouble(dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[2].Value);
                    los.Bordesx    = Convert.ToInt32(dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[6].Value);
                    los.BordesY    = Convert.ToInt32(dataGridView1.Rows[cmbLosas.SelectedIndex].Cells[7].Value);
                    los.Idproyecto = project.Id;
                    b.InsertLosa(los);
                }

                this.Hide();
                ccf.Show();
            }
            else
            {
                MessageBox.Show("Aun hay losas sin calcular", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        }//final un proyectos

        //select lista de losas
        public List <Losa> selectLosas(long idProyecto)
        {
            List <Losa> Listalosa = new List <Losa>();

            try
            {
                command.CommandText = "SELECT * FROM LOSA WHERE ID_PROYECTO=" + Convert.ToString(idProyecto);
                command.CommandType = CommandType.Text;
                connection.Open();

                OleDbDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Losa p = new Losa();
                    p.Id         = Convert.ToInt32(reader["ID_LOSA"].ToString());
                    p.Nombre     = reader["NOMBRE"].ToString();
                    p.Lx         = Convert.ToDouble(reader["LX"].ToString());
                    p.Ly         = Convert.ToDouble(reader["LY"].ToString());
                    p.Bordesx    = Convert.ToInt32(reader["BORDESX"].ToString());
                    p.BordesY    = Convert.ToInt32(reader["BORDESY"].ToString());
                    p.Idproyecto = Convert.ToInt64(reader["ID_PROYECTO"].ToString());

                    Listalosa.Add(p);
                }
                return(Listalosa);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }//final las losas de proyectos
Exemplo n.º 5
0
        }//final insert

        public void InsertLosa(Losa l)
        {
            try
            {
                command.CommandText = "INSERT INTO LOSA (NOMBRE, LX, LY, BORDESX, BORDESY, ID_PROYECTO) VALUES('" + l.Nombre + "', " + Convert.ToString(l.Lx) + ", " + Convert.ToString(l.Ly) + ", " + Convert.ToString(l.Bordesx) + ", " + Convert.ToString(l.BordesY) + ", " + Convert.ToString(l.Idproyecto) + ")";
                command.CommandType = CommandType.Text;

                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }//final insert
Exemplo n.º 6
0
        public CalculosProyecto(XmlDocument xmlDoc)
        {
            //inicializando variables de listas y proyectos
            proyecto       = new Proyecto();
            losas          = new List <DatabaseLosa.Losa>();
            cargas         = new List <DatabaseLosa.Carga>();
            calculosLosas  = new List <CalculosLosa>();
            calculosCargas = new List <CalculoCarga>();

            proyecto.Id = Convert.ToInt64(DateTime.Now.ToString("yyMMddhhmm")); //asignando a id al proyecto exportado

            XmlNode projectNode = xmlDoc.SelectSingleNode("Proyecto");          //tomando nodo principal proyecto

            //tomando datos del nodo: nombre
            XmlNode nodeData = projectNode.SelectSingleNode("Nombre");

            proyecto.Nombre = nodeData.InnerText;

            //tomando datos del nodo: Usuario
            nodeData         = projectNode.SelectSingleNode("Usuario");
            proyecto.Usuario = nodeData.InnerText;

            //tomando datos del nodo: Tipo_losa
            nodeData           = projectNode.SelectSingleNode("Tipo_losa");
            proyecto.Tipo_losa = nodeData.InnerText;

            //tomando datos del nodo: Pandereta
            nodeData           = projectNode.SelectSingleNode("Pandereta");
            proyecto.Pandereta = Convert.ToDouble(nodeData.InnerText);

            //tomando datos del nodo: Peso_concreto
            nodeData = projectNode.SelectSingleNode("Peso_concreto");
            proyecto.Peso_concreto = Convert.ToDouble(nodeData.InnerText);

            //tomando datos del nodo: Peso_concreto
            nodeData             = projectNode.SelectSingleNode("Terminacion");
            proyecto.Terminacion = Convert.ToDouble(nodeData.InnerText);

            //tomando datos del nodo: Recubrimiento
            nodeData = projectNode.SelectSingleNode("Recubrimiento");
            proyecto.Recubrimiento = Convert.ToDouble(nodeData.InnerText);

            //tomando datos del nodo: Fy
            nodeData    = projectNode.SelectSingleNode("Fy");
            proyecto.Fy = Convert.ToDouble(nodeData.InnerText);

            //tomando datos del nodo: Fc
            nodeData    = projectNode.SelectSingleNode("Fc");
            proyecto.Fc = Convert.ToDouble(nodeData.InnerText);

            //tomando datos del nodo: Estado
            nodeData        = projectNode.SelectSingleNode("Estado");
            proyecto.Estado = nodeData.InnerText;

            //tomando datos del nodo: Tipo_edificio
            nodeData = projectNode.SelectSingleNode("Tipo_edificio");
            proyecto.Tipo_edificio = nodeData.InnerText;

            //tomando datos del nodo: Fecha
            nodeData       = projectNode.SelectSingleNode("Fecha");
            proyecto.Fecha = nodeData.InnerText;

            XmlNode     nodeLosa  = projectNode.SelectSingleNode("Losas");
            XmlNodeList nodeLosas = nodeLosa.SelectNodes("losa");

            foreach (XmlElement item in nodeLosas)
            {
                //variables para add to list
                DatabaseLosa.Losa  losa  = new DatabaseLosa.Losa();
                DatabaseLosa.Carga carga = new DatabaseLosa.Carga();

                //obteniendo datos de losa
                losa.Nombre  = item.SelectSingleNode("Nombre").InnerText;
                losa.Lx      = Convert.ToDouble(item.SelectSingleNode("Lx").InnerText);
                losa.Ly      = Convert.ToDouble(item.SelectSingleNode("Ly").InnerText);
                losa.BordesY = Convert.ToInt32(item.SelectSingleNode("BordesY").InnerText);
                losa.Bordesx = Convert.ToInt32(item.SelectSingleNode("Bordesx").InnerText);

                //obteniendo datos de carga
                carga.Xy              = item.SelectSingleNode("Xy").InnerText;
                carga.Hinclinacion    = Convert.ToDouble(item.SelectSingleNode("Hinclinacion").InnerText);
                carga.Carga_viva      = Convert.ToDouble(item.SelectSingleNode("Carga_viva").InnerText);
                carga.Carga_adicional = Convert.ToDouble(item.SelectSingleNode("Carga_adicional").InnerText);

                losas.Add(losa);
                cargas.Add(carga);
            }


            int x = 0;

            //calculando losas y cargas
            foreach (DatabaseLosa.Losa losa in losas)
            {
                CalculosLosa cl    = new CalculosLosa(losa);
                CalculoCarga ccarg = new CalculoCarga(losa, cl, proyecto, cargas[x]);
                calculosLosas.Add(cl);
                calculosCargas.Add(ccarg);
                x++;
            }
        }
Exemplo n.º 7
0
        //metodo constructos... se puede cambiar para que la clase trabaje con diferentes metodos y funciones para difentetes plantillas
        public Plantilla(DatabaseLosa.Losa p)
        {
            //agregando la ruta y otros espesificaciones a la instancia del documento
            wordDoc = wordApp.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);

            //for que recorre cada campo de la plantilla del documento
            foreach (Field myMergeField in wordDoc.Fields)
            {
                Range rngFieldCode = myMergeField.Code;

                String fieldText = rngFieldCode.Text;



                if (fieldText.StartsWith(" MERGEFIELD"))                       //validacion para llenar campos que sean MERGEFIELD
                {
                    Int32 endMerge = fieldText.IndexOf("\\");                  // final del campo

                    Int32 fieldNameLength = fieldText.Length - endMerge;       //tamaño del campo a llenar

                    String fieldName = fieldText.Substring(11, endMerge - 11); //corte del nombre del campo por defecto


                    fieldName = fieldName.Trim();   //se eleminan espacios en blanco


                    //se llena cada campo con su respectivo dato
                    if (fieldName == "fNombre")
                    {
                        myMergeField.Select();
                        wordApp.Selection.TypeText(p.Nombre);
                    }

                    if (fieldName == "fApellido")
                    {
                        myMergeField.Select();
                        wordApp.Selection.TypeText(Convert.ToString(p.Idproyecto));
                    }

                    if (fieldName == "fCedula")
                    {
                        myMergeField.Select();
                        wordApp.Selection.TypeText(Convert.ToString(p.Ly));
                    }

                    if (fieldName == "fTipoSangre")
                    {
                        myMergeField.Select();
                        wordApp.Selection.TypeText(Convert.ToString(p.Ly));
                    }

                    if (fieldName == "fPeso")
                    {
                        myMergeField.Select();
                        wordApp.Selection.TypeText(Convert.ToString(p.Id));
                    }
                }
            }

            wordDoc.SaveAs(p.Nombre + ".doc");         //save as
            wordApp.Documents.Open(p.Nombre + ".doc"); //opcional: abre el documento para visualizar despues de haber guardado
            //wordApp.Application.Quit();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Calcula los datos sobre espesores de losa
        ///
        /// </summary>
        /// <param name="l">Losa del proyecto</param>
        public CalculosLosa(DatabaseLosa.Losa L)
        {
            DatabaseLosa.Broker b = new DatabaseLosa.Broker();
            losa     = new DatabaseLosa.Losa();
            losa     = L;
            proyecto = new Proyecto();
            proyecto = b.selectProyecto(L.Idproyecto);
            double m, tmi = 0, P180 = -1, t = 10.00;
            // bordes discontinuos
            int bordes = L.Bordesx + L.BordesY;

            bordesDiscontinuos = Convert.ToString(bordes);

            // Lc/Ll
            if (L.Lx <= L.Ly)
            {
                m = L.Lx / L.Ly;
            }
            else
            {
                m = L.Ly / L.Lx;
            }
            LcLl = Convert.ToString(m);


            if ((m >= 0.5))
            {
                direccionLosa             = "En dos direcciones";
                apoyoArmadoEnUnaDireccion = "...";
                if ((L.Lx) <= (L.Ly))
                {
                    double bs = (L.Ly / L.Lx);
                    //hacer select del proyecto para buscar fy
                    tmi = ((L.Ly * 100) * (0.8 + proyecto.Fy / 14000)) / (36 + (9 * bs));
                }
                else
                {
                    double bs = (L.Lx / L.Ly);
                    tmi = ((L.Lx * 100) * (0.8 + proyecto.Fy / 14000)) / (36 + (9 * bs));
                }


                P180 = (2 * 100 * (L.Lx + L.Ly)) / 180;
            }
            else
            {
                direccionLosa = "En una dirección";
                if (bordes == 1)
                {//empotrada-articulada
                    apoyoArmadoEnUnaDireccion = "empotrada-articulada";
                    if ((L.Lx) <= (L.Ly))
                    {
                        tmi = (L.Lx * 100) / 20 * (0.4 + proyecto.Fy / 7000);
                    }
                    else
                    {
                        tmi = (L.Ly * 100) / 20 * (0.4 + proyecto.Fy / 7000);
                    }
                }
                else if ((bordes == 4) || (bordes == 2))
                {//simplemente apoyada
                    apoyoArmadoEnUnaDireccion = "simplemente apoyada";
                    if ((L.Lx) <= (L.Ly))
                    {
                        tmi = (L.Lx * 100) / 24 * (0.4 + proyecto.Fy / 7000);
                    }
                    else
                    {
                        tmi = (L.Ly * 100) / 24 * (0.4 + proyecto.Fy / 7000);
                    }
                }
                else if (bordes == 3)
                {//en voladizo
                    apoyoArmadoEnUnaDireccion = "en voladizo";
                    if ((L.Lx) <= (L.Ly))
                    {
                        tmi = (L.Lx * 100) / 10 * (0.4 + proyecto.Fy / 7000);
                    }
                    else
                    {
                        tmi = (L.Ly * 100) / 10 * (0.4 + proyecto.Fy / 7000);
                    }
                }
                else if ((bordes == 0))
                {//empotrada-empotrada
                    apoyoArmadoEnUnaDireccion = "empotrada-empotrada";
                    if ((L.Lx) <= (L.Ly))
                    {
                        tmi = (L.Lx * 100) / 28 * (0.4 + proyecto.Fy / 7000);
                    }
                    else
                    {
                        tmi = (L.Ly * 100) / 28 * (0.4 + proyecto.Fy / 7000);
                    }
                }
            }

            tmin = Convert.ToString(tmi);
            if (P180 != -1)
            {
                p180 = Convert.ToString(P180);
            }
            else
            {
                p180 = "...";
            }



            if (P180 >= tmi)
            {
                if (P180 <= 10)
                {
                    t = 10.00;
                }
                else
                {
                    t = System.Math.Ceiling(P180);
                    if (((Convert.ToInt32(t) % 2) != 0) && (t != 15))
                    {
                        t++;
                    }
                }
            }
            else
            {
                if (tmi <= 10.00)
                {
                    t = 10.00;
                }
                else
                {
                    t = System.Math.Ceiling(tmi);
                    if (((Convert.ToInt32(t) % 2) != 0) && (t != 15))
                    {
                        t++;
                    }
                }
            }

            T = Convert.ToString(t);
            if (t < 12)
            {
                usar = "12";
            }
            else
            {
                usar = Convert.ToString(t);
            }



            //fin
        }