设置视区的捕捉间距。 支持的平台:仅窗口 签名工 务 局: object.SetSnapSpacing XSpacing, YSpacing 返回值(RetVal)无返回值。 言论X和Y间距的初始值为 1.0000。 此值也由 SNAPUNIT 系统变量控制。 例子工 务 局: Sub Example_SetSnapSpacing() ' This example finds the current Snap spacing and changes it. ' Find the current active viewport Dim viewportObj As AcadViewport Set viewportObj = ThisDrawing.ActiveViewport ' Turn on Snap mode and reset the viewport. viewportObj.SnapOn = True ThisDrawing.ActiveViewport = viewportObj ' Find the current Snap spacing Dim XSpacing As Double Dim YSpacing As Double viewportObj.GetSnapSpacing XSpacing, YSpacing MsgBox "X =" & XSpacing & ", Y =" & YSpacing, Title:="SetSnapSpacing Example" ' Change the Snap spacing XSpacing = XSpacing * 0.5 YSpacing = YSpacing * 0.5 viewportObj.SetSnapSpacing XSpacing, YSpacing ThisDrawing.ActiveViewport = viewportObj MsgBox "X =" & XSpacing & ", Y =" & YSpacing, Title:="SetSnapSpacing Example" End Sub Visual LISP: (vl-load-com) (defun c:Example_SetSnapSpacing() ;; This example finds the current Snap spacing, and changes that spacing. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Find the current active viewport (setq viewportObj (vla-get-ActiveViewport doc)) ;; Turn on Snap spacing and reset the viewport. (vla-put-SnapOn viewportObj :vlax-true) (vla-put-ActiveViewport doc viewportObj) ;; Find the current Snap spacing (vla-GetSnapSpacing viewportObj 'XSpacing 'YSpacing) (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2))) ;; Change the Snap spacing (vla-SetSnapSpacing viewportObj (* XSpacing 0.5) (* YSpacing 0.5)) (vla-put-ActiveViewport doc viewportObj) (vla-GetSnapSpacing viewportObj 'XSpacing 'YSpacing) (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:27
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.