Example #1
0
 /// <summary> 在UI界面中绘制模型线。此方法为异步操作,程序并不会等待 PostDraw 方法执行完成才继续向下执行。  </summary>
 public void PostDraw()
 {
     // 绘制轮廓
     this._closedCurveDrawer              = new ModelCurvesDrawer(this.uiApp, CurveCheckMode.Closed, this.CheckInTime);
     _closedCurveDrawer.DrawingCompleted += Drawer_DrawingCompleted;
     this._closedCurveDrawer.PostDraw();
 }
Example #2
0
        private void Drawer_DrawingCompleted(List <ElementId> AddedCurves, bool FinishedExternally, bool Succeeded)
        {
            if (Succeeded)
            {
                // 将结果添加到集合中
                _addedModelCurvesId.Add(AddedCurves);

                // 询问是否还要添加
                DialogResult res = MessageBox.Show(@"封闭曲线绘制成功,是否还要继续绘制另一组封闭曲线?",
                                                   @"提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res == DialogResult.Yes)
                {
                    // Can not subscribe to an event during execution of that event. revit.exception.InvalidOperationException
                    this._closedCurveDrawer.PostDraw();
                }
                else
                {
                    // 取消与这个绘制器的关联
                    _closedCurveDrawer.DrawingCompleted -= Drawer_DrawingCompleted;
                    _closedCurveDrawer.FinishOnce(FinishedExternally, Succeeded);
                    _closedCurveDrawer.Dispose();
                    this._closedCurveDrawer = null;
                    //
                    if (_closedDrawingCompletedEvent != null)
                    {
                        _closedDrawingCompletedEvent(_addedModelCurvesId, FinishedExternally, true);
                    }
                }
            }
            else
            {
                // 取消与这个绘制器的关联
                _closedCurveDrawer.DrawingCompleted -= Drawer_DrawingCompleted;
                this._closedCurveDrawer.FinishOnce(FinishedExternally, Succeeded);
                _closedCurveDrawer.Dispose();
                this._closedCurveDrawer = null;

                if (_closedDrawingCompletedEvent != null)
                {
                    _closedDrawingCompletedEvent(_addedModelCurvesId, FinishedExternally, false);
                }
            }
        }