<?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: Reading data from autocad table in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3560626#M58972</link>
    <description>&lt;P&gt;Hi amit,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What kind of solution you are looking for? Can you please explain?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to start AutoCAD from a external application using ActiveX API, then refer &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2007/12/launching-autoc.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/12/launching-autoc.html&lt;/A&gt; &amp;amp; &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Aug 2012 07:38:50 GMT</pubDate>
    <dc:creator>Virupaksha_aithal</dc:creator>
    <dc:date>2012-08-01T07:38:50Z</dc:date>
    <item>
      <title>Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3181902#M58967</link>
      <description>&lt;P&gt;Greetings to all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here i have one question...&lt;/P&gt;&lt;P&gt;Is that possible to read the Autocad Table data , without opening the Autocad from VB.NET.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with opening one autocad then loading the source dll. it was working perfectly.&lt;/P&gt;&lt;P&gt;but i need to without opening a application its possible or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2011 11:48:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3181902#M58967</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-10-06T11:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3182438#M58968</link>
      <description>&lt;P&gt;You could do this if you licensed RealDWG (&lt;A href="http://www.autodesk.com/realdwg" target="_blank"&gt;www.autodesk.com/realdwg&lt;/A&gt;). But the public (free) AutoCAD APIs require you have AutoCAD installed on your computer (and running).&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2011 16:01:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3182438#M58968</guid>
      <dc:creator>StephenPreston</dc:creator>
      <dc:date>2011-10-06T16:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3182674#M58969</link>
      <description>&lt;P&gt;In addition to Stephens comment, you could use a COM application which would require you to open AutoCAD, but you could open it Invisibly, so the user doesn't see it open.&amp;nbsp; That's as close as you can get, without using RealDWG.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2011 18:13:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3182674#M58969</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2011-10-06T18:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3183220#M58970</link>
      <description>&lt;P&gt;Thank u so much,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Ranjith&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2011 07:49:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3183220#M58970</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-10-07T07:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3551182#M58971</link>
      <description>&lt;P&gt;Hey Ranjith, did you get any success in doing so. Because i am also looking for some similar kind of solution. Can you post it here if you have any&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 05:56:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3551182#M58971</guid>
      <dc:creator>amitnkukanur</dc:creator>
      <dc:date>2012-07-25T05:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3560626#M58972</link>
      <description>&lt;P&gt;Hi amit,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What kind of solution you are looking for? Can you please explain?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to start AutoCAD from a external application using ActiveX API, then refer &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2007/12/launching-autoc.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/12/launching-autoc.html&lt;/A&gt; &amp;amp; &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2012 07:38:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3560626#M58972</guid>
      <dc:creator>Virupaksha_aithal</dc:creator>
      <dc:date>2012-08-01T07:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3560756#M58973</link>
      <description>&lt;P&gt;If you're still using COM, so try this code,&lt;/P&gt;&lt;P&gt;not tested seriously, just the same logic&lt;/P&gt;&lt;P&gt;as I'm&amp;nbsp;posted before,&lt;/P&gt;&lt;P&gt;change file name you'll want to open&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Public Shared Sub ReadTableFromDwg()
        Dim acadver As String = "18" '//AutoCAD Version
        ' set your file name to read data here
        Dim fname As String = "C:\Test\mtext.dwg"
        ' define csv file name variable
        Dim csvname As String = String.Empty

        Dim listData As New List(Of Object)
        ' get current culture
        Dim oldCult As System.Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
        ' create new culture
        Dim thisCult As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US")
        ' set current culture to newly created
        System.Threading.Thread.CurrentThread.CurrentCulture = thisCult

        MsgBox("Wait...")

        Dim appProgID As String = "Autocad.Application" + "." + acadver

        ' get reference on interface IDispatch
        Dim AcadType As Type = Type.GetTypeFromProgID(appProgID)

        ' launch AutoCAD
        Dim AcadApp As Object = Activator.CreateInstance(AcadType)

        Dim visargs() As Object = New Object(0) {}

        ' set visibility mode to false
        visargs(0) = True

        ' Make application visible
        AcadApp.GetType().InvokeMember("Visible", BindingFlags.SetProperty, Nothing, AcadApp, visargs, Nothing)

        ' Maximize window
        ''AcadApp.GetType().InvokeMember("WindowState", BindingFlags.SetProperty, Nothing, AcadApp, New Object() {1}, Nothing)

        Dim AcadDocs As Object = AcadApp.GetType().InvokeMember("Documents", BindingFlags.GetProperty, Nothing, AcadApp, Nothing)

        ' define arguments to open file
        Dim args() As Object = New Object(1) {}

        args(0) = fname
        ' set read only mode to false
        args(1) = False
        ' try open document
        Dim AcDoc As Object = AcadDocs.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, Nothing, AcadDocs, args, Nothing)

        Dim AcUtil As Object = New Object

        Try

            ' get reference on active document
            AcDoc = AcadApp.GetType().InvokeMember("ActiveDocument", BindingFlags.GetProperty, Nothing, AcadApp, Nothing, Nothing)
            ' get reference on ModelSpace
            Dim AcSpace As Object = AcDoc.GetType().InvokeMember("ModelSpace", BindingFlags.GetProperty, Nothing, AcDoc, Nothing)
            ' get reference of  AcadUtility
            AcUtil = AcDoc.GetType().InvokeMember("Utility", BindingFlags.GetProperty Or BindingFlags.Public, Nothing, AcDoc, Nothing)

            Dim acTable As New Object

            '        '_____________________________________________

            '        ' based on example written by Tony Tanzillo
            '        '_____________________________________________

            ' The array of arguments that will be passed
            ' to the AcadUtil.GetEntity() method:
            Dim entargs As Object() = New Object(2) {}

            ' In order to get VT_BYREF  arguments to be
            ' filled in by the callee, we must use ParameterModifier
            ' to retrieve the arguments:

            ' The callee will replace the ParameterModifier
            ' in the args[] argument array with the results.

            entargs(0) = New Object
            entargs(1) = New Object
            entargs(2) = vbLf + "! Select Table !"
            ' We also need to tell the marshaler that
            ' both parameters in the COM method call are
            ' 'out' or 'byref' parameters:
            ' 2 = the total number of arguments passed:
            Dim pm As New ParameterModifier(3)

            pm(0) = True
            ' first argument is ByRef
            pm(1) = True
            ' second argument is ByRef
            pm(1) = False
            ' third argument is ByVal
            Dim modifiers As ParameterModifier() = New ParameterModifier() {pm}

            ' Invoke the method, passing the arguments, and
            ' the parameter modifers

            AcUtil.GetType().InvokeMember("GetEntity", BindingFlags.InvokeMethod, Nothing, AcUtil, entargs, modifiers, Nothing, Nothing)

            ' The results are now in the entargs[] array:
            Dim entity As Object = DirectCast(entargs(0), Object)
            Dim pickpt As Object = DirectCast(entargs(1), Object)
         


            Dim objName As String = entity.GetType.InvokeMember("ObjectName", BindingFlags.GetProperty Or BindingFlags.IgnoreCase, Nothing, entity, Nothing).ToString()
            ' make sure the table object selected
            If objName &amp;lt;&amp;gt; "AcDbTable" Then

                MessageBox.Show("Selectet is not type of table, exit program ...")

                Return

            End If

            acTable = entity

            Dim tableRows As Object = acTable.GetType().InvokeMember("Rows", BindingFlags.GetProperty Or BindingFlags.Public, Nothing, acTable, Nothing)

            Dim tableColumns As Object = acTable.GetType().InvokeMember("Columns", BindingFlags.GetProperty Or BindingFlags.Public, Nothing, acTable, Nothing)


            Dim tableContent As New List(Of List(Of String))

            For i As Integer = 0 To tableRows - 1

                Dim tableLine As New List(Of String)

                For j As Integer = 0 To tableColumns - 1

                    Dim cellText As Object = acTable.GetType().InvokeMember("GetText", BindingFlags.InvokeMethod Or BindingFlags.Public, Nothing, acTable, New Object() {i, j})

                    tableLine.Add(cellText.ToString())

                Next

                tableContent.Add(tableLine)

            Next
            ''-------------------------------------------------''
            '' for debug only:

            'Dim sb As New StringBuilder
            'For Each line As List(Of String) In tableContent
            '    Dim textline As String = ""
            '    For Each st As String In line
            '        textline = textline + st + vbTab
            '    Next
            '    sb.AppendLine(textline.TrimEnd(vbTab))
            'Next
            'MessageBox.Show(sb.ToString())

            ''-------------------------------------------------''

            Dim initDir As String = AcDoc.GetType.InvokeMember("Path", BindingFlags.GetProperty, Nothing, AcDoc, Nothing, Nothing).ToString()

            Dim saveFileDialog As New System.Windows.Forms.SaveFileDialog

            saveFileDialog.Title = "Enter a file name to write data: "

            saveFileDialog.InitialDirectory = initDir

            saveFileDialog.RestoreDirectory = True

            saveFileDialog.Filter = "CSV files | *.csv"

            saveFileDialog.FileName = "File name without extension"

            Dim result As System.Windows.Forms.DialogResult = saveFileDialog.ShowDialog()

            If result &amp;lt;&amp;gt; DialogResult.OK Then
                csvname = "Not saved"
                Return
            End If

            csvname = saveFileDialog.FileName

            ' Write data to CSV
            Using sw As New StreamWriter(csvname, True, Encoding.ASCII)

                For Each line As List(Of String) In tableContent
                    Dim textline As String = ""
                    For Each st As String In line
                        textline = textline + st + vbTab
                    Next
                    sw.WriteLine(textline.TrimEnd(vbTab))
                Next
            End Using
            ''----------------------------------------------------------------------------------------------------''
            'save document
            Dim closeargs() As Object = New Object(1) {}
            closeargs(0) = True
            ' with the same name
            closeargs(1) = fname
            ' Try close document
            ' simplified syntax
            AcDoc.GetType().InvokeMember("Close", BindingFlags.InvokeMethod, Nothing, AcDoc, closeargs)

        Catch ex As System.Exception

            MessageBox.Show("Error: " &amp;amp; ex.Message &amp;amp; vbLf &amp;amp; "Trace: " &amp;amp; ex.StackTrace)

        Finally

            ' Try quit application
            AcadApp.GetType().InvokeMember("Quit", BindingFlags.InvokeMethod, Nothing, AcadApp, Nothing)
            ' clean up the memory
            '--------------------'
            ' release Document.
            releaseObject(AcDoc)
            ' release Documents.
            releaseObject(AcadDocs)
            ' release Application.
            releaseObject(AcadApp)
            ' call garbage cleaner immediatelly
            GC.WaitForPendingFinalizers()
            GC.GetTotalMemory(True)
            GC.WaitForPendingFinalizers()
            GC.GetTotalMemory(True)
            ' restore current culture
            System.Threading.Thread.CurrentThread.CurrentUICulture = oldCult
            'Display result
            MessageBox.Show("Csv file saved as:" + vbLf + csvname)
        End Try

    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2012 10:52:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/3560756#M58973</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-08-01T10:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11449913#M58974</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have seen your posts so for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing a problem in reading the table from autocad document.&lt;/P&gt;&lt;P&gt;Can you share your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That could be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;D.Giridhar&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:13:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11449913#M58974</guid>
      <dc:creator>dudde.giridhar</dc:creator>
      <dc:date>2022-09-28T12:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11468845#M58975</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't have the code and going by concept.&lt;/P&gt;&lt;P&gt;Reading table is straight forward approach&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 16:30:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11468845#M58975</guid>
      <dc:creator>amitnkukanur</dc:creator>
      <dc:date>2022-10-07T16:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11469916#M58976</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12930787"&gt;@dudde.giridhar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hi try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/OARX/2022/ENU/?guid=OARX-ManagedRefGuide-__MEMBERTYPE_Methods_Autodesk_AutoCAD_DatabaseServices_Table" target="_blank"&gt;https://help.autodesk.com/view/OARX/2022/ENU/?guid=OARX-ManagedRefGuide-__MEMBERTYPE_Methods_Autodesk_AutoCAD_DatabaseServices_Table&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2022-10-05 151622.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1124985i23A4BFCDD5849F36/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2022-10-05 151622.png" alt="Annotation 2022-10-05 151622.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 08:07:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11469916#M58976</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2022-10-08T08:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from autocad table</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11472088#M58977</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6591997" target="_self"&gt;&lt;SPAN class=""&gt;hosneyalaa&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the replay.&lt;/P&gt;&lt;P&gt;I will go through that and come back.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;D.Giridhar.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 05:41:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-autocad-table/m-p/11472088#M58977</guid>
      <dc:creator>dudde.giridhar</dc:creator>
      <dc:date>2022-10-10T05:41:05Z</dc:date>
    </item>
  </channel>
</rss>

