DisplayLocked 属性 (ActiveX) 
指定视口是否锁定。 支持的平台:仅限 Windows 属性值只读:不 类型:布尔 
 言论没有其他评论。 例子VBA: 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
可视化 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)
	       )
    )
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 07:57
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.