Home General VB.NET Start AutoCad Session .NET
20 | 05 | 2012
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade

Start AutoCad Session .NET PDF Print E-mail
User Rating: / 0
PoorBest 
Tutorials

 

Use the Function below to start a AutoCad session from VB.NET

[code]

[/code]

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput

   End Class

 

Public Class Class2

    Public Function StartAutoCADSession() As Object

        '*********************************************
        '*********Code from VisibleVisual.com*********
        '*********************************************

        On Error Resume Next

        Dim AcadApp As Object
        'Check if a AutoCad session Exists
        AcadApp = GetObject(, "AutoCAD.Application")
        If Err.Number <> 0Then
            Err.Clear()
            'If there is no AutoCad session active then there will be one created
            AcadApp = CreateObject("AutoCAD.Application")
        End If

        If Err.Number <> 0 Then
            StartAutoCADSession = Nothing
            Exit Function
        End If

        'if successful set visibility status
        AcadApp.Visible = 1
        'opened OK
        Return AcadApp

    End Function

 

Comments   

 
+1 #1 Guest 2011-09-04 16:40
if this is for VB.Net would not Try/Catch be a better error handler.

habits from VBA are difficult to drop.

Good web site though.
Quote
 

Add comment


Security code
Refresh

This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade