Release Object

Function Syntax (LM:ReleaseObject <obj>)
Current Version 1.0
Arguments
Symbol Type Description
obj VLA-Object VLA-Object to be released from memory
Returns
Type Description
Boolean T if object was successfully released, else nil

Program Description

This subfunction releases a VLA-Object from memory via plentiful error trapping.

The supplied VLA-Object argument is checked for a non-nil value and whether it indeed points to data of a VLA-Object type. Furthermore, should these preliminary checks be validated, the VLA-Object is checked as to whether it has already been released, and, should this be passed, the operation to release the object itself is wrapped in a function to catch any exceptions which may arise.

Select all
;;------------------=={ Release Object }==--------------------;;
;;                                                            ;;
;;  Releases a VLA Object from memory via plentiful error     ;;
;;  trapping                                                  ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2010 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  obj - VLA Object to be released from memory               ;;
;;------------------------------------------------------------;;
;;  Returns:  T if Object Released, else nil                  ;;
;;------------------------------------------------------------;;

(defun LM:ReleaseObject ( obj )
    (and obj (eq 'VLA-OBJECT (type obj)) (not (vlax-object-released-p obj))
        (not
            (vl-catch-all-error-p 
                (vl-catch-all-apply 'vlax-release-object (list obj))
            )
        )
    )
)

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010