CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

ActivePViewport Property (ActiveX)

2023-1-4 00:00| 发布者: admin| 查看: 440| 评论: 0|来自: AutoCAD

摘要: 指定图形的活动图纸空间视口。

指定图形的活动图纸空间视口。

支持的平台:仅窗口

签名

工 务 局:

object.ActivePViewport
对象

类型:文档

此属性适用的对象。

属性值

只读:

类型:光伏港

活动的图纸空间视口。

言论

必须使用此属性将视区设置为活动状态,然后才能看到对视区的任何更改。

例子

工 务 局:

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)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 21:02

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部