lamensterms Posted June 14, 2011 Posted June 14, 2011 (edited) Hi guys, Im not sure the best way to explain what I am looking for – but I would like to have a LISP routine that would copy and replace text. I am a steel detailer and we recently switched from one AutoCAD add-on package to another. The original software package had the ability to copy text below itself, then replace the copied text with new text (same size, style… and copied it a standard distance below the existing text). This feature is very handy when labeling dimensions. Please see attached image for examples… The distance that the new text is copied below the existing text would be proportional to the text height (style). Thanks so much for any help. Ps... i thought it would also be worth noting that it would be pre-defined text getting added below the existing text. So there could be a range of commands... ie. command 'TYP' would add the text "TYP", 'EQ' would add "= =", etc... Edited June 15, 2011 by lamensterms Quote
Lee Mac Posted June 14, 2011 Posted June 14, 2011 How about using DDEdit on the Dimension and then \XTYP or \XREF Quote
lamensterms Posted June 15, 2011 Author Posted June 15, 2011 Hi Lee, thanks for the reply.. can you please elaborate on that response? what is the function of \X? and how can i use it? Quote
Lee Mac Posted June 15, 2011 Posted June 15, 2011 When you DDEdit a Dimension you are modifying the Text Override Content of the Dimension. The represents the dimension measurement in this override string, and \X will place any text following it underneath the dimension line. Quote
lamensterms Posted June 15, 2011 Author Posted June 15, 2011 Oh wow, that’s great. Thanks so much Lee, for your help and your quick response. I understand that the ‘\X’ input needs to be written into a routine – rather than simply adding it in autoCAD? (otherwise the ‘’ appears as part of the dimension text?) I have actually just found a routine that will accomplish exactly what I need – using the same method you describe. (Defun c:fieldverify () (setq newdim (entsel "\n Select Dimension to Add FIELD VERIFY to:")) (setq newdimvalue "<>\\X FIELD VERIFY") (command "dimedit" "n" newdimvalue newdim "") (princ) ) http://www.archidigm.com/lounge/autocad%20tips/adding_text_to_dimensions.htm Thanks again for you help. Cheers. Quote
Lee Mac Posted June 15, 2011 Posted June 15, 2011 (edited) The text override could be typed manually or used in a program. A few examples: (defun c:test1 ( / e ) (if (and (setq e (car (entsel "\nSelect Dimension: "))) (wcmatch (cdr (assoc 0 (setq e (entget e)))) "*DIMENSION") ) (entmod (subst (cons 1 "<>\\XTYP") (assoc 1 e) e)) ) (princ) ) (defun c:test2 ( / ss i e ) (if (setq ss (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i))))) (entmod (subst (cons 1 "<>\\XTYP") (assoc 1 e) e)) ) ) (princ) ) There may be typo's as I've just typed that code from my mobile. Edited June 15, 2011 by Lee Mac Quote
lamensterms Posted June 15, 2011 Author Posted June 15, 2011 Thats great, thanks again for all this help Lee. will any of these routines work on dtext or mtext? i would mainly use these routines to run on dimensions, but would also like to use them on normal text. thanks again for taking the time mate. Quote
lamensterms Posted June 15, 2011 Author Posted June 15, 2011 Also... is it possible to have multiple lines of notes added below a dimension? like this... thanks again. Quote
VVA Posted June 15, 2011 Posted June 15, 2011 (defun c:test2 ( / ss i e ) (if (setq ss (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i))))) (entmod (subst (cons 1 "<>\\XREF[color="#ff0000"]\\P[/color]TYP") (assoc 1 e) e)) ) ) (princ) ) Quote
Lee Mac Posted June 15, 2011 Posted June 15, 2011 will any of these routines work on dtext or mtext? i would mainly use these routines to run on dimensions, but would also like to use them on normal text. You could use the "\\P" string to insert a new line to the end of an MText string, however, for DText you would need to create a new DText object at a distance below the original calculated from the text height of the selected DText and a Line spacing factor (such as 1.5). Quote
alanjt Posted June 15, 2011 Posted June 15, 2011 Here's a couple routines I did to add on to DText. Quote
lamensterms Posted June 17, 2011 Author Posted June 17, 2011 alanjt... thank you for your reply - that routine looks like it could be very helpful. Can you please post the routines on this forum though? I have registered to join the swamp but i havent yet received to approval to use their forums. Thanks for your help. Quote
Recommended Posts
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.