POOCRACKIN Posted January 14, 2010 Posted January 14, 2010 I AM WORKING ON A LISP TO DIMENSION FROM MIDPOINT TO MIDPOINT ON STEEL COLUMN BASEPLATES I THINK MY PROBLEM IS IN MY SSDEL, BUT I'M REALLY NOT 100% I HAVE BEEN PLAYING WITH THIS SEEMINGLY EASY CODE ALL DAY, ANY IDEAS ON WHAT I'VE DONE WRONG WOULD MAKE FOR A WHIMSICAL END TO MY DAY., THANK YOU. THIS IS WHAT I'VE GOT SO FAR.. ;;DIMENSION TO MIDPOINT OF COLUMN BASE PLATES (defun C:MEOW (/ SS1 NOSS1 CNTR YTU YTCHK YCHKD) (VL-LOAD-COM) (SETQ SS1 (SSGET) NOSS1(SSLENGTH SS1) CNTR 0 YTU (CADR (CDR (ASSOC 10 (ENTGET (SSNAME SS1 0))))) ) (WHILE (> NOSS1 CNTR) (SETQ YTCHK (CADR (CDR (ASSOC 10 (ENTGET (SSNAME SS1 CNTR))))) ;CHECKS ALL TO FIND CNTR (+ CNTR 1)) ;BOTTOM MOST POINT (IF (> YTU YTCHK)(SETQ YTU YTCHK)) ) (SETQ CNTR 0 ) (WHILE (> NOSS1 CNTR) (SETQ YCHKD (CADR (CDR (ASSOC 10 (ENTGET (SSNAME SS1 CNTR)))))) ;DELETE FROM SS1 (IF (/= CHKD YTU)(SSDEL (SSNAME SS1 CNTR) SS1)) ;IF NOT AT BOTTOM (SETQ CNTR (+ CNTR 1)) ) (COMMAND "COPY" SS1 "") ;RANDOM COMMAND TO CHECK MY SELECTION SET'S STATUS ) Quote
Lee Mac Posted January 14, 2010 Posted January 14, 2010 Perhaps you can take something from this? (defun ss->lst (ss / i ent lst) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i)))) (setq lst (cons ent lst))) lst) ;; Method 1 --------------------------------------------------------- (if (setq ss (ssget)) (progn (setq base (caddr (assoc 10 (entget (ssname ss 0))))) (mapcar (function (lambda (x) (and (< (setq y (caddr (assoc 10 (entget x)))) base) (setq minEnt x)))) (ss->lst ss)))) ;; Method 2 --------------------------------------------------------- (vl-load-com) (if (setq ss (ssget)) (setq minEnt (car (vl-sort (ss->lst ss) (function (lambda (a b) (< (caddr (assoc 10 (entget a))) (caddr (assoc 10 (entget b)))))))))) Quote
POOCRACKIN Posted January 14, 2010 Author Posted January 14, 2010 That Will Certainly Help, Thank You Very Much. Very Different Approach From Mine., Hopefully One Day I'll Learn All Those Magic Words.. Lamda.. Mapcar.. Ha, Those I Can Find, Googling Information The Function "function".. Now That'll Be Fun.. Thanks Again. Quote
Lee Mac Posted January 14, 2010 Posted January 14, 2010 That Will Certainly Help, Thank You Very Much. Very Different Approach From Mine., Hopefully One Day I'll Learn All Those Magic Words.. Lamda.. Mapcar.. Ha, Those I Can Find, Googling Information The Function "function".. Now That'll Be Fun.. Thanks Again. Why not use the Visual LISP Help files - all the functions used are documented in there, with some examples also. Quote
POOCRACKIN Posted January 14, 2010 Author Posted January 14, 2010 Oops, Sometimes I Realize I Try To Make Up With Booksmarts What I Lack In Common Sense... Unless My Common Sense Overlooks The Book. I'll Reprimand Myself Later And Use It Now.. Quote
Lee Mac Posted January 14, 2010 Posted January 14, 2010 No problem, just bear in mind that the ActiveX properties and methods documented are written for VBA, so you will just have to adapt the information to suit Visual LISP. Quote
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.