AutoCAD 2004 Referance

Discussion in 'AutoCAD' started by irfan, Mar 16, 2005.

  1. irfan

    irfan Guest

    I am using vb.net 2003. to open an autocad session.
    I have Acad 2002, 2004, & 2005 loaded in my system however in the referance -> add referance i can see only
    AutoCAD 2000 object library
    AutoCAD 2000 Type Library
    AutoCAD 2005 Type Library.
    and not autocad 2004.

    However, it opens AUtoCAD 2004, everytime. My questions are:

    1. Where does it pick AutoCAD 2004 referance
    2. I want it to open always the latest version has someone got some code for that please (old VB6 code will also work)

    TIA
    Irfan
     
    irfan, Mar 16, 2005
    #1
  2. 1. Where does it pick AutoCAD 2004 referance
    2004/2005 share the same libraries
    Then iterate call them by their versions: 15.0, 16.0, 16.1.

    Basically you need to late bind [so no references to specific libraries].
    For connecting t AutoCAD, write a multi-tiered Try-Catch loop that starts
    with the latest release and works its way down to the oldest. The are
    plenty of examples here in this ng.


    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 16, 2005
    #2
  3. irfan

    irfan Guest

    i am using
    acadApp = Marshal("AutoCAD.Application.16.1") to connect to AutoCAD 2005
    but it still opens acad 2004, can u suggest please

    irfan
     
    irfan, Mar 16, 2005
    #3
  4. Private _cadApp As Object

    Public Function Connect2ACAD() As Boolean
    '+-- establish link to AutoCAD
    Try 'get running AutoCAD 2006
    _cadApp = GetObject(, "AutoCAD.Application.16.2")
    Catch
    Try 'get running AutoCAD 2005
    _cadApp = GetObject(, "AutoCAD.Application.16.1")
    Catch
    Try 'get running AutoCAD 2004
    _cadApp = GetObject(, "AutoCAD.Application.16")
    Catch
    Try 'start AutoCAD 2006
    _cadApp = CreateObject("AutoCAD.Application.16.2")
    Catch
    Try 'start AutoCAD 2005
    _cadApp = CreateObject("AutoCAD.Application.16.1")
    Catch
    Try 'start AutoCAD 2004
    _cadApp = CreateObject("AutoCAD.Application.16")
    Catch
    Return False
    End Try
    End Try
    End Try
    End Try
    End Try
    End Try
    End Function


    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 17, 2005
    #4
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.