Beispiel #1
0
            public List <Entity> GetEntities()
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

                foreach (Entity ent in Entities)
                {
                    Atend.Global.Acad.AcadJigs.MyPolyLine n = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;

                    //ed.WriteMessage("additiona count : {0}  \n", n.AdditionalDictionary.Count);
                }

                return(Entities);
            }
            private Entity CreateHeaderCable(Point3dCollection P3C)
            {
                Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
                pLine.ColorIndex = 40;
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(P3C[0].X, P3C[0].Y), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(P3C[1].X, P3C[1].Y), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(P3C[2].X, P3C[2].Y), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(P3C[0].X, P3C[0].Y), 0, 0, 0);

                Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, (int)Atend.Control.Enum.ProductType.HeaderCabel);
                pLine.Closed = true;

                return(pLine);
            }
Beispiel #3
0
            private Entity DrawTriangle(Point3d BasePoint)
            {
                double BaseX = BasePoint.X;
                double BaseY = BasePoint.Y;

                Atend.Global.Acad.AcadJigs.MyPolyLine _MyPolyline = new Atend.Global.Acad.AcadJigs.MyPolyLine();
                _MyPolyline.AddVertexAt(_MyPolyline.NumberOfVertices, new Point2d(BaseX - 3, BaseY + 3), 0, 0, 0);
                _MyPolyline.AddVertexAt(_MyPolyline.NumberOfVertices, new Point2d(BaseX + 3, BaseY), 0, 0, 0);
                _MyPolyline.AddVertexAt(_MyPolyline.NumberOfVertices, new Point2d(BaseX - 3, BaseY - 3), 0, 0, 0);
                _MyPolyline.AddVertexAt(_MyPolyline.NumberOfVertices, new Point2d(BaseX - 3, BaseY + 3), 0, 0, 0);
                _MyPolyline.Closed = true;


                Atend.Global.Acad.AcadJigs.SaveExtensionData(_MyPolyline, (int)Atend.Control.Enum.ProductType.Else);
                return(_MyPolyline);
            }
Beispiel #4
0
            private Entity CreateConsol(Point3d BasePoint, double Width, double Height)
            {
                double BaseX = BasePoint.X;
                double BaseY = BasePoint.Y;

                Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - (Width / 2), BaseY - (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + (Width / 2), BaseY - (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + (Width / 2), BaseY + (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - (Width / 2), BaseY + (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - (Width / 2), BaseY - (Height / 2)), 0, 0, 0);
                pLine.Closed = true;

                Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, (int)Atend.Control.Enum.ProductType.ConsolElse);
                return(pLine);
            }
Beispiel #5
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~ METHOD ~~~~~~~~~~~~~~~~~~~~~~~~~//

        public static Entity DrawKablsho(Point3d CenterPoint)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            double BaseX = CenterPoint.X - 2.5;
            double BaseY = CenterPoint.Y;

            Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY - 5), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 5, BaseY), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
            pLine.Closed = true;

            return(pLine);
        }
Beispiel #6
0
            private Entity CreateKablshoEntity(Point2d BasePoint)
            {
                double BaseX = BasePoint.X;
                double BaseY = BasePoint.Y;

                Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();

                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY - 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 5, BaseY), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
                pLine.Closed = true;

                Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, (int)Atend.Control.Enum.ProductType.KablSho);

                return(pLine);
            }
Beispiel #7
0
            private Entity CreateMeasuredJackpanelEntity(Point2d BasePoint)
            {
                double BaseX = BasePoint.X;
                double BaseY = BasePoint.Y;

                Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();

                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - 6, BaseY + 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 6, BaseY + 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 6, BaseY - 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - 6, BaseY - 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - 6, BaseY + 5), 0, 0, 0);
                pLine.Closed = true;

                //Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, (int)Atend.Control.Enum.ProductType.Kalamp);

                return(pLine);
            }
Beispiel #8
0
            private Entity CreateCellEntity(Point3d CenterPoint, double Width, double Height, int Type)
            {
                double BaseX = CenterPoint.X;
                double BaseY = CenterPoint.Y;

                Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - (Width / 2), BaseY - (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + (Width / 2), BaseY - (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + (Width / 2), BaseY + (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - (Width / 2), BaseY + (Height / 2)), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX - (Width / 2), BaseY - (Height / 2)), 0, 0, 0);
                pLine.Closed = true;

                //Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, Type);
                //Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, (long)ProductCode);
                //Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, CodeGuid);
                return(pLine);
            }
Beispiel #9
0
            //private Entity CreateConnectionPoint(Point3d CenterPoint, double Radius)
            //{
            //    Atend.Global.Acad.AcadJigs.MyCircle c = new Atend.Global.Acad.AcadJigs.MyCircle();

            //    c.Center = CenterPoint;

            //    c.Normal = new Vector3d(0, 0, 1);

            //    c.Radius = Radius;

            //    c.ColorIndex = 3;

            //    Atend.Global.Acad.AcadJigs.SaveExtensionData(c, (int)Atend.Control.Enum.ProductType.ConnectionPoint);

            //    return c;
            //}

            private Entity DrawKablsho(Point3d CenterPoint)
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                //ObjectId HeaderOI = ObjectId.Null;

                double BaseX = CenterPoint.X - 2.5;
                double BaseY = CenterPoint.Y;

                Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY - 5), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 5, BaseY), 0, 0, 0);
                pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
                pLine.Closed = true;

                Atend.Global.Acad.AcadJigs.SaveExtensionData(pLine, (int)Atend.Control.Enum.ProductType.KablSho);

                return(pLine);
            }
