/// <summary> /// this method had command before for drwing /// </summary> /// <param name="PostContainerEntity"></param> /// <param name="CellCount"></param> /// <param name="ProductCode"></param> public void DrawWeekJackPanel(Entity PostContainerEntity, int CellCount) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; bool conti = true; double MyScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.WeekJackPanel).Scale; //ed.WriteMessage("DrawWeekJackPanel 01 \n"); DrawWeekJackPanelJig MidJ = new DrawWeekJackPanelJig(PostContainerEntity, CellCount, MyScale); PromptResult pr; while (conti) { pr = ed.Drag(MidJ); if (pr.Status == PromptStatus.OK) { conti = false; #region save data here ObjectIdCollection OIC = new ObjectIdCollection(); ObjectIdCollection HeadersOI = new ObjectIdCollection(); //ed.WriteMessage("DrawWeekJackPanel 02 \n"); List <Entity> Entities = new List <Entity>(); //ed.WriteMessage("DrawWeekJackPanel 03 \n"); Entities = MidJ.GetEntities(); //ed.WriteMessage("DrawWeekJackPanel 04 \n"); foreach (Entity ent in Entities) { Atend.Global.Acad.AcadJigs.MyPolyLine HeaderCablePoly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine; //ed.WriteMessage("DrawWeekJackPanel 05 \n"); if (HeaderCablePoly != null) { ObjectId hoi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.LOW_GROUND.ToString()); HeadersOI.Add(hoi); OIC.Add(hoi); //ed.WriteMessage("DrawWeekJackPanel 06 \n"); } else { ObjectId NOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString()); if (NOI != ObjectId.Null) { OIC.Add(NOI); Atend.Base.Acad.AT_INFO HeaderInfo = new Atend.Base.Acad.AT_INFO(NOI); HeaderInfo.ParentCode = _nodeCode.ToString(); HeaderInfo.NodeCode = ""; HeaderInfo.NodeType = (int)Atend.Control.Enum.ProductType.WeekJackPanel; HeaderInfo.ProductCode = 0; HeaderInfo.Insert(); } //ed.WriteMessage("DrawWeekJackPanel 07 \n"); } } try { foreach (ObjectId HeaderOI in HeadersOI) { Atend.Base.Acad.AT_INFO HeaderInfo = new Atend.Base.Acad.AT_INFO(HeaderOI); //ed.WriteMessage("Header Parent :{0}\n", p.CodeGuid); HeaderInfo.ParentCode = _nodeCode.ToString(); HeaderInfo.NodeCode = ""; HeaderInfo.NodeType = (int)Atend.Control.Enum.ProductType.HeaderCabel; HeaderInfo.ProductCode = 0; HeaderInfo.Insert(); } ObjectId WeekGroup = Atend.Global.Acad.Global.MakeGroup(NodeCode.ToString(), OIC); if (WeekGroup != ObjectId.Null) { Atend.Base.Acad.AT_INFO WeekInfo = new Atend.Base.Acad.AT_INFO(WeekGroup); //ed.WriteMessage(">>>>>>Header Parent :{0} , WeekCode :{1} \n", p.ParentCode, p.CodeGuid); WeekInfo.ParentCode = _parentCode.ToString(); WeekInfo.NodeCode = _nodeCode.ToString(); WeekInfo.NodeType = (int)Atend.Control.Enum.ProductType.WeekJackPanel; WeekInfo.ProductCode = _productCode; WeekInfo.Insert(); //ed.WriteMessage("ADD TO POST WEEK\n"); Atend.Base.Acad.AT_SUB.AddToAT_SUB(WeekGroup, PostContainerEntity.ObjectId); Atend.Base.Acad.AT_SUB.AddToAT_SUB(PostContainerEntity.ObjectId, WeekGroup); } } catch (System.Exception ex) { ed.WriteMessage("Error DrawWeekJackPanel : {0} \n", ex.Message); } #endregion } //else //{ // conti = false; //} } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void DrawTransformer(Entity PostContainerEntity) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; bool conti = true; double MyScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Transformer).Scale; double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Transformer).CommentScale; DrawTransformerJig transformerJig = new DrawTransformerJig(PostContainerEntity, MyScale); PromptResult pr; while (conti) { pr = ed.Drag(transformerJig); if (pr.Status == PromptStatus.OK) { conti = false; #region Save data here List <Entity> Entities = transformerJig.GetEntities(); if (NodeCode != null && ParentCode != null) { ObjectIdCollection OIC = new ObjectIdCollection(); foreach (Entity ent in Entities) { ObjectId NewEntOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString()); Atend.Base.Acad.AT_INFO EntInfo = new Atend.Base.Acad.AT_INFO(NewEntOI); EntInfo.ParentCode = ParentCode.ToString(); // TransformerParent.ToString(); EntInfo.NodeCode = ""; Atend.Global.Acad.AcadJigs.MyPolyLine poly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine; object ProductType = null; if (poly != null) { if (poly.AdditionalDictionary.ContainsKey("ProductType")) { poly.AdditionalDictionary.TryGetValue("ProductType", out ProductType); } } else { Atend.Global.Acad.AcadJigs.MyLine lin = ent as Atend.Global.Acad.AcadJigs.MyLine; if (lin != null) { if (lin.AdditionalDictionary.ContainsKey("ProductType")) { lin.AdditionalDictionary.TryGetValue("ProductType", out ProductType); } } else { Atend.Global.Acad.AcadJigs.MyCircle cir = ent as Atend.Global.Acad.AcadJigs.MyCircle; if (cir != null) { if (cir.AdditionalDictionary.ContainsKey("ProductType")) { cir.AdditionalDictionary.TryGetValue("ProductType", out ProductType); } } } } if (ProductType != null) { EntInfo.NodeType = Convert.ToInt32(ProductType); } else { EntInfo.NodeType = 0; } EntInfo.ProductCode = 0; EntInfo.Insert(); OIC.Add(NewEntOI); } ObjectId TransformerGroupOI = Atend.Global.Acad.Global.MakeGroup(NodeCode.ToString(), OIC); Atend.Base.Acad.AT_INFO GroupInfo = new Atend.Base.Acad.AT_INFO(TransformerGroupOI); GroupInfo.ParentCode = ParentCode.ToString(); GroupInfo.NodeCode = NodeCode.ToString(); GroupInfo.NodeType = (int)Atend.Control.Enum.ProductType.Transformer; GroupInfo.ProductCode = ProductCode; GroupInfo.Insert(); string comment = string.Format("Tr: {0} KVR", Atend.Base.Equipment.ETransformer.AccessSelectByCode(ProductCode).Capaciy); ObjectId TextOi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(Atend.Global.Acad.UAcad.WriteNote(comment, new Point3d(transformerJig.MyCenterPoint.X, transformerJig.MyCenterPoint.Y, transformerJig.MyCenterPoint.Z) , MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString()); Atend.Base.Acad.AT_INFO TextInfo = new Atend.Base.Acad.AT_INFO(TextOi); TextInfo.ParentCode = NodeCode.ToString(); TextInfo.NodeCode = ""; TextInfo.NodeType = (int)Atend.Control.Enum.ProductType.Comment; TextInfo.ProductCode = 0; TextInfo.Insert(); //ed.WriteMessage("ADD TO POST TRANSFORMER\n"); Atend.Base.Acad.AT_SUB.AddToAT_SUB(TransformerGroupOI, PostContainerEntity.ObjectId); Atend.Base.Acad.AT_SUB.AddToAT_SUB(PostContainerEntity.ObjectId, TransformerGroupOI); Atend.Base.Acad.AT_SUB.AddToAT_SUB(TextOi, TransformerGroupOI); } #endregion } else { conti = false; } } }//