Jump to content
ILoveMadoka

Lisp to reorder a column of text?

Recommended Posts

ILoveMadoka

Does someone have a routine (or know of a way) to reorder a column of text items?

 

ie:

Line 1

Line 2

Line 3

Line 4

 

to

 

Line 4

Line 3

Line 2

Line 1

 

I have a large table of text that I need to flip the column order.

Has someone posted something along these lines?

Is there an Autocad command I don't know about?

 

I have had no luck in any of the search terms I have used..

 

 

 

Thanks for all the help you guys provide... :)

Share this post


Link to post
Share on other sites
ymg3

Is it a true autocad table or simply line of text ?

 

Post a drawing

Share this post


Link to post
Share on other sites
ILoveMadoka

Lee Mac to the rescue once again!!!

 

Dynamic Text Alignment v1.6

 

http://www.lee-mac.com/dynamictextalignment.html

 

I had to jump through some hoops but Lee's program made it all possible.

 

Could your next update allow a text column to be rotated 360 degrees instead of limiting it 180?

(seems that is how it worked)

 

I had to rotate the text in place 180 degrees then use Autocad to rotate the entire column 180.

Awesome! Still quite a time saver!

 

Thanks Lee!

 

ps: It was all regular text entities

Share this post


Link to post
Share on other sites
Lee Mac

I'm glad my Dynamic Text Alignment program came in handy!

 

Here is another way to achieve the same result:

([color=BLUE]defun[/color] c:revtxt ( [color=BLUE]/[/color] e i l s )
   ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"TEXT"[/color]))))
       ([color=BLUE]progn[/color]
           ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s))
               ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i))))
                     l ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]assoc[/color] ([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]=[/color] 0 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 71 e))) ([color=BLUE]=[/color] 0 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 72 e)))) 10 11) e) ([color=BLUE]assoc[/color] -1 e)) l)
               )
           )
           ([color=BLUE]mapcar[/color]
              '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]entmod[/color] ([color=BLUE]list[/color] ([color=BLUE]cadr[/color] a) ([color=BLUE]car[/color] b))))
               ([color=BLUE]setq[/color] l ([color=BLUE]vl-sort[/color] l '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]<[/color] ([color=BLUE]caddar[/color] a) ([color=BLUE]caddar[/color] b)))))
               ([color=BLUE]reverse[/color] l)
           )
       )
   )
   ([color=BLUE]princ[/color])
)

Share this post


Link to post
Share on other sites
BIGAL

This prompted me to a slightly different question you have 3 individual columns of text but only want to sort on 1st column wrote a export columns that joins the text into single row then using Lee-Mac's would allow sort. Any one wants it post request here. It was done to export to excel to sort.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×