<?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: SelectionFilter SelectAll with specific XData in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337587#M24566</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With a selection filter, you can only filter on the registered application.&lt;/P&gt;
&lt;P&gt;To filter on a specific xdata value, you have to open each selected object and check for its xdata values.&lt;/P&gt;
&lt;P&gt;See &lt;A href="https://help.autodesk.com/view/OARX/2019/ENU/?guid=GUID-FCEBA022-3F80-47BE-BC29-8DF73CA9C0B8" target="_blank"&gt;this topic&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Oct 2018 13:18:38 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2018-10-16T13:18:38Z</dc:date>
    <item>
      <title>SelectionFilter SelectAll with specific XData</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337555#M24565</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to select all objects (lines, polyline, blockreferences, circle etc) with specific Xdata added to the object? when I use the selectionfilter, it only selects polylines with Xdata.&lt;/P&gt;&lt;P&gt;In every drawn element I added specific Xdata.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim doc = Application.DocumentManager.MdiActiveDocument
        Dim ed = doc.Editor

        '---Select objects with specific Xdata
        Dim ID As TypedValue = New TypedValue(1000, XdataString)
        Dim sf As SelectionFilter = New SelectionFilter(New TypedValue() {ID})
        Dim res = ed.SelectAll(sf)
        If res IsNot Nothing Then
            Dim objIds() As ObjectId = res.Value.GetObjectIds()
end if&lt;/PRE&gt;&lt;P&gt;Maybe it is because I added Xdata the wrong way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub SetXData(ByVal ObjIDColl As ObjectIdCollection, ByVal tekst As String, ByVal Engineer as string)
       If ObjIDColl Is Nothing Then Exit Sub
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument
        Dim docLock As DocumentLock = doc.LockDocument
        Dim ed As Editor = doc.Editor


        Dim AppName As String
        AppName = Algemeen.ProgName
        If AppName = "" Then AppName = "ThisMacro"
        '---
        Using MyTrans As Transaction = doc.TransactionManager.StartTransaction()
            AddRegAppTableRecord(AppName)
            For Each item In ObjIDColl
                Dim obj As Object = MyTrans.GetObject(item, OpenMode.ForWrite)

                '---remove previous Xdata
                If obj.XData IsNot Nothing Then
                    For Each tv As TypedValue In obj.XData
                        If tv.TypeCode = 1001 Then
                            obj.UpgradeOpen()
                            obj.XData = New ResultBuffer(New TypedValue(1001, tv.Value))
                            obj.DowngradeOpen()
                        End If
                    Next
                End If

                '---set new Xdata
                Dim rb As New ResultBuffer(New TypedValue(1001, AppName), New TypedValue(1000, tekst), New TypedValue(1000, Now), New TypedValue(1000, Engineer))

                '---Bind Xdata
                obj.XData = rb
                rb.Dispose()
            Next
            MyTrans.Commit()
        End Using
        docLock.Dispose()
    End Sub&lt;/PRE&gt;&lt;P&gt;kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wouter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 13:07:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337555#M24565</guid>
      <dc:creator>wbdehaan</dc:creator>
      <dc:date>2018-10-16T13:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: SelectionFilter SelectAll with specific XData</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337587#M24566</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With a selection filter, you can only filter on the registered application.&lt;/P&gt;
&lt;P&gt;To filter on a specific xdata value, you have to open each selected object and check for its xdata values.&lt;/P&gt;
&lt;P&gt;See &lt;A href="https://help.autodesk.com/view/OARX/2019/ENU/?guid=GUID-FCEBA022-3F80-47BE-BC29-8DF73CA9C0B8" target="_blank"&gt;this topic&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 13:18:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337587#M24566</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-10-16T13:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: SelectionFilter SelectAll with specific XData</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337760#M24567</link>
      <description>&lt;P&gt;Thanks a lot! I will edit the Xdata, and move the specific ID to the appname, then it is possible to search on this appname.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 14:13:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectionfilter-selectall-with-specific-xdata/m-p/8337760#M24567</guid>
      <dc:creator>wbdehaan</dc:creator>
      <dc:date>2018-10-16T14:13:47Z</dc:date>
    </item>
  </channel>
</rss>

