CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

拆分方法 (ActiveX)

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

摘要: 将视口拆分为给定数量的视图。

将视口拆分为给定数量的视图。

支持的平台:仅窗口

签名

工 务 局:

object.Split NumWins
对象

类型:视口

此方法适用的对象。

数字赢

访问:仅输入

类型:枚举AcViewportSplitType

  • acViewport2Horizontal
  • acViewport2Vertical
  • acViewport3Above
  • acViewport3Below
  • acViewport3Horizontal
  • acViewport3Left
  • acViewport3Right
  • acViewport3Vertical
  • acViewport4

返回值(RetVal)

无返回值。

言论

尽管已调用该方法,但在使用该属性使视区处于活动状态之前,更改不会显示。即使视口在调用 to 之前处于活动状态,这也是必需的。SplitActiveViewportSplit

视区不必处于活动状态才能使此方法正常工作,但是,必须将其重置为活动才能看到此方法的结果。

例子

工 务 局:

Sub Example_Split()
    ' This example creates a new viewport and makes it active.
    ' Then it splits the viewport into four windows.
    ' It then takes one of the four windows, and splits that
    ' window horizontally in half.
    Dim newViewport As AcadViewport
       
    ' Create a new viewport and make it active
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport
    
    ' Split the viewport in four windows
    newViewport.Split acViewport4
    
    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport
    
    ' Note that current drawing layout will show four windows.
    ' However, only one of the windows will be active.
    ' The following code sets the lower-left corner window
    ' to be the active window and then splits that
    ' window into two horizontal windows.
    Dim entry
    For Each entry In ThisDrawing.Viewports
        If entry.name = "TESTVIEWPORT" Then
            Dim lowerLeft
            lowerLeft = entry.LowerLeftCorner
            If lowerLeft(0) = 0 And lowerLeft(1) = 0 Then
                Set newViewport = entry
                Exit For
            End If
        End If
    Next
    newViewport.Split acViewport2Horizontal
    ThisDrawing.ActiveViewport = newViewport
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Split()
    ;; This example creates a new viewport and makes it active.
    ;; Then it splits the viewport into four windows.
    ;; It then takes one of the four windows, and splits that
    ;; window horizontally in half.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
       
    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "TESTVIEWPORT"))
    (vla-put-ActiveViewport doc newViewport)
    
    ;; Split the viewport in four windows
    (vla-Split newViewport acViewport4)
    
    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)
    
    ;; Note that current drawing layout will show four windows.
    ;; However, only one of the windows will be active.
    ;; The following code sets the lower-left corner window
    ;; to be the active window and then splits that
    ;; window into two horizontal windows.
    (vlax-for entry (vla-get-Viewports doc)
        (if (= (vla-get-Name entry) "TESTVIEWPORT")
            (progn
                (setq lowerLeft (vlax-variant-value (vla-get-LowerLeftCorner entry)))

                (if (and (= (vlax-safearray-get-element lowerLeft 0) 0)
                         (= (vlax-safearray-get-element lowerLeft 1) 0))
                    (setq newViewport entry)
                )
            )
        )
    )

    (vla-Split newViewport acViewport2Horizontal)
    (vla-put-ActiveViewport doc newViewport)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 18:00

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部