PDA

View Full Version : vla-saveas....


msretenovic
2004-07-28, 05:00 PM
Hi all,

I have run into a problem with vla-saveas. I have this line of code in my routine:

(vla-saveas dbxDoc dwgName ac2000_dwg)

I recieve an error on this line. The error is:
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on unknown exception

If I use
(vla-saveas dbxDoc dwgName nil)
instead, everything works fine . The problem is that it will save it to the 2004 format, I need to leave the drawing(s) in the 2000 format (at least until we upgrade later this year).

TIA

RobertB
2004-07-28, 08:13 PM
You cannot do that with ObjectDBX.

If you use the type library's version of SaveAs, and not AutoCAD's version, that argument is not there. (See attached screen shot)

msretenovic
2004-07-28, 08:21 PM
I'm confused :confused: then because I found this in the help ("VBA and ActiveX documentation set" "SaveAs method"):

AcSaveAsType enum; input-only; optional for Document objects
ac2000_dwg
AutoCAD 2000 DWG (*.dwg)

ac2000_dxf
AutoCAD 2000 DXF (*.dxf)

ac2000_Template
AutoCAD 2000 Drawing Template File (*.dwt)

ac2004_dwg
AutoCAD 2004 DWG (*.dwg)

ac2004_dxf
AutoCAD 2004 DXF (*.dxf)

ac2004_Template
AutoCAD 2004 Drawing Template File (*.dwt)

acNative
A synonym for the latest drawing release. In this release, this value equals ac2004_dwg.

Am I taking this out of context?

RobertB
2004-07-28, 09:06 PM
I'm confused :confused: then because I found this in the help ("VBA and ActiveX documentation set" "SaveAs method"):
Am I taking this out of context?

Yes. That method you are looking at is for an AcadDocument, not an AxDbDocument. Some methods and properties available in normal AutoCAD will not be available, or even the same, in an ObjectDBX document.

However, I may have mispoken on the (vla-SaveAs) approach too. Please try this code:
(vlax-invoke-method dbxdoc 'saveas filename)
in your situation, and provide the bogus argument for filetype. Does the C05 occur? Or do you get an invalid argument? It may be an issue with the ActiveX interface.

I did a (vlax-dump-object dbxdoc T) and notice that the SaveAs method for a DBXDoc only accepts two arguments:
; SaveAs (2)

Therefore (vla-SaveAs dbxdoc ...) ought to be running the object's version of SaveAs. But if that call is accepting 3 arguments, something weird is going on.

msretenovic
2004-07-28, 09:47 PM
Robert,

I have tried to use the method you mentioned. I tried it three ways:

(vlax-invoke-method dbxDoc 'saveas dwg) ;;<-- No Error
(vlax-invoke-method dbxDoc 'saveas dwg nil) ;;<-- No Error
(vlax-invoke-method dbxDoc 'saveas dwg ac2000_dwg) ;;<-- Same error as before

The first two methods went through without a problem. But the third gave the same error that I had previously :-| . I understand if it is only supposed to accept two arguments and it works on the first one. But, if accepts three and works on the second one but not the third, I don't understand :screwy: .

If you have any ideas, I'm willing to try them...

RobertB
2004-07-29, 12:04 AM
Well, the flat-out answer is that ObjectDBX does not support saving to other versions. That can be seen in the VBAIDE.