예제 #1
0
        private void VerProyectoForm_Load(object sender, EventArgs e)
        {
            groupBoxCargando.Visible = false;
            if (isLoadingAFile)
            {
                project = cp.proyecto;
            }
            else
            {
                cp = new CalculosProyecto(project);
                if (cp.proyecto.Estado == "Terminado")
                {
                    cp.calcularCargasDelProyecto();
                }
            }
            lblTitulo.Text       += " " + project.Nombre + " " + project.Tipo_edificio;
            txtFx.Text            = Convert.ToString(project.Fc);
            txtFy.Text            = Convert.ToString(project.Fy);
            txtRecublimiento.Text = Convert.ToString(project.Recubrimiento);

            dataGridView1.Rows.Add(cp.losas.Count);
            dataGridView2.Rows.Add(cp.losas.Count);

            for (int i = 0; i <= cp.losas.Count - 1; i++)
            {
                //Espesores
                dataGridView1.Rows[i].Cells[0].Value  = cp.losas[i].Nombre;
                dataGridView2.Rows[i].Cells[0].Value  = cp.losas[i].Nombre;//carga
                dataGridView1.Rows[i].Cells[1].Value  = cp.losas[i].Lx;
                dataGridView1.Rows[i].Cells[2].Value  = cp.losas[i].Ly;
                dataGridView1.Rows[i].Cells[3].Value  = cp.calculosLosas[i].LcLl;
                dataGridView1.Rows[i].Cells[4].Value  = cp.calculosLosas[i].direccionLosa;
                dataGridView1.Rows[i].Cells[5].Value  = cp.calculosLosas[i].bordesDiscontinuos;
                dataGridView1.Rows[i].Cells[6].Value  = cp.losas[i].Bordesx;
                dataGridView1.Rows[i].Cells[7].Value  = cp.losas[i].BordesY;
                dataGridView1.Rows[i].Cells[8].Value  = cp.calculosLosas[i].apoyoArmadoEnUnaDireccion;
                dataGridView1.Rows[i].Cells[9].Value  = cp.calculosLosas[i].tmin;
                dataGridView1.Rows[i].Cells[10].Value = cp.calculosLosas[i].p180;
                dataGridView1.Rows[i].Cells[11].Value = cp.calculosLosas[i].T;
                dataGridView1.Rows[i].Cells[12].Value = cp.calculosLosas[i].usar;
                dataGridView2.Rows[i].Cells[1].Value  = cp.calculosLosas[i].usar;//carga

                //Cargas
                dataGridView2.Rows[i].Cells[2].Value = cp.cargas[i].Hinclinacion;
                dataGridView2.Rows[i].Cells[3].Value = cp.calculosCargas[i].angulo;
                dataGridView2.Rows[i].Cells[4].Value = cp.calculosCargas[i].cargaMuerta;
                dataGridView2.Rows[i].Cells[5].Value = cp.calculosCargas[i].cargaViva;
                dataGridView2.Rows[i].Cells[6].Value = cp.cargas[i].Carga_adicional;
                dataGridView2.Rows[i].Cells[7].Value = cp.calculosCargas[i].cargaUltima;
                dataGridView2.Rows[i].Cells[8].Value = cp.calculosCargas[i].reaccion;
                dataGridView2.Rows[i].Cells[9].Value = cp.calculosCargas[i].reaccionAng;
            }
        }
예제 #2
0
        private void EspesoresViwsForm_Load(object sender, EventArgs e)
        {
            cp = new CalculosProyecto(project);
            dataGridView1.Rows.Add(cp.losas.Count);
            lblTitulo.Text += " " + project.Nombre;
            for (int i = 0; i <= cp.losas.Count - 1; i++)
            {
                cmbLosas.Items.Add(cp.losas[i].Nombre);
                dataGridView1.Rows[i].Cells[0].Value = cp.losas[i].Nombre;
                dataGridView1.Rows[i].Cells[1].Value = cp.calculosLosas[i].T;
            }

            cmbLosas.SelectedIndex   = 0;
            comboBoxXY.SelectedIndex = 0;
            //labelTipoEdificio.Text = project.Nombre.Substring(0, project.Nombre.IndexOf(" a "));
            //string tipoedificio = project.Nombre.Substring(0, project.Nombre.IndexOf(" a "));
        }