Beispiel #10
0
        public void DrawKhazan()
        {
            Editor ed    = Application.DocumentManager.MdiActiveDocument.Editor;
            bool   conti = true;

            //ObjectId ConsolElseOI, ConnectionOI, KhazanOI, ELse1OI, Else2OI;
            double MyScale        = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.BankKhazan).Scale;
            double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.BankKhazan).CommentScale;
            //ed.WriteMessage("AccessSelectBySoftwareCode:{0}:{1}", MyScale, MyCommentScale);

            ObjectIdCollection  NewDrawnCollection = new ObjectIdCollection();
            DrawKhazanJig       drawKhazan;
            PromptEntityOptions peo = new PromptEntityOptions("\nSelect Container:");
            PromptEntityResult  per = ed.GetEntity(peo);

            if (per.Status == PromptStatus.OK)
            {
                Atend.Base.Acad.AT_INFO at_info = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per.ObjectId);
                if (at_info.ParentCode != "NONE" && (at_info.NodeType == (int)Atend.Control.Enum.ProductType.Pole || at_info.NodeType == (int)Atend.Control.Enum.ProductType.PoleTip))
                {
                    Entity entContainer = Atend.Global.Acad.UAcad.GetEntityByObjectID(per.ObjectId);
                    if (entContainer != null)
                    {
                        drawKhazan = new DrawKhazanJig(entContainer, MyScale);
                        //ed.WriteMessage("current scale : {0} : {1} \n", MyScale, (int)Atend.Control.Enum.ProductType.BankKhazan);
                        while (conti)
                        {
                            PromptResult pr = ed.Drag(drawKhazan);
                            if (pr.Status == PromptStatus.OK && drawKhazan.PartOneIsActive)
                            {
                                drawKhazan.PartOneIsActive = false;
                                pr = ed.Drag(drawKhazan);
                                if (pr.Status == PromptStatus.OK && !drawKhazan.PartOneIsActive)
                                {
                                    conti = false;
                                    #region Save Data Here

                                    List <Entity> Entities = drawKhazan.GetEntities();
                                    //ed.WriteMessage("2 \n");
                                    if (SaveKhazanData(at_info.NodeCode))
                                    {
                                        //ed.WriteMessage("3 \n");
                                        ObjectId ConsolElseOI = ObjectId.Null;
                                        foreach (Entity ent in Entities)
                                        {
                                            //ed.WriteMessage("1001\n");
                                            ObjectId newDrawnoi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_AIR.ToString());
                                            Atend.Global.Acad.AcadJigs.MyPolyLine mPoly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                                            if (mPoly != null)
                                            {
                                                //ed.WriteMessage("POLY LINE FOUND\n");
                                                if (mPoly.AdditionalDictionary.ContainsKey("ProductType"))
                                                {
                                                    object ProductType = null;
                                                    mPoly.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                                    if (ProductType != null)
                                                    {
                                                        if (Convert.ToInt32(ProductType) == (int)Atend.Control.Enum.ProductType.ConsolElse)
                                                        {
                                                            //ed.WriteMessage("1002\n");
                                                            ConsolElseOI = newDrawnoi;
                                                            Atend.Base.Acad.AT_INFO ConsolElseInfo = new Atend.Base.Acad.AT_INFO(newDrawnoi);
                                                            ConsolElseInfo.ParentCode  = at_info.NodeCode;
                                                            ConsolElseInfo.NodeCode    = KhazanPack.Code.ToString();
                                                            ConsolElseInfo.NodeType    = Convert.ToInt32(ProductType);
                                                            ConsolElseInfo.ProductCode = 0;
                                                            ConsolElseInfo.Insert();
                                                        }
                                                    }
                                                }
                                            }
                                            NewDrawnCollection.Add(newDrawnoi);
                                        }

                                        //ed.WriteMessage("ConsolElseOI:{0}\n", ConsolElseOI);
                                        if (ConsolElseOI != ObjectId.Null)
                                        {
                                            Atend.Base.Acad.AT_SUB ConsolElseSub = new Atend.Base.Acad.AT_SUB(ConsolElseOI);
                                            foreach (ObjectId oi in NewDrawnCollection)
                                            {
                                                if (oi != ConsolElseOI)
                                                {
                                                    //ed.WriteMessage("ConsolElseSubOI:{0}\n", oi);
                                                    ConsolElseSub.SubIdCollection.Add(oi);
                                                }
                                            }
                                            ConsolElseSub.SubIdCollection.Add(per.ObjectId);
                                            ConsolElseSub.Insert();
                                        }

                                        foreach (ObjectId oi in NewDrawnCollection)
                                        {
                                            if (oi != ConsolElseOI)
                                            {
                                                Atend.Base.Acad.AT_INFO a = new Atend.Base.Acad.AT_INFO(oi);
                                                a.ParentCode  = at_info.NodeCode;
                                                a.NodeCode    = KhazanPack.Code.ToString();
                                                a.NodeType    = (int)Atend.Control.Enum.ProductType.BankKhazan;
                                                a.ProductCode = KhazanPack.ProductCode;
                                                a.Insert();
                                            }
                                        }


                                        //ed.WriteMessage("Number of Entity : {0} \n", NewDrawnCollection.Count);

                                        ObjectId NewCreatedGroup =
                                            Atend.Global.Acad.Global.MakeGroup(KhazanPack.Code.ToString(), NewDrawnCollection);


                                        ObjectId txtOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(
                                            Atend.Global.Acad.UAcad.WriteNote(eKhazanTip.Description, drawKhazan.GetCommentPoSition(), MyCommentScale),
                                            Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());

                                        Atend.Base.Acad.AT_INFO GroupInfo1 = new Atend.Base.Acad.AT_INFO(txtOI);
                                        GroupInfo1.ParentCode  = KhazanPack.Code.ToString();
                                        GroupInfo1.NodeCode    = "";
                                        GroupInfo1.NodeType    = (int)Atend.Control.Enum.ProductType.Comment;
                                        GroupInfo1.ProductCode = 0;
                                        GroupInfo1.Insert();

                                        Atend.Base.Acad.AT_INFO GroupInfo = new Atend.Base.Acad.AT_INFO(NewCreatedGroup);
                                        GroupInfo.ParentCode  = at_info.NodeCode;
                                        GroupInfo.NodeCode    = KhazanPack.Code.ToString();
                                        GroupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.BankKhazan;
                                        GroupInfo.ProductCode = KhazanPack.ProductCode;
                                        GroupInfo.Insert();

                                        Atend.Base.Acad.AT_SUB.AddToAT_SUB(NewCreatedGroup, per.ObjectId);
                                        //ed.WriteMessage("PoleOI for KHazan:{0}", per.ObjectId);
                                        Atend.Base.Acad.AT_SUB GroupSub = new Atend.Base.Acad.AT_SUB(NewCreatedGroup);
                                        GroupSub.SubIdCollection.Add(per.ObjectId);
                                        //ed.WriteMessage("TXTOI for KHazan:{0}", txtOI);
                                        GroupSub.SubIdCollection.Add(txtOI);
                                        GroupSub.Insert();
                                    }

                                    #endregion
                                }
                                else
                                {
                                    conti = false;
                                }
                            }
                            else
                            {
                                conti = false;
                            }
                        }
                    }
                }//if it was pole
            }
        }
        public void DrawWeekJackPanel(Entity PostContainerEntity, int CellCount, ref DataRow[] PostEquipInserted)
        {
            Editor ed          = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            bool   conti       = true;
            Guid   NodeCode    = new Guid(PostEquipInserted[0]["NodeCode"].ToString());
            Guid   ParentCode  = new Guid(PostEquipInserted[0]["ParentCode"].ToString());
            int    ProductCode = Convert.ToInt32(PostEquipInserted[0]["ProductCode"]);


            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, ref PostEquipInserted);
            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
                }
            }
        }
Beispiel #12
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        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;
                }
            }
        }//
