Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vlax-release-object...cont'd

40 REPLIES 40
Reply
Message 1 of 41
Anonymous
482 Views, 40 Replies

vlax-release-object...cont'd

Some questions arise from R. Robert Bell's 9/18 post on releasing objects.
I'll start with only one to see if there's still interest in this topic.

For background here is the text from the Developer's Guide on releasing
objects...

Just as you can have different variables pointing to the same AutoCAD
entity, you can have multiple VLA-objects pointing to the same drawing
object. You can compare two VLA-objects with the equal function, which
returns T if both objects point to the same drawing object.
As long as a VLA-object points to a drawing object, AutoCAD will keep all
the memory needed for the object. When you no longer need to reference an
object, use the vlax-release-object function to indicate this to AutoCAD:

(vlax-release-object object)

After releasing an object, it is no longer accessible through the VLA-object
pointer. This is similar to closing a file. No memory is necessarily freed
when you issue vlax-release-object, but AutoCAD can reclaim the memory if
needed, once all references to the object have been released.
To test whether or not an object has been released, use the
vlax-object-released-p function:

(vlax-object-released-p object)

This function returns T if the object has been released, nil if it has not.
...

Question; if a variable is set to nil (or declared local) but not released
via vlax-release-object, does this have the same effect as releasing the
object? If not what happens when a pointer is set to nil without releasing
the object first? Help says that the object is no longer accessible through
the pointer when released so if the pointer is set to nil it has no access
either. To see what happens to the pointer when an object is released I ran
this little function:

(defun c:rel ( / acad)
(setq acad (vlax-get-acad-object))
(PRINC "\nacad = ") (PRINC acad)
(vlax-release-object acad)
(PRINC "\nreleased = ") (PRINC (vlax-object-released-p acad))
(PRINC "\nacad = ") (PRINC acad)
(princ)
)

acad = #
released = T
acad = #

...which shows that the pointer "exists" (it's not nil) after the release
but doesn't point to anything.

Anyone want to do a discourse on ActiveX objects?
--

Cliff
40 REPLIES 40
Message 41 of 41
Anonymous
in reply to: Anonymous

"Cliff Middleton" writes:

> Well, at least the old way of doing things is
> still intact. We don't HAVE to use COM objects.

Yep, you can go pretty far with plain ol'
autolisp. I use a couple of activex function (for
solids volume & cdg) but I can't understand why
there are people that whant to change good working
autolisp code to activex nightmare.

> Still, it beats manual drafting (or a stick in
> the eye:).

Sure, but it's sad that autodesk improved in the
(IMO) wrong direction.


--

Eduardo Muñoz

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost