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.
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.
- AutoLISP
-
(vl-load-com) (defun c:Ch3_ChangeSnapBasePoint() (setq acadObj (vlax-get-acad-object) doc (vla-get-ActiveDocument acadObj) vportObj (vla-get-ActiveViewport doc)) ;; Turn on the grid for the active viewport (vla-put-GridOn vportObj :vlax-true) ;; Change the snap base point to 1, 1 (setq newBasePoint (vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-fill newBasePoint '(1 1)) (vla-put-SnapBasePoint vportObj newBasePoint) ;; Change the snap rotation angle to 30 degrees (0.5236 radians) (setq rotationAngle 0.5236) (vla-put-SnapRotationAngle vportObj rotationAngle) ;; Reset the active viewport (vla-put-ActiveViewport doc vportObj) )
- VBA (AutoCAD Only)
-
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.5236 radians) Dim rotationAngle As Double rotationAngle = 0.5236 ThisDrawing.ActiveViewport.SnapRotationAngle = rotationAngle ' Reset the active viewport ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport End Sub