AutoCAD 2004 Referance
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
AutoCAD 2004 Referance

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
irfan
Guest





Posted: Wed Mar 16, 2005 5:46 pm    Post subject: AutoCAD 2004 Referance Reply with quote

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 Reply with quote

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 Reply with quote

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 Reply with quote

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
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB