Lee Mac Posted August 21, 2009 Posted August 21, 2009 AJ, why not use entmakex and have it return an ename... :wink: Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 AJ, why not use entmakex and have it return an ename... :wink: lol, that thing is old old old. i never noticed the missing x, good eye. Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 lol, that thing is old old old. i never noticed the missing x, good eye. Always happy to nit-pick Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 Always happy to nit-pick glad you got your chance to return the favor. Quote
CAB Posted August 21, 2009 Posted August 21, 2009 I'll try one more time and I assume the text does not have to be moved! ;; CAB version 2 [08.21.09] ;; Find the bottom text in a list of text objects. ;; Draw a line above it the length of the object. (defun c:hthc (/ ss lst ELST BB LL HT P1 P2) (while (and (princ "\nSelect both text to divide") (setq ss (ssget)) ) (setq lst (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))) (cond ((not (vl-every '(lambda (x) (= (cdr (assoc 0 x)) "TEXT")) lst)) (princ "\nError - all objects must be text.") ) ((mapcar '(lambda (x) (cond ((null elst) (setq elst x)) ((< (caddr (assoc 10 x)) (caddr (assoc 10 elst))) (setq elst x)) )) lst) ) ) (if elst (progn (setq bb (textbox (list (assoc -1 elst)))) (setq ll (cdr (assoc 10 elst)) ht (cdr (assoc 40 elst)) p1 (polar ll (/ pi 2) (* ht 1.333)) p2 (polar p1 0 (abs (- (caadr bb) (caar bb)))) ) (entmake (list (cons 0 "LINE") (cons 6 "BYLAYER") (cons 8 "linija") (cons 10 p1) (cons 11 p2) ) ) ) ) ) (princ) ) Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 Alan, Why not use a vl-sort to sort the list in y? *just curious* Quote
CAB Posted August 21, 2009 Posted August 21, 2009 There are many ways to skin a cat. I just grabed the closest knife & moved on. ;; CAB version 2 [08.21.09] ;; Find the bottom text in a list of text objects. ;; Draw a line above it the length of the object. (defun c:hthc (/ ss lst ELST BB LL HT P1 P2) (while (and (princ "\nSelect both text to divide") (setq ss (ssget)) ) (setq lst (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))) (cond ((not (vl-every '(lambda (x) (= (cdr (assoc 0 x)) "TEXT")) lst)) (princ "\nError - all objects must be text.") ) ((setq elst (car (vl-sort lst '(lambda (e1 e2) (< (caddr (assoc 10 e1)) (caddr (assoc 10 e2)))))))) ) (if elst (progn (setq bb (textbox (list (assoc -1 elst)))) (setq ll (cdr (assoc 10 elst)) ht (cdr (assoc 40 elst)) p1 (polar ll (/ pi 2) (* ht 1.333)) p2 (polar p1 0 (abs (- (caadr bb) (caar bb)))) ) (entmake (list (cons 0 "LINE") (cons 6 "BYLAYER") (cons 8 "linija") (cons 10 p1) (cons 11 p2) ) ) ) ) ) (princ) ) Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 that reminds me, i'm hungry. There are many ways to skin a cat. I just grabed the closest knife & moved on. ;; CAB version 2 [08.21.09] ;; Find the bottom text in a list of text objects. ;; Draw a line above it the length of the object. (defun c:hthc (/ ss lst ELST BB LL HT P1 P2) (while (and (princ "\nSelect both text to divide") (setq ss (ssget)) ) (setq lst (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))) (cond ((not (vl-every '(lambda (x) (= (cdr (assoc 0 x)) "TEXT")) lst)) (princ "\nError - all objects must be text.") ) ((setq elst (car (vl-sort lst '(lambda (e1 e2) (< (caddr (assoc 10 e1)) (caddr (assoc 10 e2)))))))) ) (if elst (progn (setq bb (textbox (list (assoc 1 elst) (assoc 7 elst) (assoc 40 elst) (assoc 41 elst)))) (setq ll (cdr (assoc 10 elst)) ht (cdr (assoc 40 elst)) p1 (polar ll (/ pi 2) (* ht 1.333)) p2 (polar p1 0 (abs (- (caadr bb) (caar bb)))) ) (entmake (list (cons 0 "LINE") (cons 6 "BYLAYER") (cons 8 "linija") (cons 10 p1) (cons 11 p2) ) ) ) ) ) (princ) ) Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 There are many ways to skin a cat. I just grabed the closest knife & moved on. I'm not at all critical, your method was ingenious and I would never have thought of it that reminds me, i'm hungry. I'm not even going to ask... Quote
CAB Posted August 22, 2009 Posted August 22, 2009 Critical? Didn't even occur to me Lee. No worries mate. 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.