MSpace Property (ActiveX)

Allows editing of the model from floating paper space viewports.

Supported platforms: Windows only

Signature

VBA:

object.MSpace
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Remarks

AutoCAD operates in either model space or paper space. Use model space for drafting and design work and to create 2D drawings or 3D models. Use paper space to create a finished layout of a drawing for printing or plotting.

Note: Before using the MSpace property, the ActiveSpace property must be set to acPaperSpace, and the display control of the PViewport object must be switched on by the Display property.

Examples

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

Visual 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.")))
)