Jump to content

Recommended Posts

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    9

  • alanjt

    8

  • goldy2000

    7

  • CAB

    5

Top Posters In This Topic

Posted Images

Posted
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.

Posted
lol, that thing is old old old. i never noticed the missing x, good eye.

 

Always happy to nit-pick o:)

Posted
Always happy to nit-pick o:)

glad you got your chance to return the favor. :)

Posted

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)
)

Posted

Alan,

 

Why not use a vl-sort to sort the list in y?

 

*just curious*

Posted

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)
)

Posted

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)
)

Posted
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... o:)

Posted

Critical? Didn't even occur to me Lee. No worries mate.8)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...