CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

DisplayLock Property (ActiveX)

2023-1-3 18:17| 发布者: admin| 查看: 396| 评论: 0|来自: AutoCAD

摘要: 指定视区是否锁定。

指定视区是否锁定。

支持的平台:仅窗口

签名

工 务 局:

object.DisplayLocked
对象

类型:光伏港

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:视口已锁定。
  • False:视口未锁定。

言论

没有额外的评论。

例子

工 务 局:

Sub Example_DisplayLocked()
    ' This example scans the current drawing paper space Viewports
    ' and displays whether or not any of them are locked.
    
    Dim pviewportObj As Object
    Dim msg As String, DisplayState As String
    
    ' Make sure this drawing contains paper space viewports before continuing
    If ThisDrawing.PaperSpace.Count = 0 Then
        MsgBox "There are no paper space viewports in the current drawing."
        Exit Sub
    End If
    
    ' Go through each PViewport object in the drawing paper space
    ' and determine whether the paper space viewport is locked or not

    For Each pviewportObj In ThisDrawing.PaperSpace
        ' Determine if this is a paper space viewport
        If pviewportObj.ObjectName = "AcDbViewport" Then
            ' Determine if this paper space viewport is clipped
            DisplayState = IIf(pviewportObj.DisplayLocked, " is locked", " is not locked")
            msg = msg & "PViewport ID " & pviewportObj.ObjectID & DisplayState & vbCrLf
        End If
    Next

    ' Display locked state of paper space Viewports
    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayLocked()
    ;; This example scans the current drawing paper space Viewports
    ;; and displays whether or not any of them are locked.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq paperSpace (vla-get-PaperSpace doc))
  
    ;; Make sure this drawing contains paper space viewports before continuing
    (if (= (vla-get-count paperSpace) 0)
        (alert "There are no paper space viewports in the current drawing.")
        (progn
	           (setq msg "")
	           ;; Go through each paper space viewport object in the drawing paper space
	           ;; and determine whether or not it is locked
	           (vlax-for pviewportObj paperSpace
	               ;; Determine whether this is a paper space viewport
	               (if (= (vla-get-ObjectName pviewportObj) "AcDbViewport")
	                   (progn
	                       ;; Determine whether this paper space viewport is locked
	                       (setq DisplayState (if (= (vla-get-DisplayLocked pviewportObj) :vlax-true) " is locked" " is not locked"))
		                      (setq ID (itoa (vla-get-ObjectID pviewportObj)))
	                       (setq msg (strcat msg "PViewport ID " ID DisplayState "\n"))
	                   )
	               )
	           )

	           ;; Display locked state of paper space Viewports
	           (alert msg)
	       )
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 04:37

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部