/// <summary> /// 选取插入的基点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; SelectObjOperation.SelectCADWindows(); PromptPointResult pt = ed.GetPoint("\n请选择点"); if (pt.Status == PromptStatus.OK) { bPoint = (Point3d)pt.Value; ShowMsgOperation.Message("您选择了点:" + bPoint.X + "," + bPoint.Y + "\n"); } else { ShowMsgOperation.Message("未选择点,默认为原点"); } lblPointValue.Text = bPoint.X.ToString() + " , " + bPoint.Y.ToString(); this.Focus(); }
/// <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()); } }