private void btnOk_Click_1(object sender, EventArgs e) { Atend.Global.Acad.DrawEquips.AcDrawConductor DrawConductor = new Atend.Global.Acad.DrawEquips.AcDrawConductor(); if (Validation()) { if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[8].Value) == false)//Access { //ed.WriteMessage("Access Update\n"); DrawConductor.UseAccess = true; Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode( Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString())); DrawConductor.eConductorTip = CondTip; } else { //ed.WriteMessage("*******Local Update\n"); DrawConductor.UseAccess = false; DrawConductor.eConductors = new List <Atend.Base.Equipment.EConductor>(); Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode( new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); //ed.WriteMessage("condTip.Name={0}\n", CondTip.Name); DrawConductor.eConductorTip = CondTip; //ed.WriteMessage("CondTip.PhaseProductXCode={0}\n", CondTip.PhaseProductXCode); Atend.Base.Equipment.EConductor CondPhase = Atend.Base.Equipment.EConductor.SelectByXCode( CondTip.PhaseProductXCode); //ed.WriteMessage("CondPhase.Name={0}\n", CondPhase.Name); DrawConductor.eConductors.Add(CondPhase); //ed.WriteMessage("***\n"); Atend.Base.Equipment.EConductor CondNeutral = Atend.Base.Equipment.EConductor.SelectByXCode( CondTip.NeutralProductXCode); DrawConductor.eConductors.Add(CondNeutral); Atend.Base.Equipment.EConductor CondNight = Atend.Base.Equipment.EConductor.SelectByXCode( CondTip.NightProductXCode); DrawConductor.eConductors.Add(CondNight); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawConductor.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawConductor.ProjectCode = 0; } else { DrawConductor.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawConductor.UpdateConductorData(NodeCode, obj, Convert.ToDouble(txtLenght.Text)); } else { AllowClose = false; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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); }