© 2010 Autodesk
Introduction to Revit 2011 API
ダイナミックモデルアップデート
 概要
§モデル変更時に更にモデルを編集可能
§要素の追加、変更、削除を監視
§
§
§
ここまでは、アプリケーション全体とドキュメント単位のイベントをみてきました。ここではダイナミックモデルアップデートという要素単位のイベントについてです。

ダイナミックモデルアップデートでは要素が追加、変更、削除されたことを監視できます。

>>>>>


変更をかける上での注意点ですが、変更はイベント発行元の要素を変更するのに使用するのと同じトランザクションで行うということです。この場合、元の要素の変更がUndoされた場合は、ダイナミックモデルアップデートで変更した要素の一緒にUndoされます。


Dynamic model update offers the ability for a Revit API application to modify the Revit model as a reaction to changes happening in the model. Application.DocumentChanged event is read-only event and thus it does not support modification to Revit database. For that, we can use the DMU mechanism.


Revit will now let you know when elements are added, modified or deleted. So Dynamic model update offers the ability to track and modify the model as a reaction to changes happening in the model. This facility is offered through implementation of updaters. The updater interface offers the ability to implement a method that is informed of the scope of changes that triggered the changes.

To subscribe to an updater, we need to assign some triggers which work in combination of both update scope and update type. Update scope refers to changes in explicit list of element ids in document or implicit list of elements communicated via element filter. Change Type refers to changes including element addition, deletion , modification of geometry, parameters, or any property of element.

One important thing to note is that this facility allows the application to perform its changes to react to the notification within the same transaction as the one that triggered the changes. Thus this enables you to edit the model during the model regeneration cycle triggered by the element change. For example – if the user stretches a concrete beam and our application is based on rebars, we can modify the rebar within the beam right after the users are done with resizing the beam. And those changes to the model will be contained in that overall transaction, and so if the user does an undo, our rebar sizing and the beam resizing will all be done at once in one shot (instead of having a clunky two stage resizing). This has lot of implication since we are now able to react to events in model and we can update our analysis applications,  or make changes in the model in reaction to users interaction to the model elements.