关于重置活动对象 (ActiveX)
对大多数活动对象(例如活动图层和活动线型)的更改会立即显示。
但是,必须重置多个活动对象才能显示更改。这些对象是活动文本样式、活动用户坐标系 (UCS) 和活动视口。如果对这些对象中的任何一个进行了更改,则必须重置该对象,并且必须调用该方法才能显示更改。Regen
若要重置这些对象,只需使用更新的对象设置 、 或 属性即可。ActiveTextStyleActiveUCSActiveViewport
重置活动视口
以下示例更改活动视口中网格的显示,然后将视口重置为活动视口以显示更改。
- AutoLISP
-
(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)
)
- VBA(仅限 AutoCAD)
-
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
|