アクティブな画層や線種など、大部分のアクティブ オブジェクトへの変更はただちに表示されます。
ただし、リセットしないと変更が表示されないアクティブ オブジェクトもいくつかあります。これらのオブジェクトは、アクティブな文字スタイル、UCS、およびビューポートです。これらのオブジェクトが変更された場合、オブジェクトをリセットし、Regen メソッドを呼出して変更を表示する必要があります。
これらのオブジェクトをリセットするには、更新したオブジェクトに ActiveTextStyle、ActiveUCS、または ActiveViewport プロパティを設定します。
以下の例では、アクティブなビューポートのグリッド表示を変更し、変更がアクティブなビューポートの表示に反映されるようビューポートをリセットします。
(vl-load-com) (defun c:Ch3_ResetActiveViewport() (setq acadObj (vlax-get-acad-object) doc (vla-get-ActiveDocument acadObj) vportObj (vla-get-ActiveViewport doc)) ;; Toggle the setting of the grid display ;; for the active viewport (vla-put-GridOn vportObj (if (= (vla-get-GridOn vportObj) :vlax-true) :vlax-false :vlax-true)) ;; Reset the active viewport (vla-put-ActiveViewport doc vportObj) )
Sub Ch3_ResetActiveViewport() ' Toggle the setting of the grid display ' for the active viewport ThisDrawing.ActiveViewport.GridOn = Not (ThisDrawing.ActiveViewport.GridOn) ' Reset the active viewport ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport End Sub