Jump to content

Sort of on screen fun


rlx

Recommended Posts

Posted (edited)

Often I have to (ok , I want to) edit text (or blocks) directly on screen that are in a sort of table like order. Then it would be nice to be able sort it in rows & columns. In a perfect world all items would be spaced evenly. But we're not living in a perfect world now are we? Besides , that would be boring. Had something like this written a very long time ago but lately needed to be able to see if sorting order was correct before doing my stuff. So also for the fun of it I created mini app to sort things out (but not in my head)

 

Anyways , added routine including a couple of tiny test functions. My own needs are a little bit more complex because need to be able to apply it on (sometimes specific) attributes in blocks too , but I leave the specialities for you little dragons 😄

 

Working is as follows:

Select a group of simple text's (you can use attached drawing). The shape of your selection determines if you sort by row or by column (landscape means rows , portrait means columns. It uses the boundary size from 1st item in selection as a fuzz factor , some blocks are a little up , some a little down etc. This you can check by selecting the blocks on the left side of the sample drawing. After you made selection all insertionpoints (or text alignment points) the points are marked with blue number indication their rank on the social ladder.

 

After this I use (grread) in a loop where you can use Tab to switch between ByRow & ByColumn , Spacebar to cycle in which Quadrant to start numbering and Enter means you're a happy human of planet earth.

 

(C:t1) just shows you the list , (C:t2) you can replace the texts with another string.

 

image.thumb.png.3344a6d3a923e4a30eb407c0d1372a93.png

 

image.png.9ed2027bf506d57d8054727eae400f99.png

 

image.png.cbfb0a960afa23477dfbaff66630034c.png

 

image.png.2bfdcf9ebb85098bfe59cf8c74e4844f.png

 

 

🐉

 

Rlx-Sort-SS.dwg RlxSortSS.lsp

Edited by rlx
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Posted (edited)

it's amazing. 

Thank you for giving me something to study.

 

when I tried something similar for text, determining whether they were the same row or column was very difficult for me.

Edited by exceed
Link to comment
Share on other sites

I had a quick look and quickly realized going down the wrong path. Just an idea get the xy values and round them to say a whole number within a tolerance when sorting on X or Y, use sort x then y for portrait opposite for landscape. I think this idea was in the exceed link.

 

Swap car cadr for Y priority

; sorts on 1st two items X 1st
(setq lst (vl-sort lst
	 '(lambda (a b)
	    (cond
	      ((< (car a) (car b)))
	      ((= (car a) (car b)) (< (cadr a) (cadr b)))
	    )
	  )
   )
)

 

 

Its drinks time so maybe tomorrow.

Link to comment
Share on other sites

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...