指定图形的活动图纸空间视口。 支持的平台:仅窗口 言论必须使用此属性将视区设置为活动状态,然后才能看到对视区的任何更改。 例子工 务 局: Sub Example_ActivePViewport() Dim newPViewport As AcadPViewport Dim centerPoint(0 To 2) As Double Dim height As Double Dim width As Double height = 5# width = 5# centerPoint(0) = 5#: centerPoint(1) = 5#: centerPoint(2) = 0# ' Create a paper space Viewport object ThisDrawing.ActiveSpace = acPaperSpace Set newPViewport = ThisDrawing.PaperSpace.AddPViewport(centerPoint, width, height) ZoomAll newPViewport.DISPLAY (True) ' Before making a paper space Viewport active, ' the mspace property needs to be True ThisDrawing.mspace = True ThisDrawing.ActivePViewport = newPViewport End Sub Visual LISP: (vl-load-com) (defun c:Example_ActivePViewport() (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq centerPoint (vlax-3d-point 5 5 0) height 5.0 width 5.0) ;; Create a paper space Viewport object (vla-put-ActiveSpace doc acPaperSpace) (setq paperSpace (vla-get-PaperSpace doc)) (setq newPViewport (vla-AddPViewport paperSpace centerPoint width height)) (vla-ZoomAll acadObj) (vla-Display newPViewport :vlax-true) ;; Before making a paper space Viewport active, ;; the mspace property needs to be True (vla-put-MSpace doc :vlax-true) (vla-put-ActivePViewport doc newPViewport) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:15
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.