Author Topic: Saving down with Objectdbx  (Read 6162 times)

0 Members and 1 Guest are viewing this topic.

OcCad

  • Guest
Saving down with Objectdbx
« 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?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Saving down with Objectdbx
« Reply #1 on: March 10, 2008, 10:54:52 PM »
Have you tried this.
It will convert multiple files.
http://www.theswamp.org/index.php?topic=8279.msg161421#msg161421
I've reached the age where the happy hour is a nap. (°Ώ°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

OcCad

  • Guest
Re: Saving down with Objectdbx
« Reply #2 on: March 10, 2008, 10:59:11 PM »
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?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Saving down with Objectdbx
« Reply #3 on: March 10, 2008, 11:02:40 PM »
I've reached the age where the happy hour is a nap. (°Ώ°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

OcCad

  • Guest
Re: Saving down with Objectdbx
« Reply #4 on: March 10, 2008, 11:11:59 PM »
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

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Saving down with Objectdbx
« Reply #5 on: March 10, 2008, 11:27:03 PM »
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).

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

FengK

  • Guest
Re: Saving down with Objectdbx
« Reply #6 on: March 11, 2008, 03:49:53 AM »
Do you have to use ObjectDBX? Are you processing hundreds/thousands of drawings?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Saving down with Objectdbx
« Reply #7 on: March 11, 2008, 04:30:01 AM »
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 ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8718
  • AKA Daniel
Re: Saving down with Objectdbx
« Reply #8 on: March 11, 2008, 06:49:00 AM »
Don’t know if this will help you but here is an ARX routine that might do the trick.

Code: [Select]
(saveas2004 "c:\\1.dwg" "c:\\2.dwg")
(saveas2000 "c:\\1.dwg" "c:\\2.dwg")

Joe Burke

  • Guest
Re: Saving down with Objectdbx
« Reply #9 on: March 11, 2008, 08:03:44 AM »
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").

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8718
  • AKA Daniel
Re: Saving down with Objectdbx
« Reply #10 on: March 11, 2008, 08:13:12 AM »
...Where did it come from?....

I just wrote it, :-o
 my tests also show that it can’t be the same filename  :|

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Saving down with Objectdbx
« Reply #11 on: March 11, 2008, 08:14:14 AM »
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. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8718
  • AKA Daniel
Re: Saving down with Objectdbx
« Reply #12 on: March 11, 2008, 08:36:55 AM »
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.

Code: [Select]

  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) ;
  }
« Last Edit: March 11, 2008, 08:42:59 AM by Daniel »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Saving down with Objectdbx
« Reply #13 on: March 11, 2008, 08:39:36 AM »
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 ...



Thanks Daniel, that's be great.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Guest

  • Guest
Re: Saving down with Objectdbx
« Reply #14 on: March 11, 2008, 08:42:09 AM »
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?!?

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8718
  • AKA Daniel
Re: Saving down with Objectdbx
« Reply #15 on: March 11, 2008, 11:38:41 AM »
added (saveasR14  "c:\\1.dwg" "c:\\2.dwg")

edit: please get file here http://www.theswamp.org/index.php?topic=21875.msg264050#msg264050
« Last Edit: March 12, 2008, 10:15:03 AM by Daniel »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Saving down with Objectdbx
« Reply #16 on: March 11, 2008, 12:19:17 PM »
Very generous Daniel, thanks again. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

OcCad

  • Guest
Re: Saving down with Objectdbx
« Reply #17 on: March 11, 2008, 12:25:33 PM »
Quote
Quote
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.

OcCad

  • Guest
Re: Saving down with Objectdbx
« Reply #18 on: March 11, 2008, 12:51:27 PM »
Quote
Quote
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.

Joe Burke

  • Guest
Re: Saving down with Objectdbx
« Reply #19 on: March 11, 2008, 06:55:26 PM »
Quote
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 Burke

  • Guest
Re: Saving down with Objectdbx
« Reply #20 on: March 12, 2008, 07:25:49 AM »
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

Guest

  • Guest
Re: Saving down with Objectdbx
« Reply #21 on: March 12, 2008, 08:26:53 AM »
Quote
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)

Joe Burke

  • Guest
Re: Saving down with Objectdbx
« Reply #22 on: March 12, 2008, 08:57:32 AM »
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.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8718
  • AKA Daniel
Re: Saving down with Objectdbx
« Reply #23 on: March 12, 2008, 10:33:06 AM »
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