Convert dimension value to text

Hello,

Does anyone of you know if there is a lisp-routine that converts the horizontal and vertical dimension value to text (preferably mtext).

In other words: I want to put a text with the dimensions in a square (glass panel), e.g. [Horizontal value] x [Vertical value].

Thanks very much in advance !

Rob

Reply to
The Jester
Loading thread data ...

(defun c:RMSIZE (/ ha hb hc hd va vb vc vd a b th tp r ) (setvar "OSMODE" 32) (setq ha (getpoint "\nPick first point horizontal dimension: ")) (setq hc (getpoint "\nPick second horizontal point: ")) (setq va (getpoint "\nPick first point vertical dimension: ")) (setq vc (getpoint "\nPick second vertical point: ")) (setq tp (getpoint "\nStart point for text: ")) (setq th (getreal "\nEnter text height: ")) (setq hb (car ha)) (setq hd (car hc)) (setq vb (cadr va)) (setq vd (cadr vc)) (setq a (abs (- hd hb))) (setq a (rtos a 4 1)) (setq b (abs (- vd vb))) (setq b (rtos b 4 1)) (setq r (strcat a " x " b)) (setvar "OSMODE" 0) (graphscr) (command "TEXT" tp th 0 r) (princ) )

Reply to
Michael Bulatovich

Thank you very much, Michael !! Sorry for not thanking you sooner (all work and no play and such ... ;o) )

I've tried the routine and it works great. However, since I live in Holland, I'd like the text in metric values, is it possible for you to edit the routine that way ? And if it's not too much to ask, to convert the text to mtext, please ? I'd be very greatful if you could.

Another question is about the way to enter the 4 points: wouldn't it be simpler to select a diagonal line in a rectangle (or just the 2 points diagonally opposite eachother in that rectangle) and subtract the x-coördinates and y-coördinates from eachother ?

Again, thanks very much for your help.

Rob

"Michael Bulatovich" schreef in bericht news: snipped-for-privacy@news1.newsguy.com...

Reply to
The Jester

The 4 in (rtos a 4 1) makes it return feet and inches, and the 1 is the unit accuracy. If you want plain decimal numbers change the 4 to 2 wherever you see an (RTOS......) statement. If your units are millimeters accuracy of 1 will be fine. If your units are meters you might want to change it to 3.

Reply to
Michael Bulatovich

You might also want to shorten the name to something more appropriate in the (defun....) statement, and saveas that other name dot LSP.

Reply to
Michael Bulatovich

"Michael Bulatovich" schreef in bericht news: snipped-for-privacy@news3.newsguy.com...

Thank you very much ! It will save me a lot of time at work, as I had to type in the dimensions for every glass panel in my drawings. I was used to 'just' dimension them, but my new boss wants it as text in the panel itself.

Much appreciated.

Rob

Reply to
The Jester

Take a penny, leave a penny.

Reply to
Michael Bulatovich

"Michael Bulatovich" schreef in bericht news: snipped-for-privacy@news3.newsguy.com...

Yes, I know. You've explained the principle before ;o). But still ...

Rob

Reply to
The Jester

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.