Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
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.
In every drawn element I added specific Xdata.
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
Maybe it is because I added Xdata the wrong way?
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
kind regards,
Wouter
Solved! Go to Solution.