예제 #3
0
        public XmlDocument crearLosaXml(CalculosProyecto cp)
        {
            //
            //ejemplo de creacion
            //

            /* XmlDocument xmlDoc = new XmlDocument();
             * XmlNode rootNode = xmlDoc.CreateElement("Lista");
             * xmlDoc.AppendChild(rootNode);
             * XmlNode userNode;
             * XmlAttribute attribute;
             *
             * for (int i = 0; i < listBox1.Items.Count; i++)
             * {
             *   listBox2.SelectedIndex = i;
             *   listBox1.SelectedIndex = i;
             *   userNode = xmlDoc.CreateElement("Path");
             *   attribute = xmlDoc.CreateAttribute("Time");
             *   attribute.Value = DateTime.Now.ToString("hhmmss");
             *   userNode.Attributes.Append(attribute);
             *   userNode.InnerText = Convert.ToString(listBox2.SelectedItem);
             *   rootNode.AppendChild(userNode);
             *
             * }*/

            //creando xml document y el nodo principal
            XmlDocument xmlDoc   = new XmlDocument();
            XmlNode     rootNode = xmlDoc.CreateElement("Proyecto");

            xmlDoc.AppendChild(rootNode);//anidado nodo al documento

            //
            //creando nodos que estaran dentro del nodo proyecto (datos generadas)
            //
            XmlNode projectNode = xmlDoc.CreateElement("Nombre");

            projectNode.InnerText = cp.proyecto.Nombre;
            rootNode.AppendChild(projectNode);

            //creando nodo para usuario
            projectNode           = xmlDoc.CreateElement("Usuario");
            projectNode.InnerText = cp.proyecto.Usuario;
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Tipo_losa
            projectNode           = xmlDoc.CreateElement("Tipo_losa");
            projectNode.InnerText = cp.proyecto.Tipo_losa;
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Pandereta
            projectNode           = xmlDoc.CreateElement("Pandereta");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Pandereta);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Peso_concreto
            projectNode           = xmlDoc.CreateElement("Peso_concreto");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Peso_concreto);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Terminacion
            projectNode           = xmlDoc.CreateElement("Terminacion");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Terminacion);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Recubrimiento
            projectNode           = xmlDoc.CreateElement("Recubrimiento");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Recubrimiento);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Fy
            projectNode           = xmlDoc.CreateElement("Fy");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Fy);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Fc
            projectNode           = xmlDoc.CreateElement("Fc");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Fc);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Estado
            projectNode           = xmlDoc.CreateElement("Estado");
            projectNode.InnerText = Convert.ToString(cp.proyecto.Estado);
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Tipo_edificio
            projectNode           = xmlDoc.CreateElement("Tipo_edificio");
            projectNode.InnerText = cp.proyecto.Tipo_edificio;
            rootNode.AppendChild(projectNode);//anidado nodo al nodo Proyecto

            //creando nodo para Fecha
            projectNode           = xmlDoc.CreateElement("Fecha");
            projectNode.InnerText = cp.proyecto.Fecha;
            rootNode.AppendChild(projectNode);                 //anidado nodo al nodo Proyecto

            XmlNode LosasNode = xmlDoc.CreateElement("Losas"); //nodo para las losas

            rootNode.AppendChild(LosasNode);

            XmlNode LosaNode;     //nodo para una losa que pertenecera al nodo de las losa
            XmlNode LosaDatoNode; //nodo para los datos de una losa
            int     x = 0;        //contador para el foreach-cargas

            foreach (DatabaseLosa.Losa l in cp.losas)
            {
                LosaNode = xmlDoc.CreateElement("losa");

                //creando nodo para Nombre
                LosaDatoNode           = xmlDoc.CreateElement("Nombre");
                LosaDatoNode.InnerText = Convert.ToString(l.Nombre);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para Lx
                LosaDatoNode           = xmlDoc.CreateElement("Lx");
                LosaDatoNode.InnerText = Convert.ToString(l.Lx);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para Ly
                LosaDatoNode           = xmlDoc.CreateElement("Ly");
                LosaDatoNode.InnerText = Convert.ToString(l.Ly);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para BordesY
                LosaDatoNode           = xmlDoc.CreateElement("BordesY");
                LosaDatoNode.InnerText = Convert.ToString(l.BordesY);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para BordesX
                LosaDatoNode           = xmlDoc.CreateElement("Bordesx");
                LosaDatoNode.InnerText = Convert.ToString(l.Bordesx);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para Xy
                LosaDatoNode           = xmlDoc.CreateElement("Xy");
                LosaDatoNode.InnerText = Convert.ToString(cp.cargas[x].Xy);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para Hinclinacion
                LosaDatoNode           = xmlDoc.CreateElement("Hinclinacion");
                LosaDatoNode.InnerText = Convert.ToString(cp.cargas[x].Hinclinacion);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para Carga_viva
                LosaDatoNode           = xmlDoc.CreateElement("Carga_viva");
                LosaDatoNode.InnerText = Convert.ToString(cp.cargas[x].Carga_viva);
                LosaNode.AppendChild(LosaDatoNode);//anidado nodo al nodo losa

                //creando nodo para Carga_adicional
                LosaDatoNode           = xmlDoc.CreateElement("Carga_adicional");
                LosaDatoNode.InnerText = Convert.ToString(cp.cargas[x].Carga_adicional);
                LosaNode.AppendChild(LosaDatoNode); //anidado nodo al nodo losa

                LosasNode.AppendChild(LosaNode);    //anidado nodo losa al nodo losas
                x++;                                //siguiente carga
            }


            return(xmlDoc);
            //
            //example for save
            //

            /*xmlDoc.Save("ListSong" + DateTime.Now.ToString("hhmmss") + ".xml");
             * or
             * SaveFileDialog Save = new SaveFileDialog();
             * Save.Title = "Save ListSong Files";
             * Save.Filter = "Xml|*.xml|All files(*.*)|*.*";
             * Save.FileName = "ListSong" + DateTime.Now.ToString("hhmmss");
             * if (Save.ShowDialog() == DialogResult.OK)
             * {
             *  xmlDoc.Save(Save.FileName);
             * } */
        }
