| Author |
Message |
irfan
Guest
|
Posted:
Wed Mar 16, 2005 5:46 pm Post subject:
AutoCAD 2004 Referance |
|
|
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
|
|
| Back to top |
|
 |
Mike Tuersley
Guest
|
Posted:
Wed Mar 16, 2005 6:50 pm Post subject:
Re: AutoCAD 2004 Referance |
|
|
| Quote: | 1. Where does it pick AutoCAD 2004 referance
2004/2005 share the same libraries |
| Quote: | 2. I want it to open always the latest version has someone got some code for that please (old VB6 code will also work)
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... |
|
| Back to top |
|
 |
irfan
Guest
|
Posted:
Wed Mar 16, 2005 7:25 pm Post subject:
Re: AutoCAD 2004 Referance |
|
|
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
|
|
| Back to top |
|
 |
Mike Tuersley
Guest
|
Posted:
Thu Mar 17, 2005 9:13 am Post subject:
Re: AutoCAD 2004 Referance |
|
|
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... |
|
| Back to top |
|
 |
|
|
|
|