Filter type and Filter data is not working
Hi!
I want to select only Lines but filter type and data is not working. it says invalid filter type
Code:
setColl = AcadDoc.SelectionSets
For Each objSSet1 In setColl
If objSSet1.Name = setName Then
AcadDoc.SelectionSets.Item(setName).Delete()
Exit For
End If
Next
objSSet1 = AcadDoc.SelectionSets.Add(setName)
'End With
Me.Hide()
Dim FilterType(0) As Integer
Dim FilterData(0) As Object
FilterType(0) = 0
FilterData(0) = "Line"
objSSet1.SelectOnScreen(FilterType, FilterData)
Can any one help me.
Re: Filter type and Filter data is not working
Here's a C# example of how to do it using the managed api. Note that the SelectAll method accepts a single array.
Code:
// Get a selection set of ents whose color is not ByLayer.
TypedValue[] tvls = new TypedValue[2];
tvls.SetValue(new TypedValue((int)DxfCode.Operator, "!="), 0);
tvls.SetValue(new TypedValue((int)DxfCode.Color, 256), 1); //Color 0 = ByLayer
SelectionFilter sf = new SelectionFilter(tvls);
PromptSelectionResult PSR = Active.Editor.SelectAll(sf);
If you still want to use the COM method, the example in this Help topic filters for a circle. Note that the Select method takes variant arrays, so you have to assign your filter data to variant arrays first before trying to use it in the Filter argument.
BTW, to put your code in a CODE window, click on the Go Advanced button, then select the # button to insert CODE tags.