Пример #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper DrawSelfKeeper = new Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper();
            if (Validation())
            {
                if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[7].Value) == false)
                {
                    DrawSelfKeeper.UseAccess      = true;
                    DrawSelfKeeper.eSelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Convert.ToInt32(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value.ToString()));
                }
                else if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[7].Value))
                {
                    DrawSelfKeeper.UseAccess = false;
                    Atend.Base.Equipment.ESelfKeeperTip selfkeepertip = new Atend.Base.Equipment.ESelfKeeperTip();
                    ed.WriteMessage("SelectByXCode={0}\n", gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString());
                    selfkeepertip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString()));
                    DrawSelfKeeper.eSelfKeeperTip = selfkeepertip;
                    ed.WriteMessage("SelefKipperTip.XCOde={0}\n", selfkeepertip.XCode);
                    List <Atend.Base.Equipment.ESelfKeeper> list = new List <Atend.Base.Equipment.ESelfKeeper>();
                    list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.PhaseProductxCode));
                    list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.NeutralProductxCode));
                    list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.NightProductxCode));
                    DrawSelfKeeper.eSelfKeepers = list;
                }

                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                DrawSelfKeeper.Existance = status.ACode;

                if (cboProject.Items.Count == 0)
                {
                    DrawSelfKeeper.ProjectCode = 0;
                }
                else
                {
                    DrawSelfKeeper.ProjectCode = Convert.ToInt32(cboProject.SelectedValue);
                }

                DrawSelfKeeper.SelectedObjectId = BranchObj;

                DrawSelfKeeper.UpdateSelfKeeperData(Convert.ToDouble(txtLenght.Text), BranchCode);
                //if (DrawSelfKeeper.UpdateSelfKeeperData())
                //    ed.WriteMessage("Update SelfKeeper Success \n");
            }
        }
