Save Method in ObjectDBX

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

  1. axvoskan

    axvoskan Guest

    I'm trying to save a document opened with ObjectDBX and getting an error. I checked some of the discussions in this group and looks like there is an issue with Save method. There are some suggestions using SaveAs method. I have no problem using SaveAs. However, I do get the eact same error on SaveAs. Any ideas?

    Artem
     
    axvoskan, Feb 17, 2004
    #1
  2. axvoskan

    Mark Propst Guest

    filename?
    write permissions?

    I checked some of the discussions in this group and looks like there is an
    issue with Save method. There are some suggestions using SaveAs method. I
    have no problem using SaveAs. However, I do get the eact same error on
    SaveAs. Any ideas?
     
    Mark Propst, Feb 17, 2004
    #2
  3. axvoskan

    axvoskan Guest

    No permissions issue. I tried opening a blank drawing on my c:\temp and immediately using SaveAs method, but still get the same exact error. By the way, just to clarify, my project is in VB not VBA.
     
    axvoskan, Feb 17, 2004
    #3
  4. axvoskan

    Mark Propst Guest

    hard to say, you haven't said what the error was, nor posted the code...


    immediately using SaveAs method, but still get the same exact error. By the
    way, just to clarify, my project is in VB not VBA.
     
    Mark Propst, Feb 17, 2004
    #4
  5. What are you doing before you call SaveAs() ?

    Are you opening an existing DWG file, or are you
    adding objects to a new AxDbDocument? If the
    former, are you saving back to the original DWG
    file's name?



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip


    the same exact error. By the way, just to clarify, my project is in VB not VBA.
     
    Tony Tanzillo, Feb 17, 2004
    #5
  6. axvoskan

    axvoskan Guest

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

    and this is some code pieces from my class module:

    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 to
    ' try the save as right after drawing is opened
    objDbxDoc.SaveAs objDbxDoc.Name

    End Function
     
    axvoskan, Feb 17, 2004
    #6
  7. Tony Tanzillo, Feb 17, 2004
    #7
  8. axvoskan

    axvoskan Guest

    My original code runs the SaveAs() after it finished some xref repathing and block renaming. That's when I discovered the error. Then I started moving SaveAs() closer and closer to open() and finally to what I had in my code. Is the change I mentioned a good enough change?
    I'll try adding and removing a layer just in case, but I doubt that can fix the problem. There is a limit to the things I can do with ObjectDBX anyway.
     
    axvoskan, Feb 18, 2004
    #8
  9. axvoskan

    axvoskan Guest

    Just incase this might help...
    I just tried adding and removing a layer just to be able to try the saveAs() after a legitimate change, but I got the exact same error number on Delete() method now. Layer gets added successfully and I'm able to verify that, but I get ("Method 'Delete' of object 'IAcadLayer' failed") on Delete().
    I’m sure there is an obvious thing I’m missing here. Any help is much appreciated.
     
    axvoskan, Feb 18, 2004
    #9
  10. The next obvious step is to try to save the
    database to another file (that does not exist)
    and see if that also fails.



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip


    the error. Then I started moving SaveAs() closer and closer to open() and finally to what I had in my code. Is the
    change I mentioned a good enough change?
    things I can do with ObjectDBX anyway.
     
    Tony Tanzillo, Feb 18, 2004
    #10
  11. axvoskan

    Mark Propst Guest

    I'm not a hundred percent positive, but I think that:
    if tFile isn't found, the open method will create a new dwg without a name
    so you can't do a saveas to the objdbxDoc.Name
    test for dwg name before trying to use it

    Public Function OpenDBXdwgForWrite(ByVal tFile As String) As Boolean
    On Error Resume Next
    objDbxDoc.Open tFile

    If Err.Number <> 0 Then
    Err.Clear
    OpenDBXdwgForWrite = False
    else

    debug.print "The name is: " & objDbxDoc.name
    'see if it's what you expected


    End If

    hth
    Mark
     
    Mark Propst, Feb 18, 2004
    #11
  12. axvoskan

    axvoskan Guest

    I have tried saving to a file that doesn't exist.
     
    axvoskan, Feb 18, 2004
    #12
  13. axvoskan

    axvoskan Guest

    As I mentioned in my earlier posting, I am able to open the drawing and interact with xrefs (meaning the file is obviously there).
     
    axvoskan, Feb 18, 2004
    #13
  14. axvoskan

    axvoskan Guest

    Looks like everyone is going out of the track here. Most probably it's because I might have not explain it clearly.

    I hope these helps: (all saves mentioned is SaveAs)
    -I am opening a drawing that exists.
    -File is not open by anyone else, or by any other application.
    -I tried opening and saving it immediately. I got the error
    -I tried opening creating layer and removing it. I am able to create the layer, but get an error deleting it.
    -I left the new layer alone and tried to save the drawing and still get that error
     
    axvoskan, Feb 18, 2004
    #14
  15. axvoskan

    Mark Propst Guest

    so does the problem only exist with one specific drawing?
    your code works fine with all other dwgs?
    can you open the dwg normally? - eg in editor, not dbx
    have you tried recovering the dwg?
    ....again, did you check the name of the dbx before trying to saveas
    dbx.name?

    because I might have not explain it clearly.
    layer, but get an error deleting it.
    that error
     
    Mark Propst, Feb 18, 2004
    #15
  16. axvoskan

    axvoskan Guest

    There is nothing wrong with the drawing.
    I get the error on every drawing.
    I checked name of the drawing.

    My code is written in a way that I can easily switch from ObjectDBX to full blown AutoCAD. I do not get these errors when drawings are opened in AutoCAD.
    Somebody suggested something. I will try it in the next couple of minutes. If it was the answer I'll post it here for everyone.
     
    axvoskan, Feb 18, 2004
    #16
  17. Tony Tanzillo, Feb 18, 2004
    #17
  18. What do you mean by 'interact with xrefs' ??????

    Doi you mean insertions of XRefs or the XRef databases themselves?



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip


    obviously there).
     
    Tony Tanzillo, Feb 18, 2004
    #18
  19. axvoskan

    axvoskan Guest

    Unfortunately, that was not the answer. The suggestion was using:

    Private objDbxDoc As New AXDBLib.AxDbDocument
    In place of:
    Private objDbxDoc As AXDBLib.AxDbDocument
     
    axvoskan, Feb 18, 2004
    #19
  20. Tony Tanzillo, Feb 18, 2004
    #20
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.