See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: ObjectDBX in 2010

  1. #1
    Active Member
    Join Date
    2004-08
    Posts
    50
    Login to Give a bone
    0

    Default ObjectDBX in 2010

    I've already installed the VBA Enabler for my ACA2010. I have legacy code that won't run anymore. I get an "ActiveX can't create object" error on the following code:

    Code:
    Public Sub test()
        Dim oD As New AXDBLib.AxDbDocument
        oD.Open "E:\mjm\4334hatch.dwg"
        Debug.Print oD.Name
    
    End Sub
    Does ObjectDBX still work?

    -mjm
    Last edited by RobertB; 2010-03-04 at 05:58 PM. Reason: Added [code] tags

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: ObjectDBX in 2010

    Do you have any invalid references in your project?
    R.K. McSwain | CAD Panacea |

  3. #3
    Active Member
    Join Date
    2004-08
    Posts
    50
    Login to Give a bone
    1

    Default Re: ObjectDBX in 2010

    none. i've minimized as many variables as i can.
    Attached Images Attached Images

  4. #4
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: ObjectDBX in 2010

    Ironically, years ago I decided to use late binding and that works. Do not set a reference to AXDBLib.

    Code:
    Sub Test()
      Dim dbxInterfaceName As String
      dbxInterfaceName = "ObjectDBX.AxDbDocument." & _
      Left$(ThisDrawing.GetVariable("AcadVer"), 2)
      
      Dim aDBX As Object
      Set aDBX = AcadApplication.GetInterfaceObject(dbxInterfaceName)
      
      aDBX.Open "C:\Temp\Test.dwg"
      Debug.Print aDBX.Name
    End Sub
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  5. #5
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: ObjectDBX in 2010

    Quote Originally Posted by RobertB View Post
    Ironically, years ago I decided to use late binding and that works. Do not set a reference to AXDBLib.
    I'm not so sure that its late that binding does it. I use a similar technique to yours but early bind. I think its that you can't instantiate a New instance. You need to get the instance that acad created through the interface.
    C:> ED WORKING....

  6. #6
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: ObjectDBX in 2010

    Quote Originally Posted by Ed Jobe View Post
    I'm not so sure that its late that binding does it. I use a similar technique to yours but early bind. I think its that you can't instantiate a New instance. You need to get the instance that acad created through the interface.
    You are right that making the reference to AXDBLib and using the code below also works.
    Code:
    Sub Test()
      Dim dbxInterfaceName As String
      dbxInterfaceName = "ObjectDBX.AxDbDocument." & _
      Left$(ThisDrawing.GetVariable("AcadVer"), 2)
      
      Dim aDBX As AxDbDocument
      Set aDBX = AcadApplication.GetInterfaceObject(dbxInterfaceName)
      
      aDBX.Open "C:\Temp\Test.dwg"
      Debug.Print aDBX.Name
    End Sub
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  7. #7
    Active Member
    Join Date
    2004-08
    Posts
    50
    Login to Give a bone
    0

    Default Re: ObjectDBX in 2010

    Sure enough! Works great. Thanks guys.

Similar Threads

  1. OBJECTDBX and VB
    By raj_thapar2003 in forum VBA/COM Interop
    Replies: 4
    Last Post: 2018-02-15, 01:36 PM
  2. BlockReferences with C# and objectDBX
    By ivan.markov in forum Dot Net API
    Replies: 13
    Last Post: 2007-06-19, 05:59 PM
  3. C# and ObjectDBX?
    By KevinBarnett in forum Dot Net API
    Replies: 1
    Last Post: 2006-09-19, 06:09 AM
  4. Saving in ObjectDBX
    By whdjr in forum AutoLISP
    Replies: 11
    Last Post: 2004-07-28, 07:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •