CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

捕捉旋转角度属性 (ActiveX)

2023-1-3 06:00| 发布者: admin| 查看: 203| 评论: 0|来自: AutoCAD

摘要: 指定视区相对于当前 UCS 的捕捉旋转角度。

指定视区相对于当前 UCS 的捕捉旋转角度。

支持的平台:仅窗口

签名

工 务 局:

object.SnapRotationAngle
对象

类型:光伏端口视口

此属性适用的对象。

属性值

只读:

类型:

以弧度为单位的角度。有效范围为 0 到 6.28。

言论

不能更改活动图纸空间视口的捕捉基点。

在执行对任一 theor方法 的调用之前,对此属性的更改不会反映在图形中。UpdateRegen

注意:此属性的值存储在 SNAPANG 系统变量中。

例子

工 务 局:

Sub Example_SnapRotationAngle()
    ' This example changes the snap rotation angle for a
    ' model space and paper space viewport.
    
    ' Create a new model space viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.Viewports.Add("NewViewport")
    
    ' Find the current snap rotation angle
    Dim currSnapAngle As Double
    currSnapAngle = viewportObj.SnapRotationAngle
    MsgBox "The current model space snap rotation angle is " & viewportObj.SnapRotationAngle, , "SnapRotationAngle Example"
    
    ' Change the snap rotation angle
    viewportObj.SnapRotationAngle = 1.5
    MsgBox "The new model space snap rotation angle is " & viewportObj.SnapRotationAngle, , "SnapRotationAngle Example"
    
    ' Create a new paper space viewport
    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double
    
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40
    ThisDrawing.ActiveSpace = acPaperSpace
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    
    ' Find the current snap rotation angle
    currSnapAngle = pviewportObj.SnapRotationAngle
    MsgBox "The current paper space snap rotation angle is " & pviewportObj.SnapRotationAngle, , "SnapRotationAngle Example"
    
    ' Change the snap rotation angle
    pviewportObj.SnapRotationAngle = 1.5
    MsgBox "The new paper space snap base point is " & pviewportObj.SnapRotationAngle, , "SnapRotationAngle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SnapRotationAngle()
    ;; This example changes the snap rotation angle for a
    ;; model space and paper space viewport.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new model space viewport
    (setq viewportObj (vla-Add (vla-get-Viewports doc) "NewViewport"))
    
    ;; Find the current snap rotation angle
    (setq currSnapAngle (vla-get-SnapRotationAngle viewportObj))
    (alert (strcat "The current model space snap rotation angle is " (rtos currSnapAngle 2)))
    
    ;; Change the snap rotation angle
    (vla-put-SnapRotationAngle viewportObj 1.5)
    (alert (strcat "The new model space snap rotation angle is " (rtos (vla-get-SnapRotationAngle viewportObj) 2)))
    
    ;; Create a new paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
	         height 40)
    
    (vla-put-ActiveSpace doc acPaperSpace)
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))
    
    ;; Find the current snap rotation angle
    (setq currSnapAngle (vla-get-SnapRotationAngle pviewportObj))
    (alert (strcat "The current paper space snap rotation angle is " (rtos currSnapAngle 2)))
    
    ;; Change the snap rotation angle
    (vla-put-SnapRotationAngle pviewportObj 1.5)
    (alert (strcat "The new paper space snap base point is " (rtos (vla-get-SnapRotationAngle pviewportObj) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 09:06

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部