Visible Example

AEC Auto

Visible Example

Sub Example_Visible_AecBaseObject()

   ' This example adds an AecPolygon object to the current drawing,
   ' displays the object, then turns the object's Visible property
   ' to False and redisplays the drawing.

    Dim obj As AcadObject
    Dim pt As Variant
    Dim polygon As AecPolygon

    ' Add an AecPolygon object to the drawing.
    Set polygon = ThisDrawing.ModelSpace.AddCustomObject("AecPolygon")

    'Select a location for the object onscreen.
    pt = ThisDrawing.Utility.GetPoint(, "Select the insertion point:")
    If Err.Number  0 Then
        MsgBox ("error when getting a point." & vbCrLf)
        Exit Sub
    End If

    ' Place the object at the specified point, then display
    ' a message so that users can see the object.
    polygon.Location = pt
    polygon.Update
    MsgBox ("AecPolygon added to drawing. Now you see it...")

    ' Make the object invisible, then display a message so that
    ' the drawing is visible and users can see that the
    ' object is no longer visible.
    polygon.Visible = False
    polygon.Update    
    MsgBox ("...and now you don't.")

    ' Make the object visible again, so that users can manipulate
    ' it through the user interface.
    polygon.Visible = True
    polygon.Update

End Sub