.NET : How to Get current AutoCAD session

.NET : How to Get current AutoCAD session

Anonymous
Not applicable
473 Views
3 Replies
Message 1 of 4

.NET : How to Get current AutoCAD session

Anonymous
Not applicable
Hi all,
is there a way to get the current AutoCAD session with VB.Net?
(as we did with GetObject("AutoCad.Application") in VB6)

Thanks, Nicola
0 Likes
474 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
ngarone wrote: > Hi all, > is there a way to get the current AutoCAD session with VB.Net? > (as we did with GetObject("AutoCad.Application") in VB6) > > Thanks, Nicola This works in all .NET languages as it's a call to the base class library: System.Runtime.InteropServices.Marshal.GetActiveObject() I believe VB.NET can still use GetObject. -- There are 10 kinds of people: those who understand binary and those who don't.
0 Likes
Message 3 of 4

Anonymous
Not applicable
'Try to get an open AutoCad object
Try
objApp = GetObject(, "AutoCAD.Application.16")
Catch
'Try to create an AutoCad object if the previous request failed
Try
objApp = CreateObject("AutoCAD.Application.16")
Catch
'Error handling
End Try
End Try
0 Likes
Message 4 of 4

Anonymous
Not applicable
No. Better to use Frank's method as using the old VB6 approach causes problems when exiting the app -- Mike ___________________________ Mike Tuersley CADalyst's CAD Clinic Rand IMAGINiT Technologies ___________________________ the trick is to realize that there is no spoon...
0 Likes