TheSwamp

Code Red => .NET => Topic started by: Draftek on October 11, 2005, 02:55:02 PM

Title: Logical Filter grouping
Post by: Draftek on October 11, 2005, 02:55:02 PM
I'm trying to build a selection set of text and mtext objects in c#

This works in vb:
Code: [Select]
   Dim sstext As AcadSelectionSet
   Dim FilterType(3) As Integer
   Dim FilterData(3) As Variant
   Set sstext = ThisDrawing.SelectionSets.Add("MySS")
   FilterType(0) = -4
   FilterData(0) = "<or"
   FilterType(1) = 0
   FilterData(1) = "TEXT"
   FilterType(2) = 0
   FilterData(2) = "MTEXT"
   FilterType(3) = -4
   FilterData(3) = "or>"
   Call sstext.Select(acSelectionSetAll, FilterType, FilterData)

I get an exception - "Input String was not in a correct format" when I try to apply the filter on the last line here:

Code: [Select]
filterlist = new TypedValue[4];
filterlist[0] = new TypedValue(-4, "<or");
filterlist[1] = new TypedValue(0, "TEXT");
filterlist[2] = new TypedValue(0, "MTEXT");
filterlist[3] = new TypedValue(-4, "or>");
filter = new SelectionFilter(filterlist);
selRes = ed.SelectAll(filter);

Any clues?
Title: Re: Logical Filter grouping
Post by: MP on October 11, 2005, 03:02:50 PM
Code: [Select]
filterlist = new TypedValue[1];
filterlist[0] = new TypedValue(0, "TEXT,MTEXT");
filter = new SelectionFilter(filterlist);
selRes = ed.SelectAll(filter);

Does this woik?
Title: Re: Logical Filter grouping
Post by: Draftek on October 11, 2005, 03:18:27 PM
To my surprise, it does...

oooOOOooo!

Your magic....