<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to access AutoCAD 2012 from Vb.net Standard Exe in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363537#M56993</link>
    <description>&lt;PRE&gt;   Sub dwgAddCircle(ByVal acadApp As Autodesk.AutoCAD.Interop.AcadApplication)

        Dim doc As AcadDocument = acadApp.ActiveDocument

        Dim pt(2) As Double
        pt(0) = 0
        pt(1) = 0
        pt(2) = 0

        doc.ModelSpace.AddCircle(pt, 10)

    End Sub

    Sub dwgReSave(ByVal acadApp As Autodesk.AutoCAD.Interop.AcadApplication, ByVal strFileName As String)
        Dim acadDBX As Object = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.18")

        If FileExists(strFileName) Then
            If Not InUse(strFileName) Then
                Try
                    acadDBX.Open(strFileName)
                    acadDBX.saveas(strFileName)
                    acadDBX = Nothing
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(acadApp)

                    GC.Collect()
                    GC.WaitForPendingFinalizers()

                Catch ex As Exception
                End Try
            End If
        End If


    End Sub

    Public Function InUse(ByVal sFile As String) As Boolean

        If System.IO.File.Exists(sFile) Then
            Try
                Dim F As Short = FreeFile()
                FileOpen(F, sFile, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.LockReadWrite)
                FileClose(F)
            Catch


                Return True
            End Try
        End If
    End Function

    Public Function FileExists(ByVal FileFullPath As String) _
As Boolean
        Dim f As New IO.FileInfo(FileFullPath)
        Return f.Exists

    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2012 17:31:35 GMT</pubDate>
    <dc:creator>arcticad</dc:creator>
    <dc:date>2012-03-08T17:31:35Z</dc:date>
    <item>
      <title>how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363237#M56988</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is that possible to access AutoCAD 2012 from VB.net Standard Exe&lt;/P&gt;&lt;P&gt;i am using vb.net 2010&lt;/P&gt;&lt;P&gt;i try to load AcDbMgd.dll and AcMgd every time i compile it give error in "Imports&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Autodesk.AutoCAD.ApplicationServices"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there any example for read and write current open drawing in AutoCAD from .net Standard Exe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Amrit&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 15:09:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363237#M56988</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-08T15:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363285#M56989</link>
      <description>&lt;P&gt;&lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2006/07/debugging_using.html"&gt;http://through-the-interface.typepad.com/through_the_interface/2006/07/debugging_using.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 15:41:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363285#M56989</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2012-03-08T15:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363333#M56990</link>
      <description>&lt;P&gt;i don't understand&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 15:59:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363333#M56990</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-08T15:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363365#M56991</link>
      <description>&lt;P&gt;Sorry I read your question wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;acDbMgd.dll and AcMgd are only for internal use within Autocad. They can't be used by an outside EXE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Get a reference to COM Autocad 2012 Type Library&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports System
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.Interop

Public Class ComCode

    Public Sub runme()

        Const progID As String = "AutoCAD.Application.18"
        Dim acApp As AcadApplication = Nothing
        Try
            acApp = DirectCast(Marshal.GetActiveObject(progID), AcadApplication)
        Catch ex As Exception
            Try
                Dim acType As Type = Type.GetTypeFromProgID(progID)
                acApp = DirectCast(Activator.CreateInstance(acType, True), AcadApplication)
            Catch ex2 As Exception
                MessageBox.Show("Cannot create object of type """ &amp;amp; progID &amp;amp; """")

            End Try
        End Try

        If acApp IsNot Nothing Then
            ' By the time this is reached AutoCAD is fully
            ' functional and can be interacted with through code
        End If
    End Sub

End Clas&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 16:12:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363365#M56991</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2012-03-08T16:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363427#M56992</link>
      <description>&lt;P&gt;hi arcticad&lt;/P&gt;&lt;P&gt;thanks for reply&lt;/P&gt;&lt;P&gt;it look like it is connect with autocad. but how to draw object and how to select object on it. could you please give little&amp;nbsp; hints.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thnaks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 16:32:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363427#M56992</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-08T16:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363537#M56993</link>
      <description>&lt;PRE&gt;   Sub dwgAddCircle(ByVal acadApp As Autodesk.AutoCAD.Interop.AcadApplication)

        Dim doc As AcadDocument = acadApp.ActiveDocument

        Dim pt(2) As Double
        pt(0) = 0
        pt(1) = 0
        pt(2) = 0

        doc.ModelSpace.AddCircle(pt, 10)

    End Sub

    Sub dwgReSave(ByVal acadApp As Autodesk.AutoCAD.Interop.AcadApplication, ByVal strFileName As String)
        Dim acadDBX As Object = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.18")

        If FileExists(strFileName) Then
            If Not InUse(strFileName) Then
                Try
                    acadDBX.Open(strFileName)
                    acadDBX.saveas(strFileName)
                    acadDBX = Nothing
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(acadApp)

                    GC.Collect()
                    GC.WaitForPendingFinalizers()

                Catch ex As Exception
                End Try
            End If
        End If


    End Sub

    Public Function InUse(ByVal sFile As String) As Boolean

        If System.IO.File.Exists(sFile) Then
            Try
                Dim F As Short = FreeFile()
                FileOpen(F, sFile, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.LockReadWrite)
                FileClose(F)
            Catch


                Return True
            End Try
        End If
    End Function

    Public Function FileExists(ByVal FileFullPath As String) _
As Boolean
        Dim f As New IO.FileInfo(FileFullPath)
        Return f.Exists

    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 17:31:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3363537#M56993</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2012-03-08T17:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3365287#M56994</link>
      <description>&lt;P&gt;it come error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unable to cast COM object of type 'System.__ComObject' to interface type 'Autodesk.AutoCAD.Interop.Common.IAcadModelSpace'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C60BC8AF-58DA-4866-859D-22A7F61411DE}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in line&lt;/P&gt;&lt;P&gt;&amp;nbsp;doc.ModelSpace.AddCircle(pt, 10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 16:26:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3365287#M56994</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-09T16:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to access AutoCAD 2012 from Vb.net Standard Exe</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3366765#M56995</link>
      <description>&lt;P&gt;hi Arcticad&lt;/P&gt;&lt;P&gt;your code work while i change compiler&amp;nbsp; to 3.5. and when i try to use 4 it give error on draw.&lt;/P&gt;&lt;P&gt;Thanks you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could any one suggest me what need more in code to draw from exe to autocad while i set to compile option in .net framework 4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 11 Mar 2012 21:32:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-autocad-2012-from-vb-net-standard-exe/m-p/3366765#M56995</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-11T21:32:58Z</dc:date>
    </item>
  </channel>
</rss>

