CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

GridOn 属性 (ActiveX)

2023-1-3 15:22| 发布者: admin| 查看: 468| 评论: 0|来自: AutoCAD

摘要: 指定视区网格的状态。

指定视区网格的状态。

支持的平台:仅窗口

签名

工 务 局:

object.GridOn
对象

类型:光伏端口视口

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:网格已打开。
  • False:网格已关闭。

言论

网格仅用于视觉参考。它不被打印,也不被视为图形的一部分。网格原点由方法设置。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.")  
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 14:10

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部