CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

UCSIconAtOrigin 属性 (ActiveX)

2024-5-18 18:57| 发布者: admin| 查看: 128| 评论: 0|原作者: admin|来自: AutoCAD

UCSIconAtOrigin 属性 (ActiveX)

指定是否在原点显示 UCS 图标。

支持的平台:仅限 Windows

签名

VBA:

object.UCSIconAtOrigin
对象

类型:PViewport视口

此属性应用于的对象。

属性值

只读:

类型:布尔

  • True:UCS图标显示在原点。
  • False:原点不显示 UCS 图标。

言论

如果 UCS 图标处于打开状态(请参阅属性)且未显示在原点,则该图标将显示在 UCSORG 系统变量定义的 WCS 坐标处。UCSIconOn

例子

VBA:

Sub Example_UCSIconAtOrigin()
    ' This example toggles the setting of UCSIconAtOrigin.

    Dim viewportObj As AcadViewport
    
    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport
    
    ' Make sure the UCS Icon is on, and a new UCS is defined.
    ' The new UCS defines the origin for the icon. When the icon
    ' is not displayed at the origin, it is displayed at the
    ' lower-left corner of the display.
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double
    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0
    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    viewportObj.UCSIconOn = True
    
    ' Display the current setting of UCSIconAtOrigin
    MsgBox "UCSIconAtOrigin is: " & IIf(viewportObj.UCSIconAtOrigin, "On", "Off"), , "UCSIconAtOrigin Example"

    ' Toggle the setting of UCSIconAtOrigin
    viewportObj.UCSIconAtOrigin = Not (viewportObj.UCSIconAtOrigin)
    
    ' Reset the active viewport to see the change
    ThisDrawing.ActiveViewport = viewportObj
    
    MsgBox "UCSIconAtOrigin is now: " & IIf(viewportObj.UCSIconAtOrigin, "On", "Off"), , "UCSIconAtOrigin Example"
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_UCSIconAtOrigin()
    ;; This example toggles the setting of UCSIconAtOrigin.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))
    
    ;; Make sure the UCS Icon is on, and a new UCS is defined.
    ;; The new UCS defines the origin for the icon. When the icon
    ;; is not displayed at the origin, it is displayed at the
    ;; lower-left corner of the display.
    (setq origin (vlax-3d-point 2 2 0)
          xAxisPoint (vlax-3d-point 3 2 0)
          yAxisPoint (vlax-3d-point 2 3 0))

    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "UCS1"))
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-UCSIconOn viewportObj :vlax-true)
    
    ;; Display the current setting of UCSIconAtOrigin
    (alert (strcat "UCSIconAtOrigin is: " (if (= (vla-get-UCSIconAtOrigin viewportObj) :vlax-true) "On" "Off")))

    ;; Toggle the setting of UCSIconAtOrigin
    (vla-put-UCSIconAtOrigin viewportObj (if (= (vla-get-UCSIconAtOrigin viewportObj) :vlax-true) :vlax-false :vlax-true))
    
    ;; Reset the active viewport to see the change
    (vla-put-ActiveViewport doc viewportObj)
    
    (alert (strcat "UCSIconAtOrigin is now: " (if (= (vla-get-UCSIconAtOrigin viewportObj) :vlax-true) "On" "Off")))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-14 07:40

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部