Delete Method

Back to Methods Reference

Deletes a specified object.


VBA : object.Delete Name

VL : (vla-Delete object Name)

(vla-delete (vla-item ssets "$Set"))

  • Object : All Drawing Objects, Block, Dictionary, DimStyle, Group, Hyperlink, Layer, Layout, Linetype, PlotConfiguration , PopupMenuItem, PViewport, RegisteredApplication, SelectionSet, TextStyle, Toolbar, ToolbarItem, UCS, View, Viewport, XRecord
  • Name : The object or objects this method applies to.


When you delete an object in a collection, all remaining items in the collection are reassigned a new index based on the current count. You should therefore avoid loops that delete an object while iterating through the collection.

Although most collections inherit a Delete method, you cannot actually delete collections. Attempting to delete a collection will result in an error, therefore the Delete method has been removed from the documentation for all collections.

ToolbarItem: You can only add or remove toolbar items when the toolbar is visible.

Example :

(defun c:al-select ()


(setq thisdrawing (vla-get-activedocument

(setq ssets (vla-get-selectionsets thisdrawing))

(if (vl-catch-all-error-p 
    (vl-catch-all-apply 'vla-item (list ssets "$Set")))

  (setq newSet (vla-add ssets "$Set"))
    	(vla-delete (vla-item ssets "$Set"))
  	(setq newSet (vla-add ssets "$Set"))


(vla-Select newSet acSelectionSetAll)



The AutoLisp/Visual Lisp/VBA Resource Website
Search the WWW Search AfraLisp

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website