Ejemplo n.º 1
0
            private Entity CreateLine(Point3d StartPoint, Point3d EndPoint, int ProductType, int ColorIndex, double Thickness)
            {
                Atend.Global.Acad.AcadJigs.MyLine mLine = new Atend.Global.Acad.AcadJigs.MyLine();
                mLine.StartPoint = StartPoint;
                mLine.EndPoint   = EndPoint;

                //if (Thickness != 0)
                //{
                //    mLine.Thickness = Thickness;
                //}


                //if (ProductType != 0)
                //{
                //Atend.Global.Acad.AcadJigs.SaveExtensionData(mLine, ProductType);
                //Atend.Global.Acad.AcadJigs.SaveExtensionData(mLine, CodeGuid);
                //}
                //if (ColorIndex != 0)
                //{
                mLine.ColorIndex = ColorIndex;
                //}

                return(mLine);
            }
Ejemplo n.º 2
0
        //update in tehran 7/15
        public void DrawBreaker()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage("DRaw BREAKER \n");
            System.Data.DataTable ParentList = Atend.Global.Acad.UAcad.DetermineParent((int)Atend.Control.Enum.ProductType.Breaker);
            double V1 = 0;
            double V2 = 0;

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

            PromptEntityOptions peo1 = new PromptEntityOptions("Select first node:");
            PromptEntityResult  per  = ed.GetEntity(peo1);

            if (per.Status == PromptStatus.OK)
            {
                Atend.Base.Acad.AT_INFO Info1 = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per.ObjectId);
                DataRow[] drs = ParentList.Select(string.Format("SoftwareCode={0}", Info1.NodeType));
                if (drs.Length != 0)
                {
                    switch (((Atend.Control.Enum.ProductType)drs[0]["SoftwareCode"]))
                    {
                    case Atend.Control.Enum.ProductType.HeaderCabel:
                        //V1 = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(Info1.ProductCode);
                        V1 = 0;
                        break;

                    case Atend.Control.Enum.ProductType.Consol:
                        V1 = Atend.Base.Equipment.EConsol.AccessSelectByCode(Info1.ProductCode).VoltageLevel;
                        break;

                    case Atend.Control.Enum.ProductType.KablSho:
                        //V1 = Atend.Base.Equipment.EKablsho.AccessSelectByCode(Info1.ProductCode);
                        V1 = 0;
                        break;

                    case Atend.Control.Enum.ProductType.Kalamp:
                        V1 = Atend.Base.Equipment.EClamp.AccessSelectByCode(Info1.ProductCode).VoltageLevel;
                        break;
                    }
                    PromptEntityOptions peo2 = new PromptEntityOptions("Select second node:");
                    PromptEntityResult  per1 = ed.GetEntity(peo2);
                    if (per1.Status == PromptStatus.OK)
                    {
                        Atend.Base.Acad.AT_INFO Info2 = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per1.ObjectId);
                        DataRow[] drs1 = ParentList.Select(string.Format("SoftwareCode={0}", Info2.NodeType));
                        if (drs1.Length != 0)
                        {
                            switch (((Atend.Control.Enum.ProductType)drs1[0]["SoftwareCode"]))
                            {
                            case Atend.Control.Enum.ProductType.HeaderCabel:
                                //V1 = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(Info1.ProductCode);
                                V2 = 0;
                                break;

                            case Atend.Control.Enum.ProductType.Consol:
                                V2 = Atend.Base.Equipment.EConsol.AccessSelectByCode(Info2.ProductCode).VoltageLevel;
                                break;

                            case Atend.Control.Enum.ProductType.KablSho:
                                //V1 = Atend.Base.Equipment.EKablsho.AccessSelectByCode(Info1.ProductCode);
                                V2 = 0;
                                break;

                            case Atend.Control.Enum.ProductType.Kalamp:
                                V2 = Atend.Base.Equipment.EClamp.AccessSelectByCode(Info2.ProductCode).VoltageLevel;
                                break;
                            }

                            if (V1 == V2 && Info1.ParentCode == Info2.ParentCode)
                            {
                                DrawBreakerJig _DrawBreakerJig = new DrawBreakerJig(MyScale);
                                List <Entity>  ents            = _DrawBreakerJig.GetDemo(
                                    Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(per.ObjectId)),
                                    Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(per1.ObjectId)));

                                if (SaveBreakerData())
                                {
                                    ObjectIdCollection OIC = new ObjectIdCollection();
                                    foreach (Entity ent in ents)
                                    {
                                        ObjectId TerminalOI = ObjectId.Null;
                                        ObjectId KetOI      = ObjectId.Null;
                                        ObjectId NOI        = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());
                                        Atend.Global.Acad.AcadJigs.MyLine terminal = ent as Atend.Global.Acad.AcadJigs.MyLine;
                                        if (terminal != null)
                                        {
                                            object ProductType = null;
                                            if (terminal.AdditionalDictionary.TryGetValue("ProductType", out ProductType))
                                            {
                                                if (Convert.ToInt32(ProductType) == (int)Atend.Control.Enum.ProductType.Terminal)
                                                {
                                                    //ed.WriteMessage("terminal aws found\n");
                                                    if (ProductType != null)
                                                    {
                                                        TerminalOI = NOI;
                                                    }
                                                }
                                                else if (Convert.ToInt32(ProductType) == (int)Atend.Control.Enum.ProductType.Key)
                                                {
                                                    //ed.WriteMessage("Key aws found\n");
                                                    if (ProductType != null)
                                                    {
                                                        KetOI = NOI;
                                                    }
                                                }
                                            }
                                        }
                                        OIC.Add(NOI);



                                        if (TerminalOI == ObjectId.Null)
                                        {
                                            if (KetOI == ObjectId.Null)
                                            {
                                                Atend.Base.Acad.AT_INFO groupInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                                groupInfo.NodeCode    = BreakerPack.Code.ToString();
                                                groupInfo.ParentCode  = "";
                                                groupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Breaker;
                                                groupInfo.ProductCode = BreakerPack.ProductCode;
                                                groupInfo.Insert();
                                            }
                                            else
                                            {
                                                //ed.WriteMessage("KEYOI != null\n");
                                                Atend.Base.Acad.AT_INFO groupInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                                groupInfo.NodeCode    = BreakerPack.Code.ToString();
                                                groupInfo.ParentCode  = "";
                                                groupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Key;
                                                groupInfo.ProductCode = BreakerPack.ProductCode;
                                                groupInfo.Insert();
                                            }
                                        }
                                        else
                                        {
                                            Atend.Base.Acad.AT_INFO groupInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                            groupInfo.NodeCode    = BreakerPack.Code.ToString();
                                            groupInfo.ParentCode  = "";
                                            groupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Terminal;
                                            groupInfo.ProductCode = BreakerPack.ProductCode;
                                            groupInfo.Insert();
                                        }
                                    }

                                    ObjectId GOI = Atend.Global.Acad.Global.MakeGroup(BreakerPack.Code.ToString(), OIC);
                                    //ed.WriteMessage("----<<<<<----GOI:{0}\n",GOI);

                                    Atend.Base.Acad.AT_INFO groupInfo1 = new Atend.Base.Acad.AT_INFO(GOI);
                                    groupInfo1.NodeCode    = BreakerPack.Code.ToString();
                                    groupInfo1.ParentCode  = "";
                                    groupInfo1.NodeType    = (int)Atend.Control.Enum.ProductType.Breaker;
                                    groupInfo1.ProductCode = BreakerPack.ProductCode;
                                    groupInfo1.Insert();


                                    ObjectId TextOi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(
                                        Atend.Global.Acad.UAcad.WriteNote(eBreaker.Comment,
                                                                          _DrawBreakerJig.MyCenterPoint
                                                                          , MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString()
                                        );

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

                                    Atend.Base.Acad.AT_SUB groupSub = new Atend.Base.Acad.AT_SUB(GOI);
                                    groupSub.SubIdCollection.Add(per.ObjectId);
                                    groupSub.SubIdCollection.Add(per1.ObjectId);
                                    groupSub.SubIdCollection.Add(TextOi);
                                    groupSub.Insert();

                                    Atend.Base.Acad.AT_SUB.AddToAT_SUB(GOI, per.ObjectId);
                                    Atend.Base.Acad.AT_SUB.AddToAT_SUB(GOI, per1.ObjectId);
                                }
                                //Line l = new Line(
                                //    Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(per.ObjectId)),
                                //    Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(per1.ObjectId)));
                                //Atend.Global.Acad.UAcad.DrawEntityOnScreen(l);
                            }
                            else
                            {
                                ed.WriteMessage("Voltage was not ok \n");
                            }
                        } //if (drs1.Length != 0)
                    }     //if (per1.Status == PromptStatus.OK)
                }         //if (drs.Length != 0)
            }             //if (per.Status == PromptStatus.OK )
        }
