ObjectDBX and VB6

Discussion in 'AutoCAD' started by axvoskan, Feb 18, 2004.

  1. axvoskan

    axvoskan Guest

    Is there anyone who tried opening an ObjectDBX document in a VB6 (not VBA) project, making some changes to it and save it successfully? If you did, could you please share just the variable declaration, and opening and saving lines?

    I can open drawings and get information from it, but having problem saving it.
     
    axvoskan, Feb 18, 2004
    #1
  2. axvoskan

    Ed Jobe Guest

    The Save method does not work, use the SaveAs method instead.

    --
    --
    Ed
    --
    project, making some changes to it and save it successfully? If you did,
    could you please share just the variable declaration, and opening and saving
    lines?
    it.
     
    Ed Jobe, Feb 19, 2004
    #2
  3. axvoskan

    axvoskan Guest

    SaveAs doesn't work either. Have you tried ObjectDBX in VB6? Please share some lines from your code.
     
    axvoskan, Feb 19, 2004
    #3
  4. Dim DbxDoc As AXDB15Lib.AxDbDocument

    Set DbxDoc = AcadApp.GetInterfaceObject("ObjectDBX.AxDbDocument")

    DbxDoc.Open (sdir + "\" + myfiles(i))

    '''''modify dwg here

    DbxDoc.SaveAs (sdir + "\" + misArchivos(i))

    set DbxDoc = nothing

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    project, making some changes to it and save it successfully? If you did,
    could you please share just the variable declaration, and opening and saving
    lines?
    it.
     
    Jorge Jimenez, Feb 19, 2004
    #4
  5. axvoskan

    axvoskan Guest

    Thanks, but I don't see any difference with my code, except I'm using 2004 libraries. This is what I have.
    Private objDbxDoc As AXDBLib.AxDbDocument
    Set objDbxDoc = objAcad.GetInterfaceObject("ObjectDBx.AxDbDocument.16")

    There might be a difference in 2004? I wonder if someone tried 2004 successfully.
     
    axvoskan, Feb 19, 2004
    #5
  6. Make sure you dont have 2000 and 2004 libs referenced in the same project.

    In 2004 SAVE, there is an additional parameter for the password

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    libraries. This is what I have.
    successfully.
     
    Jorge Jimenez, Feb 19, 2004
    #6
  7. axvoskan

    axvoskan Guest

    libraries are not mixed.
     
    axvoskan, Feb 19, 2004
    #7
  8. I have tested my code with 2002 and 2004 (changing libs of course), using
    out of process VB6 exe, and the DbxDoc.SaveAs works fine.

    Your problem must lie somewhere else.

    You could either take a break and debug your code again (for the 100th
    time), or post your complete code here, or send us a plane ticket to europe
    to help you out.
     
    Jorge Jimenez, Feb 19, 2004
    #8
  9. axvoskan

    SpeedCAD Guest

    SpeedCAD, Feb 19, 2004
    #9
  10. axvoskan

    axvoskan Guest

    Here is the code from my class module:
    BTW (just in case it might help), While ObjectDBX document is open, I can successfully add a Layer, TextStyle, etc., But I'm getting the same exact error when I try to delete them.

    The error reads(for SaveAs):
    Run-Time error '-2147417851 (80010105)':
    Method "SaveAs" of object 'IAxDbDocument' failed

    The Code:

    Private objAcad As AcadApplication
    Private objDbxDoc As AXDBLib.AxDbDocument

    Public Sub OpenDBX()
    Set objDbxDoc = objAcad.GetInterfaceObject("ObjectDBx.AxDbDocument.16")
    End Sub

    Public Function OpenDBXdwgForWrite(ByVal tFile As String) As Boolean
    On Error Resume Next
    objDbxDoc.Open tFile
    OpenDBXdwgForWrite = True
    If Err.Number <> 0 Then
    OpenDBXdwgForWrite = False
    End If
    On Error GoTo 0

    'This line is normally not here I just added it to
    ' test the SaveAs right after drawing is opened
    objDbxDoc.SaveAs objDbxDoc.Name

    End Function
     
    axvoskan, Feb 19, 2004
    #10
  11. axvoskan

    axvoskan Guest

    Ok Everyone,

    I'm very pleased to say I found the answer.

    What I was doing was:
    1- Start AutoCAD
    2- Close the initial drawing
    3- Minimize AutoCAD
    4- Rest of the story

    The problem lied in #2. There was no real reason for #2 other than trying to make it look nice or whatever. I guess unknowingly I was digging my own grave.

    When no drawing is opened (the gray background), ObjectDBX works fine to open other drawings and read from them, even create layers and other possiblechanges. However, it raises error when you try to delete (Layers, TextStyles) or use SaveAs.

    I left the default drawing alone and problem got solved.

    Strange, isn’t it?

    I guess we should all go to Europe now. It might be fun to get out of LA for a change.
     
    axvoskan, Feb 19, 2004
    #11
  12. Oh yeah, cero document state is another world !!
    Be careful what you do in that state !

    Well you managed to raise quite a racket here and like I told you, the
    problem lied somewhere else.

    About the Europe thing, I thought you were posting through the Autodesk
    Europe server, but seems I got my ips wrong !

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    Ok Everyone,

    I'm very pleased to say I found the answer.

    What I was doing was:
    1- Start AutoCAD
    2- Close the initial drawing
    3- Minimize AutoCAD
    4- Rest of the story

    The problem lied in #2. There was no real reason for #2 other than trying to
    make it look nice or whatever. I guess unknowingly I was digging my own
    grave.

    When no drawing is opened (the gray background), ObjectDBX works fine to
    open other drawings and read from them, even create layers and other
    possible changes. However, it raises error when you try to delete (Layers,
    TextStyles) or use SaveAs.

    I left the default drawing alone and problem got solved.

    Strange, isn't it?

    I guess we should all go to Europe now. It might be fun to get out of LA for
    a change.
     
    Jorge Jimenez, Feb 19, 2004
    #12
  13. axvoskan

    axvoskan Guest

    No sweat, I appreciate all quick responses. They definitely put me in the right path to find the answer.
     
    axvoskan, Feb 19, 2004
    #13
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.