oliver Posted Wednesday at 10:49 PM Share Posted Wednesday at 10:49 PM Need a little favor..tired of manual connect..see the attached photo. Thanks once again and Good day. Quote Link to comment Share on other sites More sharing options...
Tsuky Posted yesterday at 12:12 AM Share Posted yesterday at 12:12 AM Try this (defun c:foo ( / ss e_base pt_base n lst) (princ "\nSelect base point:") (while (null (setq ss (ssget "_+.:E:S" '((0 . "POINT")))))) (setq e_base (ssname ss 0) pt_base (cdr (assoc 10 (entget e_base))) ) (princ "\nSelect points to connect:") (setq ss (ssget '((0 . "POINT")))) (cond (ss (if (ssmemb e_base ss) (ssdel e_base ss)) (repeat (setq n (sslength ss)) (setq lst (cons (cdr (assoc 10 (entget (ssname ss (setq n (1- n)))))) lst)) ) (mapcar '(lambda (x) (entmake (list (cons 0 "LINE") (cons 10 pt_base) (cons 11 x) ) ) ) lst ) ) ) (prin1) ) 3 Quote Link to comment Share on other sites More sharing options...
mhupp Posted yesterday at 01:07 AM Share Posted yesterday at 01:07 AM Never fully learned mapcar and at this point probably wont. (defun c:foo ( / ss base pt) (setq base (getpoint "\nSelect Base Point:")) (princ "\nSelect Point(s) to Connect:") (setq ss (ssget '((0 . "POINT")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq pt (cdr (assoc 10 ent))) (entmake (list '(0 . "LINE") (cons 10 base) (cons 11 x))) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tsuky Posted yesterday at 01:28 AM Share Posted yesterday at 01:28 AM Quote Never fully learned mapcar and at this point probably wont. @mhupp (mapcar allows you to apply a function to each member of one or more lists and return the resulting list. simple exemple: (mapcar '1+ '(0 1 2 3 4)) -> (1 2 3 4 5) complex (but powerful) example: (mapcar '(lambda (x y z) (strcat x " "y " " z)) '("me" "you") '("and" "not") '("you" "they")) -> ("me and you" "you not they") Quote Link to comment Share on other sites More sharing options...
oliver Posted 12 hours ago Author Share Posted 12 hours ago 15 hours ago, Tsuky said: Try this (defun c:foo ( / ss e_base pt_base n lst) (princ "\nSelect base point:") (while (null (setq ss (ssget "_+.:E:S" '((0 . "POINT")))))) (setq e_base (ssname ss 0) pt_base (cdr (assoc 10 (entget e_base))) ) (princ "\nSelect points to connect:") (setq ss (ssget '((0 . "POINT")))) (cond (ss (if (ssmemb e_base ss) (ssdel e_base ss)) (repeat (setq n (sslength ss)) (setq lst (cons (cdr (assoc 10 (entget (ssname ss (setq n (1- n)))))) lst)) ) (mapcar '(lambda (x) (entmake (list (cons 0 "LINE") (cons 10 pt_base) (cons 11 x) ) ) ) lst ) ) ) (prin1) ) thank you very much...its..working. 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.