#CADtutor
vl-sort a list of lists
I have a list of lists I would like to sort by two entries. I once had a need to do a sort and the forum helped a lot. So, I thought I would ask again. I thought I would first attempt the code I was once given and as I was studying how it worked and how I could use it, I found that vl-sort will remove duplicate items. And then someone posted code in CADTutor that Kent1Cooper had wrote using mapcar to retain the duplicates. His code is slightly above my abilities. My list is: (setq LST '(((1 . "T1") (2 . "l-cre-non.dwg") (3 . 4) (4 . "CREPE MYRTLE") (5 . 8) (6 . 1)) ((1 . "T2") (2 . "l-mag-non.dwg") (3 . 12) (4 . "MAGNOLIA") (5 . 24) (6 . 1)) ((1 . "T3") (2 . "l-oak-non.dwg") (3 . 10) (4 . "OAK") (5 . 20) (6 . 1)) ((1 . "T4") (2 . "l-app-non.dwg") (3 . 12) (4 . "APPLE") (5 . 24) (6 . 1)) ((1 . "T5") (2 . "l-app-non.dwg") (3 . 8) (4 . "APPLE") (5 . 16) (6 . 2)) )) I would like to first sort by association 4 (cdr (assoc 4 LST)), then by association 3 (cdr (assoc 3 LST)) The list should be returned as: (setq LST '(((1 . "T5") (2 . "l-app-non.dwg") (3 . 8) (4 . "APPLE") (5 . 16) (6 . 2)) ((1 . "T4") (2 . "l-app-non.dwg") (3 . 12) (4 . "APPLE") (5 . 24) (6 . 1)) ((1 . "T1") (2 . "l-cre-non.dwg") (3 . 4) (4 . "CREPE MYRTLE") (5 . 8) (6 . 1)) ((1 . "T2") (2 . "l-mag-non.dwg") (3 . 12) (4 . "MAGNOLIA") (5 . 24) (6 . 1)) ((1 . "T3") (2 . "l-oak-non.dwg") (3 . 10) (4 . "OAK") (5 . 20) (6 . 1)) )) I would appreciate any help given. Thanks.
forums.autodesk.com
April 13, 2025 at 8:10 PM
Getting your head around Constraints in AutoCAD can be challenging, but it doesn't need to be!

Learn here 🤓🧠

#autocad #dynamicblocks #cadtutor #cadtutorials #advancedautocad

youtu.be/JABSoHJgev4
01 - Two Ways To Constrain a Rectangle - Geometric & Dimensional Constraints 101 - Dynamic Blocks
YouTube video by Felt Tip Faerie
youtu.be
February 9, 2026 at 6:54 AM