Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd Behavior with a lsp and stacking text

Status
Not open for further replies.

shadow

Computer
Mar 1, 2001
321
well found this lsp online a couple of versions ago namely 2000 had worked great and still does occasionally here is what happens now you select the base text which is the text that it alines all othe lines of text with well if you use the lisp on the same sets of text more than once it wont do it it just ignores you
so if anyone gets ambitous and wants to play with it here yall go

(defun c:txtstack ( / tmp ntht bitm bent sset bins oins oang itm num done
ndis nhnd nent chnd cent cins cdis ht)
(setq cmdecho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "UNDO" "G")
(setq tmp (getreal (strcat &quot;\nDS> Interline Scale Factor <1.62>: &quot;)))
(if (/= tmp nil)(setq vscl tmp)(setq vscl 1.62))
(setq tmp (getreal &quot;\nDS> New Text Height <Unchanged>: &quot;))
(if (/= tmp nil)(setq ntht tmp)(setq ntht 0))
(setq bitm (car (entsel &quot;\nDS> Pick Base String: &quot;)))
(setq bent (entget bitm))
(if (= &quot;TEXT&quot; (cdr (assoc 0 bent)))
(progn
(redraw bitm 3)
(princ &quot;\nDS> Select Text to Align: &quot;)
(setq sset (ssget '((0 . &quot;TEXT&quot;))))
(redraw bitm 4)
(if sset
(progn
(if (> ntht 0)
(progn
(setq bent (subst (cons 40 ntht)(assoc 40 bent) bent))
(entmod bent)
)
)
(if (> (cdr (assoc 72 bent)) 0)
(setq bins (cdr (assoc 11 bent)))
(setq bins (cdr (assoc 10 bent)))
)
(setq bang (cdr (assoc 50 bent)))
(setq tang (- bang (/ PI 2)))
(setq nins bins)
(ssdel bitm sset)
(while (> (sslength sset) 0)
(setq num (sslength sset) itm 0)
(setq ndis 99999999.9)
(while (< itm num)
(setq chnd (ssname sset itm))
(setq cent (entget chnd))
(if (> (cdr (assoc 72 cent)) 0)
(setq cins (cdr (assoc 11 cent)))
(setq cins (cdr (assoc 10 cent)))
)
(setq cdis (distance bins cins))
(if (< cdis ndis)
(setq ndis cdis nhnd chnd nent cent)
)
(setq itm (1+ itm))
)
(if (> ntht 0)
(progn
(setq nent (subst (cons 40 ntht)(assoc 40 nent) nent))
(setq txht ntht)
)
(setq txht (cdr (assoc 40 nent)))
)
(setq nins (polar nins tang (* txht vscl)))
(if (> (cdr (assoc 72 nent)) 0)
(setq nent (subst (cons 11 nins)(assoc 11 nent) nent))
(setq nent (subst (cons 10 nins)(assoc 10 nent) nent))
)
(setq nent (subst (cons 50 bang)(assoc 50 nent) nent))
(entmod nent)
(ssdel nhnd sset)
)
)
)
)
)
;
(setq sset nil)
(command &quot;UNDO&quot; &quot;E&quot;)
(setvar &quot;CMDECHO&quot; cmdecho)
(princ)
)
if everyone helps everybody the world will be a better place
 
Replies continue below

Recommended for you

I found that same lisp routine a year or two ago. In order
to fix that problem, you would have to provide several
more variables, and several more lines of Lisp. Otherwise,
you just have to deal with the &quot;unfinished&quot; one.
 
Well, the fact of the matter is.....

This text stacking routine will stack the text in a fashion that is consistant with the selection order. If you do not select them in the order you want them aligned in, the outcome is unpredictable. Another caveat of this routine is that of course, once you align the text once, it will indeed be aligned and will not require that you &quot;realign&quot; it, therefore it will appear as though nothing has happened.

To fix the problems I mentioned would require that all of the y coordinates be compared and adjusted in relation to the base insertion point, then the x coordinate of the base object replicated in the member text objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor