Jump to content

Search the Community

Showing results for tags 'sorting'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 6 results

  1. Good afternoon, One of our vendors has sent us several shp files with lines/polylines and ones with points. All the data comes in on a single layer, but I would like to sort the data with a LISP based on existing layers I've created and some of the Object data. Below is an example of the OD I want to use, and the layers I would like to have the objects sorted into. Could anyone help with some code that I could use to sort these objects? The OD table name will change depending on the file we receive, if that matters. Thanks
  2. I'm trying to find the latest revision from a list of revisions. The revisions start with A,B,C... Z, AA, AB, AC...ZZ, AAA, AAB, AAC... Then proceed to numbers 0, 1, 2, 3, etc. Any help would be appreciated! (setq testCases (list "A" "AA" "AB" "BD" "AZ" "ZZ" "ZZZ" "11" "10" "9" "2" "1" "0" "Z" "X" "D" "C" "B")) (setq testCases (vl-sort testCases '(lambda ( b a / x y ) (setq x (read a) y (read b)) (cond ( (and (numberp x) (numberp y)) (< x y)) ( (numberp y)) ( (numberp x) nil) ( (< a b)) ) ) ) ) (foreach test testCases (progn (princ "\n") (princ test) ) ) ;Currently produces the following reverse-alphabetical sequence: ;11, 10, 9, 2, 1, 0, ZZZ, ZZ, Z, X, D, C, BD, B, AZ, AB, AA, A ;Desired sequence: ;11, 10, 9, 2, 1, 0, ZZZ, ZZ, BD, AZ, AB, AA, Z, X, D, C, B, A
  3. Hi Sirs, I'm just new on using autolisp and still learning so please help me on the dilemma i'm facing. Basically i want to sort a selection set of polyline (rectangle) under the layer of "REF" basing on it's X axis. I copied bits of info around the net but i can't get it work the way i want it to. Here is where i copied some of it. http://forums.augi.com/showthread.php?137837-Sort-Selectionset-by-X-coord (setq plt_set (ssget '((8 . "REF")))) ;select layer "REF" (setq count 1 count1 (sslength plt_set) ss6 (ssadd) ss4 (list (ssname plt_set (1- count))) ) (while (<= (1+ count) count1) ;SORT LIST BY X COORD LOW TO HIGH (setq ss3 (list (ssname plt_set count))) (setq ss4 (append ss4 ss3)) (setq count (1+ count)) ) ;_ end of while (vl-sort ss4 (function (lambda (a b) (> ;; or maybe > depending on the order you want (cadr (assoc 10 (entget a))) (cadr (assoc 10 (entget b))) ) ) ) ) (foreach ss5 (reverse ss4) (setq ss6 (ssadd ss5 ss6)) ) It is still sorting by the sequence of when it was created. Hoping for your kind help Cad Masters. Thank you, Ryan
  4. Separate/copy layer to other place by user pick point then sorting them horizontal below code not sorting horizontal.how to change the code, become horizontal (see image attached) (defun c:test1 ( / _move d ss l lst ) (vl-load-com) (defun _move ( obj p q dist ) (vla-move (setq obj (vla-copy obj)) (vlax-3D-point p) (vlax-3D-point q)) (vla-move obj (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point (list dist 0. 0.))) ) (if (and (ssget "_:L") (setq p1 (getpoint "\nBase Point: ")) (setq p2 (getpoint "\nDesired Location: " p1)) (setq p1 (trans p1 1 0) p2 (trans p2 1 0)) ) (progn (vlax-for obj (setq d 10. ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (_move obj p1 p2 (cond ( (cdr (assoc (setq l (vla-get-layer obj)) lst)) ) ((cdr (assoc (vl-string-right-trim "D" l) lst))) ((cdr (assoc (strcat l "D") lst))) ( (setq lst (cons (cons l (setq d (- d 650.))) lst)) d ) ) ) ) (vla-delete ss) ) ) (princ) )
  5. andar424

    sorting the tree

    Hey guys, Kind of a random question, but what are some known issues of why a tree can not be sorted? I'm referring to the "Alpha Sort Component" in the "Productivity" section of the "Assemble" tab. It sucks when I'm forced to work in other people's projects and go to do it and it fails. Do things like component patterns cause it to hang up? I'm kind of picky when it comes to my tree, and I know I can generally right click and "Find in Browser," but I like it to be nice and organized!
  6. Hey everyone. Could use a little assistance here. Not sure if this is even possible, but I assume it should be. I'm still in the "i know enough LISP just to be dangerous, but slightly useful" stage I have a LISP routine that collects 5 variables from the user (r1,r2,r3,r4,r5). (setq r1 (getint "\nEnter First Rev Line Number use ZERO for NONE: ")) (setq r2 (getint "\nEnter Second Rev Line Number use ZERO for NONE: ")) (if (= r2 0)(setq r3 0)(setq r3 (getint "\nEnter Third Rev Line Number use ZERO for NONE: "))) (if (= r3 0)(setq r4 0)(setq r4 (getint "\nEnter Fourth Rev Line Number use ZERO for NONE: "))) (if (= r4 0)(setq r5 0)(setq r5 (getint "\nEnter Fifth Rev Line Number use ZERO for NONE: "))) What I would like to do with them, is sort them by their values, putting the highest value first, then sorting in reverse. Can anyone offer any insight on this? Thank you in advance!
  • Create New...