ObjectDBX and saving.

ObjectDBX and saving.

Anonymous
Not applicable
447 Views
21 Replies
Message 1 of 22

ObjectDBX and saving.

Anonymous
Not applicable
Hi all, and help!
I am trying to save a document after having altered the path
of an attached image file, using ObjectDBX.
Everything is smooth until it comes time to save and close.
The path is indeed being altered but I'm having a hard time
grasping what kind of argument the save method wants.
Since the documentation is "VBA and ActiveX centric",
I'm hearing Twighlight Zone, and X-files theme music
as I try to apply it.
The sticking point is at ***, at the bottom of
the hastily written fragment below. Any help would
sure be appreciated.

(defun process (pathhandname)
(setq dbxdoc
(vla-GetInterfaceObject
(vlax-get-acad-object)
"ObjectDBX.AxDbDocument"
)
)
(vla-open dbxdoc pathhandname)
(setq mdl (vla-get-modelspace dbxdoc))
(setq lis nil)
(vlax-for thing mdl (setq lis (cons thing lis)))
(setq ilis nil)
(foreach obj lis (if (= "AcDbRasterImage" (vla-get-objectname
obj))(setq ilis (cons obj ilis))))
(setq k 0 )
(while (< k (length ilis))
(setq imagefile (vla-get-imagefile (nth k ilis))
pieces (parse "\\" imagefile)
newimagefile (strcat newpath (last pieces))
)
(vla-put-imagefile (nth k ilis) newimagefile)
(setq k (1+ k))
);
(vla-save dbxdoc);*** what do we want here?
(vla-close dbxdoc);*** or, what kind of argument am I supposed to
supply?
(vlax-release-object dbxdoc)
)
0 Likes
448 Views
21 Replies
Replies (21)
Message 2 of 22

Anonymous
Not applicable
Here is my latest attempt and the error it generates:

.
.
..............
(vla-put-imagefile (nth k ilis) newimagefile)
(setq k (1+ k))
)
(vla-close :vlax-true pathhandname);***
(vlax-release-object dbxdoc)
)

;the line with the *** produces:
; error: bad argument type: VLA-OBJECT :vlax-true

;yet this is the argument order suggested in help for
;the close method

;but since that help is, again, geared for ActiveX we attempt


(vla-close dbxdoc :vlax-true pathhandname);***

;yielding the error

;error: ActiveX Server returned the error: unknown name: Close

1. Again, any suggestions?

2. Is write capability for ObjectDBX a false assumption?




On Thu, 24 Aug 2000 15:00:16 +0000, tom_brabant_jr_@hotmail.com (tom
brabant jr) wrote:

>Hi all, and help!
>I am trying to save a document after having altered the path
>of an attached image file, using ObjectDBX.
>Everything is smooth until it comes time to save and close.
>The path is indeed being altered but I'm having a hard time
>grasping what kind of argument the save method wants.
>Since the documentation is "VBA and ActiveX centric",
>I'm hearing Twighlight Zone, and X-files theme music
>as I try to apply it.
> The sticking point is at ***, at the bottom of
>the hastily written fragment below. Any help would
>sure be appreciated.
>
>(defun process (pathhandname)
>(setq dbxdoc
> (vla-GetInterfaceObject
> (vlax-get-acad-object)
> "ObjectDBX.AxDbDocument"
> )
> )
> (vla-open dbxdoc pathhandname)
> (setq mdl (vla-get-modelspace dbxdoc))
> (setq lis nil)
> (vlax-for thing mdl (setq lis (cons thing lis)))
> (setq ilis nil)
> (foreach obj lis (if (= "AcDbRasterImage" (vla-get-objectname
>obj))(setq ilis (cons obj ilis))))
> (setq k 0 )
> (while (< k (length ilis))
> (setq imagefile (vla-get-imagefile (nth k ilis))
> pieces (parse "\\" imagefile)
> newimagefile (strcat newpath (last pieces))
> )
> (vla-put-imagefile (nth k ilis) newimagefile)
> (setq k (1+ k))
> );
> (vla-save dbxdoc);*** what do we want here?
> (vla-close dbxdoc);*** or, what kind of argument am I supposed to
>supply?
> (vlax-release-object dbxdoc)
> )
0 Likes
Message 3 of 22

Anonymous
Not applicable
Head over to Tony T's web site (www.caddzone.com) and have a look in the
Free Stuff section for a set of ObjectDBX routines written in LISP. I think
he calls it Vl-DBX.zip Perhaps it'll clear up some issues for you.

--
Attitudes are contagious. Is yours worth catching?
http://www.acadx.com

"tom brabant jr" wrote in message
news:39a56ceb.21014433@discussion.autodesk.com...
> Here is my latest attempt and the error it generates:
0 Likes
Message 4 of 22

Anonymous
Not applicable
Thank you, Frank.
And excuse me, let me rephrase item two from my earlier post

2. Is close-saving-changes supported by ObjectDBX?

