Author Topic: 2006 dvb in 2007?  (Read 2184 times)

0 Members and 1 Guest are viewing this topic.

jbuzbee

  • Swamp Rat
  • Posts: 851
2006 dvb in 2007?
« on: February 16, 2007, 01:12:07 PM »
Will a dvb file created in ACAD2006 work in 2007?
James Buzbee
Windows 8

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4043
Re: 2006 dvb in 2007?
« Reply #1 on: February 16, 2007, 01:13:43 PM »
yep, unless you have done something crazy :lol:

Post it and I'll try it for you
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

havano

  • Guest
Re: 2006 dvb in 2007?
« Reply #2 on: February 17, 2007, 03:41:55 PM »
I had to change a reference for a DVB to work with Acad 2007: Autocad/Objectdbx Common 16.0 type library had to be replaced with Autocad/Objectdbx Common 17.0 type library.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16897
  • Superior Stupidity at its best
Re: 2006 dvb in 2007?
« Reply #3 on: February 17, 2007, 06:14:49 PM »
One of the issues with having dvb files work across multiple versions is early binding. If you are going to utilize a specific type library other than the VBA or AutoCAD type libraries, if you do late binding, it will make the program more portable. Most type libraries allow you to select the base version and the OS will keep track of the latest version.

For example, if I wanted to get a reference to AutoCAD 2007 I could use
Code: [Select]
Set Acad = GetObject(,"AutoCAD.Application.17")

But if I want the code to run on any version, I would use

Code: [Select]
Set Acad = GetObject(,"AutoCAD.Application")

I hope that is clear as mud ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: 2006 dvb in 2007?
« Reply #4 on: February 19, 2007, 10:31:03 AM »
Everyone thanks for the responses!  I'm very new to VBA.

Keith, so instead of setting "hard" references in the Tools / References / dialog,  I can(should) set them in a module? 

Right now I have the ObjectDBX 16.0 type library referenced and in a module & use the following statement

Code: [Select]
Dim dbxDoc As AxDbDocument
So I should remove the reference and add the following:

Code: [Select]
Set dbx = GetObject(,"ObjectDBX") [don't know the right syntax here]
Dim dbxDoc as dbx.AxDbDocument

??
James Buzbee
Windows 8

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16897
  • Superior Stupidity at its best
Re: 2006 dvb in 2007?
« Reply #5 on: February 19, 2007, 10:59:22 AM »
In short .. yes .. except you need to use "GetInterfaceObject" for the ObjectDBX library.

Thus .. as in this example, you need only run the application and not add any reference to the type library.
Code: [Select]
Sub Test()
    Dim ACDbx As Object
    Dim Block As AcadBlock
    Set ACDbx = GetInterfaceObject("ObjectDBX.AxDbDocument")
    ACDbx.Open ("c:\test.dwg")
    For Each Block In ACDbx.Blocks
        MsgBox Block.Name
    Next
    Set ACDbx = Nothing
End Sub

But ... the answer is not always that simple, because not all libraries work with all versions of AutoCAD, BUT if you set the reference programmatically, it will load the class from the current version on the computer and not try to load the one from the development computer.

Oh .. and you don't load the ObjectDBX object per 'se , you actually load the document interface, then open the document you want to manipulate.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: 2006 dvb in 2007?
« Reply #6 on: February 23, 2007, 01:36:46 PM »
thanks Keith - I'll give it a try! :wink:
James Buzbee
Windows 8