Jump to content

Recommended Posts

Posted
Interesting approach Tharwat, Watch out for duplicates(ish) , and sometimes gives strange results

 

It does when you have texts not in order .

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    4

  • pBe

    4

  • hmsilva

    4

  • vnanhvu

    3

Top Posters In This Topic

Posted
Wow, splitting the list into two sets makes more sense. I stopped using entmod for string modification ever since ADESK introduced Annotative Text Styles
You'll note Lee's code is not using entmod on the entire DXF list. He's only sending the ename & text string items (codes -1 and 1) - so the issue with annotative text does not happen due to no change on the height code 40.
Posted

Bloody stupid of me sorry :oops:. Here's a fix for my code:

(defun c:SortTxt3  (/ sym ss eLst sLst)
 (vl-load-com)
 (initget "Ascending Descending")
 (setq sym (cond ((eq (getkword "\nChoose [Ascending/Descending] <Ascending>: ") "Descending")
                  (cons <= <=))
                 (t (cons <= >=))))
 (if (ssget "_:L" '((0 . "TEXT")))
   (progn (vlax-for eo  (setq ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object))))
            (setq eLst (cons eo eLst)
                  sLst (cons (vla-get-TextString eo) sLst)))
          (vla-Delete ss)
          (mapcar 'vla-put-TextString
                  (vl-sort eLst '(lambda (eo1 eo2) ((cdr sym) (cadr (vlax-get eo1 'InsertionPoint)) (cadr (vlax-get eo2 'InsertionPoint)))))
                  (vl-sort sLst '(lambda (s1 s2) ((car sym) (strcase s1) (strcase s2)))))))
 (princ))

Reduced the ('s by taking a leaf from Lee's code ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...