Filtering SSet for XData problem

Filtering SSet for XData problem

Anonymous
Not applicable
470 Views
7 Replies
Message 1 of 8

Filtering SSet for XData problem

Anonymous
Not applicable
Here's what I can't figure out - how do I filter SSet for, say, partial string "*John*" if I have an XData structure like this: Type: 1001 Data: "MYAPP" Type: 1002 Data: "{" Type: 1000 Data: "John" Type: 1000 Data: "Wayne" Type: 1002 Data: "}" I tried with SelSet filters: DataType(0) = 1001: DataString(0) = "MYAPP" DataType(1) = 1000: DataString(1) = "*John*" but it doesn't work. Many thanks for any tip regarding the problem. Maksim Sestic
0 Likes
471 Views
7 Replies
Replies (7)
Message 2 of 8

Speed_CAD
Collaborator
Collaborator
Hi...

Try this...

Private Sub SelXdata()
Dim tipoXdatoOut As Variant
Dim valorXtipoOut As Variant
Dim objEntidad As AcadEntity
Dim sSeleccion As AcadSelectionSet
Dim cSeleccion As AcadSelectionSets
Dim vCodigo As Variant
Dim vEntidad As Variant
Dim codigo(0) As Integer
Dim entidad(0) As Variant

AppActivate autocadApp.Caption
Set cSeleccion = autocadApp.ActiveDocument.SelectionSets

For Each sSeleccion In cSeleccion
If sSeleccion.Name = "SS" Then
sSeleccion.Delete
Exit For
End If
Next
Set sSeleccion = cSeleccion.Add("SS")
codigo(0) = 1001
entidad(0) = "MYAPP"
vCodigo = codigo
vEntidad = entidad
sSeleccion.Select acSelectionSetAll, , , vCodigo, vEntidad
For Each objEntidad In sSeleccion
objEntidad.GetXData "MYAPP", tipoXdatoOut, valorXtipoOut
If valorXtipoOut(1) = "John" Then
objEntidad.Color = acBlue
objEntidad.Highlight True
End If
Next objEntidad
End Sub

Un saludo de SpeedCAD... 🙂
CHILE
FORO: http://www.hispacad.com/foro
Mauricio Jorquera
0 Likes
Message 3 of 8

Anonymous
Not applicable
Thanks SpeedCAD, but this is the approach I've already implemented. I was rather wandering if it's possible to implement filtering on both 1001="MYAPP" and 1000="*John*" simultaneously. Autodesk documentation says that codes 1000+ are "not maintained by AutoCAD"... whatever this means, but still can't figure out why I just can't filter on DXF code 1001... Regards, Maksim Sestic "SpeedCAD" wrote in message news:31940764.1075565195881.JavaMail.jive@jiveforum2.autodesk.com... > Hi... > > Try this... > > Private Sub SelXdata() > Dim tipoXdatoOut As Variant > Dim valorXtipoOut As Variant > Dim objEntidad As AcadEntity > Dim sSeleccion As AcadSelectionSet > Dim cSeleccion As AcadSelectionSets > Dim vCodigo As Variant > Dim vEntidad As Variant > Dim codigo(0) As Integer > Dim entidad(0) As Variant > > AppActivate autocadApp.Caption > Set cSeleccion = autocadApp.ActiveDocument.SelectionSets > > For Each sSeleccion In cSeleccion > If sSeleccion.Name = "SS" Then > sSeleccion.Delete > Exit For > End If > Next > Set sSeleccion = cSeleccion.Add("SS") > codigo(0) = 1001 > entidad(0) = "MYAPP" > vCodigo = codigo > vEntidad = entidad > sSeleccion.Select acSelectionSetAll, , , vCodigo, vEntidad > For Each objEntidad In sSeleccion > objEntidad.GetXData "MYAPP", tipoXdatoOut, valorXtipoOut > If valorXtipoOut(1) = "John" Then > objEntidad.Color = acBlue > objEntidad.Highlight True > End If > Next objEntidad > End Sub > > Un saludo de SpeedCAD... :) > CHILE > FORO: http://www.hispacad.com/foro
0 Likes
Message 4 of 8

Anonymous
Not applicable
Straight from the developer's guide.... The ssget function recognizes all group codes except entity names (group -1), handles (group 5), and xdata codes (groups greater than 1000). If an invalid group code is used in a filter-list, it is ignored by ssget. To search for objects with xdata, use the -3 code as described in Filtering for Extended Data HTH, Jeff "Maksim Sestic" wrote in message news:401bde81_3@newsprd01... > Thanks SpeedCAD, but this is the approach I've already implemented. I was > rather wandering if it's possible to implement filtering on both > 1001="MYAPP" and 1000="*John*" simultaneously. Autodesk documentation says > that codes 1000+ are "not maintained by AutoCAD"... whatever this means, but > still can't figure out why I just can't filter on DXF code 1001... > > Regards, > Maksim Sestic > > "SpeedCAD" wrote in message > news:31940764.1075565195881.JavaMail.jive@jiveforum2.autodesk.com... > > Hi... > > > > Try this... > > > > Private Sub SelXdata() > > Dim tipoXdatoOut As Variant > > Dim valorXtipoOut As Variant > > Dim objEntidad As AcadEntity > > Dim sSeleccion As AcadSelectionSet > > Dim cSeleccion As AcadSelectionSets > > Dim vCodigo As Variant > > Dim vEntidad As Variant > > Dim codigo(0) As Integer > > Dim entidad(0) As Variant > > > > AppActivate autocadApp.Caption > > Set cSeleccion = autocadApp.ActiveDocument.SelectionSets > > > > For Each sSeleccion In cSeleccion > > If sSeleccion.Name = "SS" Then > > sSeleccion.Delete > > Exit For > > End If > > Next > > Set sSeleccion = cSeleccion.Add("SS") > > codigo(0) = 1001 > > entidad(0) = "MYAPP" > > vCodigo = codigo > > vEntidad = entidad > > sSeleccion.Select acSelectionSetAll, , , vCodigo, vEntidad > > For Each objEntidad In sSeleccion > > objEntidad.GetXData "MYAPP", tipoXdatoOut, valorXtipoOut > > If valorXtipoOut(1) = "John" Then > > objEntidad.Color = acBlue > > objEntidad.Highlight True > > End If > > Next objEntidad > > End Sub > > > > Un saludo de SpeedCAD... :) > > CHILE > > FORO: http://www.hispacad.com/foro > >
0 Likes
Message 5 of 8

