TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: OcCad on March 10, 2008, 06:47:50 PM
-
I'm modifying multiple drawing with odbx but some files were becoming unreadable for clients. Normally I save down to 2004 from 2008 but in odbx the default saveas seems to be 2007. How do I do a saveas savedown to 2004? Or convert to 2004?
-
Have you tried this.
It will convert multiple files.
http://www.theswamp.org/index.php?topic=8279.msg161421#msg161421 (http://www.theswamp.org/index.php?topic=8279.msg161421#msg161421)
-
Thats the thing though. i dont want to have to use dwgconvert. I would rather do it in the lisp. Right now the routine is causing the problem by vla-saveas to 2007. is there a way to tell it to save to 2004 version?
-
Bad news I'm afraid.
http://www.theswamp.org/index.php?topic=15872.msg240579#msg240579
-
I dont understand. that post says the vla-save method doesnt work in odbx. But I'm looking to use vla-saveas but to an older format
-
I dont understand. that post says the vla-save method doesnt work in odbx.
True, you can't.
I'm looking to use vla-saveas but to an older format
AKAIK ... You can't specify the format. The SaveAs method for documents opened via ObjectDBX takes two arguments, the first (mandatory) is a string representing the file path and name. The second (optional) is a variant allowing one to encrypt and digitally sign the drawing. I personally haven't used the latter and can't say I'm an advocate.
Sorry to confirm the bad news.
(Discussion based on 2008).
-
Do you have to use ObjectDBX? Are you processing hundreds/thousands of drawings?
-
That's the thing though. i dint want to have to use dwgconvert. I would rather do it in the lisp. Right now the routine is causing the problem by vla-saveas to 2007. is there a way to tell it to save to 2004 version?
I'm sure you have your reasons for not using dwgconvert, but I can't immediately think of one ... care to share the reasons ?
-
Dont know if this will help you but here is an ARX routine that might do the trick.
(saveas2004 "c:\\1.dwg" "c:\\2.dwg")
(saveas2000 "c:\\1.dwg" "c:\\2.dwg")
-
Daniel,
That's interesting. Where did it come from? Google search finds no mention of it elsewhere.
A few quick tests indicate it *may* be a solution for saving down an ODBX document. After the document is released, I think you would have to give the file a unique saveas name. Then delete the original/source file and rename the new file the same as the original. IOW, it does not allow this (saveas2000 "c:\\example.dwg" "c:\\example.dwg").
-
...Where did it come from?....
I just wrote it, :-o
my tests also show that it can’t be the same filename :|
-
Nice, I'll have to try that Daniel. Like Joe said, where did it come from? Is the source code available? I'd be wary of building a solution around it without knowing something about it's origins and future. Nonetheless has promise. :)
Bah, ya snuck in as I was posting, I'll leave it verbatim; peace. :)
-
This is in my open source project for lispers, there is also a few other goodies in here, I will post this in the "Show your stuff" area in a while
Arx code.
static int ads_saveas2004(void)
{
Acad::ErrorStatus es;
struct resbuf *pArgs =acedGetArgs () ;
if (pArgs == NULL || pArgs->restype != RTSTR )
return RSERR;
if (pArgs->restype != RTSTR )
return RSERR;
CString infile = pArgs->resval.rstring;
if ((pArgs = pArgs->rbnext) == NULL || pArgs->restype != RTSTR )
return RSERR;
CString outfile = pArgs->resval.rstring;
std::auto_ptr<AcDbDatabase> pDb(new AcDbDatabase(Adesk::kFalse));
es = pDb->readDwgFile(infile);
if(es != Acad::eOk)
return es;
es = acdbSaveAs2004(pDb.get(),outfile);
if(es != Acad::eOk)
return es;
acedRetT();
return (RSRSLT) ;
}
static int ads_saveas2000(void)
{
Acad::ErrorStatus es;
struct resbuf *pArgs =acedGetArgs () ;
if (pArgs == NULL || pArgs->restype != RTSTR )
return RSERR;
if (pArgs->restype != RTSTR )
return RSERR;
CString infile = pArgs->resval.rstring;
if ((pArgs = pArgs->rbnext) == NULL || pArgs->restype != RTSTR )
return RSERR;
CString outfile = pArgs->resval.rstring;
std::auto_ptr<AcDbDatabase> pDb(new AcDbDatabase(Adesk::kFalse));
es = pDb->readDwgFile(infile);
if(es != Acad::eOk)
return es;
es = acdbSaveAs2000(pDb.get(),outfile);
if(es != Acad::eOk)
return es;
acedRetT();
return (RSRSLT) ;
}
-
This in my open source project for lispers, there is also a few other goodies in here, I will post this in the "Show your stuff" area in a while ...
(http://www.theswamp.org/screens/mp/excellent.png)
Thanks Daniel, that's be great.
-
I'm modifying multiple drawing with odbx but some files were becoming unreadable for clients. Normally I save down to 2004 from 2008 but in odbx the default saveas seems to be 2007. How do I do a saveas savedown to 2004? Or convert to 2004?
AutoCAD 2008 has a new command called AECTOACAD that will allow you to save in a lower version (back to R14). Might be of some use?!?
-
added (saveasR14 "c:\\1.dwg" "c:\\2.dwg")
edit: please get file here http://www.theswamp.org/index.php?topic=21875.msg264050#msg264050
-
Very generous Daniel, thanks again. :)
-
That's the thing though. i didnt want to have to use dwgconvert. I would rather do it in the lisp. Right now the routine is causing the problem by vla-saveas to 2007. is there a way to tell it to save to 2004 version?
I'm sure you have your reasons for not using dwgconvert, but I can't immediately think of one ... care to share the reasons ?
Kerry, Though my response seems a little late (and by the way thanks, daniel!) the reason I would prefer not use dwgconvert is that it would take me just as much time to run a batch version of my lisp that will save as 2004 as it would to run the much quicker odbx and then use dwgconvert which is not that fast.
-
I'm modifying multiple drawing with odbx but some files were becoming unreadable for clients. Normally I save down to 2004 from 2008 but in odbx the default saveas seems to be 2007. How do I do a saveas savedown to 2004? Or convert to 2004?
AutoCAD 2008 has a new command called AECTOACAD that will allow you to save in a lower version (back to R14). Might be of some use?!?
And did everyone just completely ignore Matt W's response. I did not know that about 2008. I will have to look into this.
-
And did everyone just completely ignore Matt W's response. I did not know that about 2008. I will have to look into this.
Cannot use command calls with an ODBX document.
-
Daniel,
I'm not familiar with the code you posted.
I'm wondering what's the mechanism involved? Specifically, is it exactly the same as what happens when Options > Open and Save tab is set save down to a previous file format?
Looking forward to your post in Show your stuff.
Thanks
-
And did everyone just completely ignore Matt W's response. I did not know that about 2008. I will have to look into this.
Cannot use command calls with an ODBX document.
Joe's right. I just threw that out as an option, figuring you were more focused on ODBX. You'd still have to actually open each drawing, call the command, wash, rinse, repeat. Like I said, I just threw it out as an option.
(That command may have been introduced in 2007, for what it's worth)
-
Matt,
If the document involved in not an ODBX doc, the SaveAs method allows a choice of file format.
ODBX would be more powerful if it offered the same option.
-
Daniel,
I'm not familiar with the code you posted.
I'm wondering what's the mechanism involved? Specifically, is it exactly the same as what happens when Options > Open and Save tab is set save down to a previous file format?
Looking forward to your post in Show your stuff.
Thanks
I am not sure what Autodesk does internally, but does act different that what I am doing. All I am doing is opening the database and saving it down through the method provided in the ARX SDK, have look at acdbSaveAs2004() and AcDbDatabase::saveAs(). In the ARX docs