Ejemplo n.º 3
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        //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;
                }
            }
        }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
0
        //update in tehran 7/15
        public void DrawDisconnector()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            System.Data.DataTable ParentList = Atend.Global.Acad.UAcad.DetermineParent((int)Atend.Control.Enum.ProductType.Disconnector);

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


            PromptEntityOptions peo1 = new PromptEntityOptions("Select first node:");
            PromptEntityResult  per  = ed.GetEntity(peo1);

            if (per.Status == PromptStatus.OK)
            {
                Atend.Base.Acad.AT_INFO Info1 = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per.ObjectId);
                DataRow[] drs = ParentList.Select(string.Format("SoftwareCode={0}", Info1.NodeType));
                if (drs.Length != 0)
                {
                    PromptEntityOptions peo2 = new PromptEntityOptions("Select second node:");
                    PromptEntityResult  per1 = ed.GetEntity(peo2);
                    if (per1.Status == PromptStatus.OK)
                    {
                        Atend.Base.Acad.AT_INFO Info2 = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per1.ObjectId);
                        DataRow[] drs1 = ParentList.Select(string.Format("SoftwareCode={0}", Info2.NodeType));
                        if (drs1.Length != 0 && Info1.ParentCode == Info2.ParentCode)
                        {
                            DrawDisconnectorJig _DrawDisconnectorJig = new DrawDisconnectorJig(MyScale);
                            List <Entity>       ents = _DrawDisconnectorJig.GetDemo(
                                Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(per.ObjectId)),
                                Atend.Global.Acad.UAcad.CenterOfEntity(Atend.Global.Acad.UAcad.GetEntityByObjectID(per1.ObjectId)));

                            if (SaveDisConnectorData())
                            {
                                ObjectIdCollection OIC = new ObjectIdCollection();
                                //ed.WriteMessage("go for each\n");
                                foreach (Entity ent in ents)
                                {
                                    ObjectId TerminalOI = ObjectId.Null;
                                    ObjectId KetOI      = ObjectId.Null;
                                    ObjectId NOI        = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());
                                    Atend.Global.Acad.AcadJigs.MyLine terminal = ent as Atend.Global.Acad.AcadJigs.MyLine;
                                    if (terminal != null)
                                    {
                                        object ProductType = null;
                                        if (terminal.AdditionalDictionary.TryGetValue("ProductType", out ProductType))
                                        {
                                            if (Convert.ToInt32(ProductType) == (int)Atend.Control.Enum.ProductType.Terminal)
                                            {
                                                //ed.WriteMessage("terminal aws found\n");
                                                if (ProductType != null)
                                                {
                                                    TerminalOI = NOI;
                                                }
                                            }
                                            else if (Convert.ToInt32(ProductType) == (int)Atend.Control.Enum.ProductType.Key)
                                            {
                                                //ed.WriteMessage("Key aws found\n");
                                                if (ProductType != null)
                                                {
                                                    KetOI = NOI;
                                                }
                                            }
                                        }
                                    }
                                    OIC.Add(NOI);

                                    if (TerminalOI == ObjectId.Null)
                                    {
                                        if (KetOI == ObjectId.Null)
                                        {
                                            //ed.WriteMessage("TerminalOI == null\n");
                                            Atend.Base.Acad.AT_INFO groupInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                            groupInfo.NodeCode    = DisConnectorPack.Code.ToString();
                                            groupInfo.ParentCode  = "";
                                            groupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Disconnector;
                                            groupInfo.ProductCode = DisConnectorPack.ProductCode;
                                            groupInfo.Insert();
                                        }
                                        else
                                        {
                                            //ed.WriteMessage("KEYOI != null\n");
                                            Atend.Base.Acad.AT_INFO groupInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                            groupInfo.NodeCode    = DisConnectorPack.Code.ToString();
                                            groupInfo.ParentCode  = "";
                                            groupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Key;
                                            groupInfo.ProductCode = DisConnectorPack.ProductCode;
                                            groupInfo.Insert();
                                        }
                                    }
                                    else
                                    {
                                        //ed.WriteMessage("TerminalOI != null\n");
                                        Atend.Base.Acad.AT_INFO groupInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                        groupInfo.NodeCode    = DisConnectorPack.Code.ToString();
                                        groupInfo.ParentCode  = "";
                                        groupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Terminal;
                                        groupInfo.ProductCode = DisConnectorPack.ProductCode;
                                        groupInfo.Insert();
                                    }
                                }

                                ObjectId GOI = Atend.Global.Acad.Global.MakeGroup(DisConnectorPack.Code.ToString(), OIC);

                                Atend.Base.Acad.AT_INFO groupInfo1 = new Atend.Base.Acad.AT_INFO(GOI);
                                groupInfo1.NodeCode    = DisConnectorPack.Code.ToString();
                                groupInfo1.ParentCode  = "";
                                groupInfo1.NodeType    = (int)Atend.Control.Enum.ProductType.Disconnector;
                                groupInfo1.ProductCode = DisConnectorPack.ProductCode;
                                groupInfo1.Insert();


                                ObjectId TextOi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(
                                    Atend.Global.Acad.UAcad.WriteNote(eDisConnector.Comment,
                                                                      _DrawDisconnectorJig.MyCenterPoint
                                                                      , MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString()
                                    );

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

                                Atend.Base.Acad.AT_SUB groupSub = new Atend.Base.Acad.AT_SUB(GOI);
                                groupSub.SubIdCollection.Add(per.ObjectId);
                                groupSub.SubIdCollection.Add(per1.ObjectId);
                                groupSub.SubIdCollection.Add(TextOi);
                                groupSub.Insert();

                                Atend.Base.Acad.AT_SUB.AddToAT_SUB(GOI, per.ObjectId);
                                Atend.Base.Acad.AT_SUB.AddToAT_SUB(GOI, per1.ObjectId);
                            }
                        } //if (drs1.Length != 0)
                    }     //if (per1.Status == PromptStatus.OK)
                }         //if (drs.Length != 0)
            }             //if (per.Status == PromptStatus.OK )
        }
Ejemplo n.º 6
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;
                }
            }
        }//