<?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 : AutoCAD Mechanical and Visual Studio (VB) connection in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6961219#M32271</link>
    <description>&lt;P&gt;A bit advice: do not just list a big chunk of code and simply say it does not work and let potential respondents play a guess game (OK, your code is not too long. But you get the idea). You need to explain in detail what "does not work" mean? is the code execution breaks with error (error message, at which line)? or the code when through without expected result (if so, did you step through the code to examine the data in variables to find out why easily)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can see a couple of potential issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. If the code goes via the first Try...Catch...block's "Catch..."clause (having to create a new AutoCAD instance, the code follows may not work, depending on AutoCAD's "Startup" mode: there may not be a "ActiveDocument" to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. If TypeName(entity) = "IAcadBlockReference" Then ... may not be good choice, because an AcadBlockReference may be derived from difference Interface, depending on AutoCAD's version. (if I have to guess, this is the line of code that might bypass the real work you need). The reliable code should be like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If TypeOf entity Is AcadBlockReference Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;...you try to retrieve attribute information here&lt;/P&gt;
&lt;P&gt;End if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is very easy to step through the code and find where the code does not work as expected:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;place a break point at a line of code. If the execution does not hit it (execution does not stop at the break point, code before the break point could be wrong&lt;/LI&gt;
&lt;LI&gt;Once the break point is hit, press F10/F11 to execute the code line by line. IN the meantime you can examine the variables in the code to see what the information in it.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you do these, you might have answered your own question in just a few minutes.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2017 13:43:59 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2017-03-21T13:43:59Z</dc:date>
    <item>
      <title>AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6950791#M32261</link>
      <description>&lt;P&gt;Hello to all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have done it successful with Inventor 2017 and Visual Basic 2010 Express. So, when I start Visual Basic I have &lt;STRONG&gt;Inventor 2017 Addin template&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to make the same connection between Visual Basic Express and AutoCAD Mechanical 2017 to have also template:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img12.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/333929i0CF9AC8DDC656CE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="img12.PNG" alt="img12.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible or not?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cause, something that I have read on the&amp;nbsp;&lt;A href="http://usa.autodesk.com/adsk/servlet/index?siteID=123112&amp;amp;id=18162797#steps" target="_self"&gt;http://usa.autodesk.com/adsk/servlet/index?siteID=123112&amp;amp;id=18162797#steps&lt;/A&gt; is that I need Visual Studio 2015.&amp;nbsp; Also, do I need classic AutoCAD or I can continue with AutoCAD Mechanical 2017?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is very appreciated.&lt;/P&gt;
&lt;P&gt;Danijel&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 14:44:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6950791#M32261</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-16T14:44:08Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6951403#M32262</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IMHO, you should use Visual Studio 2015 (Community Edition is free), and learn how to start an &lt;A href="http://help.autodesk.com/view/ACD/2017/ENU/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA" target="_blank"&gt;AutoCAD plug-in project from scratch&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Project templates are usefull, but do not teach anything about the Visual Studio project itself.&lt;/P&gt;
&lt;P&gt;When you'll understand the project structure, you can quite easily build your own templates.&lt;/P&gt;
&lt;P&gt;You can see &lt;A href="https://forums.autodesk.com/t5/net/how-to-install-the-dotnet-api-help/td-p/6926880" target="_blank"&gt;this thread&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 17:30:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6951403#M32262</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-03-16T17:30:41Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6956788#M32263</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IMHO, you should use Visual Studio 2015 (Community Edition is free), and learn how to start an &lt;A href="http://help.autodesk.com/view/ACD/2017/ENU/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA" target="_blank"&gt;AutoCAD plug-in project from scratch&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Project templates are usefull, but do not teach anything about the Visual Studio project itself.&lt;/P&gt;
&lt;P&gt;When you'll understand the project structure, you can quite easily build your own templates.&lt;/P&gt;
&lt;P&gt;You can see &lt;A href="https://forums.autodesk.com/t5/net/how-to-install-the-dotnet-api-help/td-p/6926880" target="_blank"&gt;this thread&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hello sir,&lt;/P&gt;
&lt;P&gt;You are right. I have always believed that Autodesk VB plug-in Templates are better for using cause they includes all references. So, I agree with your suggestion to start with creating projects from scratch.&lt;/P&gt;
&lt;P&gt;I have also few more things where I need advice:&lt;/P&gt;
&lt;P&gt;1. Do I need classic AutoCAD to iterate with Visual Studio 2015 or it is more than enough to have just AutoCAD Mechanical?&lt;/P&gt;
&lt;P&gt;2. Does AutoCAD have possibility to iterate with Visual Studio via &lt;A href="http://modthemachine.typepad.com/my_weblog/2010/03/iproperties-without-inventor-apprentice.html" target="_self"&gt;Apprentice&lt;/A&gt; as it is possible with Inventor?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2017 17:05:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6956788#M32263</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-19T17:05:39Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6956892#M32264</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not use Mechanical but you should be able to program the AutoCAD part referencing the standard libraries and probably reference some specific ones for the Mechanical part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About Apprentice, it seems to be specific to Inventor (I never use it).&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2017 18:49:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6956892#M32264</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-03-19T18:49:26Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6956938#M32265</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not use Mechanical but you should be able to program the AutoCAD part referencing the standard libraries and probably reference some specific ones for the Mechanical part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About Apprentice, it seems to be specific to Inventor (I never use it).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thank you very much for the quick answer.&lt;/P&gt;
&lt;P&gt;Apprentice access to properties is very useful cause don't need Inventor to be opened to manage with some data and properties. I was thinking it is also possible with AutoCAD, so I just can list all attributes via VisualBasic and manage with them.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2017 19:32:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6956938#M32265</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-19T19:32:54Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6957083#M32266</link>
      <description>&lt;P&gt;I have found an code to list all of the attributes of the opened drawing, but there is something that I did wrong.&lt;/P&gt;
&lt;PRE&gt;Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim AcadApp As Object
        Dim dbxDoc As Object

        AcadApp = &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;StartAutoCADSession()&lt;/STRONG&gt;&lt;/FONT&gt;
        dbxDoc = AcadApp.Activedocument
        AcadApp.Visible = True

        Dim I As Integer
        Dim strAttributes As String
        Dim varAttributes As Object
        Dim entity As Object

        For Each entity In dbxDoc.PaperSpace

            If TypeName(entity) = "IAcadBlockReference" Then
                If entity.hasattributes = True Then

                    varAttributes = entity.GetAttributes
                    strAttributes = ""

                    For I = LBound(varAttributes) To UBound(varAttributes)

                        MsgBox("BLOCKNAME:  " &amp;amp; entity.name &amp;amp; vbCr _
                                &amp;amp; "TAG             :  " &amp;amp; varAttributes(I).TagString &amp;amp; vbCr _
                                &amp;amp; "VALUE         :  " &amp;amp; varAttributes(I).TextString)

                    Next
                End If
            End If
        Next entity
    End Sub
End Class
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="startacadsession.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/335025i24D911DD3365A1E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="startacadsession.PNG" alt="startacadsession.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2017 22:47:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6957083#M32266</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-19T22:47:13Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6957109#M32267</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you absolutely need to use COM API (stand-alone exe), you should try to get already runing AutoCAD with GetObject and if it fails create a new one with GetObject&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure about VB syntax&lt;/P&gt;
&lt;PRE&gt;Dim acadApp A AcadApplication
' Get a running instance of AutoCAD
Try
    acadApp = GetObject(, "AutoCAD.Application")
    ' An error occurs if no instance is running
Catch
    Try
        ' Create a new instance of AutoCAD
        acadApp = CreateObject("AutoCAD.Application")
    Catch
        ' If an instance of AutoCAD is not created then message and exit
        MsgBox("Instance of 'AutoCAD.Application' could not be created.")
        Exit Sub
    End Try
End Try&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Mar 2017 23:19:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6957109#M32267</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-03-19T23:19:37Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6958524#M32268</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you absolutely need to use COM API (stand-alone exe), you should try to get already runing AutoCAD with GetObject and if it fails create a new one with GetObject&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure about VB syntax&lt;/P&gt;
&lt;PRE&gt;Dim acadApp A AcadApplication
' Get a running instance of AutoCAD
Try
    acadApp = GetObject(, "AutoCAD.Application")
    ' An error occurs if no instance is running
Catch
    Try
        ' Create a new instance of AutoCAD
        acadApp = CreateObject("AutoCAD.Application")
    Catch
        ' If an instance of AutoCAD is not created then message and exit
        MsgBox("Instance of 'AutoCAD.Application' could not be created.")
        Exit Sub
    End Try
End Try&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I agree, I would like to iterate with already opened acad document, but there is a error with definition:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="not defined.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/335279iAAE460F5F2A396C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="not defined.PNG" alt="not defined.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have tried also with:&lt;/P&gt;
&lt;PRE&gt;Dim acadApp as AutoCAD.AcadApplication&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2017 14:34:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6958524#M32268</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-20T14:34:44Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6958628#M32269</link>
      <description>&lt;P&gt;I made mistake cause I have not included reference for AutoCAD 2017 Type Library.&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="defined.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/335298iA084998EEC6AD296/image-size/large?v=v2&amp;amp;px=999" role="button" title="defined.PNG" alt="defined.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is ok now. I have adapted the code but still I am not getting the information about attributed from the drawing.&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="attributes.PNG" style="width: 443px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/335299i986185497FE22BEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="attributes.PNG" alt="attributes.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I have tried with:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;Dim acadApp As AutoCAD.AcadApplication
        ' Get a running instance of AutoCAD
        Try
            acadApp = GetObject(, "AutoCAD.Application")
            ' An error occurs if no instance is running
        Catch
            Try
                ' Create a new instance of AutoCAD
                acadApp = CreateObject("AutoCAD.Application")
            Catch
                ' If an instance of AutoCAD is not created then message and exit
                MsgBox("Instance of 'AutoCAD.Application' could not be created.")
                Exit Sub
            End Try
        End Try

        'Dim AcadApp As Object
        Dim dbxDoc As Object

        'AcadApp = StartAutoCADSession()
        dbxDoc = acadApp.ActiveDocument
        acadApp.Visible = True

        Dim I As Integer
        Dim strAttributes As String
        Dim varAttributes As Object
        Dim entity As Object

        For Each entity In dbxDoc.PaperSpace

            If TypeName(entity) = "IAcadBlockReference" Then
                If entity.hasattributes = True Then
                    MsgBox("sss")
                    varAttributes = entity.GetAttributes
                    strAttributes = ""

                    For I = LBound(varAttributes) To UBound(varAttributes)

                        MsgBox("BLOCKNAME:  " &amp;amp; entity.name &amp;amp; vbCr _
                                &amp;amp; "TAG             :  " &amp;amp; varAttributes(I).TagString &amp;amp; vbCr _
                                &amp;amp; "VALUE         :  " &amp;amp; varAttributes(I).TextString)

                    Next
                End If
            End If
        Next entity
    End Sub&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2017 14:57:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6958628#M32269</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-20T14:57:54Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6960468#M32270</link>
      <description>&lt;PRE&gt;Dim acadApp As AutoCAD.AcadApplication
        ' Get a running instance of AutoCAD
        Try
            acadApp = GetObject(, "AutoCAD.Application")
            ' An error occurs if no instance is running
        Catch
            Try
                ' Create a new instance of AutoCAD
                acadApp = CreateObject("AutoCAD.Application")
            Catch
                ' If an instance of AutoCAD is not created then message and exit
                MsgBox("Instance of 'AutoCAD.Application' could not be created.")
                Exit Sub
            End Try
        End Try

        'Dim AcadApp As Object
        Dim dbxDoc As Object

        dbxDoc = acadApp.ActiveDocument
        acadApp.Visible = True

        Dim I As Integer
        Dim strAttributes As String
        Dim varAttributes As Object
        Dim entity As Object

        For Each entity In dbxDoc.PaperSpace

            If TypeName(entity) = "IAcadBlockReference" Then
                If entity.hasattributes = True Then
                    varAttributes = entity.GetAttributes
                    strAttributes = ""

                    For I = LBound(varAttributes) To UBound(varAttributes)

                        MsgBox("BLOCKNAME:  " &amp;amp; entity.name &amp;amp; vbCr _
                                &amp;amp; "TAG             :  " &amp;amp; varAttributes(I).TagString &amp;amp; vbCr _
                                &amp;amp; "VALUE         :  " &amp;amp; varAttributes(I).TextString)

                    Next
                End If
            End If
        Next entity&lt;/PRE&gt;
&lt;P&gt;The only thing that I am trying to do is to list all blocks and their attributes in msgbox.&lt;/P&gt;
&lt;P&gt;Code above doesn't work. Does anyone know why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 08:42:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6960468#M32270</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-21T08:42:32Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6961219#M32271</link>
      <description>&lt;P&gt;A bit advice: do not just list a big chunk of code and simply say it does not work and let potential respondents play a guess game (OK, your code is not too long. But you get the idea). You need to explain in detail what "does not work" mean? is the code execution breaks with error (error message, at which line)? or the code when through without expected result (if so, did you step through the code to examine the data in variables to find out why easily)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can see a couple of potential issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. If the code goes via the first Try...Catch...block's "Catch..."clause (having to create a new AutoCAD instance, the code follows may not work, depending on AutoCAD's "Startup" mode: there may not be a "ActiveDocument" to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. If TypeName(entity) = "IAcadBlockReference" Then ... may not be good choice, because an AcadBlockReference may be derived from difference Interface, depending on AutoCAD's version. (if I have to guess, this is the line of code that might bypass the real work you need). The reliable code should be like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If TypeOf entity Is AcadBlockReference Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;...you try to retrieve attribute information here&lt;/P&gt;
&lt;P&gt;End if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is very easy to step through the code and find where the code does not work as expected:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;place a break point at a line of code. If the execution does not hit it (execution does not stop at the break point, code before the break point could be wrong&lt;/LI&gt;
&lt;LI&gt;Once the break point is hit, press F10/F11 to execute the code line by line. IN the meantime you can examine the variables in the code to see what the information in it.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you do these, you might have answered your own question in just a few minutes.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 13:43:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6961219#M32271</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2017-03-21T13:43:59Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD Mechanical and Visual Studio (VB) connection</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6961456#M32274</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Apologize for my problem is not clearly explained. I will try to explain it better. I have installed AutoCAD Mechanical 2017 and I am trying to iterate with some opened AutoCAD drawing through Visual Basic 2015, to get some block attributes from it.&lt;/P&gt;
&lt;P&gt;By your suggestion, I have modified the code little bit, but I am still not getting the return of the block attributes (block name, attribute's tag &amp;amp; attribute's value) .&lt;/P&gt;
&lt;P&gt;This is the first time that I am trying to iterate with AutoCAD drawing using Visual Basic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 14:45:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-mechanical-and-visual-studio-vb-connection/m-p/6961456#M32274</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2017-03-21T14:45:58Z</dc:date>
    </item>
  </channel>
</rss>

