指定视区是否锁定。 支持的平台:仅窗口 属性值只读:不 类型:布尔
言论没有额外的评论。 例子工 务 局: 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) ) ) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:38
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.