TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Biscuits on March 12, 2008, 01:51:56 PM

Title: Match Attribute Height
Post by: Biscuits on March 12, 2008, 01:51:56 PM
Using Windows XP with Autocad2008.

I'm looking for a routine to select an attribute (to obtain text height)
then select other attributes to change their text height to match the previous selection.

Would appreciate any assistance with this.
Title: Re: Match Attribute Height
Post by: T.Willey on March 12, 2008, 01:55:29 PM
Look at 'nentsel' to select the first attribute.  Then grab the Height property.  Then use the routine here (http://www.theswamp.org/index.php?topic=19886.0) to select the other attributes.
Title: Re: Match Attribute Height
Post by: deegeecees on March 12, 2008, 02:08:10 PM
Need more?

(setq en1 (entget (car (nentsel))))
(setq en2 (cdr (assoc 40 en1)))
Title: Re: Match Attribute Height
Post by: deegeecees on March 13, 2008, 11:54:40 AM
So, any progress?
Title: Re: Match Attribute Height
Post by: Biscuits on March 13, 2008, 12:25:12 PM
Poor lsp skills and time constraints are my excuses for little progress for now.
Not sure how to combine your statements with T.Willey's

Thanks for your help
Title: Re: Match Attribute Height
Post by: deegeecees on March 13, 2008, 12:29:47 PM
I'll see if I can whip something up for you then. I've got a little time.
Title: Re: Match Attribute Height
Post by: deegeecees on March 13, 2008, 12:53:08 PM
My general disclaimer applies - "It aint pretty but it works"

There is a regen after each selection, and the variables aren't reset, but I've run out of time to make it a bit more friendly. Others here could probably do quite a bit better, but hey, it works.

Enjoy!

Code: [Select]
;match_att_ht.lsp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;start prog

(defun c:match_att_ht ()
(setq en1 (entget (car (nentsel))))
(setq en2 (cdr (assoc 40 en1)))
(setq cntr1 1)
(while (= 1 cntr1)
(setq ent1 (nentsel "\nSelect any text object <HIT ESC TO STOP>:" ))
(setq en1-2 (car ent1))

(setq en3 (entget (car Ent1)))

   (setq en3
                   (subst(cons 40 en2)
                         (assoc 40 en3)
                         en3))
        (entmod en3)
        (entupd en1-2)
(command "regen")
(princ)
);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;while

)
Title: Re: Match Attribute Height
Post by: Biscuits on March 13, 2008, 01:47:16 PM
Lookin' purty to me!

Thank you.

Works great.
Title: Re: Match Attribute Height
Post by: deegeecees on March 13, 2008, 01:57:49 PM
Not a problem (today anyway)!