Beispiel #13
0
        public void DrawRod()
        {
            Editor             ed    = Application.DocumentManager.MdiActiveDocument.Editor;
            bool               conti = true;
            ObjectIdCollection NewDrawnCollection = new ObjectIdCollection();
            //ObjectId ConsolElseOI = ObjectId.Null, ConnectionOI = ObjectId.Null, RodOI = ObjectId.Null, RodTriangeOI = ObjectId.Null;

            double MyScale        = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Rod).Scale;
            double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Rod).CommentScale;

            PromptEntityOptions peo = new PromptEntityOptions("\nSelect Container :");
            PromptEntityResult  per = ed.GetEntity(peo);

            if (per.Status == PromptStatus.OK)
            {
                DrawRodJig drawRod;
                Atend.Base.Acad.AT_INFO at_info = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per.ObjectId);
                if (at_info.ParentCode != "NONE" && (at_info.NodeType == (int)Atend.Control.Enum.ProductType.Pole || at_info.NodeType == (int)Atend.Control.Enum.ProductType.PoleTip))
                {
                    drawRod = new DrawRodJig(Atend.Global.Acad.UAcad.GetEntityByObjectID(per.ObjectId), MyScale);
                    while (conti)
                    {
                        PromptResult pr = ed.Drag(drawRod);

                        if (pr.Status == PromptStatus.OK && drawRod.PartOneIsActive)
                        {
                            drawRod.PartOneIsActive = false;
                            pr = ed.Drag(drawRod);

                            if (pr.Status == PromptStatus.OK && !drawRod.PartOneIsActive)
                            {
                                conti = false;
                                //ed.WriteMessage("1 \n");
                                #region Save Data Here

                                List <Entity> Entities = drawRod.GetEntities();
                                //ed.WriteMessage("2 \n");
                                if (SaveRodData(at_info.NodeCode))
                                {
                                    // ed.WriteMessage("3 \n");

                                    //foreach (Entity ent in Entities)
                                    //{
                                    //    NewDrawnCollection.Add(DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MID_AIR.ToString()));
                                    //}

                                    //---------------------
                                    ObjectId ConsolElseOI = ObjectId.Null;
                                    foreach (Entity ent in Entities)
                                    {
                                        ObjectId newDrawnoi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_AIR.ToString());
                                        Atend.Global.Acad.AcadJigs.MyPolyLine mPoly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                                        if (mPoly != null)
                                        {
                                            //ed.WriteMessage("POLY LINE FOUND\n");
                                            if (mPoly.AdditionalDictionary.ContainsKey("ProductType"))
                                            {
                                                object ProductType = null;
                                                mPoly.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                                if (ProductType != null)
                                                {
                                                    if (Convert.ToInt32(ProductType) == (int)Atend.Control.Enum.ProductType.ConsolElse)
                                                    {
                                                        ConsolElseOI = newDrawnoi;
                                                        Atend.Base.Acad.AT_INFO ConsolElseInfo = new Atend.Base.Acad.AT_INFO(newDrawnoi);
                                                        ConsolElseInfo.ParentCode  = at_info.NodeCode;
                                                        ConsolElseInfo.NodeCode    = RodPack.Code.ToString();
                                                        ConsolElseInfo.NodeType    = Convert.ToInt32(ProductType);
                                                        ConsolElseInfo.ProductCode = 0;
                                                        ConsolElseInfo.Insert();
                                                    }
                                                }
                                            }
                                        }
                                        NewDrawnCollection.Add(newDrawnoi);
                                    }

                                    //NewDrawnCollection.Add(Atend.Global.Acad.UAcad.DrawEntityOnScreen(
                                    //Atend.Global.Acad.Global.WriteNoteMText(
                                    //    Atend.Base.Equipment.ERod.SelectByCode(Atend.Base.Acad.AcadGlobal.dPackageForRod.ProductCode).Comment,
                                    //    new Point3d(drawRod.CenterPoint02.X + 10, drawRod.CenterPoint02.Y, 0)),
                                    //    Atend.Control.Enum.AutoCadLayerName.MID_AIR.ToString()));


                                    if (ConsolElseOI != ObjectId.Null)
                                    {
                                        Atend.Base.Acad.AT_SUB ConsolElseSub = new Atend.Base.Acad.AT_SUB(ConsolElseOI);
                                        foreach (ObjectId oi in NewDrawnCollection)
                                        {
                                            if (oi != ConsolElseOI)
                                            {
                                                //ed.WriteMessage("ConsolElseSubOI:{0}\n", oi);
                                                ConsolElseSub.SubIdCollection.Add(oi);
                                            }
                                        }
                                        ConsolElseSub.SubIdCollection.Add(per.ObjectId);
                                        ConsolElseSub.Insert();
                                    }
                                    //---------------------



                                    foreach (ObjectId oi in NewDrawnCollection)
                                    {
                                        if (oi != ConsolElseOI)
                                        {
                                            Atend.Base.Acad.AT_INFO a = new Atend.Base.Acad.AT_INFO(oi);
                                            a.ParentCode  = at_info.NodeCode;
                                            a.NodeCode    = RodPack.Code.ToString();
                                            a.NodeType    = (int)Atend.Control.Enum.ProductType.Rod;
                                            a.ProductCode = RodPack.ProductCode;;
                                            a.Insert();
                                        }
                                    }

                                    //for (int i = 1; i <= 4; i++)
                                    //{

                                    //    ed.WriteMessage("4 \n");
                                    //    switch (i)
                                    //    {

                                    //        case 1:
                                    //            ed.WriteMessage("5 \n");
                                    //            #region Draw & Save ConsolElse Here
                                    //            ConsolElseOI = DrawAndSaveConsolElse(Entities);
                                    //            #endregion
                                    //            break;
                                    //        case 2:
                                    //            ed.WriteMessage("6 \n");
                                    //            #region Draw & Save Connection Here
                                    //            ConnectionOI = DrawAndSaveConnection(Entities);
                                    //            #endregion
                                    //            break;
                                    //        case 3:
                                    //            ed.WriteMessage("7 \n");
                                    //            #region Draw & Save Rod Here
                                    //            RodOI = DrawAndSaveRod(Entities);
                                    //            #endregion
                                    //            break;
                                    //        case 4:
                                    //            ed.WriteMessage("8 \n");
                                    //            #region Draw & Save RodTriangle Here
                                    //            RodTriangeOI = DrawAndSaveRodTriangle(Entities);
                                    //            #endregion
                                    //            break;
                                    //    }

                                    //}

                                    //save additional data here

                                    //ed.WriteMessage("9 \n");
                                    //Atend.Base.Acad.AT_INFO ConsolElseInfo = new Atend.Base.Acad.AT_INFO(ConsolElseOI);
                                    //ConsolElseInfo.ParentCode = at_info.NodeCode;
                                    //ConsolElseInfo.NodeCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.Code.ToString();
                                    //ConsolElseInfo.NodeType = (int)Atend.Control.Enum.ProductType.Rod;
                                    //ConsolElseInfo.ProductCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.ProductCode;
                                    //ConsolElseInfo.Insert();


                                    //ed.WriteMessage("10 \n");
                                    //Atend.Base.Acad.AT_SUB ConsolElseSub = new Atend.Base.Acad.AT_SUB(ConsolElseOI);
                                    //ConsolElseSub.SubIdCollection.Add(ConnectionOI);
                                    //ConsolElseSub.Insert();


                                    //``````````````````````````
                                    //ed.WriteMessage("11 \n");
                                    //ConsolElseInfo = new Atend.Base.Acad.AT_INFO(ConnectionOI);
                                    //ConsolElseInfo.ParentCode = at_info.NodeCode;
                                    //ConsolElseInfo.NodeCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.Code.ToString();
                                    //ConsolElseInfo.NodeType = (int)Atend.Control.Enum.ProductType.Rod;
                                    //ConsolElseInfo.ProductCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.ProductCode;
                                    //ConsolElseInfo.Insert();


                                    //ed.WriteMessage("12 \n");
                                    //ConsolElseSub = new Atend.Base.Acad.AT_SUB(ConnectionOI);
                                    //ConsolElseSub.SubIdCollection.Add(ConsolElseOI);
                                    //ConsolElseSub.SubIdCollection.Add(RodOI);
                                    //ConsolElseSub.Insert();

                                    //```````````````````````````````````````````

                                    //ed.WriteMessage("13 \n");
                                    //ConsolElseInfo = new Atend.Base.Acad.AT_INFO(RodOI);
                                    //ConsolElseInfo.ParentCode = at_info.NodeCode;
                                    //ConsolElseInfo.NodeCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.Code.ToString();
                                    //ConsolElseInfo.NodeType = (int)Atend.Control.Enum.ProductType.Rod;
                                    //ConsolElseInfo.ProductCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.ProductCode;
                                    //ConsolElseInfo.Insert();


                                    //ed.WriteMessage("14 \n");
                                    //ConsolElseSub = new Atend.Base.Acad.AT_SUB(RodOI);
                                    //ConsolElseSub.SubIdCollection.Add(ConnectionOI);
                                    //ConsolElseSub.SubIdCollection.Add(RodTriangeOI);
                                    //ConsolElseSub.Insert();

                                    //```````````````````````````````````````````
                                    //ed.WriteMessage("15 \n");
                                    //ConsolElseInfo = new Atend.Base.Acad.AT_INFO(RodTriangeOI);
                                    //ConsolElseInfo.ParentCode = at_info.NodeCode;
                                    //ConsolElseInfo.NodeCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.Code.ToString();
                                    //ConsolElseInfo.NodeType = (int)Atend.Control.Enum.ProductType.Rod;
                                    //ConsolElseInfo.ProductCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.ProductCode;
                                    //ConsolElseInfo.Insert();

                                    //--------------------------
                                    //ed.WriteMessage("Number of Entity : {0} \n", NewDrawnCollection.Count);

                                    ObjectId NewCreatedGroup =
                                        Atend.Global.Acad.Global.MakeGroup(RodPack.Code.ToString(), NewDrawnCollection);


                                    //Atend.Base.Equipment.ERod ERodForComment = Atend.Base.Equipment.ERod.SelectByCode(RodPack.ProductCode);

                                    //ed.WriteMessage("scale:{0} comment:{1}\n",MyCommentScale,ERod.Comment);
                                    ObjectId txtOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(Atend.Global.Acad.UAcad.WriteNote(ERod.Comment, new Point3d(drawRod.CenterPoint02.X, drawRod.CenterPoint02.Y, 0), MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());
                                    //ed.WriteMessage("text was writen\n");

                                    Atend.Base.Acad.AT_INFO GroupInfo1 = new Atend.Base.Acad.AT_INFO(txtOI);
                                    GroupInfo1.ParentCode  = RodPack.Code.ToString();
                                    GroupInfo1.NodeCode    = "";
                                    GroupInfo1.NodeType    = (int)Atend.Control.Enum.ProductType.Comment;
                                    GroupInfo1.ProductCode = 0;
                                    GroupInfo1.Insert();


                                    //Atend.Base.Acad.AT_INFO GroupInfo = new Atend.Base.Acad.AT_INFO(NewCreatedGroup);
                                    //GroupInfo.ParentCode = at_info.NodeCode;
                                    //GroupInfo.NodeCode = Atend.Base.Acad.AcadGlobal.dPackageForRod.Code.ToString();
                                    //GroupInfo.NodeType = (int)Atend.Control.Enum.ProductType.BankKhazan;
                                    //GroupInfo.ProductCode = Atend.Base.Acad.AcadGlobal.dPackageForKhazanTip.ProductCode;
                                    //GroupInfo.Insert();



                                    //    Atend.Base.Equipment.EKhazanTip khazanTip = Atend.Base.Equipment.EKhazanTip.SelectByCode(
                                    //        Atend.Base.Acad.AcadGlobal.dPackageForKhazanTip.ProductCode);


                                    //    ObjectId txtOI = DrawEntityOnScreen(
                                    //    Atend.Global.Acad.UAcad.WriteNote(khazanTip.Description, drawKhazan.GetCommentPoSition()),
                                    //    Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());


                                    Atend.Base.Acad.AT_INFO GroupInfo = new Atend.Base.Acad.AT_INFO(NewCreatedGroup);
                                    GroupInfo.ParentCode  = at_info.NodeCode;
                                    GroupInfo.NodeCode    = RodPack.Code.ToString();
                                    GroupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Rod;
                                    GroupInfo.ProductCode = RodPack.ProductCode;
                                    GroupInfo.Insert();


                                    Atend.Base.Acad.AT_SUB.AddToAT_SUB(NewCreatedGroup, per.ObjectId);
                                    //ed.WriteMessage("PoleOI for KHazan:{0}", per.ObjectId);
                                    Atend.Base.Acad.AT_SUB GroupSub = new Atend.Base.Acad.AT_SUB(NewCreatedGroup);
                                    GroupSub.SubIdCollection.Add(per.ObjectId);
                                    //ed.WriteMessage("TXTOI for KHazan:{0}", txtOI);
                                    GroupSub.SubIdCollection.Add(txtOI);
                                    GroupSub.Insert();


                                    //    Atend.Base.Acad.AT_SUB.AddToAT_SUB(NewCreatedGroup, per.ObjectId);

                                    //    Atend.Base.Acad.AT_SUB GroupSub = new Atend.Base.Acad.AT_SUB(NewCreatedGroup);
                                    //    GroupSub.SubIdCollection.Add(per.ObjectId);
                                    //    GroupSub.SubIdCollection.Add(txtOI);
                                    //    GroupSub.Insert();
                                }


                                #endregion
                            }
                            else
                            {
                                conti = false;
                            }
                        }
                        else
                        {
                            conti = false;
                        }
                    }
                }
            }
        }
