CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2021 开发者帮助

MSpace 属性 (ActiveX)

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

MSpace 属性 (ActiveX)

允许从浮动图纸空间视口编辑模型。

支持的平台:仅限 Windows

签名

VBA:

object.MSpace
对象

类别: 文档

此属性应用于的对象。

属性值

只读:

类型:布尔

  • True:允许编辑模型。
  • False:不允许编辑模型。

言论

AutoCAD 在模型空间或图纸空间中运行。使用模型空间进行绘图和设计工作,并创建 2D 工程图或 3D 模型。使用图纸空间创建图形的完成布局以进行打印或打印。

注意:在使用该属性之前,必须将该属性设置为 ,并且该属性必须打开对象的显示控件。MSpaceActiveSpaceacPaperSpacePViewportDisplay

例子

VBA:

Sub Example_MSpace()
    ' This example creates a new paper space viewport.
    ' It then toggles the ability to edit in model space using
    ' the MSpace property.
    
    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double
    
    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40
    
    ' Change from model space to paperspace
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewport
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    pviewportObj.DISPLAY True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj
    ThisDrawing.Regen acAllViewports
    
    ' Find the current MSpace value
    MsgBox "The ability to edit model space from this PViewport is " & IIf(ThisDrawing.mspace, "on.", "off."), , "MSpace Example"
    
    ' Toggle the setting of MSpace
    ThisDrawing.mspace = False
    MsgBox "The ability to edit model space from this PViewport is now " & IIf(ThisDrawing.mspace, "on.", "off."), , "MSpace Example"

End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_MSpace()
    ;; This example creates a new paper space viewport.
    ;; It then toggles the ability to edit in model space using
    ;; the MSpace property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)
    
    ;; Change from model space to paperspace
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewport
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    (vla-Display pviewportObj :vlax-true)
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj)
    (vla-Regen doc acAllViewports)
    
    ;; Find the current MSpace value
    (alert (strcat "The ability to edit model space from this PViewport is " (if (= (vla-get-MSpace doc) :vlax-true) "on." "off.")))
    
    ;; Toggle the setting of MSpace
    (vla-put-MSpace doc :vlax-false)
    (alert (strcat "The ability to edit model space from this PViewport is now " (if (= (vla-get-MSpace doc) :vlax-true) "on." "off.")))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-5 17:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部