示例#1
0
            private Entity DrawHeader(Point3d BasePoint)
            {
                Atend.Global.Acad.AcadJigs.MyCircle _MyCircle = new Atend.Global.Acad.AcadJigs.MyCircle();
                _MyCircle.Radius = 5;
                _MyCircle.Normal = Vector3d.ZAxis;
                _MyCircle.Center = BasePoint;

                Atend.Global.Acad.AcadJigs.SaveExtensionData(_MyCircle, (int)Atend.Control.Enum.ProductType.Khazan);
                return(_MyCircle);
            }
示例#2
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.Breaker);
                //Atend.Global.Acad.AcadJigs.SaveExtensionData(c, CodeGuid);
                return(c);
            }
示例#3
0
            private Entity CreateCircle(Point3d CenterPoint, double Radius, int ColorIndex)
            {
                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 = ColorIndex;

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

                return(c);
            }
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        //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;
                }
            }
        }
示例#5
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;
                }
            }
        }
示例#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;
                }
            }
        }//