wimal Posted April 23, 2015 Share Posted April 23, 2015 Actually I have a selection set of texts. I need arrange them ascending order to X coordinates of insertion points of texts. Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted April 23, 2015 Share Posted April 23, 2015 (edited) Actually I have a selection set of texts.I need arrange them ascending order to X coordinates of insertion points of texts. (defun c:demo (/ ss i lst [color="red"]en[/color]) (if (setq ss (ssget ":L" '((0 . "TEXT")))) (progn (repeat (setq i (sslength ss)) [color="red"](setq en[/color] (ssname ss (setq i (1- i))[color="red"])[/color] lst (cons [color="red"](cons en[/color] (cdr (assoc 10 (entget [color="red"]en[/color])))[color="red"]) [/color]lst)) ) (mapcar 'print ([color="blue"]vl-sort[/color] lst ''((a b) (< ([color="red"]cadr[/color] a) ([color="red"]cadr[/color] b))))) ) ) (princ) ) EDIT: in red Edited April 23, 2015 by hanhphuc add ename as OP's requested Quote Link to comment Share on other sites More sharing options...
wimal Posted April 23, 2015 Author Share Posted April 23, 2015 Many thanks for your code. Yes it is working nicely. I need few more facility. The entities added to selection set also to be rearrange according to lst. Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted April 23, 2015 Share Posted April 23, 2015 Many thanks for your code. Yes it is working nicely. I need few more facility. The entities added to selection set also to be rearrange according to lst. something like this? [color="green"];(<Entity name: 7eff6968> 349.007 -619.006 0.0) ? [/color] code updated post#2 (in red) Quote Link to comment Share on other sites More sharing options...
wimal Posted April 26, 2015 Author Share Posted April 26, 2015 Thanks the code is working now.next I need keep one item each which have same insertion points and filter others. Please can you help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.