Support

As evidenced by over 30 years of development history, trust-worthy Korean CAD, CADian!

FAQ · 2013.12.11
CADian VBA Sample Code - 19 [ Grid ]
"" Specify the status of the viewport grid.

Signature

object.GridOn

object : Viewport, PViewport
The objects this property applies to.

GridOn : Boolean ; Read-write
True: Grid On.
False: Grid Off.

Syatem variables

The value of this property is stored in the GRIDMODE system variable. When using the SetVariable method to update the grid mode of the active viewport, you do not have to reset the viewport as the active viewport to see the change.

Remarks

The grid is used only for visual reference. It is not plotted, nor is it considered part of the drawing. The grid origin is set by the SnapBasePoint method.

When the grid is turned on, it is set to the current grid spacing. To change the grid spacing, use the SetGridSpacing method.

When you turn the grid on or off on a viewport, the visibility of the grid will not change until the viewport is made active. If you toggle the grid of the active viewport, the visibility of the grid will not change until the viewport is reset as the active viewport. To set or reset the viewport as the active viewport, use the ActiveViewport property with the updated viewport object.



Dim viewportObj As IntelliCAD.Viewport

Dim XGrid As Double

Dim YGrid As Double

Set viewportObj = IntelliCAD.ActiveDocument.ActiveViewport

"" Turn on the grid and reset the viewport to see it come on.

viewportObj.GridOn = True

IntelliCAD.ActiveDocument.ActiveViewport = viewportObj

"" Find the current grid spacing

viewportObj.GetGridSpacing XGrid, YGrid

MsgBox "X Grid spacing = " & XGrid & " Y Grid spacing = " & YGrid

Added to cart.

VIEW CART

Please sign in first.

JOIN