예제 #1
0
        public ObjectId DrawKablsho02(Point3d CenterPoint)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            //ed.WriteMessage("CurrentPoint:{0} \n", CenterPoint);
            ObjectId HeaderOI = ObjectId.Null;


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

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

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

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

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

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

            pLine.TransformBy(trans1);

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


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


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

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

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

            //ed.WriteMessage("return from draw header cable \n");
            return(HeaderOI);
        }
예제 #2
0
        //MOUSAVI->AutoPoleInstallation
        public ObjectId DrawKalamp(Point3d CenterPoint, ObjectId ParentOI)
        {
            Editor   ed       = Application.DocumentManager.MdiActiveDocument.Editor;
            ObjectId HeaderOI = ObjectId.Null;

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


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

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


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

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


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

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

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

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


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

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

                Atend.Base.Acad.AT_SUB.AddToAT_SUB(TextOi, HeaderOI);
            }
            return(HeaderOI);
        }