Insert Geometries in drawings

Next we have two examples of create a rectangle inside of a view and how to create a rectangle in the drawing outside of the views

 public void CreateGeometry()//Criar rectangulo dentro de uma vista
        {
            DrawingHandler MyDrawingHandler = new DrawingHandler();
            if (MyDrawingHandler.GetConnectionStatus())
            {
                TSD.Polygon MyPolygon;
                PointList PolygonPoints = new PointList();
                PolygonPoints.Add(new TSG.Point(5, 5));
                PolygonPoints.Add(new TSG.Point(185, 5));
                PolygonPoints.Add(new TSG.Point(185, 292));
                PolygonPoints.Add(new TSG.Point(5, 292));
                DrawingObjectEnumerator views = MyDrawingHandler.GetActiveDrawing().GetSheet().GetAllViews();
                while (views.MoveNext())
                {
                    MyPolygon = new TSD.Polygon(views.Current as ViewBase, PolygonPoints);
                    MyPolygon.Insert();
                }

            }
        }

        public void CreateGeometryOut()//Criar rectangulo no desenho
        {
            DrawingHandler MyDrawingHandler = new DrawingHandler();
            //ViewBase view = MyDrawingHandler.GetActiveDrawing().GetSheet().GetAllViews().Current as ViewBase;
            Tekla.Structures.Drawing.ViewBase view = MyDrawingHandler.GetActiveDrawing().GetSheet() as Tekla.Structures.Drawing.ViewBase;

            TSD.Polygon MyPolygon;
            PointList PolygonPoints = new PointList();
            PolygonPoints.Add(new TSG.Point(5, 5));
            PolygonPoints.Add(new TSG.Point(185, 5));
            PolygonPoints.Add(new TSG.Point(185, 292));
            PolygonPoints.Add(new TSG.Point(5, 292));

            MyPolygon = new TSD.Polygon(MyDrawingHandler.GetActiveDrawing().GetSheet(), PolygonPoints);
            MyPolygon.Insert();
        }

        private void RefreshDrawing1_Click(object sender, EventArgs e)
        {
            //DeleteView1();
            this.timer1.Start();

            InsertNorthSymbol();
            InsertDWGDetailDuctCenters();
            InsertDWGWall2WallDetail();
            InsertDWGMANHOLE_ROOF_TO_WALL();
            InsertDWGStandardPANEL2400();
            InsertDWGBaseDetail();
            InsertDWGColumnReinforcement();

            //CreateGeometry();
            CreateGeometryOut();

            InsertDWGNotes();
            this.timer1.Start();

            //CreateViewsForGaDrawing1(); //Momentaniamente desactivada para ser mais rapido
            this.timer1.Start();

        }

Comentários

Mensagens populares