Filehost.ro - gazduire fisiere
lisp2arx
Visual Programming for AutoLisp Mathématiques en programmation Lisp.. doc2cpp,doc2lsp, sld2lsp, bmp2dcl, free__GifCcapture for all-CAD'platforms..
Nou pe simpatie:
glamour35
Femeie
24 ani
Constanta
cauta Barbat
28 - 69 ani
lisp2arxReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
lisp2arx / Listof AutoLisp.100 /

vla-AutoLispR14- vl-sort-i, vl-sort-points

Pagini: 1 Moderat de zauchan
#1
admin
Administrator
Din: Bucharest
Postari: 523
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")
)



vla-AutoLispR14- vl-sort-i, vl-sort-points - Here sort I have a problem with sorting a - Listof AutoLisp.100
vla-AutoLispR14- vl-sort-i, vl-sort-points – poza de admin, in Listof AutoLisp.100 · 75.9KB


_______________________________________
http://www.puiubrat.3x.ro/lisp2arx/lisp ... O2UTM2.pdf

 
   
Pagini: 1  
Mergi la