(I've already seen that it is write capable.)

Tony's BGREP.LSP file you mentioned is what got me started to
begin with. Looked at the other two items in the zip file
and as far as I can tell, though CopyBlock does indeed make
changes, they are only to the Active Document.
This is a last fragment of a general action that includes
a nice, working recursive descent of a directory tree.
I'm anxious to complete the task and am willing to
post all of it. I don't sell software - I'm in production, and
need to run this and similar actions on our entire server.
Anybody wanna get involved?

On Thu, 24 Aug 2000 18:49:29 +0000, "Frank Oquendo"
wrote:

>Head over to Tony T's web site (www.caddzone.com) and have a look in the
>Free Stuff section for a set of ObjectDBX routines written in LISP. I think
>he calls it Vl-DBX.zip Perhaps it'll clear up some issues for you.
>
>--
>Attitudes are contagious. Is yours worth catching?
>http://www.acadx.com
>
>"tom brabant jr" wrote in message
>news:39a56ceb.21014433@discussion.autodesk.com...
>> Here is my latest attempt and the error it generates:
>
0 Likes
Message 5 of 22

Anonymous
Not applicable
Looking at AxDbDocument in the Object Browser does not reveal a Close
method, only Save and SaveAs. I assume you simply save you changes then open
the next document. When you've processed the last one, release the
AxDbDocument object.

--
Attitudes are contagious. Is yours worth catching?
http://www.acadx.com

"tom brabant jr" wrote in message
news:39a57838.23907453@discussion.autodesk.com...
> Thank you, Frank.
> And excuse me, let me rephrase item two from my earlier post
>
> 2. Is close-saving-changes supported by ObjectDBX?
>
> (I've already seen that it is write capable.)
0 Likes
Message 6 of 22

Anonymous
Not applicable
Tom - An AxDbDocument cannot be 'closed'. You call
the Save method to save the file to the current
filename, or SaveAs to save it to a different
filename. You don't have to 'close' the document
afterwards before opening another one, you just
call the Open method. When you're done with the
document, just use (vlax-release-object Doc) to
release it, and that's it.

Keep in mind that saving a modified DBX document
will cause it to loose its thumbnail preview,
unless you use my AcadX ActiveX server.

tom brabant jr wrote:
>
> Thank you, Frank.
> And excuse me, let me rephrase item two from my earlier post
>
> 2. Is close-saving-changes supported by ObjectDBX?
>
> (I've already seen that it is write capable.)
>
> Tony's BGREP.LSP file you mentioned is what got me started to
> begin with. Looked at the other two items in the zip file
> and as far as I can tell, though CopyBlock does indeed make
> changes, they are only to the Active Document.
> This is a last fragment of a general action that includes
> a nice, working recursive descent of a directory tree.
> I'm anxious to complete the task and am willing to
> post all of it. I don't sell software - I'm in production, and
> need to run this and similar actions on our entire server.
> Anybody wanna get involved?
>
> On Thu, 24 Aug 2000 18:49:29 +0000, "Frank Oquendo"
> wrote:
>
> >Head over to Tony T's web site (www.caddzone.com) and have a look in the
> >Free Stuff section for a set of ObjectDBX routines written in LISP. I think
> >he calls it Vl-DBX.zip Perhaps it'll clear up some issues for you.
> >
> >--
> >Attitudes are contagious. Is yours worth catching?
> >http://www.acadx.com
> >
> >"tom brabant jr" wrote in message
> >news:39a56ceb.21014433@discussion.autodesk.com...
> >> Here is my latest attempt and the error it generates:
> >

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 7 of 22

Anonymous
Not applicable
Thanks, guys.
Close was definitely a wrong turn.
Returning to original post with vla-save.

Noting that the open method takes on an
additional requried object when used with
Objectdbx (The interface rig precedes the
path/drawing), we try:

(vla-open dbxdoc pathhandname)
.
.
.
(vla-save dbxdoc)

since the save method normally
takes no arguments {just copying
an apparent pattern}

and receive my original error message

; error: Automation Error. Description was not provided.

try to throw in path

(vla-save dbxdoc pathhandname)

; error: Too many actual parameters
{which is understandable, but I'm scattershotting now}

;and the another shot, completely ridiculous
;but what the hell...........

error: bad argument type: VLA-OBJECT
"S:\\lisp\\vl\\tempxrpath\\b1.dwg"

Which cycles back to the mystery of my original post,
and the question I should have included in it:

in error message

"; error: Automation Error. Description was not provided."

What kind of description is it looking for?

On Thu, 24 Aug 2000 15:00:16 +0000, tom_brabant_jr_@hotmail.com (tom
brabant jr) wrote:

>Hi all, and help!
>I am trying to save a document after having altered the path
>of an attached image file, using ObjectDBX.
>Everything is smooth until it comes time to save and close.
>The path is indeed being altered but I'm having a hard time
>grasping what kind of argument the save method wants.
>Since the documentation is "VBA and ActiveX centric",
>I'm hearing Twighlight Zone, and X-files theme music
>as I try to apply it.
> The sticking point is at ***, at the bottom of
>the hastily written fragment below. Any help would
>sure be appreciated.
>
>(defun process (pathhandname)
>(setq dbxdoc
> (vla-GetInterfaceObject
> (vlax-get-acad-object)
> "ObjectDBX.AxDbDocument"
> )
> )
> (vla-open dbxdoc pathhandname)
> (setq mdl (vla-get-modelspace dbxdoc))
> (setq lis nil)
> (vlax-for thing mdl (setq lis (cons thing lis)))
> (setq ilis nil)
> (foreach obj lis (if (= "AcDbRasterImage" (vla-get-objectname
>obj))(setq ilis (cons obj ilis))))
> (setq k 0 )
> (while (< k (length ilis))
> (setq imagefile (vla-get-imagefile (nth k ilis))
> pieces (parse "\\" imagefile)
> newimagefile (strcat newpath (last pieces))
> )
> (vla-put-imagefile (nth k ilis) newimagefile)
> (setq k (1+ k))
> );
> (vla-save dbxdoc);*** what do we want here?
> (vla-close dbxdoc);*** or, what kind of argument am I supposed to
>supply?
> (vlax-release-object dbxdoc)
> )
0 Likes
Message 8 of 22

Anonymous
Not applicable
vla- methods are for AutoCAD ActiveX, not ObjectDBX.

While many of them work, some of them may not, because
they wrap a predefined DISPID that may not be the same
for the ObjectDBX interface.

Change this:

(vla-save )

to this:

(vlax-invoke-method 'Save)

Make sure that you're not working with a document
that has been opened in the drawing editor (after
it's loaded into the AxDbDocuemnt).

There are some pitfalls involving the use of ObjectDBX.
One of them, is that there is no enforcement of file
locking (e.g., when you open a drawing in an ObjectDBX
document, the drawing file is not 'locked', and it can
be opened concurrently by any AutoCAD session).

You can set the file attributes of the drawing to
read-only while it's open, to prevent someone else
from modifying it.

tom brabant jr wrote:
>
> Thanks, guys.
> Close was definitely a wrong turn.
> Returning to original post with vla-save.
>
> Noting that the open method takes on an
> additional requried object when used with
> Objectdbx (The interface rig precedes the
> path/drawing), we try:
>
> (vla-open dbxdoc pathhandname)
> .
> .
> .
> (vla-save dbxdoc)
>
> since the save method normally
> takes no arguments {just copying
> an apparent pattern}
>
> and receive my original error message
>
> ; error: Automation Error. Description was not provided.
>
> try to throw in path
>
> (vla-save dbxdoc pathhandname)
>
> ; error: Too many actual parameters
> {which is understandable, but I'm scattershotting now}
>
> ;and the another shot, completely ridiculous
> ;but what the hell...........
>
> error: bad argument type: VLA-OBJECT
> "S:\\lisp\\vl\\tempxrpath\\b1.dwg"
>
> Which cycles back to the mystery of my original post,
> and the question I should have included in it:
>
> in error message
>
> "; error: Automation Error. Description was not provided."
>
> What kind of description is it looking for?
>
> On Thu, 24 Aug 2000 15:00:16 +0000, tom_brabant_jr_@hotmail.com (tom
> brabant jr) wrote:
>
> >Hi all, and help!
> >I am trying to save a document after having altered the path
> >of an attached image file, using ObjectDBX.
> >Everything is smooth until it comes time to save and close.
> >The path is indeed being altered but I'm having a hard time
> >grasping what kind of argument the save method wants.
> >Since the documentation is "VBA and ActiveX centric",
> >I'm hearing Twighlight Zone, and X-files theme music
> >as I try to apply it.
> > The sticking point is at ***, at the bottom of
> >the hastily written fragment below. Any help would
> >sure be appreciated.
> >
> >(defun process (pathhandname)
> >(setq dbxdoc
> > (vla-GetInterfaceObject
> > (vlax-get-acad-object)
> > "ObjectDBX.AxDbDocument"
> > )
> > )
> > (vla-open dbxdoc pathhandname)
> > (setq mdl (vla-get-modelspace dbxdoc))
> > (setq lis nil)
> > (vlax-for thing mdl (setq lis (cons thing lis)))
> > (setq ilis nil)
> > (foreach obj lis (if (= "AcDbRasterImage" (vla-get-objectname
> >obj))(setq ilis (cons obj ilis))))
> > (setq k 0 )
> > (while (< k (length ilis))
> > (setq imagefile (vla-get-imagefile (nth k ilis))
> > pieces (parse "\\" imagefile)
> > newimagefile (strcat newpath (last pieces))
> > )
> > (vla-put-imagefile (nth k ilis) newimagefile)
> > (setq k (1+ k))
> > );
> > (vla-save dbxdoc);*** what do we want here?
> > (vla-close dbxdoc);*** or, what kind of argument am I supposed to
> >supply?
> > (vlax-release-object dbxdoc)
> > )

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 9 of 22

Anonymous
Not applicable
Tony, Frank, thanks again.

Made sure drawing was not open in the editor.

(vlax-invoke-method dbxdoc 'save)

error: Automation Error. Description was not provided.
so, exact same error.

So hey all:
Tried something I should have tried
twenty-four, twenty-four hours ago:
I am now elated,

because:

(vlax-invoke-method dbxdoc 'saveas "b2")

and

(vla-saveas dbxdoc "b2")

both work, and we can work with that.

Still curious, though:
Anybody out there know what is meant by

"; error: Automation Error. Description was not provided."

Autodesk?
On Thu, 24 Aug 2000 23:23:30 +0000, Tony Tanzillo
wrote:

>vla- methods are for AutoCAD ActiveX, not ObjectDBX.
>
>While many of them work, some of them may not, because
>they wrap a predefined DISPID that may not be the same
>for the ObjectDBX interface.
>
>Change this:
>
> (vla-save )
>
>to this:
>
> (vlax-invoke-method 'Save)
>
>Make sure that you're not working with a document
>that has been opened in the drawing editor (after
>it's loaded into the AxDbDocuemnt).
>
>There are some pitfalls involving the use of ObjectDBX.
>One of them, is that there is no enforcement of file
>locking (e.g., when you open a drawing in an ObjectDBX
>document, the drawing file is not 'locked', and it can
>be opened concurrently by any AutoCAD session).
>
>You can set the file attributes of the drawing to
>read-only while it's open, to prevent someone else
>from modifying it.
>
>tom brabant jr wrote:
>>
>> Thanks, guys.
>> Close was definitely a wrong turn.
>> Returning to original post with vla-save.
>>
>> Noting that the open method takes on an
>> additional requried object when used with
>> Objectdbx (The interface rig precedes the
>> path/drawing), we try:
>>
>> (vla-open dbxdoc pathhandname)
>> .
>> .
>> .
>> (vla-save dbxdoc)
>>
>> since the save method normally
>> takes no arguments {just copying
>> an apparent pattern}
>>
>> and receive my original error message
>>
>> ; error: Automation Error. Description was not provided.
>>
>> try to throw in path
>>
>> (vla-save dbxdoc pathhandname)
>>
>> ; error: Too many actual parameters
>> {which is understandable, but I'm scattershotting now}
>>
>> ;and the another shot, completely ridiculous
>> ;but what the hell...........
>>
>> error: bad argument type: VLA-OBJECT
>> "S:\\lisp\\vl\\tempxrpath\\b1.dwg"
>>
>> Which cycles back to the mystery of my original post,
>> and the question I should have included in it:
>>
>> in error message
>>
>> "; error: Automation Error. Description was not provided."
>>
>> What kind of description is it looking for?
>>
>> On Thu, 24 Aug 2000 15:00:16 +0000, tom_brabant_jr_@hotmail.com (tom
>> brabant jr) wrote:
>>
>> >Hi all, and help!
>> >I am trying to save a document after having altered the path
>> >of an attached image file, using ObjectDBX.
>> >Everything is smooth until it comes time to save and close.
>> >The path is indeed being altered but I'm having a hard time
>> >grasping what kind of argument the save method wants.
>> >Since the documentation is "VBA and ActiveX centric",
>> >I'm hearing Twighlight Zone, and X-files theme music
>> >as I try to apply it.
>> > The sticking point is at ***, at the bottom of
>> >the hastily written fragment below. Any help would
>> >sure be appreciated.
>> >
>> >(defun process (pathhandname)
>> >(setq dbxdoc
>> > (vla-GetInterfaceObject
>> > (vlax-get-acad-object)
>> > "ObjectDBX.AxDbDocument"
>> > )
>> > )
>> > (vla-open dbxdoc pathhandname)
>> > (setq mdl (vla-get-modelspace dbxdoc))
>> > (setq lis nil)
>> > (vlax-for thing mdl (setq lis (cons thing lis)))
>> > (setq ilis nil)
>> > (foreach obj lis (if (= "AcDbRasterImage" (vla-get-objectname
>> >obj))(setq ilis (cons obj ilis))))
>> > (setq k 0 )
>> > (while (< k (length ilis))
>> > (setq imagefile (vla-get-imagefile (nth k ilis))
>> > pieces (parse "\\" imagefile)
>> > newimagefile (strcat newpath (last pieces))
>> > )
>> > (vla-put-imagefile (nth k ilis) newimagefile)
>> > (setq k (1+ k))
>> > );
>> > (vla-save dbxdoc);*** what do we want here?
>> > (vla-close dbxdoc);*** or, what kind of argument am I supposed to
>> >supply?
>> > (vlax-release-object dbxdoc)
>> > )
>
>--
>
>Checkout the AcadX(tm) ActiveX Extension Library at:
>
> http://www.caddzone.com/acadx/acadx.htm
>
>/*********************************************************/
>/* Tony Tanzillo Design Automation Consulting */
>/* Programming & Customization for AutoCAD & Compatibles */
>/* ----------------------------------------------------- */
>/* tony.tanzillo@worldnet.att.net */
>/* http://www.caddzone.com */
>/*********************************************************/
0 Likes
Message 10 of 22

Anonymous
Not applicable
Would you mind showing us the code you're using to create your DBXDOC
variable?

BTW, I must agree with Tony: do not use *any* of the VLA methods with an
ObjectDBX document. VLA methods are wrappers for AutoCAD's object model.
While ObjectDBX and AutoCAD look a whole lot alike, the fact remains they
are not one and the same. As Tony has pointed out in the past, VLA anything
references the AutoCAD 2000 Type Library. ObjectDBX has one of its own. If
you'd like to shorten the commands you're using (VLAX-INVOKE, yada, yada is
a lot of typing), take a look at the VLAX-IMPORT-TYPE-LIBRARY function. It
lets you define your own prefixes for methods, properties and constants
contained by that type library. It would be quite convenient to have
functions like dbx-Save, etc.

--
Attitudes are contagious. Is yours worth catching?
http://www.acadx.com

"tom brabant jr" wrote in message
news:39a68f48.6381620@discussion.autodesk.com...
> Tony, Frank, thanks again.
>
> Made sure drawing was not open in the editor.
>
> (vlax-invoke-method dbxdoc 'save)
>
> error: Automation Error. Description was not provided.
> so, exact same error.
>
> So hey all:
> Tried something I should have tried
> twenty-four, twenty-four hours ago:
> I am now elated,
>
> because:
>
> (vlax-invoke-method dbxdoc 'saveas "b2")
>
> and
>
> (vla-saveas dbxdoc "b2")
>
> both work, and we can work with that.
>
> Still curious, though:
> Anybody out there know what is meant by
>
> "; error: Automation Error. Description was not provided."
>
> Autodesk?
0 Likes
Message 11 of 22

Anonymous
Not applicable
Thanks for warning about vla-*.
My colleague, Thomas S. Howe, set up the type
library for "AxDb15.tlb" with a nice alias
while we were struggling with this yesterday.
(we were trying everything)
Since we, once again, saw the same error message(s),
we didn't mess a whole lot.

As far as the code goes, it's fairly lifted from
Tony's BGREP.LSP and posting it would technically
be a violation of his copyright (Wanna waive?).
When I mentioned posting the whole shebang earlier
in thread, I was going to reference that aspect
to his web site.

On Fri, 25 Aug 2000 15:29:34 +0000, "Frank Oquendo"
wrote:

>Would you mind showing us the code you're using to create your DBXDOC
>variable?
>
>BTW, I must agree with Tony: do not use *any* of the VLA methods with an
>ObjectDBX document. VLA methods are wrappers for AutoCAD's object model.
>While ObjectDBX and AutoCAD look a whole lot alike, the fact remains they
>are not one and the same. As Tony has pointed out in the past, VLA anything
>references the AutoCAD 2000 Type Library. ObjectDBX has one of its own. If
>you'd like to shorten the commands you're using (VLAX-INVOKE, yada, yada is
>a lot of typing), take a look at the VLAX-IMPORT-TYPE-LIBRARY function. It
>lets you define your own prefixes for methods, properties and constants
>contained by that type library. It would be quite convenient to have
>functions like dbx-Save, etc.
>
>--
>Attitudes are contagious. Is yours worth catching?
>http://www.acadx.com
>
>"tom brabant jr" wrote in message
>news:39a68f48.6381620@discussion.autodesk.com...
>> Tony, Frank, thanks again.
>>
>> Made sure drawing was not open in the editor.
>>
>> (vlax-invoke-method dbxdoc 'save)
>>
>> error: Automation Error. Description was not provided.
>> so, exact same error.
>>
>> So hey all:
>> Tried something I should have tried
>> twenty-four, twenty-four hours ago:
>> I am now elated,
>>
>> because:
>>
>> (vlax-invoke-method dbxdoc 'saveas "b2")
>>
>> and
>>
>> (vla-saveas dbxdoc "b2")
>>
>> both work, and we can work with that.
>>
>> Still curious, though:
>> Anybody out there know what is meant by
>>
>> "; error: Automation Error. Description was not provided."
>>
>> Autodesk?
>
0 Likes
Message 12 of 22

Anonymous
Not applicable
oops, rather only the couple of lines
you're asking about are "lifted".
The directory recursion engine, and the
rest are original (and, again available
to anyone).
On Fri, 25 Aug 2000 15:29:34 +0000, "Frank Oquendo"
wrote:

>Would you mind showing us the code you're using to create your DBXDOC
>variable?
>
>BTW, I must agree with Tony: do not use *any* of the VLA methods with an
>ObjectDBX document. VLA methods are wrappers for AutoCAD's object model.
>While ObjectDBX and AutoCAD look a whole lot alike, the fact remains they
>are not one and the same. As Tony has pointed out in the past, VLA anything
>references the AutoCAD 2000 Type Library. ObjectDBX has one of its own. If
>you'd like to shorten the commands you're using (VLAX-INVOKE, yada, yada is
>a lot of typing), take a look at the VLAX-IMPORT-TYPE-LIBRARY function. It
>lets you define your own prefixes for methods, properties and constants
>contained by that type library. It would be quite convenient to have
>functions like dbx-Save, etc.
>
>--
>Attitudes are contagious. Is yours worth catching?
>http://www.acadx.com
>
>"tom brabant jr" wrote in message
>news:39a68f48.6381620@discussion.autodesk.com...
>> Tony, Frank, thanks again.
>>
>> Made sure drawing was not open in the editor.
>>
>> (vlax-invoke-method dbxdoc 'save)
>>
>> error: Automation Error. Description was not provided.
>> so, exact same error.
>>
>> So hey all:
>> Tried something I should have tried
>> twenty-four, twenty-four hours ago:
>> I am now elated,
>>
>> because:
>>
>> (vlax-invoke-method dbxdoc 'saveas "b2")
>>
>> and
>>
>> (vla-saveas dbxdoc "b2")
>>
>> both work, and we can work with that.
>>
>> Still curious, though:
>> Anybody out there know what is meant by
>>
>> "; error: Automation Error. Description was not provided."
>>
>> Autodesk?
>
0 Likes
Message 13 of 22

Anonymous
Not applicable
You're not violating any copyrights by posting a
derivation of my code. I can't really tell you
what may be the problem wihtout seeing what you're
doing.

Also, have you tried it with other drawings and
gotten the same results?

tom brabant jr wrote:
>
> Thanks for warning about vla-*.
> My colleague, Thomas S. Howe, set up the type
> library for "AxDb15.tlb" with a nice alias
> while we were struggling with this yesterday.
> (we were trying everything)
> Since we, once again, saw the same error message(s),
> we didn't mess a whole lot.
>
> As far as the code goes, it's fairly lifted from
> Tony's BGREP.LSP and posting it would technically
> be a violation of his copyright (Wanna waive?).
> When I mentioned posting the whole shebang earlier
> in thread, I was going to reference that aspect
> to his web site.
>
> On Fri, 25 Aug 2000 15:29:34 +0000, "Frank Oquendo"
> wrote:
>
> >Would you mind showing us the code you're using to create your DBXDOC
> >variable?
> >
> >BTW, I must agree with Tony: do not use *any* of the VLA methods with an
> >ObjectDBX document. VLA methods are wrappers for AutoCAD's object model.
> >While ObjectDBX and AutoCAD look a whole lot alike, the fact remains they
> >are not one and the same. As Tony has pointed out in the past, VLA anything
> >references the AutoCAD 2000 Type Library. ObjectDBX has one of its own. If
> >you'd like to shorten the commands you're using (VLAX-INVOKE, yada, yada is
> >a lot of typing), take a look at the VLAX-IMPORT-TYPE-LIBRARY function. It
> >lets you define your own prefixes for methods, properties and constants
> >contained by that type library. It would be quite convenient to have
> >functions like dbx-Save, etc.
> >
> >--
> >Attitudes are contagious. Is yours worth catching?
> >http://www.acadx.com
> >
> >"tom brabant jr" wrote in message
> >news:39a68f48.6381620@discussion.autodesk.com...
> >> Tony, Frank, thanks again.
> >>
> >> Made sure drawing was not open in the editor.
> >>
> >> (vlax-invoke-method dbxdoc 'save)
> >>
> >> error: Automation Error. Description was not provided.
> >> so, exact same error.
> >>
> >> So hey all:
> >> Tried something I should have tried
> >> twenty-four, twenty-four hours ago:
> >> I am now elated,
> >>
> >> because:
> >>
> >> (vlax-invoke-method dbxdoc 'saveas "b2")
> >>
> >> and
> >>
> >> (vla-saveas dbxdoc "b2")
> >>
> >> both work, and we can work with that.
> >>
> >> Still curious, though:
> >> Anybody out there know what is meant by
> >>
> >> "; error: Automation Error. Description was not provided."
> >>
> >> Autodesk?
> >

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 14 of 22

Anonymous
Not applicable
Tony,

> Make sure that you're not working with a document
> that has been opened in the drawing editor (after
> it's loaded into the AxDbDocuemnt).

Does this mean that drawings on a network drive can't be opened using
vla-open, if they're opened by another user? I get the same error as Tom
(error: Automation Error. Description was not provided.) when trying to get
information from a drawing opened in another AutoCAD session. Is it
possible to read data from all files in a directory regardless of them being
opened already?

Thank you,

James Dee
www.caddee.com
0 Likes
Message 15 of 22

Anonymous
Not applicable
James & Tony:

James, moved to another workstation and also received

error: Automation Error. Description was not provided.

when trying (vlax-invoke-method dbxdoc 'open pathhandname)

intermittently, sometimes it worked, sometimes it did not,
and none of the drawings involved have been open in the editor.

Tony, here is the "lifted" code (ignore "server", path hardcoded)

(defun register ()
;RegisterObjectDBX
(setq *objectdbx* "ObjectDBX.AxDbDocument")
(vl-registry-read (strcat "HKEY_CLASSES_ROOT\\" *objectdbx*
"\\CLSID"))
(setq server (findfile "AxDb15.dll"))
;the following line produces an apparently inoccuous "illegal
operation" complaint
;(startapp "regsvr32.exe" (strcat "/s \"" server "\""))
;while using the following shell does not.....
(command "sh" "c:\\windows\\system\\regsvr32 /s
C:\\PROGRA~1\\ACAD2000\\AxDb15.dll")
)

On Sun, 27 Aug 2000 21:45:53 +0000, "CADDee.com"
wrote:

>Tony,
>
>> Make sure that you're not working with a document
>> that has been opened in the drawing editor (after
>> it's loaded into the AxDbDocuemnt).
>
>Does this mean that drawings on a network drive can't be opened using
>vla-open, if they're opened by another user? I get the same error as Tom
>(error: Automation Error. Description was not provided.) when trying to get
>information from a drawing opened in another AutoCAD session. Is it
>possible to read data from all files in a directory regardless of them being
>opened already?
>
>Thank you,
>
>James Dee
>www.caddee.com
>
0 Likes
Message 16 of 22

Anonymous
Not applicable
I'm not sure what the register server code has to
do with a failure when trying to save.

I need to see the relevant code, not the part that
registers the server.

tom brabant jr wrote:
>
> James & Tony:
>
> James, moved to another workstation and also received
>
> error: Automation Error. Description was not provided.
>
> when trying (vlax-invoke-method dbxdoc 'open pathhandname)
>
> intermittently, sometimes it worked, sometimes it did not,
> and none of the drawings involved have been open in the editor.
>
> Tony, here is the "lifted" code (ignore "server", path hardcoded)
>
> (defun register ()
> ;RegisterObjectDBX
> (setq *objectdbx* "ObjectDBX.AxDbDocument")
> (vl-registry-read (strcat "HKEY_CLASSES_ROOT\\" *objectdbx*
> "\\CLSID"))
> (setq server (findfile "AxDb15.dll"))
> ;the following line produces an apparently inoccuous "illegal
> operation" complaint
> ;(startapp "regsvr32.exe" (strcat "/s \"" server "\""))
> ;while using the following shell does not.....
> (command "sh" "c:\\windows\\system\\regsvr32 /s
> C:\\PROGRA~1\\ACAD2000\\AxDb15.dll")
> )
>
> On Sun, 27 Aug 2000 21:45:53 +0000, "CADDee.com"
> wrote:
>
> >Tony,
> >
> >> Make sure that you're not working with a document
> >> that has been opened in the drawing editor (after
> >> it's loaded into the AxDbDocuemnt).
> >
> >Does this mean that drawings on a network drive can't be opened using
> >vla-open, if they're opened by another user? I get the same error as Tom
> >(error: Automation Error. Description was not provided.) when trying to get
> >information from a drawing opened in another AutoCAD session. Is it
> >possible to read data from all files in a directory regardless of them being
> >opened already?
> >
> >Thank you,
> >
> >James Dee
> >www.caddee.com
> >

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 17 of 22

Anonymous
Not applicable
ObjectDBX will not open a drawing file that's currently
open in another drawing editor.

You can open a file with the read-only attribute set,
but attempting to save it will result in the same error
you mentioned. Ditto for the attibutes of the directory
containing the file.

Generally, if you want to open a file that's open in
another AutoCAD session, you should copy the file, and
then open the copy. Of course, that precludes saving to
the original file, but of course you should never do
that if someone else owns the file (e.g. has it open in
an AutoCAD session).

"CADDee.com" wrote:
>
> Tony,
>
> > Make sure that you're not working with a document
> > that has been opened in the drawing editor (after
> > it's loaded into the AxDbDocuemnt).
>
> Does this mean that drawings on a network drive can't be opened using
> vla-open, if they're opened by another user? I get the same error as Tom
> (error: Automation Error. Description was not provided.) when trying to get
> information from a drawing opened in another AutoCAD session. Is it
> possible to read data from all files in a directory regardless of them being
> opened already?
>
> Thank you,
>
> James Dee
> www.caddee.com

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 18 of 22

Anonymous
Not applicable
Thank you Tony! I tried checking to see if the file was in use, and if it
was I made a temp copy. No more error (error: Automation Error. Description
was not provided.). I'm simply reading the file so there's not reason to
save it. Works great!

James Dee
www.caddee.com

Tony Tanzillo wrote in message
news:39AAEC65.BABA13FF@worldnet.att.net...
> ObjectDBX will not open a drawing file that's currently
> open in another drawing editor.
>
> You can open a file with the read-only attribute set,
> but attempting to save it will result in the same error
> you mentioned. Ditto for the attibutes of the directory
> containing the file.
>
> Generally, if you want to open a file that's open in
> another AutoCAD session, you should copy the file, and
> then open the copy. Of course, that precludes saving to
> the original file, but of course you should never do
> that if someone else owns the file (e.g. has it open in
> an AutoCAD session).
>
> "CADDee.com" wrote:
> >
> > Tony,
> >
> > > Make sure that you're not working with a document
> > > that has been opened in the drawing editor (after
> > > it's loaded into the AxDbDocuemnt).
> >
> > Does this mean that drawings on a network drive can't be opened using
> > vla-open, if they're opened by another user? I get the same error as
Tom
> > (error: Automation Error. Description was not provided.) when trying to
get
> > information from a drawing opened in another AutoCAD session. Is it
> > possible to read data from all files in a directory regardless of them
being
> > opened already?
> >
> > Thank you,
> >
> > James Dee
> > www.caddee.com
>
> --
>
> Checkout the AcadX(tm) ActiveX Extension Library at:
>
> http://www.caddzone.com/acadx/acadx.htm
>
> /*********************************************************/
> /* Tony Tanzillo Design Automation Consulting */
> /* Programming & Customization for AutoCAD & Compatibles */
> /* ----------------------------------------------------- */
> /* tony.tanzillo@worldnet.att.net */
> /* http://www.caddzone.com */
> /*********************************************************/
0 Likes
Message 19 of 22

Anonymous
Not applicable
Tony,
The document(s) I've been running this on
are not open, or in use, to the best of
my knowlege. Just in case, is there a
function/method/property
out there for testing this? Maybe someone on
our network is playing a practical joke!
Otherwise, that's a slim possiblity.
And I would think (hope) that the message I'm receiving,
"error: Automation Error. Description was not provided.",
suggests some other problem with

(vlax-invoke-method dbxdoc 'save);***

I believe everything relevant is already
in this thread, but....
Here is the latest opus, minus the
directory recurser (the save bombs on
single drawings.) Also missing is the
definition of "parse": it is merely a utility
to decompose a string into a list of tokens.

A couple of things have changed. As per
your and Frank's advice, vla- functions
have been replaced with vlax- .
And a workaround with a saveas ****
has been added.

We have had some kind of problem,
possibly related, on another workstation,
with (vlax-invoke-method dbxdoc 'open pathhandname).
It was also reporting the same, confounding

"error: Automation Error. Description was not provided."

However, it is so intermittent, I'd almost
like to leave it out of the discussion.
Thanks once more, for your attention in this matter.

(defun register ()
;RegisterObjectDBX
(vl-load-com)
(setq *objectdbx* "ObjectDBX.AxDbDocument")
(vl-registry-read (strcat "HKEY_CLASSES_ROOT\\" *objectdbx*
"\\CLSID"))
(setq server (findfile "AxDb15.dll"))
;the following line produces an apparently inoccuous "illegal
operation" complaint
;(startapp "regsvr32.exe" (strcat "/s \"" server "\""))
;while using the following shell does not.....
(command "sh" "c:\\windows\\system\\regsvr32 /s
D:\\PROGRA~1\\ACAD2000\\AxDb15.dll");Cadd1
;(command "sh" "c:\\windows\\system\\regsvr32 /s C:\\PROGRAM
FILES\\ACAD2000\\AxDb15.dll");damon
;????????
);defun register
;the following will be replaced with (mapcar 'process *dfplat*),
;{*dfplat* is a list of full paths generated from a recursion down
;a directory tree}.

(defun test ()(process (setq pt
"S:\\lisp\\vl\\tempxrpath\\b1.dwg")))

(setq *newpath* "S:\\lisp\\vl\\tempxrpath\\p1\\")

(defun process (pathhandname)
(setq dbxdoc
(vlax-invoke-method
(vlax-get-acad-object) 'GetInterfaceObject
"ObjectDBX.AxDbDocument"
)
)
(vlax-invoke-method dbxdoc 'open pathhandname)
(setq mdl (vlax-get-property dbxdoc 'modelspace))
(setq lis nil)
(vlax-for thing mdl (setq lis (cons thing lis)))
(setq ilis nil)
(foreach obj lis
(if (= "AcDbRasterImage" (vlax-get-property obj 'objectname))
(setq ilis (cons obj ilis))))
(setq k 0 )
(while (< k (length ilis))
(setq imagefile (vlax-get-property (nth k ilis) 'imagefile)
pieces (parse "\\" imagefile)
newimagefile (strcat *newpath* (last pieces))
)
(vlax-put-property (nth k ilis) 'imagefile newimagefile)
(setq k (1+ k))
)
;save ***
;(vlax-invoke-method dbxdoc 'save)
;"error: Automation Error. Description was not provided."
;(vlax-invoke-method 'save);
;" error: too few arguments"
;saveas ****
(setq plis (parse "\\" pathhandname))
(setq olddwgname (last plis) pathl (reverse (cdr (reverse plis)))
newdwgname
(strcat (apply 'strcat
(mapcar '(lambda (piece)(strcat piece "\\"))
pathl)) "imod-" olddwgname
)
)
(vlax-invoke-method dbxdoc 'saveas newdwgname )
(vlax-release-object dbxdoc)
)

On Mon, 28 Aug 2000 22:49:09 +0000, Tony Tanzillo
wrote:

>ObjectDBX will not open a drawing file that's currently
>open in another drawing editor.
>
>You can open a file with the read-only attribute set,
>but attempting to save it will result in the same error
>you mentioned. Ditto for the attibutes of the directory
>containing the file.
>
>Generally, if you want to open a file that's open in
>another AutoCAD session, you should copy the file, and
>then open the copy. Of course, that precludes saving to
>the original file, but of course you should never do
>that if someone else owns the file (e.g. has it open in
>an AutoCAD session).
>
>"CADDee.com" wrote:
>>
>> Tony,
>>
>> > Make sure that you're not working with a document
>> > that has been opened in the drawing editor (after
>> > it's loaded into the AxDbDocuemnt).
>>
>> Does this mean that drawings on a network drive can't be opened using
>> vla-open, if they're opened by another user? I get the same error as Tom
>> (error: Automation Error. Description was not provided.) when trying to get
>> information from a drawing opened in another AutoCAD session. Is it
>> possible to read data from all files in a directory regardless of them being
>> opened already?
>>
>> Thank you,
>>
>> James Dee
>> www.caddee.com
>
>--
>
>Checkout the AcadX(tm) ActiveX Extension Library at:
>
> http://www.caddzone.com/acadx/acadx.htm
>
>/*********************************************************/
>/* Tony Tanzillo Design Automation Consulting */
>/* Programming & Customization for AutoCAD & Compatibles */
>/* ----------------------------------------------------- */
>/* tony.tanzillo@worldnet.att.net */
>/* http://www.caddzone.com */
>/*********************************************************/
0 Likes
Message 20 of 22

Anonymous
Not applicable
Tom - Try commenting out the code that
modifies the contents of the drawing, and
let the code run to simply open the file,
and then save it, without making changes,
and see if the error still occurs.

tom brabant jr wrote:
>
> Tony,
> The document(s) I've been running this on
> are not open, or in use, to the best of
> my knowlege. Just in case, is there a
> function/method/property
> out there for testing this? Maybe someone on
> our network is playing a practical joke!
> Otherwise, that's a slim possiblity.
> And I would think (hope) that the message I'm receiving,
> "error: Automation Error. Description was not provided.",
> suggests some other problem with
>
> (vlax-invoke-method dbxdoc 'save);***
>
> I believe everything relevant is already
> in this thread, but....
> Here is the latest opus, minus the
> directory recurser (the save bombs on
> single drawings.) Also missing is the
> definition of "parse": it is merely a utility
> to decompose a string into a list of tokens.
>
> A couple of things have changed. As per
> your and Frank's advice, vla- functions
> have been replaced with vlax- .
> And a workaround with a saveas ****
> has been added.
>
> We have had some kind of problem,
> possibly related, on another workstation,
> with (vlax-invoke-method dbxdoc 'open pathhandname).
> It was also reporting the same, confounding
>
> "error: Automation Error. Description was not provided."
>
> However, it is so intermittent, I'd almost
> like to leave it out of the discussion.
> Thanks once more, for your attention in this matter.
>
> (defun register ()
> ;RegisterObjectDBX
> (vl-load-com)
> (setq *objectdbx* "ObjectDBX.AxDbDocument")
> (vl-registry-read (strcat "HKEY_CLASSES_ROOT\\" *objectdbx*
> "\\CLSID"))
> (setq server (findfile "AxDb15.dll"))
> ;the following line produces an apparently inoccuous "illegal
> operation" complaint
> ;(startapp "regsvr32.exe" (strcat "/s \"" server "\""))
> ;while using the following shell does not.....
> (command "sh" "c:\\windows\\system\\regsvr32 /s
> D:\\PROGRA~1\\ACAD2000\\AxDb15.dll");Cadd1
> ;(command "sh" "c:\\windows\\system\\regsvr32 /s C:\\PROGRAM
> FILES\\ACAD2000\\AxDb15.dll");damon
> ;????????
> );defun register
> ;the following will be replaced with (mapcar 'process *dfplat*),
> ;{*dfplat* is a list of full paths generated from a recursion down
> ;a directory tree}.
>
> (defun test ()(process (setq pt
> "S:\\lisp\\vl\\tempxrpath\\b1.dwg")))
>
> (setq *newpath* "S:\\lisp\\vl\\tempxrpath\\p1\\")
>
> (defun process (pathhandname)
> (setq dbxdoc
> (vlax-invoke-method
> (vlax-get-acad-object) 'GetInterfaceObject
> "ObjectDBX.AxDbDocument"
> )
> )
> (vlax-invoke-method dbxdoc 'open pathhandname)
> (setq mdl (vlax-get-property dbxdoc 'modelspace))
> (setq lis nil)
> (vlax-for thing mdl (setq lis (cons thing lis)))
> (setq ilis nil)
> (foreach obj lis
> (if (= "AcDbRasterImage" (vlax-get-property obj 'objectname))
> (setq ilis (cons obj ilis))))
> (setq k 0 )
> (while (< k (length ilis))
> (setq imagefile (vlax-get-property (nth k ilis) 'imagefile)
> pieces (parse "\\" imagefile)
> newimagefile (strcat *newpath* (last pieces))
> )
> (vlax-put-property (nth k ilis) 'imagefile newimagefile)
> (setq k (1+ k))
> )
> ;save ***
> ;(vlax-invoke-method dbxdoc 'save)
> ;"error: Automation Error. Description was not provided."
> ;(vlax-invoke-method 'save);
> ;" error: too few arguments"
> ;saveas ****
> (setq plis (parse "\\" pathhandname))
> (setq olddwgname (last plis) pathl (reverse (cdr (reverse plis)))
> newdwgname
> (strcat (apply 'strcat
> (mapcar '(lambda (piece)(strcat piece "\\"))
> pathl)) "imod-" olddwgname
> )
> )
> (vlax-invoke-method dbxdoc 'saveas newdwgname )
> (vlax-release-object dbxdoc)
> )
>
> On Mon, 28 Aug 2000 22:49:09 +0000, Tony Tanzillo
> wrote:
>
> >ObjectDBX will not open a drawing file that's currently
> >open in another drawing editor.
> >
> >You can open a file with the read-only attribute set,
> >but attempting to save it will result in the same error
> >you mentioned. Ditto for the attibutes of the directory
> >containing the file.
> >
> >Generally, if you want to open a file that's open in
> >another AutoCAD session, you should copy the file, and
> >then open the copy. Of course, that precludes saving to
> >the original file, but of course you should never do
> >that if someone else owns the file (e.g. has it open in
> >an AutoCAD session).
> >
> >"CADDee.com" wrote:
> >>
> >> Tony,
> >>
> >> > Make sure that you're not working with a document
> >> > that has been opened in the drawing editor (after
> >> > it's loaded into the AxDbDocuemnt).
> >>
> >> Does this mean that drawings on a network drive can't be opened using
> >> vla-open, if they're opened by another user? I get the same error as Tom
> >> (error: Automation Error. Description was not provided.) when trying to get
> >> information from a drawing opened in another AutoCAD session. Is it
> >> possible to read data from all files in a directory regardless of them being
> >> opened already?
> >>
> >> Thank you,
> >>
> >> James Dee
> >> www.caddee.com
> >
> >--
> >
> >Checkout the AcadX(tm) ActiveX Extension Library at:
> >
> > http://www.caddzone.com/acadx/acadx.htm
> >
> >/*********************************************************/
> >/* Tony Tanzillo Design Automation Consulting */
> >/* Programming & Customization for AutoCAD & Compatibles */
> >/* ----------------------------------------------------- */
> >/* tony.tanzillo@worldnet.att.net */
> >/* http://www.caddzone.com */
> >/*********************************************************/

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes