关于调整对齐和网格对齐 (ActiveX)
您可以使用网格作为视觉指南,并打开贴靠模式以限制光标移动。
除了设置间距外,还可以调整对齐和网格对齐方式。您可以旋转路线,也可以将其设置为用于等轴测图形。
如果需要沿特定对齐方式或角度绘制,可以旋转捕捉角度。捕捉角度旋转的中心点是捕捉基点。如果需要对齐填充图案,可以更改此点,该点通常设置为 0,0。
若要旋转捕捉角度,请使用该属性。若要更改捕捉角度旋转的基点,请使用该属性。SnapRotationAngleSnapBasePoint
注意:这两个特性都需要调用该方法来更新 AutoCAD 显示。Update
更改捕捉基点和旋转角度
本示例将捕捉基点更改为 (1,1),捕捉旋转角度更改为 30 度。网格处于打开状态,以便可以看到更改。
- 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)
-
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
|