指定视区网格的状态。 支持的平台:仅窗口 属性值只读:不 类型:布尔
言论网格仅用于视觉参考。它不被打印,也不被视为图形的一部分。网格原点由方法设置。SnapBasePoint 当网格打开时,它将设置为当前网格间距。若要更改网格间距,请使用该方法。SetGridSpacing 在视口上打开或关闭网格时,在视口处于活动状态之前,网格的可见性不会更改。如果切换活动视口的网格,则在视口重置为活动视口之前,网格的可见性不会更改。若要将视区设置或重置为活动视区,请将该属性与更新的视区对象一起使用。ActiveViewport 注意:此属性的值存储在 GRIDMODE 系统变量中。使用该方法更新活动视区的网格模式时,不必将视口重置为活动视口即可看到更改。SetVariable
例子工 务 局: 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
Visual 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-12-2 22:25
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.