GridOn 属性 (ActiveX)
指定视口网格的状态。 支持的平台:仅限 Windows 属性值只读:不 类型:布尔
言论网格仅用于视觉参考。它没有被绘制,也不被视为绘图的一部分。网格原点由方法设置。SnapBasePoint 当网格打开时,它被设置为当前的网格间距。若要更改网格间距,请使用以下方法。SetGridSpacing 在视口上打开或关闭网格时,在视口处于活动状态之前,网格的可见性不会改变。如果切换活动视口的网格,则在视口重置为活动视口之前,网格的可见性不会更改。若要将视口设置为活动视口或将其重置为活动视口,请将该属性与更新的视口对象一起使用。ActiveViewport 注意:此属性的值存储在 GRIDMODE 系统变量中。使用该方法更新活动视口的网格模式时,无需将视口重置为活动视口即可查看更改。SetVariable
例子VBA: Sub Example_GridOn()
' This example toggles the setting of GridOn.
Dim viewportObj As AcadViewport
' Set the viewportObj variable to the activeviewport
Set viewportObj = ThisDrawing.ActiveViewport
TOGGLEGRID:
If MsgBox("Toggle the grid?", vbOKCancel, "GridOn Example") = vbOK Then
viewportObj.GridOn = Not (viewportObj.GridOn)
Else
Exit Sub
End If
' Reset the active viewport to see the change
ThisDrawing.ActiveViewport = viewportObj
GoTo TOGGLEGRID
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_GridOn()
;; This example toggles the setting of GridOn.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Set the viewportObj variable to the activeviewport
(setq viewportObj (vla-get-ActiveViewport doc))
(vla-put-GridOn viewportObj (if (= (vla-get-GridOn viewportObj) :vlax-true) :vlax-false :vlax-true))
;; Reset the active viewport to see the change
(vla-put-ActiveViewport doc viewportObj)
(vla-Regen doc acAllViewports)
(alert "Toggled the display of the grid.")
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 09:45
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.