Пример #2
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~ methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~//


        ///// <summary>
        ///// Save all data before start AutoPoleInstallation
        ///// </summary>
        ///// <returns></returns>
        //private bool PrepareData()
        //{
        //    Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
        //    OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);
        //    OleDbTransaction aTransaction;
        //    try
        //    {
        //        aConnection.Open();
        //        aTransaction = aConnection.BeginTransaction();

        //        try
        //        {
        //            if (!selectedPole.AccessInsert(aTransaction, aConnection, true, true))
        //            {
        //                throw new System.Exception("selectedPole.AccessInsert");
        //            }
        //            if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.Conductor)
        //            {
        //                if (!SelectedConsol.AccessInsert(aTransaction, aConnection, true, true))
        //                {
        //                    throw new System.Exception("SelectedConsol.AccessInsert");
        //                }
        //                if (!SelectedConsolTension.AccessInsert(aTransaction, aConnection, true, true))
        //                {
        //                    throw new System.Exception("SelectedConsolTension.AccessInsert");
        //                }
        //            }
        //            else if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.SelfKeeper)
        //            {
        //                if (!SelectedClamp.AccessInsert(aTransaction, aConnection, true, true))
        //                {
        //                    throw new System.Exception("SelectedClamp.AccessInsert");
        //                }
        //                if (!SelectedClampTension.AccessInsert(aTransaction, aConnection, true, true))
        //                {
        //                    throw new System.Exception("SelectedClampTension.AccessInsert");
        //                }

        //            }



        //        }
        //        catch (System.Exception ex2)
        //        {
        //            ed.WriteMessage("ERROR PrepareData: {0} \n", ex2.Message);
        //            aTransaction.Rollback();
        //            aConnection.Close();
        //            return false;
        //        }
        //    }
        //    catch (System.Exception ex1)
        //    {
        //        ed.WriteMessage("ERROR PrepareData: {0} \n", ex1.Message);
        //        aConnection.Close();
        //        return false;
        //    }

        //    aTransaction.Commit();
        //    aConnection.Close();
        //    return true;
        //}

        public bool PoleInstallationWithoutForbiddenArea(Guid SelectedPoleDpackageCode)
        {
            Editor ed     = Application.DocumentManager.MdiActiveDocument.Editor;
            bool   Answer = true;
            List <ObjectIdCollection> _AllConsols = new List <ObjectIdCollection>();
            ObjectIdCollection        _AllClamps  = new ObjectIdCollection();

            double _SectionLength = 0;
            double _SpanLength    = 0;
            int    _SectionCount  = SectionCalculation(out _SectionLength);
            int    _SpanCount     = SpanCalculation(_SectionLength, out _SpanLength);

            Atend.Base.Acad.AT_INFO CurrentBranchInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(BranchEntity.ObjectId);
            ObjectIdCollection      t = new ObjectIdCollection();

            try
            {
                Atend.Global.Acad.DrawEquips.AcDrawPole        _AcDrawPole        = null;
                Atend.Global.Acad.DrawEquips.AcDrawCirclePole  _AcDrawCirclePole  = null;
                Atend.Global.Acad.DrawEquips.AcDrawPolygonPole _AcDrawPolygonPole = null;

                if (_SpanLength != -1)
                {
                    CalculateSectionPoints(branchEntity.StartPoint, branchEntity.EndPoint, _SectionCount);
                    Atend.Base.Design.DPackage PolePack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(SelectedPoleDpackageCode);

                    //Start Pole consols or clamp
                    if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.Conductor)
                    {
                        t.Add(GetStartConsolOrClamp());
                        _AllConsols.Add(t);
                    }
                    else
                    {
                        _AllClamps.Add(GetStartConsolOrClamp());
                    }


                    for (int SectionCounter = 0; SectionCounter < _SectionCount; SectionCounter++)
                    {
                        SpanPoints.Clear();
                        CalculateSpanPoints(SectionPoints[SectionCounter], SectionPoints[SectionCounter + 1], _SpanCount);
                        for (int SpanCounter = 1; SpanCounter < _SpanCount; SpanCounter++)
                        {
                            Atend.Base.Design.DPoleInfo PoleInfo = new Atend.Base.Design.DPoleInfo();
                            PoleInfo.HalterCount = 0;
                            PoleInfo.HalterType  = 0;
                            PoleInfo.Factor      = 0;
                            if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.Conductor)
                            {
                                #region Counductor
                                //ed.WriteMessage("~~~~~~~~{0}~~~~~~~~~~~~~~GO TO SHAPE~~~~~~~~~~~{1}~~~~~~~~~~~~~~\n", SelectedPole.Shape, SelectedPole.Type);
                                if (SelectedPole.Shape == 0)
                                {
                                    //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~TWO~~~~~~~~~~~~~~~~~~~~~~~~~\n");
                                    _AcDrawCirclePole = new Atend.Global.Acad.DrawEquips.AcDrawCirclePole();
                                    #region POLECircle
                                    _AcDrawCirclePole.UseAccess   = true;
                                    _AcDrawCirclePole.ePole       = SelectedPole;
                                    _AcDrawCirclePole.ProjectCode = PolePack.ProjectCode;
                                    _AcDrawCirclePole.Existance   = Convert.ToByte(PolePack.IsExistance);

                                    _AcDrawCirclePole.dPoleInfo = PoleInfo;

                                    _AcDrawCirclePole.eConsols.Add(SelectedConsol);
                                    _AcDrawCirclePole.eConsolCount.Add(2);
                                    _AcDrawCirclePole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));
                                    _AcDrawCirclePole.eConsolProjectCode.Add(PolePack.ProjectCode);
                                    _AcDrawCirclePole.eConsolUseAccess.Add(false);

                                    _AcDrawCirclePole.eHalterCount = 0;

                                    if (!_AcDrawCirclePole.DrawPoleCircle(SpanPoints[SpanCounter], GetStartPoleAngle() + 90, out t))
                                    {
                                        throw new System.Exception("failor while drawing pole");
                                    }
                                    _AllConsols.Add(t);
                                    #endregion
                                }
                                else if (SelectedPole.Shape == 1)
                                {
                                    if (SelectedPole.Type == 2)//pertic
                                    {
                                        //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~THREE~~~~~~~~~~~~~~~~~~~~~~~~~\n");
                                        _AcDrawPolygonPole = new Atend.Global.Acad.DrawEquips.AcDrawPolygonPole();
                                        #region PolePolygon
                                        _AcDrawPolygonPole.UseAccess   = true;
                                        _AcDrawPolygonPole.ePole       = SelectedPole;
                                        _AcDrawPolygonPole.ProjectCode = PolePack.ProjectCode;
                                        _AcDrawPolygonPole.Existance   = Convert.ToByte(PolePack.IsExistance);

                                        _AcDrawPolygonPole.dPoleInfo = PoleInfo;

                                        _AcDrawPolygonPole.eConsols.Add(SelectedConsol);
                                        _AcDrawPolygonPole.eConsolCount.Add(2);
                                        _AcDrawPolygonPole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));
                                        _AcDrawPolygonPole.eConsolProjectCode.Add(PolePack.ProjectCode);
                                        _AcDrawPolygonPole.eConsolUseAccess.Add(false);

                                        _AcDrawPolygonPole.eHalterCount = 0;

                                        if (!_AcDrawPolygonPole.DrawPolePolygon(SpanPoints[SpanCounter], GetStartPoleAngle() + 90, out t))
                                        {
                                            throw new System.Exception("failor while drawing pole");
                                        }
                                        _AllConsols.Add(t);
                                        #endregion
                                    }
                                    else
                                    {
                                        //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~ONE~~~~~~~~~~~~~~~~~~~~~~~~~\n");
                                        _AcDrawPole = new Atend.Global.Acad.DrawEquips.AcDrawPole();
                                        #region Pole
                                        _AcDrawPole.UseAccess   = true;
                                        _AcDrawPole.ePole       = SelectedPole;
                                        _AcDrawPole.ProjectCode = PolePack.ProjectCode;
                                        _AcDrawPole.Existance   = Convert.ToByte(PolePack.IsExistance);

                                        _AcDrawPole.dPoleInfo = PoleInfo;

                                        _AcDrawPole.eConsols.Add(SelectedConsol);
                                        _AcDrawPole.eConsolCount.Add(2);
                                        _AcDrawPole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));
                                        _AcDrawPole.eConsolProjectCode.Add(PolePack.ProjectCode);
                                        _AcDrawPole.eConsolUseAccess.Add(false);

                                        _AcDrawPole.eHalterCount = 0;

                                        if (!_AcDrawPole.DrawPole(SpanPoints[SpanCounter], GetStartPoleAngle() + 90, out t))
                                        {
                                            throw new System.Exception("failor while drawing pole");
                                        }
                                        _AllConsols.Add(t);
                                        #endregion
                                    }
                                }
                                #endregion
                            }//end of if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.Conductor)
                            else if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.SelfKeeper)
                            {
                                #region Selfkeeper
                                if (SelectedPole.Shape == 0)
                                {
                                    //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~TWO~~~~~~~~~~~~~~~~~~~~~~~~~\n");
                                    _AcDrawCirclePole = new Atend.Global.Acad.DrawEquips.AcDrawCirclePole();
                                    #region POLECircle
                                    _AcDrawCirclePole.UseAccess   = true;
                                    _AcDrawCirclePole.ePole       = SelectedPole;
                                    _AcDrawCirclePole.ProjectCode = PolePack.ProjectCode;
                                    _AcDrawCirclePole.Existance   = Convert.ToByte(PolePack.IsExistance);

                                    _AcDrawCirclePole.dPoleInfo = PoleInfo;

                                    _AcDrawCirclePole.eConsols           = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawCirclePole.eConsolCount       = new ArrayList();
                                    _AcDrawCirclePole.eConsolExistance   = new ArrayList();
                                    _AcDrawCirclePole.eConsolProjectCode = new ArrayList();
                                    _AcDrawCirclePole.eConsolUseAccess   = new ArrayList();

                                    _AcDrawCirclePole.eHalterCount = 0;

                                    if (!_AcDrawCirclePole.DrawPoleCircle(SpanPoints[SpanCounter], GetStartPoleAngle() + 90, out t))
                                    {
                                        throw new System.Exception("failor while drawing pole");
                                    }
                                    //_AllClamps.Add(t[0]);
                                    #endregion
                                }
                                else if (SelectedPole.Shape == 1)
                                {
                                    if (SelectedPole.Type == 2)//pertic
                                    {
                                        //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~THREE~~~~~~~~~~~~~~~~~~~~~~~~~\n");
                                        _AcDrawPolygonPole = new Atend.Global.Acad.DrawEquips.AcDrawPolygonPole();
                                        #region PolePolygon
                                        _AcDrawPolygonPole.UseAccess   = true;
                                        _AcDrawPolygonPole.ePole       = SelectedPole;
                                        _AcDrawPolygonPole.ProjectCode = PolePack.ProjectCode;
                                        _AcDrawPolygonPole.Existance   = Convert.ToByte(PolePack.IsExistance);

                                        _AcDrawPolygonPole.dPoleInfo = PoleInfo;

                                        _AcDrawPolygonPole.eConsols           = new List <Atend.Base.Equipment.EConsol>();
                                        _AcDrawPolygonPole.eConsolCount       = new ArrayList();
                                        _AcDrawPolygonPole.eConsolExistance   = new ArrayList();
                                        _AcDrawPolygonPole.eConsolProjectCode = new ArrayList();
                                        _AcDrawPolygonPole.eConsolUseAccess   = new ArrayList();

                                        _AcDrawPolygonPole.eHalterCount = 0;

                                        if (!_AcDrawPolygonPole.DrawPolePolygon(SpanPoints[SpanCounter], GetStartPoleAngle() + 90, out t))
                                        {
                                            throw new System.Exception("failor while drawing pole");
                                        }
                                        //_AllClamps.Add(t[0]);
                                        #endregion
                                    }
                                    else
                                    {
                                        //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~ONE~~~~~~~~~~~~~~~~~~~~~~~~~\n");
                                        _AcDrawPole = new Atend.Global.Acad.DrawEquips.AcDrawPole();
                                        #region Pole
                                        _AcDrawPole.UseAccess   = true;
                                        _AcDrawPole.ePole       = SelectedPole;
                                        _AcDrawPole.ProjectCode = PolePack.ProjectCode;
                                        _AcDrawPole.Existance   = Convert.ToByte(PolePack.IsExistance);

                                        _AcDrawPole.dPoleInfo = PoleInfo;

                                        _AcDrawPole.eConsols           = new List <Atend.Base.Equipment.EConsol>();
                                        _AcDrawPole.eConsolCount       = new ArrayList();
                                        _AcDrawPole.eConsolExistance   = new ArrayList();
                                        _AcDrawPole.eConsolProjectCode = new ArrayList();
                                        _AcDrawPole.eConsolUseAccess   = new ArrayList();

                                        _AcDrawPole.eHalterCount = 0;

                                        if (!_AcDrawPole.DrawPole(SpanPoints[SpanCounter], GetStartPoleAngle() + 90, out t))
                                        {
                                            throw new System.Exception("failor while drawing pole");
                                        }
                                        //_AllClamps.Add(t[0]);
                                        #endregion
                                    }
                                }
                                #endregion


                                Atend.Global.Acad.DrawEquips.AcDrawKalamp _AcDrawKalamp = new Atend.Global.Acad.DrawEquips.AcDrawKalamp();
                                _AcDrawKalamp.eClamp      = SelectedClamp;
                                _AcDrawKalamp.Existance   = PolePack.IsExistance;
                                _AcDrawKalamp.ProjectCode = PolePack.ProjectCode;
                                _AcDrawKalamp.UseAccess   = false;
                                _AllClamps.Add(_AcDrawKalamp.DrawKalamp(Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(t[0])), t[0]));
                            } //end of else if (SelectedBranch.ProductType == (int)Atend.Control.Enum.ProductType.SelfKeeper)
                        }     //end of span


                        if (SectionCounter + 1 != _SectionCount)
                        {
                            //ed.WriteMessage("~~~~~~~~~~~~<<<SECTION>>>~~~~~~~~~~~~~\n");
                            if (_AcDrawPole != null)
                            {
                                //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~ONE~~~~~~~~~~~~~~~~~~~~~~~~~\n");


                                if (CurrentBranchInfo.NodeType != (int)Atend.Control.Enum.ProductType.SelfKeeper)
                                {
                                    _AcDrawPole.eConsols = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawPole.eConsols.Add(SelectedConsolTension);
                                    _AcDrawPole.eConsols.Add(SelectedConsolTension);

                                    _AcDrawPole.eConsolCount = new ArrayList();
                                    _AcDrawPole.eConsolCount.Add(2);
                                    _AcDrawPole.eConsolCount.Add(2);

                                    _AcDrawPole.eConsolExistance = new ArrayList();
                                    _AcDrawPole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));
                                    _AcDrawPole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));

                                    _AcDrawPole.eConsolProjectCode = new ArrayList();
                                    _AcDrawPole.eConsolProjectCode.Add(PolePack.ProjectCode);
                                    _AcDrawPole.eConsolProjectCode.Add(PolePack.ProjectCode);

                                    _AcDrawPole.eConsolUseAccess = new ArrayList();
                                    _AcDrawPole.eConsolUseAccess.Add(false);
                                    _AcDrawPole.eConsolUseAccess.Add(false);
                                }
                                else
                                {
                                    _AcDrawPole.eConsols           = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawPole.eConsolCount       = new ArrayList();
                                    _AcDrawPole.eConsolExistance   = new ArrayList();
                                    _AcDrawPole.eConsolProjectCode = new ArrayList();
                                    _AcDrawPole.eConsolUseAccess   = new ArrayList();
                                }


                                _AcDrawPole.eHalterCount = 0;
                                if (!_AcDrawPole.DrawPole(SectionPoints[SectionCounter + 1], GetStartPoleAngle(), out t))
                                {
                                    throw new System.Exception("failor while drawing pole");
                                }
                            }
                            else if (_AcDrawCirclePole != null)
                            {
                                //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~TWO~~~~~~~~~~~~~~~~~~~~~~~~~\n");

                                if (CurrentBranchInfo.NodeType != (int)Atend.Control.Enum.ProductType.SelfKeeper)
                                {
                                    _AcDrawCirclePole.eConsols = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawCirclePole.eConsols.Add(SelectedConsolTension);
                                    _AcDrawCirclePole.eConsols.Add(SelectedConsolTension);

                                    _AcDrawCirclePole.eConsolCount = new ArrayList();
                                    _AcDrawCirclePole.eConsolCount.Add(2);
                                    _AcDrawCirclePole.eConsolCount.Add(2);

                                    _AcDrawCirclePole.eConsolExistance = new ArrayList();
                                    _AcDrawCirclePole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));
                                    _AcDrawCirclePole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));

                                    _AcDrawCirclePole.eConsolProjectCode = new ArrayList();
                                    _AcDrawCirclePole.eConsolProjectCode.Add(PolePack.ProjectCode);
                                    _AcDrawCirclePole.eConsolProjectCode.Add(PolePack.ProjectCode);

                                    _AcDrawCirclePole.eConsolUseAccess = new ArrayList();
                                    _AcDrawCirclePole.eConsolUseAccess.Add(false);
                                    _AcDrawCirclePole.eConsolUseAccess.Add(false);
                                }
                                else
                                {
                                    _AcDrawCirclePole.eConsols           = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawCirclePole.eConsolCount       = new ArrayList();
                                    _AcDrawCirclePole.eConsolExistance   = new ArrayList();
                                    _AcDrawCirclePole.eConsolProjectCode = new ArrayList();
                                    _AcDrawCirclePole.eConsolUseAccess   = new ArrayList();
                                }

                                _AcDrawCirclePole.eHalterCount = 0;
                                if (!_AcDrawCirclePole.DrawPoleCircle(SectionPoints[SectionCounter + 1], GetStartPoleAngle(), out t))
                                {
                                    throw new System.Exception("failor while drawing pole");
                                }
                            }
                            else if (_AcDrawPolygonPole != null)
                            {
                                //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~THREE~~~~~~~~~~~~~~~~~~~~~~~~~\n");


                                if (CurrentBranchInfo.NodeType != (int)Atend.Control.Enum.ProductType.SelfKeeper)
                                {
                                    _AcDrawPolygonPole.eConsols = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawPolygonPole.eConsols.Add(SelectedConsolTension);
                                    _AcDrawPolygonPole.eConsols.Add(SelectedConsolTension);

                                    _AcDrawPolygonPole.eConsolCount = new ArrayList();
                                    _AcDrawPolygonPole.eConsolCount.Add(2);
                                    _AcDrawPolygonPole.eConsolCount.Add(2);

                                    _AcDrawPolygonPole.eConsolExistance = new ArrayList();
                                    _AcDrawPolygonPole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));
                                    _AcDrawPolygonPole.eConsolExistance.Add(Convert.ToByte(PolePack.IsExistance));

                                    _AcDrawPolygonPole.eConsolProjectCode = new ArrayList();
                                    _AcDrawPolygonPole.eConsolProjectCode.Add(PolePack.ProjectCode);
                                    _AcDrawPolygonPole.eConsolProjectCode.Add(PolePack.ProjectCode);

                                    _AcDrawPolygonPole.eConsolUseAccess = new ArrayList();
                                    _AcDrawPolygonPole.eConsolUseAccess.Add(false);
                                    _AcDrawPolygonPole.eConsolUseAccess.Add(false);
                                }
                                else
                                {
                                    _AcDrawPolygonPole.eConsols           = new List <Atend.Base.Equipment.EConsol>();
                                    _AcDrawPolygonPole.eConsolCount       = new ArrayList();
                                    _AcDrawPolygonPole.eConsolExistance   = new ArrayList();
                                    _AcDrawPolygonPole.eConsolProjectCode = new ArrayList();
                                    _AcDrawPolygonPole.eConsolUseAccess   = new ArrayList();
                                }

                                ////ed.WriteMessage("### BBB ### \n");
                                _AcDrawPolygonPole.eHalterCount = 0;
                                if (!_AcDrawPolygonPole.DrawPolePolygon(SectionPoints[SectionCounter + 1], GetStartPoleAngle(), out t))
                                {
                                    throw new System.Exception("failor while drawing pole");
                                }
                                //ed.WriteMessage("### GGG ### \n");
                            }

                            if (CurrentBranchInfo.NodeType == (int)Atend.Control.Enum.ProductType.Conductor)
                            {
                                _AllConsols.Add(t);
                            }
                            else if (CurrentBranchInfo.NodeType == (int)Atend.Control.Enum.ProductType.SelfKeeper)
                            {
                                Atend.Global.Acad.DrawEquips.AcDrawKalamp _AcDrawKalamp = new Atend.Global.Acad.DrawEquips.AcDrawKalamp();
                                _AcDrawKalamp.eClamp      = SelectedClampTension;
                                _AcDrawKalamp.Existance   = PolePack.IsExistance;
                                _AcDrawKalamp.ProjectCode = PolePack.ProjectCode;
                                _AcDrawKalamp.UseAccess   = false;
                                _AllClamps.Add(_AcDrawKalamp.DrawKalamp(Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(t[0])), t[0]));
                            }
                            _AcDrawCirclePole  = null;
                            _AcDrawPole        = null;
                            _AcDrawPolygonPole = null;

                            // ed.WriteMessage("~~~~~~~~~~~~<<<NOT SECTION>>>~~~~~~~~~~~~~\n");
                        }//change section
                    }
                    //End Pole consols

                    if (CurrentBranchInfo.NodeType == (int)Atend.Control.Enum.ProductType.Conductor)
                    {
                        t = new ObjectIdCollection();
                        t.Add(GetEndConsolOrClamp());
                        _AllConsols.Add(t);
                    }
                    else if (CurrentBranchInfo.NodeType == (int)Atend.Control.Enum.ProductType.SelfKeeper)
                    {
                        //_AllClamps.Add(t[0]);
                        _AllClamps.Add(GetEndConsolOrClamp());
                    }

                    #region Do Branch Operation Here

                    if (CurrentBranchInfo.NodeType == (int)Atend.Control.Enum.ProductType.Conductor)
                    {
                        #region Conductor Operation
                        //delete conductor
                        if (Atend.Global.Acad.DrawEquips.AcDrawConductor.DeleteConductorData(branchEntity.ObjectId))
                        {
                            Atend.Global.Acad.DrawEquips.AcDrawConductor.DeleteConductor(branchEntity.ObjectId);
                        }
                        //ed.WriteMessage("~~~~~~ start sim keshi ~~~~~~~~~\n");
                        ObjectId LastConsol = ObjectId.Null, StartConsol = ObjectId.Null;
                        for (int ii = 0; ii < _AllConsols.Count - 1; ii++)
                        {
                            //ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~~~\n");
                            ObjectIdCollection o1 = _AllConsols[ii];
                            //foreach (ObjectId oii in o1)
                            //{
                            //    ed.WriteMessage("oi:{0}\n", oii);
                            //}


                            if (o1.Count == 1)
                            {
                                StartConsol = o1[0];
                            }
                            else
                            {
                                if (o1[1] == LastConsol)
                                {
                                    StartConsol = o1[0];
                                }
                                else
                                {
                                    StartConsol = o1[1];
                                }
                            }
                            ObjectIdCollection o2 = _AllConsols[ii + 1];
                            LastConsol = o2[0];
                            //ed.WriteMessage("Start:{0} , End:{1} \n", StartConsol, LastConsol);
                            Atend.Global.Acad.DrawEquips.AcDrawConductor _AcDrawConductor = new Atend.Global.Acad.DrawEquips.AcDrawConductor();
                            _AcDrawConductor.UseAccess = true;
                            //ed.WriteMessage("111 \n");



                            _AcDrawConductor.eConductorTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(CurrentBranchInfo.ProductCode);
                            //ed.WriteMessage("112 \n");


                            ///////////_AcDrawConductor.eConductors.Add(Atend.Base.Equipment.EConductor.AccessSelectByCode(_AcDrawConductor.eConductorTip.NeutralProductCode));
                            //ed.WriteMessage("113 \n");


                            //////////_AcDrawConductor.eConductors.Add(Atend.Base.Equipment.EConductor.AccessSelectByCode(5));
                            //ed.WriteMessage("114 \n");


                            /////////_AcDrawConductor.eConductors.Add(Atend.Base.Equipment.EConductor.AccessSelectByCode(5));
                            //ed.WriteMessage("115 \n");


                            Atend.Base.Design.DBranch _DBranch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(CurrentBranchInfo.NodeCode));
                            if (_DBranch.Code != Guid.Empty)
                            {
                                _AcDrawConductor.Existance = _DBranch.IsExist;
                                //ed.WriteMessage("116 \n");


                                _AcDrawConductor.ProjectCode = _DBranch.ProjectCode;
                                //ed.WriteMessage("i will go to draw sim \n");
                            }
                            else
                            {
                                _AcDrawConductor.Existance = 0;
                                //ed.WriteMessage("116 \n");


                                _AcDrawConductor.ProjectCode = 0;
                                //ed.WriteMessage("i will go to draw sim \n");
                            }

                            _AcDrawConductor.DrawConductor(Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(StartConsol)), Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(LastConsol)),
                                                           StartConsol, LastConsol, _SpanLength);
                            //ed.WriteMessage("Start:{0} , End:{1} \n", StartConsol, LastConsol);
                        }
                        //ed.WriteMessage("~~~~~~ end sim keshi ~~~~~~~~~\n");
                        #endregion
                    }
                    else if (CurrentBranchInfo.NodeType == (int)Atend.Control.Enum.ProductType.SelfKeeper)
                    {
                        #region SelfKeeper Operation


                        if (Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper.DeleteSelfKeeperData(branchEntity.ObjectId))
                        {
                            //ed.WriteMessage("delete data io{0}\n", branchEntity.ObjectId);
                            if (Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper.DeleteSelfKeeper(branchEntity.ObjectId, true))
                            {
                                //ed.WriteMessage("delete graphic \n");

                                for (int ClampCounter = 0; ClampCounter < _AllClamps.Count - 1; ClampCounter++)
                                {
                                    //ed.WriteMessage("draw self keeper \n");

                                    //ed.WriteMessage("ANSWER={0} \n", oi);
                                    Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper _AcDrawSelfKeeper = new Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper();
                                    _AcDrawSelfKeeper.UseAccess      = true;
                                    _AcDrawSelfKeeper.eSelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(SelectedBranch.ProductCode);
                                    _AcDrawSelfKeeper.Existance      = SelectedBranch.IsExist;
                                    _AcDrawSelfKeeper.ProjectCode    = SelectedBranch.ProjectCode;

                                    _AcDrawSelfKeeper.DrawSelfKeeper(Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(_AllClamps[ClampCounter])), Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(_AllClamps[ClampCounter + 1])), _AllClamps[ClampCounter], _AllClamps[ClampCounter + 1], _SpanLength);
                                }
                            }
                            else
                            {
                                throw new System.Exception("while deleting self keeper");
                            }
                        }
                        else
                        {
                            throw new System.Exception("while deleting self keeper");
                        }

                        #endregion
                    }
                    #endregion
                }
                else
                {
                    ed.WriteMessage("طول اسپن قابل محاسبه نمی باشد" + "\n");
                    Answer = false;
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("Error While Pole installation : {0} \n", ex.Message);
                Answer = false;
            }
            return(Answer);
        }