Beispiel #14
0
        //MOUSAVI->AutoPoleInstallation
        public ObjectId DrawKalamp(Point3d CenterPoint, ObjectId ParentOI)
        {
            Editor   ed       = Application.DocumentManager.MdiActiveDocument.Editor;
            ObjectId HeaderOI = ObjectId.Null;

            double MyScale        = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Kalamp).Scale;
            double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Kalamp).CommentScale;


            double BaseX = CenterPoint.X - 2.5;
            double BaseY = CenterPoint.Y;

            Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY - 5), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 5, BaseY), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
            pLine.Closed = true;


            if (ParentOI != ObjectId.Null)
            {
                Atend.Base.Acad.AT_INFO ParentInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(ParentOI);
                ClampPack.ParentCode = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(ParentInfo.NodeCode)).Code;
                //ed.WriteMessage("parent code :{0}", ParentInfo.NodeCode);
            }
            if (SaveKalampData())
            {
                string LayerName = "";
                if (eClamp.VoltageLevel == 400)
                {
                    LayerName = Atend.Control.Enum.AutoCadLayerName.LOW_AIR.ToString();
                }
                else
                {
                    LayerName = Atend.Control.Enum.AutoCadLayerName.MED_AIR.ToString();
                }

                Matrix3d trans1 = Matrix3d.Scaling(MyScale, CenterPoint);
                pLine.TransformBy(trans1);


                HeaderOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(pLine, LayerName);

                Atend.Base.Acad.AT_INFO at_info = new Atend.Base.Acad.AT_INFO(HeaderOI);
                //ed.WriteMessage("ParentCode For connection Point: {0}\n", ParentInfo.NodeCode);
                if (ParentOI != ObjectId.Null)
                {
                    Atend.Base.Acad.AT_SUB.AddToAT_SUB(HeaderOI, ParentOI);

                    Atend.Base.Acad.AT_INFO ParentInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(ParentOI);
                    at_info.ParentCode = ParentInfo.NodeCode;
                }
                else
                {
                    at_info.ParentCode = "";
                }
                at_info.NodeCode    = ClampPack.Code.ToString();
                at_info.NodeType    = (int)Atend.Control.Enum.ProductType.Kalamp;
                at_info.ProductCode = eClamp.Code;
                at_info.Insert();

                Atend.Base.Acad.AT_SUB ConnectionPSub = new Atend.Base.Acad.AT_SUB(HeaderOI);
                ConnectionPSub.SubIdCollection.Add(ParentOI);
                ConnectionPSub.Insert();


                ObjectId TextOi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(Atend.Global.Acad.UAcad.WriteNote(ClampPack.Number, Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(HeaderOI)), MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());

                Atend.Base.Acad.AT_INFO textInfo = new Atend.Base.Acad.AT_INFO(TextOi);
                textInfo.ParentCode  = ClampPack.Code.ToString();
                textInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Comment;
                textInfo.NodeCode    = "";
                textInfo.ProductCode = 0;
                textInfo.Insert();

                Atend.Base.Acad.AT_SUB.AddToAT_SUB(TextOi, HeaderOI);
            }
            return(HeaderOI);
        }
