GetInterFaceObject

Discussion in 'AutoCAD' started by Andy Elmore, Aug 3, 2003.

  1. Andy Elmore

    Andy Elmore Guest

    I'm trying to use the GetInterFaceObject with no success

    I've tried the example given in the help files but that example does not
    work either.

    Does anyone have an example of useing this method with ADT04, I guess the
    help file with this example was wrote for ADT3.3

    Thanks,
    Andy
     
    Andy Elmore, Aug 3, 2003
    #1
  2. Andy Elmore

    Ed Jobe Guest

    Which interface are you trying to obtain?
     
    Ed Jobe, Aug 4, 2003
    #2
  3. I'm trying to get the ADT interface so that I can externally get the wall
    styles that are in that document and other ADT specific items. So I want to
    get ADTapp and ADTdoc/s. I think this is the last major problem I'll
    encounter before I write all the code for my program

    Thanks,
    Andy Elmore
     
    Andrew Elmore, Aug 4, 2003
    #3
  4. Andy Elmore

    Ed Jobe Guest

    In that case, you are using the wrong approach. Just reference the
    appropriate type library you need. There are several that begin with "AEC".
    Go to Tools>References.
     
    Ed Jobe, Aug 4, 2003
    #4
  5. I think I tried that but with no luck. I need to connect to ADTapp not ACAD
    app.
    how cad I get to the adt side of ACAD is the problem
    so far i'm useing
    Acad_app = Getobject(,"AutoCAD.Application")
    Acad_doc = Acad_app.Activedocument............

    some how if I could do some thing like....
    ADT_app = Getobject(,"ADT.Application")

    here's my code in VB.net, I tried it VB6 also with no luck(converted to vb6
    lang of course)
    all I want todo is get the style that are currently in the doc and have
    access to adt specific stuff.
    Imports AutoCAD

    Imports AutoCAD_lib

    Imports AecXUIArchBase

    Imports AecXBase

    Imports AecXArchBase

    Imports AecXUIBase

    Imports AXDBLib

    Private Acad_Connecter As New AutoCADConnector_VB

    Public WithEvents Acad_app As AcadApplication = Acad_Connecter.Application

    Public WithEvents Acad_doc As AcadDocument = Acad_app.ActiveDocument

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    ListBox1.Items.Add(Acad_doc.Name)

    Dim strStyles() As String

    Dim bytX As Byte = 10

    Dim ADTapp As AecArchBaseApplication

    Dim ADTdoc As AecArchBaseDocument

    Try

    ADTdoc = Acad_app.ActiveDocument

    Catch ex As Exception

    MsgBox("Darn!")

    End Try

    End Sub
     
    Andrew Elmore, Aug 4, 2003
    #5
  6. Andy Elmore

    Ed Jobe Guest

    When ADT starts, it takes care of loading all the aec stuff. Therefore all
    you have to do is get/create an acad object to start an instance of acad.
    Dim your vars as aec specific object types and it should work. provided you
    referenced the librarie/s.

    With "AEC Architechtural 4.0 Application library" referenced, the help topic
    for AecBaseDocument gives this:
    Dim doc As AecBaseDocument
    Dim app As New AecBaseApplication

    app.Init ThisDrawing.Application
    Set doc = app.ActiveDocument
     
    Ed Jobe, Aug 4, 2003
    #6
  7. Will Autodesk post a working example of the getinterfaceobject for 04 the
    example given in the help does not work.
     
    Andrew Elmore, Aug 5, 2003
    #7
  8. What I'm wanting is through a VB not VBA loop through every wall style in
    the document and display it.
     
    Andrew Elmore, Aug 5, 2003
    #8
  9. That works for VBA but not for VB so I need and example of setting the ADT
    var to get the ADT application class, then I guess I could set the ADTdoc to
    get control of the ADT styles. I guess this is why they added the
    getintefaceobject, but with no help or listing of good getinteface
    calls...... Autodesk???????
     
    Andrew Elmore, Aug 5, 2003
    #9
  10. That example does not work. I tried it!

    Andy

     
    Andrew Elmore, Aug 5, 2003
    #10
  11. Andy Elmore

    Ed Jobe Guest

    I noticed that it used ver 15 for the class id. What version are you using?
     
    Ed Jobe, Aug 5, 2003
    #11
  12. I'm useing ADT 04 so that would be version 16, I still have 3.3 and tried
    that code in it and same result.

    Andy
     
    Andrew Elmore, Aug 5, 2003
    #12
  13. Andy Elmore

    Ed Jobe Guest

    Then I think your problem must be with trying to utilize that code in
    vb.net. Since I don't have vb.net, I don't think I can be of much more help.
    Sorry.
     
    Ed Jobe, Aug 5, 2003
    #13
  14. Andy Elmore

    Ed Jobe Guest

    I created a new standard.exe project with the sample code and got it to work
    with the following changes. The help topic is still for ADT 3.3.
    Set acadApp = GetObject(, "AutoCAD.Application.16") 'change 15 to 16
    Set acadApp = CreateObject("AutoCAD.Application.16") 'change 15 to
    16
    Set adtApp =
    acadApp.GetInterfaceObject("AecX.AecArchBaseApplication.4") 'add ".4"
     
    Ed Jobe, Aug 5, 2003
    #14
  15. I bet that the .4 is the problem how did you know to add that?

    Andy
     
    Andrew Elmore, Aug 5, 2003
    #15
  16. Andy Elmore

    Ed Jobe Guest

    First I ran the code in debug mode. When it failed on that line, I checked
    the registry for the class id.
     
    Ed Jobe, Aug 5, 2003
    #16
  17. Andy Elmore

    wivory Guest

    Gee you guys! Can you please *not* leave all the original text in the message every time you reply (especially if it contains a program listing). It makes it a pain to scroll through.
      
    :)
      
    Thanks
      
    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Aug 6, 2003
    #17
  18. You gotta admit, though, that this was kind of neat-looking.


    WEEEEEEEeeeeeeeeeeeee
     
    James Belshan, Aug 6, 2003
    #18
  19. Ed the .4 was the trick thanks very much for your help.

    Andy
     
    Andrew Elmore, Aug 8, 2003
    #19
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.