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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
(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) )
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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-cordinates and y-cordinates from eachother ?
Again, thanks very much for your help.
Rob

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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.
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
You might also want to shorten the name to something more appropriate in the (defun....) statement, and saveas that other name dot LSP.
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Take a penny, leave a penny.
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, I know. You've explained the principle before ;o). But still ...
Rob
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.