Selection Set Filter with more than two object filters

Selection Set Filter with more than two object filters

jdaltonAWVZ3
Participant Participant
364 Views
2 Replies
Message 1 of 3

Selection Set Filter with more than two object filters

jdaltonAWVZ3
Participant
Participant

I am writing a program that allows the user to select the following objects: MTEXT, TEXT, and MLEADER, and iteratively go through them and edit the text. The problem arises when I try to put all three object types in the selection filter. Below is what I have currently:

Dim peo As New PromptSelectionOptions With {
        .MessageForAdding = vbLf & "Select Text, Mtext, or MLeader to adjust text: ",
        .MessageForRemoval = vbLf & "Select to Remove: "
        }
Dim filterList As New List(Of TypedValue)
filterList.Add(New TypedValue(DxfCode.Operator, "<OR"))
filterList.Add(New TypedValue(DxfCode.Start, "MTEXT"))
filterList.Add(New TypedValue(DxfCode.Operator, "<OR"))
filterList.Add(New TypedValue(DxfCode.Start, "TEXT"))
filterList.Add(New TypedValue(DxfCode.Start, "MLEADER"))
Dim acSelFtr As SelectionFilter = New SelectionFilter(filterList.ToArray())
Dim selectedResult As PromptSelectionResult = acEd.GetSelection(peo, acSelFtr)
If selectedResult.Status <> PromptStatus.OK Then Exit Sub

 

When I run it in the current configuration is the program stops before it actually gets the selection, making me think that my filter is set up incorrectly. I could not find any examples online of a filter containing three objects or more. 

 

Much help would be appreciated! Thanks!

0 Likes
Accepted solutions (2)
365 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant
Accepted solution

Hi,

Try like this:

Dim filterList As New List(Of TypedValue)
filterList.Add(New TypedValue(DxfCode.Operator, "<OR"))
filterList.Add(New TypedValue(DxfCode.Start, "MTEXT"))
filterList.Add(New TypedValue(DxfCode.Start, "TEXT"))
filterList.Add(New TypedValue(DxfCode.Start, "MLEADER"))
filterList.Add(New TypedValue(DxfCode.Operator, "OR>"))

 

Or simply:


filterList.Add(New TypedValue(DxfCode.Start, "TEXT,MTEXT,MLEADER"))


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

daniel_cadext
Advisor
Advisor
Accepted solution

use a comma, and wildcards

(Db.DxfCode.kDxfStart, "*TEXT,*LEADER")
Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes