Adjust Snap and Grid Alignment

AutoCAD ActiveX

 
Adjust Snap and Grid Alignment
 
 
 

You can use the grid as a visual guideline and turn on Snap mode to restrict cursor movement. In addition to setting the spacing, you can adjust the snap and grid alignment. You can rotate the alignment, or you can set it for use with isometric drawings.

If you need to draw along a specific alignment or angle, you can rotate the snap angle. The center point of the snap angle rotation is the snap base point. If you need to align a hatch pattern, you can change this point, which is normally set to 0,0.

To rotate the snap angle, use the SnapRotationAngle property. To change the base point of the snap angle rotation, use the SnapBasePoint property.

NoteBoth properties require a call to the Update method to update the AutoCAD display.

See “Adjust Grid and Grid Snap” in the User's Guide for more information on using and setting snaps and grids.

Change the snap base point and rotation angle

This example changes the snap base point to (1,1) and the snap rotation angle to 30 degrees. The grid is turned on so that the changes are visible.

Sub Ch3_ChangeSnapBasePoint()
 ' Turn on the grid for the active viewport
 ThisDrawing.ActiveViewport.GridOn = True
      
 ' Change the snap base point to 1, 1
 Dim newBasePoint(0 To 1) As Double
 newBasePoint(0) = 1: newBasePoint(1) = 1
 ThisDrawing.ActiveViewport.SnapBasePoint = newBasePoint
      
 ' Change the snap rotation angle to 30 degrees (0.575 radians)
 Dim rotationAngle As Double
 rotationAngle = 0.575
 ThisDrawing.ActiveViewport.SnapRotationAngle = rotationAngle
      
 ' reset the viewport
 ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
End Sub