View Full Version : Contxt.lsp
robert.1.hall72202
2004-08-18, 08:35 PM
I had a really cool lisp routine for writting text underneath text that is already in the drawing.....searching the internet I found a couple routines that are suppose to do this but they throw the text way off the screen instead of under the selected text....anybody know of a lisp routine that actually works?
Mike.Perry
2004-08-18, 09:35 PM
Hi
You might want to check out the following Submission # EX001241 by Ed Jobe on the AUGI Exchange Page -
AUGI Exchange Search Page (http://www.augi.com/exchange/search.asp?page=415)
Have a good one, Mike
whdjr
2004-08-19, 11:58 AM
Rhall,
This is one I use very frequently. I got from the web a long time ago. Not sure where.
Hope this helps.
(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)
)
BeKirra
2013-02-15, 12:01 AM
I know this is an old thread and the code can also be found in many web sites.
I found it as I am learning DXF functions.
I noticed that this code doesn't work for all LEFT justifications (left, top left, middle left and bottom left).
Could anyone fix it so I can learn from you?
Thanks in advance.
BTW, from other web site I believe there is a function missing in this code:
(defun *dxf* (x ent) (cdr (assoc x ent)))
Rhall,
This is one I use very frequently. I got from the web a long time ago. Not sure where.
Hope this helps.
(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)
)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.