Specifies the visibility of an object or the application.
Supported platforms: Windows only
VBA:
object.Visible
Type: All drawing objects, Application, AttributeReference, Group, Toolbar
The objects this property applies to
Read-only: No (except for a Group object which is write-only)
Type: Boolean
If you specify an object to be invisible, it will be invisible regardless of the application visible setting. Other factors can also cause an object to be invisible; for example, an object will not be displayed if its layer is off or frozen.
Specifying the application to be invisible allows you to run tasks in the background without having to see the component.
VBA:
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)
)