CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

左下角属性 (ActiveX)

2023-1-3 11:32| 发布者: admin| 查看: 479| 评论: 0|来自: AutoCAD

摘要: 获取当前活动视区的左下角。

获取当前活动视区的左下角。

支持的平台:仅窗口

签名

工 务 局:

object.LowerLeftCorner
对象

类型:视口

此属性适用的对象。

属性值

只读:是的

类型:变体(双精度的双元素数组)

表示当前活动视区的左下角的 2D 坐标。

言论

属性表示视区在显示器上的图形位置。这些属性定义如下:LowerLeftCornerUpperRightCorner



视口 1—= (0, .5),= (.5, 1)LowerLeftCornerUpperRightCorner

视口 2—= (.5, .5),= (1, 1)LowerLeftCornerUpperRightCorner

视口 3—= (0, 0),= (.5, .5)LowerLeftCornerUpperRightCorner

视口 4—= (.5, 0),= (1, .5)LowerLeftCornerUpperRightCorner

例子

工 务 局:

Sub Example_LowerLeftCorner()
    ' This example creates a new viewport and makes it active.
    ' Then it splits the viewport into four windows.
    ' It then finds the lower-left corner of each of the
    ' windows.
    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
    
    ' Iterate through the viewports. For each viewport,
    ' make that viewport active and display the coordinates
    ' of the lower left corner.
    Dim entry As AcadViewport
    Dim lowerLeft As Variant
    For Each entry In ThisDrawing.Viewports
        entry.GridOn = True
        ThisDrawing.ActiveViewport = entry
        lowerLeft = entry.LowerLeftCorner
        MsgBox "The lower left corner of this viewport is " & lowerLeft(0) & ", " & lowerLeft(1), , "LowerLeftCorner Example"
        entry.GridOn = False
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LowerLeftCorner()
    ;; This example creates a new viewport and makes it active.
    ;; Then it splits the viewport into four windows.
    ;; It then finds the lower-left corner of each of the
    ;; windows.
    (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)
    
    ;; Iterate through the viewports. For each viewport,
    ;; make that viewport active and display the coordinates
    ;; of the lower left corner.
    (vlax-for entry (vla-get-Viewports doc)
        (vla-put-GridOn entry :vlax-true)
        (vla-put-ActiveViewport doc entry)
        (setq lowerLeft (vlax-safearray->list (vlax-variant-value (vla-get-LowerLeftCorner entry))))
        (alert (strcat "The lower left corner of this viewport is " (rtos (nth 0 lowerLeft) 2) ", " (rtos (nth 1 lowerLeft) 2)))
        (vla-put-GridOn entry :vlax-false)
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 13:19

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部