TextStyle in SelectionSet filtering

TextStyle in SelectionSet filtering

Michal_W
Contributor Contributor
1,712 Views
2 Replies
Message 1 of 3

TextStyle in SelectionSet filtering

Michal_W
Contributor
Contributor
Hello
I would like to ask how to create a filter for SelectionSet to select all texts with a specific TextStyle.
What is the DXF code for the TextStyle
Thank you in advance
Michal_W
0 Likes
Accepted solutions (2)
1,713 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor
Accepted solution

Dxf group code for TextStyleName is 7. So, following code would select all Text/MText with style name being "Standard" (replace it with whatever style name of your interest):

 

Option Explicit

Public Sub SelectTextByStyle()

    Dim ss As AcadSelectionSet
    Set ss = ThisDrawing.SelectionSets.Add("Test")
    
    Dim groupCode(0 To 1) As Integer
    Dim dataValue(0 To 1) As Variant
    groupCode(0) = 0: groupCode(1) = 7
    dataValue(0) = "TEXT,MTEXT": dataValue(1) = "Standard"
    
    ss.Select acSelectionSetAll, , , groupCode, dataValue
    
    MsgBox "Selected entity count: " & ss.Count
    
    ss.Delete
    
End Sub

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3

Michal_W
Contributor
Contributor
Accepted solution

Thank you got your help.

 

It's so simple and it works great

 

 

 

0 Likes