예제 #4
0
        //metodo constructos... se puede cambiar para que la clase trabaje con diferentes metodos y funciones para difentetes plantillas
        public PlantillaProyecto(CalculosProyecto c)
        {
            try
            {
                //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)
                {
                    bool  nofound      = true;
                    Range rngFieldCode = myMergeField.Code;

                    String fieldText = rngFieldCode.Text;



                    if (fieldText.StartsWith(" MERGEFIELD"))//validacion para llenar campos que sean MERGEFIELD
                    {
                        //string merge = " 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

                        //estructura de la plantilla

                        /*FNombre
                         * Nombre_losa1»
                         * •	«Direccion_losa1»
                         * •	«Apoyo_direccion1»
                         * •	«Espesores1»
                         * o	«tmin1»
                         * o	«p1801»
                         * o	«t1»
                         * o	«a_usar1»
                         * •	«Carga_viva1»
                         * •	«Carga_muerta1»
                         * •	«Carga_ultima1»
                         * •	Reaccion hacia los apoyos:
                         * o	«Angulos1»
                         * o	«Tonm1»
                         * Tipo de edificio
                         */
                        //se llena cada campo con su respectivo dato

                        //for(int x=0; x<10; x++)       {
                        if (fieldName == "Nombre_Ing")
                        {
                            myMergeField.Select();
                            wordApp.Selection.TypeText(c.proyecto.Usuario);
                            nofound = false;
                        }
                        for (int x = 0; x < c.losas.Count; x++)
                        {
                            if (fieldName == ("Nombre_losa" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText(c.losas[x].Nombre);
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("Direccion_losa" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Losa armada en " + c.calculosLosas[x].direccionLosa);
                                nofound = false;
                                break;
                            }

                            if (fieldName == ("Apoyo_direccion" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                if (c.calculosLosas[x].apoyoArmadoEnUnaDireccion != "...")
                                {
                                    wordApp.Selection.TypeText("Apoyos en Losas armadas en una dirección: " + c.calculosLosas[x].apoyoArmadoEnUnaDireccion);
                                    nofound = false;
                                }
                                else
                                {
                                    wordApp.Selection.TypeText(" ");
                                    nofound = false;
                                }
                                break;
                            }

                            if (fieldName == "Espesores")
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Espesores");
                                nofound = false;
                                break;
                            }

                            if (fieldName == ("tmin" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Tmin: " + c.calculosLosas[x].tmin + "(cm.)");
                                nofound = false;
                                break;
                            }

                            if (fieldName == ("p180" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("P/180: " + Convert.ToString(c.calculosLosas[x].p180) + "(cm.)");
                                nofound = false;
                                break;
                            }

                            if (fieldName == ("t" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("T: " + Convert.ToString(c.calculosLosas[x].T) + "(cm.)");
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("a_usar" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("T a usar: " + Convert.ToString(c.calculosLosas[x].usar) + "(cm.)");
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("carga_viva" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Carga viva: " + Convert.ToString(c.calculosCargas[x].cargaViva) + " (to/m²)");
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("carga_muerta" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Carga muerta: " + Convert.ToString(c.calculosCargas[x].cargaMuerta) + " (to/m²)");
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("carga_ultima" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Carga ultima: " + Convert.ToString(c.calculosCargas[x].cargaUltima) + " (to/m²)");
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("angulos" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Angulo de inclinacion en Grados: " + Convert.ToString(c.calculosCargas[x].angulo));
                                nofound = false;
                                break;
                            }
                            if (fieldName == ("Tonm" + Convert.ToString(x + 1)))
                            {
                                myMergeField.Select();
                                wordApp.Selection.TypeText("Reacción hacia los apoyos: " + Convert.ToString(c.calculosCargas[x].reaccion) + "(to/m²), " + Convert.ToString(c.calculosCargas[x].reaccionAng) + " (to/m²)");//vacio
                                nofound = false;
                                break;
                            }
                        }
                        if (fieldName == "Tipo_Edificio")
                        {
                            myMergeField.Select();
                            wordApp.Selection.TypeText(c.proyecto.Nombre + " - " + Convert.ToString(c.proyecto.Tipo_edificio));
                            nofound = false;
                        }
                        if (nofound)
                        {
                            myMergeField.Select();
                            wordApp.Selection.TypeText(" ");
                        }
                    }
                }
                progreso = 100;
                wordDoc.SaveAs(c.proyecto.Nombre + ".doc");         //save as
                wordApp.Documents.Open(c.proyecto.Nombre + ".doc"); //opcional: abre el documento para visualizar despues de haber guardado
                //wordApp.Application.Quit();
            }
            catch (COMException)
            {
                throw;
            }
        }