Speed_CAD
Collaborator
Collaborator
Hi Maksim Sestic...

That it not possible, only you can filter with code 1001 (App name). But the example that I write for you works fine.

Un saludo de SpeedCAD... 🙂
CHILE
FORO: http://www.hispacad.com/foro
Mauricio Jorquera
0 Likes
Message 6 of 8

Anonymous
Not applicable
What I would like to see is code that returns a secondary selection set AFTER the initial Xdata selection set is processed. Doable? -- FrankZander Powerfull the dark side is. ------------------------------------------------------------------------ FrankZander's Profile: http://www.vbdesign.net/expresso/member.php?action=getinfo&userid=447 View this thread: http://www.vbdesign.net/expresso/showthread.php?threadid=25545
0 Likes
Message 7 of 8

Anonymous
Not applicable
Wow, -3? I'll have to look through docs more carefully... Thanks, Maksim Sestic "Jeff Mishler" wrote in message news:401be152_2@newsprd01... > Straight from the developer's guide.... > The ssget function recognizes all group codes except entity names > (group -1), handles (group 5), and xdata codes (groups greater than 1000). > If an invalid group code is used in a filter-list, it is ignored by ssget. > To search for objects with xdata, use the -3 code as described in Filtering > for Extended Data > > HTH, > Jeff > > "Maksim Sestic" wrote in message > news:401bde81_3@newsprd01... > > Thanks SpeedCAD, but this is the approach I've already implemented. I was > > rather wandering if it's possible to implement filtering on both > > 1001="MYAPP" and 1000="*John*" simultaneously. Autodesk documentation says > > that codes 1000+ are "not maintained by AutoCAD"... whatever this means, > but > > still can't figure out why I just can't filter on DXF code 1001... > > > > Regards, > > Maksim Sestic > > > > "SpeedCAD" wrote in message > > news:31940764.1075565195881.JavaMail.jive@jiveforum2.autodesk.com... > > > Hi... > > > > > > Try this... > > > > > > Private Sub SelXdata() > > > Dim tipoXdatoOut As Variant > > > Dim valorXtipoOut As Variant > > > Dim objEntidad As AcadEntity > > > Dim sSeleccion As AcadSelectionSet > > > Dim cSeleccion As AcadSelectionSets > > > Dim vCodigo As Variant > > > Dim vEntidad As Variant > > > Dim codigo(0) As Integer > > > Dim entidad(0) As Variant > > > > > > AppActivate autocadApp.Caption > > > Set cSeleccion = autocadApp.ActiveDocument.SelectionSets > > > > > > For Each sSeleccion In cSeleccion > > > If sSeleccion.Name = "SS" Then > > > sSeleccion.Delete > > > Exit For > > > End If > > > Next > > > Set sSeleccion = cSeleccion.Add("SS") > > > codigo(0) = 1001 > > > entidad(0) = "MYAPP" > > > vCodigo = codigo > > > vEntidad = entidad > > > sSeleccion.Select acSelectionSetAll, , , vCodigo, vEntidad > > > For Each objEntidad In sSeleccion > > > objEntidad.GetXData "MYAPP", tipoXdatoOut, valorXtipoOut > > > If valorXtipoOut(1) = "John" Then > > > objEntidad.Color = acBlue > > > objEntidad.Highlight True > > > End If > > > Next objEntidad > > > End Sub > > > > > > Un saludo de SpeedCAD... :) > > > CHILE > > > FORO: http://www.hispacad.com/foro > > > > > >
0 Likes
Message 8 of 8

Anonymous
Not applicable
Doable, but hardly in only one pass... First selection set you get immediatelly after filtering, and second one you create by filtering again the first selset. Something in a form of function like: Function SecondFilter(FirstSelectionSet as AcadSelectionSet, SecondSetType as Variant, SecondSetData as Variant) as AcadSelectionSet "FrankZander" wrote in message news:FrankZander.10wwfa@vbdesign.net... > > What I would like to see is code that returns a secondary selection set > AFTER the initial Xdata selection set is processed. Doable? > > > -- > FrankZander > > Powerfull the dark side is. > ------------------------------------------------------------------------ > FrankZander's Profile: http://www.vbdesign.net/expresso/member.php?action=getinfo&userid=447 > View this thread: http://www.vbdesign.net/expresso/showthread.php?threadid=25545 >
0 Likes