Beispiel #15
0
        public ObjectId DrawKablsho02(Point3d CenterPoint)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            //ed.WriteMessage("CurrentPoint:{0} \n", CenterPoint);
            ObjectId HeaderOI = ObjectId.Null;


            double MyScale        = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.KablSho).Scale;
            double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.KablSho).CommentScale;

            System.Data.DataTable Parents            = Atend.Global.Acad.UAcad.DetermineParent((int)Atend.Control.Enum.ProductType.KablSho);
            System.Data.DataTable PointContainerList = Atend.Global.Acad.Global.PointInsideWhichEntity(CenterPoint);
            ObjectId ParentOI = ObjectId.Null;

            foreach (System.Data.DataRow dr in PointContainerList.Rows)
            {
                DataRow[] drs = Parents.Select(string.Format("SoftwareCode={0}", Convert.ToInt32(dr["Type"])));
                if (drs.Length != 0)
                {
                    ParentOI = new ObjectId(new IntPtr(Convert.ToInt32(dr["ObjectId"])));
                }
            }

            double BaseX = CenterPoint.X - 2.5;
            double BaseY = CenterPoint.Y;

            Atend.Global.Acad.AcadJigs.MyPolyLine pLine = new Atend.Global.Acad.AcadJigs.MyPolyLine();
            //pLine.ColorIndex = 40;
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY - 5), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX + 5, BaseY), 0, 0, 0);
            pLine.AddVertexAt(pLine.NumberOfVertices, new Point2d(BaseX, BaseY + 5), 0, 0, 0);
            pLine.Closed = true;

            Matrix3d trans1 = Matrix3d.Scaling(MyScale, CenterPoint);

            pLine.TransformBy(trans1);

            if (SaveKablshoData())
            {
                string LayerName = Atend.Control.Enum.AutoCadLayerName.LOW_GROUND.ToString();
                HeaderOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(pLine, LayerName);
                //ed.WriteMessage("HeaderOI : {0} \n", HeaderOI);
                Atend.Base.Acad.AT_INFO at_info = new Atend.Base.Acad.AT_INFO(HeaderOI);
                if (ParentOI != ObjectId.Null)
                {
                    Atend.Base.Acad.AT_INFO parentInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(ParentOI);
                    //ed.WriteMessage("parentInfo.NodeCode:{0} \n", parentInfo.NodeCode);
                    at_info.ParentCode = parentInfo.NodeCode;
                }
                else
                {
                    at_info.ParentCode = "";
                }
                //ed.WriteMessage("HeaderPack.Code:{0} \n", HeaderPack.Code);
                at_info.NodeCode    = KablshoPack.Code.ToString();
                at_info.NodeType    = (int)Atend.Control.Enum.ProductType.KablSho;
                at_info.ProductCode = eKablsho.Code;
                at_info.Insert();


                ObjectId TextOi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(Atend.Global.Acad.UAcad.WriteNote(KablshoPack.Number, Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(HeaderOI)), MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());


                Atend.Base.Acad.AT_INFO textInfo = new Atend.Base.Acad.AT_INFO(TextOi);
                textInfo.ParentCode  = KablshoPack.Code.ToString();
                textInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Comment;
                textInfo.NodeCode    = "";
                textInfo.ProductCode = 0;
                textInfo.Insert();

                Atend.Base.Acad.AT_SUB ConnectionPSub = new Atend.Base.Acad.AT_SUB(HeaderOI);
                ConnectionPSub.SubIdCollection.Add(TextOi);
                if (ParentOI != ObjectId.Null)
                {
                    ConnectionPSub.SubIdCollection.Add(ParentOI);
                }
                ConnectionPSub.Insert();

                if (ParentOI != ObjectId.Null)
                {
                    Atend.Base.Acad.AT_SUB.AddToAT_SUB(HeaderOI, ParentOI);
                }
            }

            //ed.WriteMessage("return from draw header cable \n");
            return(HeaderOI);
        }
