Axdbdocument and Acaddocument

Discussion in 'AutoCAD' started by srinivasan, Mar 24, 2005.

  1. srinivasan

    srinivasan Guest

    Hello all

    I had created a dbxdocument using objectdbx.
    Now i am getting a reference to the drawing i need.
    Can set the reference to an acaddocument.

    Dim doc As AcadDocument
    Dim objdbxdoc As Object
    Dim mdrawing As String
    mdrawing = "d:\sample.dwg"
    Set objdbxdoc = GetInterfaceObject("ObjectDBX.AxDbDocument")
    objdbxdoc.Open mdrawing
    set doc=objdbxdoc

    Its giving me error,when i set the reference to an acaddoc.

    Thanks in advance
    Sri
     
    srinivasan, Mar 24, 2005
    #1
  2. srinivasan

    Norman Yuan Guest

    AxdbDocument IS NOT AcadDocument, hence the error. Why do you need a
    AcadDocument here when using ObjectDBX? Yuo have gotten a "document" object
    (objdbxdoc), just do what you want with it similar to with AcadDocument.
     
    Norman Yuan, Mar 24, 2005
    #2
  3. srinivasan

    srinivasan Guest

    Thanks Yuan

    Actually i need both case.I have functions to check
    existing layers,linetypes etc which accepts the document
    object and the names as input.

    when i pass the objdbxdoc it is not considering it as an
    document object.

    With kind regards

    Regards
    Sri
     
    srinivasan, Mar 25, 2005
    #3
  4. srinivasan

    Lanny Guest

    You could declare your document object as Object -- then you could use it as an acad document or as a dbx document... i do that here without much difficulty. You do have to watch that you only use functions & objects shared by both... HTH - Lanny
     
    Lanny, Mar 25, 2005
    #4
  5. AxDbDocument <> AcadDocument.

    The two are used in totally different contexts. If you need to open an
    AxDbDocument do so by using the Documents collection of the
    AcadApplication class. That will return an AcadDocument reference.

    Which begs the question: If you're going to open it any way, why not
    just do so from the start?
     
    Frank Oquendo, Mar 25, 2005
    #5
  6. AcadDocument and AxDbDocument are not compatible
    interfaces.

    You cannot write code that manipulates either
    of them.

    What you should do, is write your code to work with
    an AcadDatabase, because both AcadDocument and
    AxDbDocument both have a Database property of
    the type AcadDatabase:

    Public Function DoStuff(Database As AcadDatabase)
    '...
    End Function


    Then, you can call DoStuff and pass it the value of
    the Database property of either an AcadDocument or
    an AxDbDocument.
     
    Tony Tanzillo, Mar 26, 2005
    #6
  7. srinivasan

    srinivasan Guest

    thanks all for your valuable suggestions.

    Regards
    Sri
     
    srinivasan, Mar 26, 2005
    #7
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.