<?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 Create Selection set and get insert point of multiple blocks in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525044#M54732</link>
    <description>&lt;P&gt;I am very new to VB.NET and I am need some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am trying to do is create a selection set of blocks with the same name.&amp;nbsp;Then&amp;nbsp;step&amp;nbsp;throught the selection set and if the block has an attribute "Tag" with a Specific "Value" then get the insert point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a good tutorial or example that someone could point me to?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jul 2012 14:46:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-03T14:46:02Z</dc:date>
    <item>
      <title>Create Selection set and get insert point of multiple blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525044#M54732</link>
      <description>&lt;P&gt;I am very new to VB.NET and I am need some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am trying to do is create a selection set of blocks with the same name.&amp;nbsp;Then&amp;nbsp;step&amp;nbsp;throught the selection set and if the block has an attribute "Tag" with a Specific "Value" then get the insert point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a good tutorial or example that someone could point me to?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 14:46:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525044#M54732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-03T14:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create Selection set and get insert point of multiple blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525322#M54733</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is a very crude example of a function to get a list of insertion points from a selection set (crossing):&lt;/P&gt;&lt;PRE&gt;Public Function getBlockInsPoints(ByVal tag As String) As List(Of Point3d)
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim db As Database = doc.Database

        Dim ipoints As New List(Of Point3d)

        Dim p1, p2 As Point3d

        Using acTrans As Transaction = db.TransactionManager.StartTransaction()
            Dim acTypValAr(1) As TypedValue
            Dim blkref As BlockReference

            acTypValAr.SetValue(New TypedValue(DxfCode.Start, "INSERT"), 0)
            acTypValAr.SetValue(New TypedValue(DxfCode.AttributeTag, tag), 1)

            Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
            Dim acSSPrompt As PromptPointResult = doc.Editor.GetPoint("Select First Point:")

            If acSSPrompt.Status = PromptStatus.OK Then
                p1 = acSSPrompt.Value
                acSSPrompt = doc.Editor.GetCorner("Select Second Point: ", p1)
                If acSSPrompt.Status = PromptStatus.OK Then
                    p2 = acSSPrompt.Value
                    Dim wssprompt As PromptSelectionResult

                    wssprompt = ed.SelectCrossingWindow(p1, p2, acSelFtr)
                    If wssprompt.Status = PromptStatus.OK Then
                        Dim wss As SelectionSet = wssprompt.Value
                        For Each acSSObj As SelectedObject In wss
                            If Not IsDBNull(acSSObj) Then
                                blkref = acSSObj.ObjectId.GetObject(OpenMode.ForRead)
                                ipoints.Add(blkref.Position)
                            End If
                        Next
                    End If
                End If
            End If
            acTrans.Commit()
        End Using
        Return ipoints
    End Function&lt;/PRE&gt;&lt;P&gt;Put the function in a command, ask for the tag name and pass it to the function, or hardcode the tag name in the function call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 16:54:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525322#M54733</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2012-07-03T16:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create Selection set and get insert point of multiple blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525328#M54734</link>
      <description>&lt;P&gt;Thanks for the help. I will look over the code and see if I can get it to work for me.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 17:03:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selection-set-and-get-insert-point-of-multiple-blocks/m-p/3525328#M54734</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-03T17:03:59Z</dc:date>
    </item>
  </channel>
</rss>

