CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

ElevationModelSpace 属性 (ActiveX)

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

ElevationModelSpace 属性 (ActiveX)

指定模型空间中的高程设置。

支持的平台:仅限 Windows

签名

VBA:

object.ElevationModelSpace
对象

类型:数据库文档

此属性应用于的对象。

属性值

只读:

类型:

模型空间的高程设置。

言论

当前高程是每当需要 3D 点但仅提供 XY 值时使用的 Z 值。当前高程分别在模型空间和图纸空间中维护。

例子

VBA:

Sub Example_ElevationModelSpace()
    ' This example changes the model space elevation of the current drawing
    ' and then resets it to the original value again.
    
    Dim currElevation As Double
    
    currElevation = ThisDrawing.ElevationModelSpace
    MsgBox "The current model space elevation is " & ThisDrawing.ElevationModelSpace, vbInformation, "ElevationModelSpace Example"
    
    ' Change the elevation
    ThisDrawing.ElevationModelSpace = currElevation + 2
    MsgBox "The new model space elevation is " & ThisDrawing.ElevationModelSpace, vbInformation, "ElevationModelSpace Example"
    
    ' Reset the elevation to its original value
    ThisDrawing.ElevationModelSpace = currElevation
    MsgBox "The model space elevation is reset to " & ThisDrawing.ElevationModelSpace, vbInformation, "ElevationModelSpace Example"

End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_ElevationModelSpace()
    ;; This example changes the model space elevation of the current drawing
    ;; and then resets it to the original value again.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq currElevation (vla-get-ElevationModelSpace doc))
    (alert (strcat "The current model space elevation is " (rtos currElevation 2)))
    
    ;; Change the elevation
    (vla-put-ElevationModelSpace doc (+ currElevation 2))
    (alert (strcat "The new model space elevation is " (rtos (vla-get-ElevationModelSpace doc) 2)))
    
    ;; Reset the elevation to its original value
    (vla-put-ElevationModelSpace doc currElevation)
    (alert (strcat "The model space elevation is reset to " (rtos (vla-get-ElevationModelSpace doc) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-1-19 06:48

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部