AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Would you like to be able to delete any entity in your drawing by just double-clicking on it? Try this out :

;CODING STARTS HERE

(vl-load-com)

;**************

(prompt "\nDC-Delete loaded. Do NOT Run.....)

(vlr-mouse-reactor "Delete Object" '((:vlr-beginDoubleClick . DC-Delete)))

(defun DC-Delete (theReactor thePoint / )

(setq objectPoint (car thePoint))

(setq acadDocument (vla-get-activedocument
(vlax-get-acad-object)))
(setq ssets (vla-get-selectionsets acadDocument))

(setq newsset (vla-add ssets "SS1"))

(vla-selectAtPoint newsset (vlax-3D-point objectPoint))

(setq theObject (vla-item newsset 0))

(vla-delete theObject)

(vla-delete (vla-item ssets "SS1"))

(princ)

);defun

;CODING ENDS HERE

Copy and paste this into the Visual Lisp Editor and save it as "DC-Delete.lsp".
Now load the application but do NOT run it.
Double-click on any object in you drawing.
Abracadabra.....it's turned into a rabbit, albeit an invisible one.

Can you see the potental for this type of reactor? Double-click on a text object,
and the text edit box opens. Double-click on a line and the properties dialog opens.
Double-click on your liquor cabinet and the bar opens. Hey, the possibilities are endless.

The AutoLisp/Visual Lisp/VBA Resource Website

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