Beispiel #16
0
        public void DrawStreetBoxUpdate()
        {
            bool         Conti = true;
            PromptResult pr;
            Editor       ed = Application.DocumentManager.MdiActiveDocument.Editor;

            double MyScale        = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.StreetBox).Scale;
            double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.StreetBox).CommentScale;


            DrawStreetBoxJig DSB = new DrawStreetBoxJig(eStreetBoxPhuse.Count, MyScale);

            while (Conti)
            {
                pr = ed.Drag(DSB);
                if (pr.Status == PromptStatus.OK)
                {
                    Conti = false;
                    List <Entity> ENTS = DSB.GetEntities();

                    //if (SaveStreetBoxData())
                    //{

                    ObjectIdCollection OIC = new ObjectIdCollection();

                    foreach (Entity ent in ENTS)
                    {
                        object ProductType = null;
                        Atend.Global.Acad.AcadJigs.MyPolyLine mPoly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                        if (mPoly != null)
                        {
                            //ed.WriteMessage("POLY\n");
                            if (mPoly.AdditionalDictionary.ContainsKey("ProductType"))
                            {
                                mPoly.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                //ed.WriteMessage("PT:{0}\n", Convert.ToInt32(ProductType));
                            }
                        }
                        else
                        {
                            Atend.Global.Acad.AcadJigs.MyLine mLine = ent as Atend.Global.Acad.AcadJigs.MyLine;
                            if (mLine != null)
                            {
                                //ed.WriteMessage("Line\n");
                                if (mLine.AdditionalDictionary.ContainsKey("ProductType"))
                                {
                                    mLine.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                    //ed.WriteMessage("PT:{0}\n", Convert.ToInt32(ProductType));
                                }
                            }
                            else
                            {
                                Atend.Global.Acad.AcadJigs.MyCircle mCircle = ent as Atend.Global.Acad.AcadJigs.MyCircle;
                                if (mCircle != null)
                                {
                                    if (mCircle.AdditionalDictionary.ContainsKey("ProductType"))
                                    {
                                        mCircle.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                        //ed.WriteMessage("PT:{0}\n",Convert.ToInt32(ProductType));
                                    }
                                }
                            }
                        }

                        //~~~~~~~~~~~~~~~~~~~~~~~~~~~

                        ObjectId NewDrawnOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString());
                        OIC.Add(NewDrawnOI);

                        Atend.Base.Acad.AT_INFO info = new Atend.Base.Acad.AT_INFO(NewDrawnOI);
                        info.ParentCode  = "";
                        info.ProductCode = StreetBoxPack.ProductCode;
                        info.NodeCode    = StreetBoxPack.Code.ToString();
                        if (ProductType != null)
                        {
                            info.NodeType = Convert.ToInt32(ProductType);
                        }
                        else
                        {
                            info.NodeType = 0;
                        }
                        info.Insert();

                        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    }

                    //text will add here
                    ObjectId TextOi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(
                        Atend.Global.Acad.UAcad.WriteNote(eStreetBox.Comment, new Point3d(DSB.MyBasePoint.X, DSB.MyBasePoint.Y, DSB.MyBasePoint.Z), MyCommentScale)
                        , Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString()
                        );
                    OIC.Add(TextOi);

                    Atend.Base.Acad.AT_INFO Textinfo = new Atend.Base.Acad.AT_INFO(TextOi);
                    Textinfo.ParentCode  = StreetBoxPack.Code.ToString();
                    Textinfo.ProductCode = 0;
                    Textinfo.NodeCode    = "";
                    Textinfo.NodeType    = (int)Atend.Control.Enum.ProductType.Comment;
                    Textinfo.Insert();



                    ObjectId GOI = Atend.Global.Acad.Global.MakeGroup(Guid.NewGuid().ToString(), OIC);
                    if (GOI != ObjectId.Null)
                    {
                        Atend.Base.Acad.AT_INFO GInfo = new Atend.Base.Acad.AT_INFO(GOI);
                        GInfo.ParentCode  = "";
                        GInfo.NodeCode    = StreetBoxPack.Code.ToString();
                        GInfo.NodeType    = (int)Atend.Control.Enum.ProductType.StreetBox;
                        GInfo.ProductCode = StreetBoxPack.ProductCode;
                        GInfo.Insert();

                        //Atend.Base.Acad.AT_SUB StreetboxSub = new Atend.Base.Acad.AT_SUB(GOI);
                        //StreetboxSub.SubIdCollection.Add(TextOi);
                        //StreetboxSub.Insert();
                    }

                    //}
                }
                else
                {
                    Conti = false;
                }
            }
        }
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        //public void DrawMiddleJackPanel(Entity PostEntity, System.Data.DataTable AllData)
        //{

        //    Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
        //    bool conti = true;
        //    //Dictionary<Guid, List<Entity>> MyCells = new Dictionary<Guid, List<Entity>>();
        //    double MyScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.MiddleJackPanel).Scale;

        //    DrawMiddleJackPanelJig MidJ = new DrawMiddleJackPanelJig(PostContainerEntity, MyScale);
        //    MidJ.MiddleJackPanelProductCode = ProductCode;
        //    MidJ.MiddleJaclPanelParentCode = ParentCode;
        //    MidJ.Cells = JackpanelCells;
        //    PromptResult pr;
        //    while (conti)
        //    {
        //        pr = ed.Drag(MidJ);
        //        if (pr.Status == PromptStatus.OK)
        //        {
        //            conti = false;
        //            #region save data here
        //            ObjectIdCollection OIC = new ObjectIdCollection();
        //            List<Guid> CellsGuid = new List<Guid>();

        //            List<Entity> Entities = new List<Entity>();
        //            Entities = MidJ.GetEntities();
        //            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        //            #region Seprate different cells from each other
        //            foreach (Entity ent in Entities)
        //            {
        //                Atend.Global.Acad.AcadJigs.MyPolyLine poly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
        //                object CellCode = null;
        //                if (poly != null)
        //                {
        //                    if (poly.AdditionalDictionary.ContainsKey("Code"))
        //                    {
        //                        poly.AdditionalDictionary.TryGetValue("Code", out CellCode);
        //                    }
        //                }
        //                else
        //                {
        //                    Atend.Global.Acad.AcadJigs.MyLine lin = ent as Atend.Global.Acad.AcadJigs.MyLine;
        //                    if (lin != null)
        //                    {
        //                        if (lin.AdditionalDictionary.ContainsKey("Code"))
        //                        {
        //                            lin.AdditionalDictionary.TryGetValue("Code", out CellCode);
        //                        }
        //                    }
        //                    else
        //                    {
        //                        Atend.Global.Acad.AcadJigs.MyCircle cir = ent as Atend.Global.Acad.AcadJigs.MyCircle;
        //                        if (cir != null)
        //                        {
        //                            if (cir.AdditionalDictionary.ContainsKey("Code"))
        //                            {
        //                                cir.AdditionalDictionary.TryGetValue("Code", out CellCode);
        //                            }
        //                        }
        //                    }
        //                }
        //                if (CellCode != null)
        //                {
        //                    if (!MyCells.ContainsKey(new Guid(CellCode.ToString())))
        //                    {
        //                        MyCells.Add(new Guid(CellCode.ToString()), new List<Entity>());
        //                        CellsGuid.Add(new Guid(CellCode.ToString()));
        //                        List<Entity> Entities1;
        //                        MyCells.TryGetValue(new Guid(CellCode.ToString()), out Entities1);
        //                        Entities1.Add(ent);

        //                    }
        //                    else
        //                    {
        //                        List<Entity> Entities1;
        //                        MyCells.TryGetValue(new Guid(CellCode.ToString()), out Entities1);
        //                        Entities1.Add(ent);
        //                    }

        //                }

        //            }
        //            #endregion

        //            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        //            ObjectIdCollection BusOIs = new ObjectIdCollection();
        //            foreach (Guid _ExistGuid in MyCells.Keys)
        //            {

        //                try
        //                {
        //                    #region Draw different cells
        //                    List<Entity> MyList = null;
        //                    MyCells.TryGetValue(_ExistGuid, out MyList);
        //                    if (MyList != null)
        //                    {
        //                        ObjectIdCollection CurrentCellEntities = new ObjectIdCollection();
        //                        ObjectId CurrentCellObjectId = ObjectId.Null;
        //                        foreach (Entity ent in MyList)
        //                        {
        //                            object MyProductType = null;
        //                            object MYProductCode = null;
        //                            object myCodeGuid = null;
        //                            Atend.Global.Acad.AcadJigs.MyPolyLine poly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
        //                            if (poly != null)
        //                            {
        //                                if (poly.AdditionalDictionary.ContainsKey("Code"))
        //                                {
        //                                    poly.AdditionalDictionary.TryGetValue("Code", out myCodeGuid);
        //                                }
        //                                if (poly.AdditionalDictionary.ContainsKey("ProductType"))
        //                                {
        //                                    poly.AdditionalDictionary.TryGetValue("ProductType", out MyProductType);
        //                                }
        //                                if (poly.AdditionalDictionary.ContainsKey("ProductCode"))
        //                                {
        //                                    poly.AdditionalDictionary.TryGetValue("ProductCode", out MYProductCode);
        //                                }


        //                            }
        //                            else
        //                            {
        //                                Atend.Global.Acad.AcadJigs.MyLine lin = ent as Atend.Global.Acad.AcadJigs.MyLine;
        //                                if (lin != null)
        //                                {
        //                                    if (lin.AdditionalDictionary.ContainsKey("Code"))
        //                                    {
        //                                        lin.AdditionalDictionary.TryGetValue("Code", out myCodeGuid);
        //                                    }
        //                                    if (lin.AdditionalDictionary.ContainsKey("ProductType"))
        //                                    {
        //                                        lin.AdditionalDictionary.TryGetValue("ProductType", out MyProductType);
        //                                    }
        //                                    if (lin.AdditionalDictionary.ContainsKey("ProductCode"))
        //                                    {
        //                                        lin.AdditionalDictionary.TryGetValue("ProductCode", out MYProductCode);
        //                                    }

        //                                }
        //                                else
        //                                {
        //                                    Atend.Global.Acad.AcadJigs.MyCircle cir = ent as Atend.Global.Acad.AcadJigs.MyCircle;
        //                                    if (cir != null)
        //                                    {
        //                                        if (cir.AdditionalDictionary.ContainsKey("Code"))
        //                                        {
        //                                            cir.AdditionalDictionary.TryGetValue("Code", out myCodeGuid);
        //                                        }
        //                                        if (cir.AdditionalDictionary.ContainsKey("ProductType"))
        //                                        {
        //                                            cir.AdditionalDictionary.TryGetValue("ProductType", out MyProductType);
        //                                        }
        //                                        if (cir.AdditionalDictionary.ContainsKey("ProductCode"))
        //                                        {
        //                                            cir.AdditionalDictionary.TryGetValue("ProductCode", out MYProductCode);
        //                                        }

        //                                    }
        //                                }
        //                            }

        //                            //------------------------
        //                            ObjectId NewCellEntities = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString());
        //                            OIC.Add(NewCellEntities);
        //                            if (MyProductType != null)
        //                            {
        //                                if (Convert.ToInt32(MyProductType) == (int)Atend.Control.Enum.ProductType.Cell)
        //                                {
        //                                    CurrentCellObjectId = NewCellEntities;
        //                                }
        //                                else
        //                                {
        //                                    CurrentCellEntities.Add(NewCellEntities);
        //                                }
        //                            }
        //                            Atend.Base.Acad.AT_INFO CellSubInfo = new Atend.Base.Acad.AT_INFO(NewCellEntities);
        //                            if (myCodeGuid != null)
        //                            {
        //                                CellSubInfo.ParentCode = NodeCode.ToString();
        //                                CellSubInfo.NodeCode = myCodeGuid.ToString();
        //                            }
        //                            else
        //                            {
        //                                CellSubInfo.ParentCode = myCodeGuid.ToString();
        //                                CellSubInfo.NodeCode = "";
        //                            }

        //                            if (MYProductCode != null)
        //                            {
        //                                CellSubInfo.ProductCode = Convert.ToInt32(MYProductCode);
        //                            }
        //                            else
        //                            {
        //                                CellSubInfo.ProductCode = 0;
        //                            }

        //                            if (MyProductType != null)
        //                            {
        //                                CellSubInfo.NodeType = Convert.ToInt32(MyProductType);
        //                                if (Convert.ToInt32(MyProductType) == (int)Atend.Control.Enum.ProductType.Bus)
        //                                {
        //                                    CellSubInfo.ProductCode = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(ProductCode).MasterProductCode;
        //                                    BusOIs.Add(NewCellEntities);
        //                                    //ed.WriteMessage("Bus OI : {0}\n", NewCellEntities);
        //                                }
        //                            }
        //                            else
        //                            {
        //                                CellSubInfo.NodeType = 0;
        //                            }
        //                            CellSubInfo.Insert();


        //                        }

        //                        if (CurrentCellObjectId != null && CurrentCellEntities.Count != 0)
        //                        {
        //                            foreach (ObjectId oi in CurrentCellEntities)
        //                            {
        //                                Atend.Base.Acad.AT_SUB.AddToAT_SUB(oi, CurrentCellObjectId);
        //                            }
        //                        }
        //                    }
        //                    #endregion
        //                }
        //                catch (System.Exception ex)
        //                {
        //                    ed.WriteMessage("Error while drawing: {0} \n", ex.Message);
        //                    return;
        //                }
        //            }
        //            //ed.WriteMessage("Bus Count : {0} \n", BusOIs.Count);

        //            #region Join Buses to each other
        //            foreach (Guid _ExistGuid in MyCells.Keys)
        //            {
        //                try
        //                {

        //                }
        //                catch (System.Exception ex)
        //                {
        //                    ed.WriteMessage("Error while Connect bus to each other: {0} \n", ex.Message);
        //                    return;
        //                }
        //            }
        //            #endregion

        //            //if (BusOIs.Count > 0)
        //            //{
        //            //    for (int BC = 0; BC < BusOIs.Count - 1; BC++)
        //            //    {

        //            //        Atend.Global.Acad.DrawEquips.AcDrawTerminal _AcDrawTerminal = new AcDrawTerminal();
        //            //        _AcDrawTerminal.DrawTerminal(Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(BusOIs[BC])), Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(BusOIs[BC])));


        //            //        //Atend.Base.Acad.AT_INFO BusInfo=new Atend.Base.Acad.AT_INFO(



        //            //    }
        //            //}
        //            #region Group all cells of Middlejack panel

        //            if (NodeCode != Guid.Empty)
        //            {
        //                //ed.WriteMessage("Group all cells of Middlejack panel\n");
        //                ObjectId GroupOI = Atend.Global.Acad.Global.MakeGroup(NodeCode.ToString() + "-MJP", OIC);

        //                Atend.Base.Acad.AT_INFO MiddleGroupInfo = new Atend.Base.Acad.AT_INFO(GroupOI);
        //                MiddleGroupInfo.ParentCode = ParentCode.ToString();
        //                MiddleGroupInfo.NodeCode = NodeCode.ToString();
        //                MiddleGroupInfo.NodeType = (int)Atend.Control.Enum.ProductType.MiddleJackPanel;
        //                MiddleGroupInfo.ProductCode = ProductCode;
        //                MiddleGroupInfo.Insert();

        //                Atend.Base.Acad.AT_SUB.AddToAT_SUB(GroupOI, PostContainerEntity.ObjectId);
        //                Atend.Base.Acad.AT_SUB.AddToAT_SUB(PostContainerEntity.ObjectId, GroupOI);

        //            }
        //            #endregion

        //            #endregion
        //        }
        //        else
        //        {
        //            conti = false;
        //        }
        //    }
        //}


        public void DrawMiddleJackPanel(Entity PostContainerEntity, ref DataRow[] PostEquipInserted)
        {
            Editor ed          = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            bool   conti       = true;
            Guid   NodeCode    = new Guid(PostEquipInserted[0]["NodeCode"].ToString());
            Guid   ParentCode  = new Guid(PostEquipInserted[0]["ParentCode"].ToString());
            int    ProductCode = Convert.ToInt32(PostEquipInserted[0]["ProductCode"]);

            Dictionary <Guid, List <Entity> > MyCells = new Dictionary <Guid, List <Entity> >();
            double MyScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.MiddleJackPanel).Scale;

            DrawMiddleJackPanelJig MidJ = new DrawMiddleJackPanelJig(PostContainerEntity, MyScale);

            MidJ.MiddleJackPanelProductCode = ProductCode;
            MidJ.MiddleJaclPanelParentCode  = ParentCode;
            MidJ.Cells = JackpanelCells;
            PromptResult pr;

            //ed.WriteMessage("------ START MJ {0} -------\n",NodeCode);
            while (conti)
            {
                pr = ed.Drag(MidJ);
                if (pr.Status == PromptStatus.OK)
                {
                    conti = false;
                    #region save data here
                    ObjectIdCollection OIC       = new ObjectIdCollection();
                    List <Guid>        CellsGuid = new List <Guid>();

                    List <Entity> Entities = new List <Entity>();
                    Entities = MidJ.GetEntities();
                    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    #region Seprate different cells from each other
                    //ed.WriteMessage("Seprate different cells from each other\n");
                    foreach (Entity ent in Entities)
                    {
                        Atend.Global.Acad.AcadJigs.MyPolyLine poly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                        object CellCode = null;
                        if (poly != null)
                        {
                            //ed.WriteMessage("~~~Poly~~~:{0}\n", poly.AdditionalDictionary.ContainsKey("ProductCode"));
                            if (poly.AdditionalDictionary.ContainsKey("Code"))
                            {
                                poly.AdditionalDictionary.TryGetValue("Code", out CellCode);
                            }
                        }
                        else
                        {
                            Atend.Global.Acad.AcadJigs.MyLine lin = ent as Atend.Global.Acad.AcadJigs.MyLine;
                            if (lin != null)
                            {
                                if (lin.AdditionalDictionary.ContainsKey("Code"))
                                {
                                    lin.AdditionalDictionary.TryGetValue("Code", out CellCode);
                                }
                            }
                            else
                            {
                                Atend.Global.Acad.AcadJigs.MyCircle cir = ent as Atend.Global.Acad.AcadJigs.MyCircle;
                                if (cir != null)
                                {
                                    if (cir.AdditionalDictionary.ContainsKey("Code"))
                                    {
                                        cir.AdditionalDictionary.TryGetValue("Code", out CellCode);
                                    }
                                }
                            }
                        }
                        if (CellCode != null)
                        {
                            //ed.WriteMessage("Cellcode:{0}\n", CellCode);
                            if (!MyCells.ContainsKey(new Guid(CellCode.ToString())))
                            {
                                //ed.WriteMessage("\nCell Cuid Code:{0}\n", CellCode.ToString());
                                MyCells.Add(new Guid(CellCode.ToString()), new List <Entity>());
                                CellsGuid.Add(new Guid(CellCode.ToString()));

                                List <Entity> Entities1;
                                MyCells.TryGetValue(new Guid(CellCode.ToString()), out Entities1);
                                Entities1.Add(ent);
                            }
                            else
                            {
                                List <Entity> Entities1;
                                MyCells.TryGetValue(new Guid(CellCode.ToString()), out Entities1);
                                Entities1.Add(ent);
                            }
                        }
                    }
                    #endregion

                    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    foreach (Guid _ExistGuid in MyCells.Keys)
                    {
                        try
                        {
                            #region Draw different cells
                            //if (MyCells.ContainsKey(_ExistGuid))
                            //{
                            //ed.WriteMessage("Cell count : {0} \n", MyCells.Count);
                            List <Entity> MyList = null;
                            MyCells.TryGetValue(_ExistGuid, out MyList);
                            if (MyList != null)
                            {
                                //ed.WriteMessage("~~~~~ Entities found ~~~~~\n");
                                ObjectIdCollection CurrentCellEntities = new ObjectIdCollection();
                                ObjectId           CurrentCellObjectId = ObjectId.Null;
                                foreach (Entity ent in MyList)
                                {
                                    //-----------------------


                                    object MyProductType = null;
                                    object MYProductCode = null;
                                    object myCodeGuid    = null;
                                    Atend.Global.Acad.AcadJigs.MyPolyLine poly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                                    if (poly != null)
                                    {
                                        //ed.WriteMessage("~~~POLY~~~{0}\n", poly.AdditionalDictionary.ContainsKey("ProductCode"));
                                        if (poly.AdditionalDictionary.ContainsKey("Code"))
                                        {
                                            poly.AdditionalDictionary.TryGetValue("Code", out myCodeGuid);
                                        }
                                        if (poly.AdditionalDictionary.ContainsKey("ProductType"))
                                        {
                                            poly.AdditionalDictionary.TryGetValue("ProductType", out MyProductType);
                                        }
                                        if (poly.AdditionalDictionary.ContainsKey("ProductCode"))
                                        {
                                            poly.AdditionalDictionary.TryGetValue("ProductCode", out MYProductCode);
                                        }
                                    }
                                    else
                                    {
                                        Atend.Global.Acad.AcadJigs.MyLine lin = ent as Atend.Global.Acad.AcadJigs.MyLine;
                                        if (lin != null)
                                        {
                                            if (lin.AdditionalDictionary.ContainsKey("Code"))
                                            {
                                                lin.AdditionalDictionary.TryGetValue("Code", out myCodeGuid);
                                            }
                                            if (lin.AdditionalDictionary.ContainsKey("ProductType"))
                                            {
                                                lin.AdditionalDictionary.TryGetValue("ProductType", out MyProductType);
                                            }
                                            if (lin.AdditionalDictionary.ContainsKey("ProductCode"))
                                            {
                                                lin.AdditionalDictionary.TryGetValue("ProductCode", out MYProductCode);
                                            }
                                        }
                                        else
                                        {
                                            Atend.Global.Acad.AcadJigs.MyCircle cir = ent as Atend.Global.Acad.AcadJigs.MyCircle;
                                            if (cir != null)
                                            {
                                                if (cir.AdditionalDictionary.ContainsKey("Code"))
                                                {
                                                    cir.AdditionalDictionary.TryGetValue("Code", out myCodeGuid);
                                                }
                                                if (cir.AdditionalDictionary.ContainsKey("ProductType"))
                                                {
                                                    cir.AdditionalDictionary.TryGetValue("ProductType", out MyProductType);
                                                }
                                                if (cir.AdditionalDictionary.ContainsKey("ProductCode"))
                                                {
                                                    cir.AdditionalDictionary.TryGetValue("ProductCode", out MYProductCode);
                                                }
                                            }
                                        }
                                    }

                                    //------------------------
                                    //ed.WriteMessage("Entity Type:{0}\n", ProductType);
                                    ObjectId NewCellEntities = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString());
                                    OIC.Add(NewCellEntities);
                                    //                                    CurrentCellEntities.Add(NewCellEntities);
                                    if (MyProductType != null)
                                    {
                                        if (Convert.ToInt32(MyProductType) == (int)Atend.Control.Enum.ProductType.Cell)
                                        {
                                            CurrentCellObjectId = NewCellEntities;
                                            //ed.WriteMessage("CurrentCellObjectId was found\n");
                                        }
                                        else
                                        {
                                            CurrentCellEntities.Add(NewCellEntities);
                                        }
                                    }
                                    //ed.WriteMessage("NodeCode : {0}\n", NodeCode);

                                    Atend.Base.Acad.AT_INFO CellSubInfo = new Atend.Base.Acad.AT_INFO(NewCellEntities);
                                    if (myCodeGuid != null)
                                    {
                                        //ed.WriteMessage("cell entity was found\n");
                                        CellSubInfo.ParentCode = NodeCode.ToString(); //CurrentMiddleJackPanelCodeGuid.ToString();
                                        CellSubInfo.NodeCode   = myCodeGuid.ToString();
                                    }
                                    else
                                    {
                                        CellSubInfo.ParentCode = myCodeGuid.ToString();
                                        CellSubInfo.NodeCode   = "";
                                    }
                                    //ed.WriteMessage("2\n");

                                    if (MYProductCode != null)
                                    {
                                        CellSubInfo.ProductCode = Convert.ToInt32(MYProductCode);
                                    }
                                    else
                                    {
                                        CellSubInfo.ProductCode = 0;
                                    }
                                    //ed.WriteMessage("3\n");

                                    if (MyProductType != null)
                                    {
                                        CellSubInfo.NodeType = Convert.ToInt32(MyProductType);
                                    }
                                    else
                                    {
                                        CellSubInfo.NodeType = 0;
                                    }
                                    //ed.WriteMessage("4\n");

                                    CellSubInfo.Insert();
                                }

                                //insert cell sub
                                //ed.WriteMessage("%%% CurrentCellObjectId %%% {0} : {1} \n", CurrentCellObjectId, CurrentCellEntities.Count);
                                if (CurrentCellObjectId != null && CurrentCellEntities.Count != 0)
                                {
                                    //ed.WriteMessage("5:1\n");
                                    //Atend.Base.Acad.AT_SUB cellsub = new Atend.Base.Acad.AT_SUB(CurrentCellObjectId);
                                    foreach (ObjectId oi in CurrentCellEntities)
                                    {
                                        //cellsub.SubIdCollection.Add(oi);
                                        Atend.Base.Acad.AT_SUB.AddToAT_SUB(oi, CurrentCellObjectId);
                                    }
                                    //cellsub.Insert();
                                    //ed.WriteMessage("5:2\n");
                                }
                            }
                            //}
                            // ed.WriteMessage("One Pack Was drawn \n");
                            //}
                            #endregion
                        }
                        catch (System.Exception ex)
                        {
                            ed.WriteMessage("Error while drawing: {0} \n", ex.Message);
                            return;
                        }
                    }

                    #region Group all cells of Middlejack panel

                    if (NodeCode != null)
                    {
                        //ed.WriteMessage("Group all cells of Middlejack panel\n");
                        ObjectId GroupOI = Atend.Global.Acad.Global.MakeGroup(NodeCode.ToString() + "-MJP", OIC);

                        Atend.Base.Acad.AT_INFO MiddleGroupInfo = new Atend.Base.Acad.AT_INFO(GroupOI);
                        MiddleGroupInfo.ParentCode  = ParentCode.ToString();
                        MiddleGroupInfo.NodeCode    = NodeCode.ToString();
                        MiddleGroupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.MiddleJackPanel;
                        MiddleGroupInfo.ProductCode = ProductCode;
                        MiddleGroupInfo.Insert();


                        Atend.Base.Acad.AT_SUB.AddToAT_SUB(GroupOI, PostContainerEntity.ObjectId);
                    }
                    #endregion

                    #endregion
                }
                else
                {
                    conti = false;
                }
            }
        }