About Updating the Geometry in the Document Window (ActiveX)

Many of the actions you perform through AutoCAD ActiveX Automation modify what is displayed in the AutoCAD drawing.

Not all of these actions immediately update the display of the drawing. This is designed so you can make several changes to the drawing without waiting for the display to be updated after every single action. Instead, you can bundle your actions together and make a single call to update the display when you have finished.

The methods that will update the display are Update and Regen.

The Update method updates the display of a single object only. The Regen method regenerates the entire drawing and recomputes the screen coordinates and view resolution for all objects. It also reindexes the drawing database for optimum display and object selection performance.

Update the display of a single object

This example creates a circle. It then updates the circle using the Update method so the circle is visible in AutoCAD.

AutoLISP
(vl-load-com)
(defun c:Ch3_UpdateDisplay()
    (setq acadObj (vlax-get-acad-object)
          doc (vla-get-ActiveDocument acadObj)
          moSpace (vla-get-ModelSpace doc))
    
    (setq center (vlax-3d-point 1 1 0)
          radius 1)

    ;; Create the circle
    (setq circleObj (vla-AddCircle moSpace center radius))

    ;; Update the circle
    (vla-Update circleObj)
)
VBA (AutoCAD Only)
Sub Ch3_UpdateDisplay()
  Dim circleObj As AcadCircle
  Dim center(0 To 2) As Double
  Dim radius As Double
  center(0) = 1: center(1) = 1: center(2) = 0
  radius = 1

  ' Create the circle
  Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)

  ' Update the circle
  circleObj.Update
End Sub