<?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 Betreff: VBA to select block by name filter in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734871#M142542</link>
    <description>&lt;P&gt;Exactly.. In Layout PSPACE I have only one block called &lt;SPAN&gt;"arrow", which needs to be selected and rotate at its position by give angle value. For which I am using "ssget" to select that block. Also I am not find any other way to select the block by name in AutoCAD command lines.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Please&lt;SPAN&gt;&amp;nbsp;share me if you have any other idea to execute&amp;nbsp;this..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Harish&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2019 17:17:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-04-16T17:17:19Z</dc:date>
    <item>
      <title>VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734141#M142533</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for a VBA code to select the blocks in drawing based on Block name (Arrow).&lt;/P&gt;
&lt;P&gt;Similar to autolisp command "(sssetfirst nil (ssget "_X" '((0 . "INSERT") (2 . "Arrow"))))"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please share me if any code available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Harish Kumar M&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 14:09:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734141#M142533</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-16T14:09:40Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734225#M142534</link>
      <description>&lt;P&gt;Use the lisp expression as stupid commandline-input (AutoCAD understand lisp expressions directly from the commandline),&lt;/P&gt;
&lt;P&gt;use SENDCOMMAND to fire the input to the commandline // quick and dirty solution, because in VBA is nothing similar to ssget available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you have to programm what you need, iterate thru the space(s) you want, check every item&lt;/P&gt;
&lt;P&gt;for type, if blockreference check it for effectivename and if the effectivename match what you are&lt;/P&gt;
&lt;P&gt;searching for, add the item to a selectionset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 14:30:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734225#M142534</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2019-04-16T14:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734349#M142535</link>
      <description>&lt;P&gt;You can get a SelectionSet of block references using the code below. Call using GetSS_BlockName("Arrow")&lt;/P&gt;
&lt;PRE&gt;Public Function AddSelectionSet(SetName As String) As AcadSelectionSet
' This routine does the error trapping neccessary for when you want to create a
' selectin set. It takes the proposed name and either adds it to the selectionsets
' collection or sets it.
    On Error Resume Next
    Set AddSelectionSet = ThisDrawing.SelectionSets.Add(SetName)
    If Err.Number &amp;lt;&amp;gt; 0 Then
        Set AddSelectionSet = ThisDrawing.SelectionSets.Item(SetName)
        AddSelectionSet.Clear
    End If
End Function

Public Function GetSS_BlockName(BlockName As String) As AcadSelectionSet
    'creates a ss of blocks with the name supplied in the argument
    Dim s2 As AcadSelectionSet
    
    Set s2 = AddSelectionSet("ssBlocks")                ' create ss with a name
    s2.Clear                                        ' clear the set
    Dim intFtyp(3) As Integer                       ' setup for the filter
    Dim varFval(3) As Variant
    Dim varFilter1, varFilter2 As Variant
    intFtyp(0) = -4: varFval(0) = "&amp;lt;AND"
    intFtyp(1) = 0: varFval(1) = "INSERT"           ' get only blocks
    intFtyp(2) = 2: varFval(2) = BlockName          ' whose name is specified in argument
    intFtyp(3) = -4: varFval(3) = "AND&amp;gt;"
    varFilter1 = intFtyp: varFilter2 = varFval
    s2.Select acSelectionSetAll, , , varFilter1, varFilter2        ' do it
    Set GetSS_BlockName = s2

End Function
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, The AutoCAD VBA forum is &lt;A href="https://forums.autodesk.com/t5/visual-basic-customization/bd-p/33" target="_blank" rel="noopener"&gt;over here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 15:01:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734349#M142535</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2019-04-16T15:01:17Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734464#M142536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply..&lt;/P&gt;
&lt;P&gt;I tried sending ssget by command line, but i am getting the error shown below.&amp;nbsp; Please suggest&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Snap 2019-04-16 at 20.56.52.png" style="width: 898px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/626837iAAAD7C5B9DADAA32/image-size/large?v=v2&amp;amp;px=999" role="button" title="Snap 2019-04-16 at 20.56.52.png" alt="Snap 2019-04-16 at 20.56.52.png" /&gt;&lt;/span&gt;&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Harish&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 15:29:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734464#M142536</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-16T15:29:36Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734497#M142537</link>
      <description>&lt;P&gt;The SendCommmand method takes an argument that evaluates to a single String argument. You've got multiple double quotes. You need to use the backslash to tell vba that they're literal characters. However, you won't be able to use SendCommand that way because it is asyncronous. The SendCommand method waits until all the vba is processed and then it sends the string to the command line AFTER the vba is through. Use the vba functions I gave you.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 15:40:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734497#M142537</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2019-04-16T15:40:02Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734623#M142538</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I need to send around series of 63 AutoCAD command via VBA to execute a single task (like AutoCAD script), in which there are requirement to select blocks by its name in between. So i am looking for VBA SEND COMMAND code to simulate "ssget".&lt;/P&gt;
&lt;P&gt;Please suggest how to incorporate "(sssetfirst nil (ssget "_X" '((0 . "INSERT") (2 . "Arrow"))))" in VBA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Harish&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 16:12:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734623#M142538</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-16T16:12:39Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734633#M142539</link>
      <description>&lt;P&gt;Why do you need to use SendCommand? Its not a very good way to do things. The code I sent you previously creates a selection set just like ssget does.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 16:15:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734633#M142539</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2019-04-16T16:15:28Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734685#M142540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14801" target="_self"&gt;Ed.Jobe&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="login-bold"&gt;Below is my part of script which i need to simulate through VBA:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snap 2019-04-16 at 21.51.32.png" style="width: 508px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/626893i62F6315D38E3AE9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Snap 2019-04-16 at 21.51.32.png" alt="Snap 2019-04-16 at 21.51.32.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Please bare with me as I am new to Autolisp &amp;amp; VBA, just started developing myself on VBA..&lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://forums.autodesk.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;
&lt;P&gt;Thank you..&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 16:27:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734685#M142540</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-16T16:27:02Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734754#M142541</link>
      <description>&lt;P&gt;Your script has some logic problems. The ssget will find all blocks called "arrow". Your script will only process the first one. Is that what you want?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 16:48:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734754#M142541</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2019-04-16T16:48:43Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734871#M142542</link>
      <description>&lt;P&gt;Exactly.. In Layout PSPACE I have only one block called &lt;SPAN&gt;"arrow", which needs to be selected and rotate at its position by give angle value. For which I am using "ssget" to select that block. Also I am not find any other way to select the block by name in AutoCAD command lines.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Please&lt;SPAN&gt;&amp;nbsp;share me if you have any other idea to execute&amp;nbsp;this..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Harish&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 17:17:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734871#M142542</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-16T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Betreff: VBA to select block by name filter</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734917#M142543</link>
      <description>&lt;P&gt;Using the functions I gave you earlier...&lt;/P&gt;
&lt;PRE&gt;Dim ss As AcadSelectionSet
Set ss = GetSS_BlockName("Arrow")
If ss.Count &amp;gt; 0 Then
   Dim oBlock As AcadBlockReference
   Set oBlock = ss.Item(0)
   With oBlock
      .InsertionPoint = (23.0, 2.3, 0)
      .Rotation = 340&lt;BR /&gt;      .Update
   End With
End If&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Apr 2019 17:31:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/vba-to-select-block-by-name-filter/m-p/8734917#M142543</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2019-04-16T17:31:06Z</dc:date>
    </item>
  </channel>
</rss>

