VBA tri le TXT in bloc dans listbox idem bloc écran

VBA tri le TXT in bloc dans listbox idem bloc écran

acad386
Observer Observer
629 Views
3 Replies
Message 1 of 4

VBA tri le TXT in bloc dans listbox idem bloc écran

acad386
Observer
Observer

hello
in autocad block 4 line TXT
TXT1 (handle # 3)
TXT2 (handle # 2)
TXT3 (handle No. 4)
TXT4 (handle # 1)

When I recuper the string in a combobox it puts me in the order of handle
TXT4,2,1,3
I then I want in the order of the line screen TXT1,2,3,4

Thank you for your help
********
Bonjour
Dans le bloc autocad 4 lignes de TXT
TXT1 (handle N°3)
TXT2 (handle N°2)
TXT3 (handle N°4)
TXT4 (handle N°1)

Quand je recupere le string dans une combobox il me le met dans l'ordre du handle =>Ligne 4,2,1,3
alors que je je veux dans l'ordre de l'écran ligne 1,2,3,4

Merci pour votre aide

Public Sub LireTxt()
Dim objBloc As AcadBlock
Dim objEnt As AcadEntity
Dim objEntTxT As as AcadText
   
ThisDrawing.Utility.GetEntity objBlocRef, Pt1, "Sélectionnez le bloc à modifier :"
Set objBloc = ThisDrawing.Blocks(objBlocRef.Name)
   
    For Each objEnt In objBloc
        If objEnt.ObjectName = "AcDbText" Then
            ListBoxTxt.AddItem objEntTxT.textString
        Endif
    Next

End Sub

 

0 Likes
630 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

you have to:

1) store LineTexts text in a temporary array

2) order the array

3) fill listbox with sorted array content

 

see the attached example

 

bye

0 Likes
Message 3 of 4

acad386
Observer
Observer

No good code

view fichier dwg for solution

0 Likes
Message 4 of 4

Anonymous
Not applicable

I got it that you wanted texts sorted by their text value

you'll find the revised code for sorting by text insertion point "Y" coordinate in

http://www.cadtutor.net/forum/showthread.php?84926-VB-Sorts-text-screen-ditto-text-block-in&p=583827...

bye

0 Likes