Example #1
0
        public void CreateCircle()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            //新建一个圆
            int count = 5;

            while (count-- > 1)
            {
                Point3d pt1    = new Point3d(10 + 100 * count, 10 + 100 * count, 0);
                double  radius = 10 * count;

                Circle cc = CreateEntityOperation.CreateCircle(pt1, radius);
                DBOperation.AddToModelSpace(cc);
            }
            ed.UpdateScreen();
        }
Example #2
0
        /// <summary>
        /// 自动绘制梁
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                //创建矩形
                double height = Convert.ToDouble(nudBeamHeight.Value);
                double width  = Convert.ToDouble(nudBeamTopHeight.Value);

                Rectangle3d rec3d = CreateEntityOperation.CreateRectangle(height, width, bPoint);
                MyRectangle rect  = new MyRectangle(rec3d);

                //将矩形添加到数据库中
                Database db = DBOperation.GetDocumentDatabase();
                //DBOperation.AddToModelSpace(rect.CreateRect(), db);
                DBOperation.AddToModelSpace(CreatePolyLineOfRectangle(), db);
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                ShowMsgOperation.Message(ex.Data + "\n" + ex.Source + "\n" + ex.TargetSite + "\n" + ex.ToString());
            }
        }