CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

可见属性 (ActiveX)

2023-1-3 01:18| 发布者: admin| 查看: 182| 评论: 0|来自: AutoCAD

摘要: 指定对象或应用程序的可见性。

指定对象或应用程序的可见性。

支持的平台:仅窗口

签名

工 务 局:

object.Visible
对象

类型:所有图形对象应用程序属性引用工具栏

此属性应用于的对象

属性值

只读:否(只写对象除外)Group

类型:布尔

  • True:对象或应用程序可见。
  • False:对象或应用程序不可见。

言论

如果将对象指定为不可见,则无论应用程序可见设置如何,该对象都将不可见。其他因素也可能导致物体不可见;例如,如果对象的图层关闭或冻结,则不会显示该对象。

通过将应用程序指定为不可见,您可以在后台运行任务,而无需查看组件。

例子

工 务 局:

Sub Example_Visible()
    ' This example creates a line in model space.
    ' It then turns visibility of the line on or off, depending
    ' on the user's choice.
    
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    ' Create the line
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll
    
    Dim response As Integer
    response = MsgBox("Do you want the new line to be visible?", vbYesNoCancel + vbQuestion)
    Select Case response
    Case vbYes
        lineObj.Visible = True
    Case vbNo
        lineObj.Visible = False
    Case vbCancel
        Exit Sub
    End Select
    
    ThisDrawing.Regen True
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Visible()
    ;; This example creates a line in model space.
    ;; It then turns visibility of the line on or off, depending
    ;; on the user's choice.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the line
    (setq startPoint (vlax-3d-point 2 2 0)
          endPoint (vlax-3d-point 4 4 0))
  
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (setq kwordList "Yes No")
    (vla-InitializeUserInput (vla-get-Utility doc) 1 kwordList)
    (setq response (vla-GetKeyword (vla-get-Utility doc) "Do you want the new line to be visible? [Yes/No]: "))

    (cond
        ((= response "Yes") (vla-put-Visible lineObj :vlax-true))
        ((= response "No") (vla-put-Visible lineObj :vlax-false))
    )
    
    (vla-Regen doc :vlax-true)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 15:02

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部