gS7 Posted February 21, 2013 Share Posted February 21, 2013 Hey Guys ... Here i need Little Help [color="red"]([/color][color="blue"]setq[/color] ename[color="red"]([/color][color="blue"]vlax-ename->vla-object[/color] ss[color="red"]))[/color] [color="red"]([/color][color="blue"]setq[/color] points[color="red"]([/color][color="blue"]vlax-safearray->list[/color] [color="red"]([/color][color="blue"]vlax-variant-value[/color][color="red"]([/color][color="blue"]vla-get-coordinates[/color] ename[color="red"]))))[/color] See here the lisp returned Coordinates Like this (7.52707 15.8253 24.8824 22.4948 30.4653 7.9432 21.2414 -1.81847 13.9595 -1.09089) and My Goal is I want to separate them all and put into a list Like This (7.52707 15.8253) (24.8824 22.4948) (30.4653 7.9432) (21.2414 -1.81847) (13.9595 -1.09089) Help me Guys Regards Ganesh Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 21, 2013 Share Posted February 21, 2013 Please check the functions from this thread. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 21, 2013 Share Posted February 21, 2013 Group List by Number Quote Link to comment Share on other sites More sharing options...
gS7 Posted February 21, 2013 Author Share Posted February 21, 2013 Thank You so Much Mircea & Lee Mac it is Helped Me To Learn the Method Quote Link to comment Share on other sites More sharing options...
gS7 Posted February 21, 2013 Author Share Posted February 21, 2013 @Lee Mac In this Few Minutes I Written'd a Solution Please Let Me Know The Way I Used Its Right Or Not (setq c 0) (setq mtlist'()) (repeat (1- (length points)) (setq a(nth c points)) (setq b(nth (1+ c) points)) (setq pt(list a b)) (setq mtlist (cons pt mtlist)) (setq c (1+ c)) ) Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted February 21, 2013 Share Posted February 21, 2013 (setq c 0) (setq mtlist'()) (repeat (1- (length points)) (setq a(nth c points)) (setq b(nth [color=red](setq c (1+ c))[/color] points)) (setq pt(list a b)) (setq mtlist (cons pt mtlist)) (setq c (1+ c)) ) Or another way : (repeat (/ (length points) 2) (setq pt (list (car points) (cadr points))) (setq points (cddr points)) (setq mtlist (cons pt mtlist)) ) (reverse mtlist) M.R. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 21, 2013 Share Posted February 21, 2013 If you wish to use repeat, I would suggest something along the lines of: (defun _groupby2 ( lst / out ) (repeat (/ (length lst) 2) (setq out (cons (list (car lst) (cadr lst)) out) lst (cddr lst) ) ) (reverse out) ) Or recursively, (defun _groupby2 ( lst ) (if lst (cons (list (car lst) (cadr lst)) (_groupby2 (cddr lst)))) ) _$ (_groupby2 '(1 2 3 4 5 6)) ((1 2) (3 4) (5 6)) This is also the method I demonstrate here. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted February 21, 2013 Share Posted February 21, 2013 One more link M.R. Quote Link to comment Share on other sites More sharing options...
gS7 Posted February 22, 2013 Author Share Posted February 22, 2013 Thank u again lee now i understood Quote Link to comment Share on other sites More sharing options...
gS7 Posted February 22, 2013 Author Share Posted February 22, 2013 Thank u so much marko-ribar ..for your good support 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.