lisp2arx
Visual Programming for AutoLisp Mathématiques en programmation Lisp.. doc2cpp,doc2lsp, sld2lsp, bmp2dcl, free__GifCcapture for all-CAD'platforms..
Lista Forumurilor Pe Tematici
lisp2arx | Reguli | Inregistrare | Login

POZE LISP2ARX

Nu sunteti logat.
Nou pe simpatie:
Anna281
Femeie
25 ani
Iasi
cauta Barbat
25 - 44 ani
lisp2arx / Listof AutoLisp.100 / vla-AutoLispR14- vl-sort-i, vl-sort-points Moderat de zauchan
Autor
Mesaj Pagini: 1
admin
Administrator

Din: Bucharest
Inregistrat: acum 13 ani
Postari: 508
Here sort

Code:

(Defun dfn_pointsortLefttoRight(/ i)
(setq i 0)
(while (< (setq i (1+ i)) (sslength ss))
    (setq pts (cons (cdr (assoc 10 (entget (ssname ss i)))) pts))
    )
    (setq pts (vl-sort pts '(lambda (x y) (< (car x)(car y)))))

I have a problem with sorting a list of strings based on the second item of the list ascendingly.

Code:

(setq the_list '(("Top Beam" "200x150") ("Left Beam" "200x100") ("Left Beam" "150x200") ("Bottom Beam" "225x75")
                 ("Bottom Beam" "100x200") ("Right Beam" "45x35") ("Bottom Beam" "100x175") ("Right Beam" "55x25")))



Code:

(defun mysort ( l )
    (mapcar '(lambda ( n ) (nth n l))
        (vl-sort-i (mapcar '(lambda ( x ) (read (strcat "(" (vl-string-subst " " "x" (cadr x)) ")"))) l)
           '(lambda ( a b )
                (if (= (car  a) (car  b))
                    (< (cadr a) (cadr b))
                    (< (car  a) (car  b))
                )
            )
        )
    )
)
(setq Author "LeeMac(c)2020-05")
$ (mysort the_list)
(
    ("Right Beam"    "45x35")
    ("Right Beam"    "55x25")
    ("Bottom Beam" "100x175")
    ("Bottom Beam" "100x200")
    ("Left Beam"   "150x200")
    ("Left Beam"   "200x100")
    ("Top Beam"    "200x150")
    ("Bottom Beam"  "225x75")
)



vl-sort-i, here i)
(setq 0)
(while (< (setq (1+ i)) (sslength ss))
 (setq pts (cons (cdr (assoc

75.9KB


_______________________________________


pus acum 2 ani
   
Pagini: 1  

Mergi la