PDA

View Full Version : Routine to add text below existing text


jhohman
2004-06-28, 03:37 PM
I am looking for a LISP routine that will allow me to input text by selecting an existing line of text and allow me to add text below the selected line in the same way that I could if I had continued typing. So, if I had a notation and leader on say a detail, the LISP would ask me to select the text I want to continue from and after I select the text it would place the start point one line below the selected text. I hope this is understandable, I had found a routine before that did this but cannot find it now, anybody have any ideas. Thanks.

Mike.Perry
2004-06-28, 06:55 PM
Hi

Check out the following submission # EX001241 by Ed Jobe on the AUGI Exchange -

Search AUGI Exchange Page (http://64.227.78.21/empower/exchange/searchdownloads.asp)

If memory serves this Text utility has the functionality you're after, hopefully Ed can confirm this one-way or the other.

Have a good one, Mike

whdjr
2004-06-29, 02:19 PM
Jay,

This is one that we use for Dtext. I don't know where we got it or who wrote it.


(defun c:CONTXT (/ uecho fht ent ins alignx alignp)
(setq uecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(and
(setq ent (entsel "\nLast line of text: "))
(setq ent (entget (car ent)))
(= (*dxf* 0 ent) "TEXT")
(or (/= (*dxf* '72 ent) 3)
(prompt "\nDoesn't work on ALIGNED text.")
)
(or (/= (*dxf* '72 ent) 5)
(prompt "\nDoesn't work on FIT text.")
)
(progn
(setq ins (*dxf* 10 ent)
fht (/= 0.0 (*dxf* 40 (tblsearch "STYLE" (*dxf* 7 ent))))
)
(if (/= (*dxf* 8 ent) (getvar "clayer"))
(command ".layer" "s" (*dxf* 8 ent) "")
)
(if (or (setq alignx (*dxf* (*dxf* 72 ent) '((1 . "c") (2 . "r") (4 . "m"))))
(setq alignp (*dxf* (*dxf* 73 ent) '((1 . "b") (2 . "m") (3 . "t"))))
)
(setq ins (*dxf* 11 ent))
)
(if (not alignx)
(setq alignx "l")
)
(if alignp
(setq alignx (strcat alignp alignx))
)
(command ".text" "s" (*dxf* 7 ent))
(if (/= alignx "l")
(command alignx)
)
(command ins)
(if (not fht)
(command (*dxf* 40 ent))
)
(command (angtos (*dxf* 50 ent)) " ")
(prompt "\nNew text: ")
(command ".dtext" "")
)
)
(setvar "cmdecho" uecho)
(princ)
)

Hope this helps,

jhohman
2004-06-29, 05:02 PM
Perhaps I am doing something wrong, but I get this after I try to use the LISP:

Command: contxt

Last line of text: ; error: no function definition: *DXF*


It asks me to select the last line of text then returns to the command prompt after I select the text.

stig.madsen
2004-06-29, 05:17 PM
Try adding a function like this and see if it works:
(defun *dxf* (val ent)(cdr (assoc val ent)))

jhohman
2004-06-29, 05:25 PM
Try adding a function like this and see if it works:
(defun *dxf* (val ent)(cdr (assoc val ent)))


Where would I insert this function?? At the end?

stig.madsen
2004-06-29, 06:26 PM
Anywhere .. just as long as it is loaded before you run c:CONTXT

whdjr
2004-06-29, 07:11 PM
Stig's post will work, but here is the one I left out.

Sorry.

(defun *dxf* (gcode elist)
(cdr (assoc gcode elist))
)

jhohman
2004-06-29, 09:05 PM
Thanks alot guys, I really appreciate all the help.