ViewportOn 属性 (ActiveX)
指定视口的显示状态。 支持的平台:仅限 Windows 属性值只读:不 类型:布尔
言论若要打开或关闭视口的显示控件,请使用该方法。Display 例子VBA: Sub Example_ViewportOn() ' This example creates two new paper space viewports. ' It then checks the status of the viewports. Dim pviewportObj1 As AcadPViewport Dim pviewportObj2 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 = 10 height = 10 ' Change from model space to paper space ThisDrawing.ActiveSpace = acPaperSpace ' Create the paper space viewports Set pviewportObj1 = ThisDrawing.PaperSpace.AddPViewport(center, width, height) center(0) = 8: center(1) = 8: center(2) = 0 width = 10 height = 10 Set pviewportObj2 = ThisDrawing.PaperSpace.AddPViewport(center, width, height) ' Before making a paper space viewport active, ' the mspace property needs to be True pviewportObj1.DISPLAY (True) ThisDrawing.mspace = True ThisDrawing.ActivePViewport = pviewportObj1 ThisDrawing.Regen acAllViewports MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _ "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on.")) ' Now turn on pviewportObj2 as well pviewportObj2.DISPLAY (True) MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _ "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on.")) End Sub 可视化 LISP: (vl-load-com) (defun c:Example_ViewportOn() ;; This example creates two new paper space viewports. ;; It then checks the status of the viewports. (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 10 height 10) ;; Change from model space to paper space (vla-put-ActiveSpace doc acPaperSpace) ;; Create the paper space viewports (setq paperSpace (vla-get-PaperSpace doc)) (setq pviewportObj1 (vla-AddPViewport paperSpace center width height)) (setq center (vlax-3d-point 8 8 0) width 10 height 10) (setq pviewportObj2 (vla-AddPViewport paperSpace center width height)) ;; Before making a paper space viewport active, ;; the mspace property needs to be True (vla-Display pviewportObj1 :vlax-true) (vla-put-MSpace doc :vlax-true) (vla-put-ActivePViewport doc pviewportObj1) (vla-Regen doc acAllViewports) (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.") "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on."))) ;; Now turn on pviewportObj2 as well (vla-Display pviewportObj2 :vlax-true) (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.") "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on."))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 22:32
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.