private void btnChange_Click(object sender, EventArgs e) { Atend.Global.Calculation.Mechanical.CMechanicalChange MecChange = new Atend.Global.Calculation.Mechanical.CMechanicalChange(); if (IsPowerWithHalter) { for (int i = 0; i < gvCommentPowerWithHalter.Rows.Count; i++) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvCommentPowerWithHalter.Rows[i].Cells[11]; //ed.WriteMessage(""); if (chk.Value.ToString() == "True") { //ed.WriteMessage("CommentPole={0}\n",gvCommentPower.Rows[i].Cells[5].Value.ToString()); if (gvCommentPowerWithHalter.Rows[i].Cells[5].Value.ToString() != "") { ed.WriteMessage("Add dPack\n"); Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[1].Value.ToString())); MecChange.DPackage.Add(dPack); Atend.Base.Design.DPoleInfo dPoleInfo = Atend.Base.Design.DPoleInfo.AccessSelectByNodeCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[1].Value.ToString())); MecChange.PoleInfo.Add(dPoleInfo); MecChange.Count.Add(Convert.ToInt32(gvCommentPowerWithHalter.Rows[i].Cells[7].Value.ToString())); //ed.WriteMessage("###={0}\n", gvCommentPower.Rows[i].Cells[2].Value.ToString()); Atend.Base.Equipment.EPole Pole = Atend.Base.Equipment.EPole.SelectByXCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[2].Value.ToString())); MecChange.Pole.Add(Pole); Atend.Base.Equipment.EHalter Halter = Atend.Base.Equipment.EHalter.SelectByXCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[12].Value.ToString())); MecChange.Halter.Add(Halter); MecChange.HalterCount.Add(Convert.ToInt32(gvCommentPowerWithHalter.Rows[i].Cells[10].Value.ToString())); } } } if (!MecChange.ChangePoleInfoWithHalter()) { ed.WriteMessage("Error in ChangePoleInfoWithHalter"); } } else { for (int i = 0; i < gvCommentPower.Rows.Count; i++) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvCommentPower.Rows[i].Cells[8]; //ed.WriteMessage(""); if (chk.Value.ToString() == "True") { if (gvCommentPower.Rows[i].Cells["CommentPole"].Value.ToString() != "") { ed.WriteMessage("Add dPack\n"); Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(gvCommentPower.Rows[i].Cells["DcPoleGuid"].Value.ToString())); MecChange.DPackage.Add(dPack); Atend.Base.Design.DPoleInfo dPoleInfo = Atend.Base.Design.DPoleInfo.AccessSelectByNodeCode(new Guid(gvCommentPower.Rows[i].Cells["DcPoleGuid"].Value.ToString())); MecChange.PoleInfo.Add(dPoleInfo); MecChange.Count.Add(Convert.ToInt32(gvCommentPower.Rows[i].Cells["Count"].Value.ToString())); ed.WriteMessage("###={0}\n", gvCommentPower.Rows[i].Cells["Code"].Value.ToString()); Atend.Base.Equipment.EPole Pole = Atend.Base.Equipment.EPole.SelectByXCode(new Guid(gvCommentPower.Rows[i].Cells["Code"].Value.ToString())); MecChange.Pole.Add(Pole); } } } if (!MecChange.ChangePoleInfo()) { ed.WriteMessage("Error in ChangePoleInfo"); } } }
public void BindDataToOwnControl() { // BindDataTofeathurePole //ed.WriteMessage("DesignCode=" + Atend.Control.Common.SelectedDesignCode.ToString() + "\n"); Atend.Base.Design.DNode myNode = Atend.Base.Design.DNode.AccessSelectByCode(NodeCode); //ed.WriteMessage("myNode.Code= " + myNode.Code.ToString() + "\n"); Atend.Base.Design.DPackage myPackage = Atend.Base.Design.DPackage.AccessSelectByNodeCodeType(myNode.Code, Convert.ToInt32(Atend.Control.Enum.ProductType.Pole)); //ed.WriteMessage("myPackage.ProductCode= " + myPackage.ProductCode.ToString() + "\n"); Atend.Base.Equipment.EPole myPole = Atend.Base.Equipment.EPole.AccessSelectByCode(myNode.ProductCode); //Extra //Atend.Base.Equipment.EPoleType myPoleType = Atend.Base.Equipment.EPoleType.SelectByCode(myPole.Type); //ed.WriteMessage("myPole.Height.ToString()" + myPole.Height.ToString() + "\n"); gvPole.AutoGenerateColumns = false; gvPole.DataSource = Atend.Base.Equipment.EPole.DrawSearch(-1, -1, -1); for (int i = 0; i < gvPole.Rows.Count; i++) { if (Convert.ToInt32(gvPole.Rows[i].Cells[0].Value.ToString()) == myNode.ProductCode) { gvPole.Rows[i].DefaultCellStyle.BackColor = Color.Yellow; } } //Extra //txtType.Text = myPoleType.Name; txtTopCrossSectionArea.Text = myPole.TopCrossSectionArea.ToString(); txtPower.Text = myPole.Power.ToString(); txtHeight.Text = myPole.Height.ToString(); txtBottomCrossSectionArea.Text = myPole.ButtomCrossSectionArea.ToString(); //ed.WriteMessage("Finish BindDataTofeathurePole\n"); //**************************** //BindDataToHalterAndPoleTypeAndConsolType Atend.Base.Design.DPoleInfo myPoleInfo = Atend.Base.Design.DPoleInfo.AccessSelectByNodeCode(myNode.Code); //ed.WriteMessage("myPoleInfo.HalterType:=" + myPoleInfo.HalterType.ToString() + "\n"); //ed.WriteMessage("myPoleInfo.HalterCount:=" + myPoleInfo.HalterCount.ToString()); cboHalterType.SelectedValue = myPoleInfo.HalterType; nudHalter.Value = myPoleInfo.HalterCount; //string poleType = myPoleInfo.PoleType.ToString(); //if (poleType.EndsWith("1")) //{ // chkCross.Checked = true; //} //if (poleType.EndsWith("2")) //{ // chkEnding.Checked = true; //} //if (poleType.EndsWith("4")) //{ // chkPulling.Checked = true; //} //ed.WriteMessage("FinishBindDataToHalterAndPoleTypeAndConsolType\n"); //***************************** //BindDataToConsol DataTable dtPackage = Atend.Base.Design.DPackage.AccessSelectByParentCodeAndType(myPackage.Code, Convert.ToInt32(Atend.Control.Enum.ProductType.Consol)); foreach (DataRow drPackage in dtPackage.Rows) { //ed.WriteMessage("ProductCode= " + drPackage["ProductCode"].ToString() + "\n"); Atend.Base.Equipment.EConsol consol = Atend.Base.Equipment.EConsol.SelectByCodeForDesign(Convert.ToInt32(drPackage["ProductCode"])); gvPoleConsol.Rows.Add(); //ed.WriteMessage("Code= "+consol.Code+"Name= "+consol.Name+"\n"); gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[0].Value = consol.Code.ToString(); gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[1].Value = consol.Name; //ed.WriteMessage("as\n"); if (consol.ConsolType == 0) { gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "کششی"; } if (consol.ConsolType == 1) { gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "انتهایی"; } if (consol.ConsolType == 2) { gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "عبوری"; } if (consol.ConsolType == 3) { gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "DP"; } gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[4].Value = drPackage["Code"].ToString(); } //ed.WriteMessage("FinishBindDataToconsol\n"); //***************************** }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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); }