Author Topic: Box Around Text that readjust to text size changes  (Read 4971 times)

0 Members and 1 Guest are viewing this topic.

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« on: June 02, 2004, 12:08:04 PM »
Does anyone have a lisp to add a box around mtext that will readjust if the mtext size or width changes?

I am currently using the "Enclose Text with Object" command from the express tools, but it takes too much time to get what you want plus if the text changes or needs to be adjusted later on down the road, you have to redo the box. Any help or direction will be greatly appreciated.

Thanks,

Andrew

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Box Around Text that readjust to text size changes
« Reply #1 on: June 02, 2004, 12:57:34 PM »
lookup reactors in C:\<acad install>\Help\acad_dev.chm that is the only way I can see doing it.
TheSwamp.org  (serving the CAD community since 2003)

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« Reply #2 on: June 02, 2004, 01:05:21 PM »
What are reactors?

FYI... I know nothing about writing lisps, just using them.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Box Around Text that readjust to text size changes
« Reply #3 on: June 02, 2004, 01:09:36 PM »
well reactors are beyond my programming abilities also, so don't feel bad. :D
TheSwamp.org  (serving the CAD community since 2003)

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« Reply #4 on: June 02, 2004, 01:13:19 PM »
I understand.  :P

Thank for trying anyway.

M-dub

  • Guest
Box Around Text that readjust to text size changes
« Reply #5 on: June 02, 2004, 01:36:17 PM »
Not sure how or if this one works...just downloaded it from CADalyst.com

Code: [Select]
;;Tip1847   LOUD.LSP       BOX FOR MTEXT                       (c) 2003 Chris

Picklesimer
(defun C:loud (/ tlf wid hig brg TLFO MTLAY BRGO CURLAY MTH FNM ENT)
;defun statement
  (prompt "PICK MTEXT TO MAKE LOUD...            ")
;prompt for user friendlyness
  (setq ent (ssget)) ;sets selected mtext as variable "ent"
  (setq fnm (ssname ent 0)) ;sets name of selected mtext as variable "fnm"
  (setq tlf (cdr (assoc 10 (entget fnm))))
;sets top left corner variable "tlf"
  (setq wid (cdr (assoc 42 (entget fnm))))
;sets variable "wid" as width of mtext

object
  (setq hig (cdr (assoc 43 (entget fnm))))
;sets variable "hig" as height of mtext

object
  (setq mth (cdr (assoc 40 (entget fnm))))
;sets variable "mth" to text height
  (setq mtlay (cdr (assoc 8 (entget fnm))))
;sets variable "mtlay" to mtext layer
  (setq brg (list (+ (car tlf) wid) (- (cadr tlf) hig)))
;formulates bottom right corner and

sets as "brg"
  (setq tlfo (list (- (car tlf) mth) (+ (cadr tlf) mth)))
;formulates rectangle top left corner,

"tlfo"
  (setq brgo (list (+ (car brg) mth) (- (cadr brg) mth)))
;formulates rectangle bot right cor,

"brgo"
  (setq curlay (getvar "clayer")) ;saves the current layer name as "curlay"
  (setvar "clayer" mtlay) ;changes current layer to mtext layer
  (command "rectang" tlfo brgo) ;draws rectangle using formulated

coordinates
  (setvar "clayer" curlay) ;changes current layer back to "curlay"
  (command "pedit" "last" "w" (* 0.125 mth) "")
;edits pline width from 0 to 1/8*"mth"
  (princ) ;prints nothing to eliminate nil
)


Good Luck...Hope it helps!

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« Reply #6 on: June 02, 2004, 01:41:16 PM »
It works the same as the other lisps I have. Just draws a box around the existing text, but if the text size or width changes the box doesn't modify accordingly.

But thanks for the efforts.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Box Around Text that readjust to text size changes
« Reply #7 on: June 02, 2004, 01:58:26 PM »
Here's my solution:
Code: [Select]
+--------------------------------+
| ADJUSTABLE TEXT FRAME TEMPLATE |
+--------------------------------+


Sorry couldnt resist. But serioulsy, you could use reactors to do this but that would be one huge program. I dont have the time/practice/etc. to build anything like this andymore.  I just dont know what to say besides "thats a tought one".
I wish i could help.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Box Around Text that readjust to text size changes
« Reply #8 on: June 02, 2004, 02:04:32 PM »
OBTW, That code failed on the first attempt. ...that prety much sums up my feelings about it too.  (Holly script batman?!)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« Reply #9 on: June 02, 2004, 02:10:31 PM »
M-dub's lisp works great, but still can't adjust the text and have the box automatically adjust too. Thanks M-dub for trying.

Is there anyone out there up for the challenge?

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Box Around Text that readjust to text size changes
« Reply #10 on: June 02, 2004, 02:58:37 PM »
Andrew i wasnt knocking M-dub. (He didnt write that code.)

What i was trying to say is that your request is a bigone. unless someone already has this application they can give out, your prolly not going to get someone to develop this for free. (this is a tall order and would require at least a couple of days worth of coding to get a solid working model. And that would be only a beta version. Next is debugging; that could take weeks.) Im not trying to squash your idea or anything --i think its a good one-- but ...well i think you understand what im trying to say now.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

M-dub

  • Guest
Box Around Text that readjust to text size changes
« Reply #11 on: June 02, 2004, 03:19:20 PM »
I know what Se7en's sayin' here...and agree.  It does sound like it might take a lot of testing to get the bugs out.  And he's right...I didn't write it...just found it.
Quote from: M-dub
...just downloaded it from CADalyst.com

In the meantime, might I suggest adding that lisp to your startup suite and creating a button for it so it's easy / quick to access the routine after editing mtext?  Actually, create a new button and put the following macro in it...see if that'll do for now...

Code: [Select]
^C^Cerase;\;ddedit;\;loud;p;;

M-dub

  • Guest
Box Around Text that readjust to text size changes
« Reply #12 on: June 02, 2004, 03:24:14 PM »
*NOTE*
YOu have to have that LOUD.LSP loaded already...
This is also assuming that you have an existing box around your text.  (if you don't, you should make another macro without the erase command in it) That's what the erase command is for...so you can erase the current one.  Then, you edit the text and right after, LOUD draws the new box around the text you just edited.  Make sense?  It's not as reliable as a properly tested, full blown lisp routine, but it's the best I can provide with my complete lack of lisp writing skills.

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« Reply #13 on: June 02, 2004, 04:08:07 PM »
I actually like the text box command from the Express Tools, but I was just wondering if there was an exiting lisp out there that would stick to the text size adjustments.

Here is my version of what M-dub posted, but using the existing ACAD Express Tools "Enclose Text with Object" command.

Code: [Select]

^C^Cerase;\;ddedit;\;tcircle;\;;r;c;b;pedit;m;\;w;.5;;


This one will let you erase an existing box, edit the text, created a new box and give the new box a thinkness. This button includes my personal setting for all the command options, but you may need to adjust them the suite your needs.

Andrew H

  • Guest
Box Around Text that readjust to text size changes
« Reply #14 on: June 02, 2004, 04:12:52 PM »
Code: [Select]

^C^Cerase;\;ddedit;\;spell;\;tcircle;\;;r;c;b;pedit;m;\;w;.5;;


Here is another version with spell check included for anyone, like myself, whom can't spell worth a darn.