Example #1
0
        public frmHalter(DataTable _dtForceOnPole, double _SafteyFactor, Guid _SectionCode, bool _IsUTs, double _SaftyFactorOburi)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }

            InitializeComponent();
            dtForceOnPole    = _dtForceOnPole;
            IsUTs            = _IsUTs;
            SectionCode      = _SectionCode;
            SaftyFactor      = _SafteyFactor;
            SaftyFactorOburi = _SaftyFactorOburi;
            Atend.Global.Calculation.Mechanical.CalcOptimalSagTension calc = new Atend.Global.Calculation.Mechanical.CalcOptimalSagTension();
            ed.WriteMessage("BeforSelectAll\n");
            DataTable dtHalter = Atend.Base.Equipment.EHalter.SelectAllX();

            ed.WriteMessage("BeforSelectByXCode\n");
            Atend.Base.Equipment.EHalter halter = Atend.Base.Equipment.EHalter.SelectByXCode(new Guid(dtHalter.Rows[0]["XCode"].ToString()));
            ed.WriteMessage("CalcResult\n");
            //DataTable dtResult=calc.CalcHalter(dtForceOnPole,halter);


            // dataGridView1.DataSource = dtResult;
        }
Example #2
0
        private void Calculation()
        {
            chkSelectSection.Focus();

            if (Validation())
            {
                this.Cursor = Cursors.WaitCursor;
                System.Data.DataTable dtGlobal = Atend.Base.Design.DGlobal.AccessSelectAll();
                System.Data.DataTable dtBranch = Atend.Global.Acad.UAcad.FillBranchList();
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                for (int gCounter = 0; gCounter < gvSection.Rows.Count; gCounter++)
                {
                    DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvSection.Rows[gCounter].Cells[1];
                    if (chk.Value.ToString() == "True")
                    {
                        calcOptimalSagTension = new Atend.Global.Calculation.Mechanical.CalcOptimalSagTension();
                        calcOptimalSagTension.DtPoleSection = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(gvSection.Rows[gCounter].Cells[0].Value.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.Pole));

                        System.Data.DataTable dtPole1 = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(gvSection.Rows[gCounter].Cells[0].Value.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.PoleTip));
                        foreach (DataRow dr in dtPole1.Rows)
                        {
                            DataRow drPole = calcOptimalSagTension.DtPoleSection.NewRow();
                            drPole["ProductType"] = dr["ProductType"].ToString();
                            drPole["ProductCode"] = dr["ProductCode"].ToString();
                            drPole["SectionCode"] = dr["SectionCode"].ToString();
                            calcOptimalSagTension.DtPoleSection.Rows.Add(drPole);
                        }


                        System.Data.DataColumn dc = new System.Data.DataColumn("PoleNumber");
                        calcOptimalSagTension.DtPoleSection.Columns.Add(dc);
                        foreach (DataRow dr in calcOptimalSagTension.DtPoleSection.Rows)
                        {
                            Atend.Base.Design.DPackage node = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(dr["ProductCode"].ToString()));
                            dr["PoleNumber"] = node.Number.ToString();
                        }
                        ReadVoltage(gCounter);
                        calcOptimalSagTension.Volt = Volt;

                        calcOptimalSagTension.DtPoleCond   = dtGlobal;
                        calcOptimalSagTension.dtBranchList = dtBranch;

                        DataGridViewComboBoxCell cboNetCross = (DataGridViewComboBoxCell)gvSection.Rows[gCounter].Cells[4];
                        //ed.WriteMessage("NetCrossCode={0}\n", cboNetCross.Value.ToString());
                        NetCross = Atend.Base.Calculating.CNetWorkCross.AccessSelectByCode(Convert.ToInt32(cboNetCross.Value.ToString()));

                        if (Volt == 400)
                        {
                            calcOptimalSagTension.Clearance = NetCross.V380;
                        }
                        if (Volt == 11000)
                        {
                            calcOptimalSagTension.Clearance = NetCross.KV11;
                        }
                        if (Volt == 20000)
                        {
                            calcOptimalSagTension.Clearance = NetCross.KV20;
                        }
                        if (Volt == 33000)
                        {
                            calcOptimalSagTension.Clearance = NetCross.KV32;
                        }

                        calcOptimalSagTension.DtconductorSection = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(gvSection.Rows[gCounter].Cells[0].Value.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor));
                        if (calcOptimalSagTension.DtconductorSection.Rows.Count == 0)
                        {
                            calcOptimalSagTension.DtconductorSection = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(gvSection.Rows[gCounter].Cells[0].Value.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper));
                            //ed.WriteMessage("Count={0}\n", calcOptimalSagTension.DtconductorSection.Rows.Count);
                        }

                        calcOptimalSagTension.VTS = Convert.ToDouble(gvSection.Rows[gCounter].Cells["UTS"].Value.ToString());
                        //System.Data.DataColumn dc1 = new System.Data.DataColumn("Angle");
                        //calcOptimalSagTension.DtconductorSection.Columns.Add(dc1);
                        calcOptimalSagTension.SectionCode = new Guid(gvSection.Rows[gCounter].Cells[0].Value.ToString());
                        //calcOptimalSagTension.Start = Convert.ToInt32(txtStart.Text);
                        //calcOptimalSagTension.End = Convert.ToInt32(txtEnd.Text);
                        //calcOptimalSagTension.Distance = Convert.ToInt32(txtDistance.Text);
                        Atend.Base.Design.DBranch MyBranch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(calcOptimalSagTension.DtconductorSection.Rows[0]["ProductCode"].ToString()));
                        //ed.WriteMessage("OOO\n");
                        dtResult.Rows.Clear();

                        //se = calcOptimalSagTension.ComputeSE();
                        //ed.WriteMessage("&&&&&&&&&&&&&&&&&&&SE={0}\n", se.ToString());
                        //SpanCount = calcOptimalSagTension.DtconductorSection.Rows.Count;
                        calcOptimalSagTension.dtStTable.Rows.Clear();

                        ed.WriteMessage("GOTOSurface\n");
                        dtResult = calcOptimalSagTension.calcRudSurface02().Copy();
                        gvResult.AutoGenerateColumns = false;
                        calcOptimalSagTension.CloseConnection();
                        gvResult.DataSource = dtResult;
                        Save(gCounter);
                    }
                }
                this.Cursor = Cursors.Default;
                //DataRow dr1 = dtRow.NewRow();
                //dr1["ProjectName"] = "";
                //dr1["NumSection"] = gvSection.SelectedRows[0].Cells[1].Value.ToString();
                //dr1["FirstPole"] = "";
                //dr1["LastPole"] = "";
                //dr1["UTS"] = calcOptimalSagTension.VTS;
                //dr1["SE"] = se.ToString();
                //dr1["SpanCount"] = SpanCount;
                //dr1["SpanLenght"] = "";
                //dr1["CondName"] = gvSagAndTension.Rows[0].Cells[0].Value;
                //dtRow.Rows.Add(dr1);
                //ChangeColor();
            }
        }