ObjectDBX

Sa Mite Samite

Usenet Archive
Joined
Jul 29, 2003
Messages
17
Reaction score
0
Object DBX vla-open method opens a file and vlax-release-object method release the variable space in the memory. Now. How to CLOSE the opened drawing file? vla-Close method does not work with this type of object and my drawing stays opened until I shutdown the AutoCAD.

Thanks,
Sam
 
There is no close method for objectdbx.
You could consider the objectdbx file like a temporary file. If you want to save it, then use vla-saveas. To open a new file just use vla-open again.
 
Sa Mite Samite said:
message ]
Object DBX vla-open method opens a file and vlax-release-object method release the variable space in the memory. Now. How to CLOSE the opened drawing file?

You just said it :-)

(vlax-release-object)

Assuming there are no other outstanding references to
the AxDbDocument, when you call (vlax-release-object)
on the AxDbdocument, it closes the file and releases
any locks on it.

vla-Close method does not work with this type of object and my
 
Doug and Tony pointed out how to close a dbx doc.
Even after learning the how, I still found myself more comfortable with a reasurring looking statement like (closeDBX oDbxDoc) that would return a comforting message telling me it worked. Guess this classifies as psychotic ....I mean psychological... programming :-) so I can go like (if (closeDBX oDbxDoc "save" "savedByDbx.Dwg")(alert"now i can sleep at night")(alert"hmmm....now what did I do wrong?")) ; gleaned from various ng posts, modified ...or is that mutilated...by mark propst ; thanks to Tony Tanzillo, Luis Esquivel, Michael Puckett, Frank Oquendo, James Buzzbee, Doug Broad et al ; for their unselfish generosity in sharing their knowlege about this undocumented feature set ; Especial thanks to Tony for his many examples which show even a dummy like me how to use Dbx ;google is a goldmine of info on objectDBX ;whatever is lame in the following code is totally my doing ;whatever is good is due to the above mentioned contributors and others posts ; Closes a dbx Document and saves or not. ; Called thus:
; (CloseDbx oDbxDoc 1 "path\\NewName.Dwg"); to save as a new name ;(CloseDbx oDbxDoc 1 nil); to save as existing name ;(CloseDbx oDbxDoc nil nil); to close but not save ;Returns nil on error or failure, 1 on success (defun CloseDbx (inDoc saveYes fname / res ) (if (and inDoc ;(=(Type inDoc)'VLA-OBJECT)..or something to that effect (not(vlax-object-released-p inDoc)) );and (progn ;if asked to save, do so (if SaveYes (saveDbx inDoc fname) ) ;try to release object (if(vl-catch-all-error-p (vl-catch-all-apply 'vlax-release-object (list inDoc) ) (progn ;(princ"\n*****Error releasing Dbx document*****");just for debugging sake nil;return nil on error );pro ;else clean up (progn ;(prind"\nDbx document released") ;just for debugging sake (gc)(gc);i saw this posted by people who should know so it's got to be a good thing! :-) 1;return 1 on success ) ;pro );if );pro (progn ;(prind"Object nil or already released");just for debugging nil );pro );if rtn );close

;based on original code from james buzbee's versions
(defun saveDbx (object oname / res fname)
(or (setq fname oname);if name arg is not nil, try to use it (setq fName(vlax-get-property object 'name));else use existing document name ) (if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke-method (list object 'saveas fName)
))

(progn
;(print"Error saving Dbx")
nil;return value of nil for failure
);progn
(progn
;(princ(strcat "\nSuccessfully saved Dbx: " fname));debug 1;return value of 1 for success );progn );if )

hth
Mark
 
Mark Propst said:
Doug and Tony pointed out how to close a dbx doc.
Even after learning the how, I still found myself more comfortable with a reasurring looking statement like (closeDBX oDbxDoc) that would return a comforting message telling me it worked. Guess this classifies as psychotic ...I mean psychological... programming :-)

Sorry, but I really don't see the point to this.

Why do you feel that you need to be reassured
that the document was closed?

Have you had this problem since birth? :-)
 
You don't close an AxDbDocument. You just discard it,
by releasing the variable assigned to it.
 
"Tony Tanzillo" <tony.tanzillo/at/caddzone/dot/com> wrote:

Sorry, but I really don't see the point to this.

yep, like i said "... this classifies as psychotic..."
Why do you feel that you need to be reassured
that the document was closed?

for the simple fact that since nearly everything i do is wrong I feel like i need to confirm every line!

Have you had this problem since birth? :-)

yep, that and a lot more besides!
:-)

where did you dig that old post up anyway? that was like a year ago or something wasn't it? and I thought *I* had a slow connection!... :-)
 
where did you dig that old post up anyway? that was like a year ago or
something wasn't it? and I thought *I* had a slow connection!... :-)

Hmmm.. It looks like the dates on the messages aren't
right in my newsreader. I reset and downloaded the
newsgroup again, and that fixed it.
 

Latest threads

Back
Top