1. Login to Give a bone

## Circle Sortings

Hi!

I have some circles in polygon, I have a routine for sorting X-direction from left to right. I need also sorting Right to Left direction.

Attached my routine for left to right direction.

Code:
```(defun bns_esort (ss func / a lst e1 na n)
(setq n 0)
(repeat (sslength ss)
(setq na (ssname ss n)
e1 (entget na)
)         ;setq
;(setq lst (append lst
;                  (list (list (eval '(func e1))
;                              e1
;                        );list
;                  );list
;          );append
;);setq
(setq lst (cons (list (eval '(func e1)) e1)
lst
)       ;cons
)         ;setq

(setq n (+ n 1))      ;setq
)         ;repeat

(setq lst (acet-list-isort lst 0))  ;setq

(setq n 0)
(repeat (length lst)
(setq a   (nth n lst)
a   (cdr (assoc -1 a))
)         ;setq
(setq n (+ n 1))      ;setq
)         ;repeat
ss2

) ```
Avinash

2. Login to Give a bone

## Re: Circle Sortings

Look into the VL-sort command it can have a > or a < which is left-right right-left etc.

Something like this
Code:
```(setq ptlist
(vl-sort ptlist
'(lambda (x y)
(cond
(< (car x)(car y)))
)
)
)
)```

3. Login to Give a bone

## Re: Circle Sortings

not working, I have a list like...
((41.0 -25.0 0.0) (41.0 -72.6802 0.0) (26.0 -135.311 0.0) (33.025 -384.687 0.0) (41.0 -637.0 0.0) (33.025 -914.667 0.0) (41.0 -1248.24 0.0) (41.0 -1308.24 0.0) (29.028 -1599.86 0.0) (41.0 -1870.24 0.0) (33.025 -2086.43 0.0) (26.0 -2409.17 0.0) (33.0 -2452.83 0.0) (45.0 -2493.15 0.0) (26.0 -2493.15 0.0) (25.0 -29.0 0.0) (25.0 -29.0 0.0))

4. Login to Give a bone

## Re: Circle Sortings

Here you go.

Code:
```(setq lst '((41.0 -25.0 0.0) (41.0 -72.6802 0.0) (26.0 -135.311 0.0) (33.025 -384.687 0.0)
(41.0 -637.0 0.0) (33.025 -914.667 0.0) (41.0 -1248.24 0.0) (41.0 -1308.24 0.0)
(29.028 -1599.86 0.0) (41.0 -1870.24 0.0) (33.025 -2086.43 0.0) (26.0 -2409.17 0.0)
(33.0 -2452.83 0.0) (45.0 -2493.15 0.0) (26.0 -2493.15 0.0) (25.0 -29.0 0.0) (25.0 -29.0 0.0)))

(setq srt:lst (vl-sort lst '(lambda (a b) (> (car a) (car b)))))```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•