Jump to content

Text from imperial to metric


datalife

Recommended Posts

Hello,

 

I have tons survey points of text drawn which is in imperial (ft). I need to change

it to metric (m). Is there a lisp to change the text by "fence" the text

and convert immediately to metric (m) in the screen.

 

Thanks:)

Link to comment
Share on other sites

It sounds to me like what you may actually want to do is change the -dwgunits of your drawing

from whatever Imperial unit they are currently to your preferred metric unit of measure.

I could be wrong, it would be helpful to see a sample .dwg file, as Tharwat suggested. :)

Link to comment
Share on other sites

perhaps this

 

(defun _I2M  (str m d)
     (if (distof str)
           (rtos (* (distof str)
                    (* 0.0254 (if m 1000 1))
                       )
                     2
                 (if m 0 d))
           )
     )

 

 

T for Milimeters

 

(_i2m "6'-11\"" t 2)

"2108"

 

nil for meters

2 Decimals places

(_i2m "6'-11\"" nil 2)

"2.11"

 

(_i2m "6'-11\"" nil 4)

"2.1082"

 

HTH

Link to comment
Share on other sites

Hello all,

I have received this drawings from surveyor

which the text show the survey points in imperial (ie in feet) units.

 

I extract part of the drawing; as mentioned earlier; I wish

to have a lisp that "fence" the text and replace the text in

metric (ie in meter) units

 

Thanks

imperial.dwg

Link to comment
Share on other sites

I checked the drawing units of your drawing and they are meters, so that looks appropriate.

 

It look like Lee Mac's http://www.lee-mac.com/textcalculator.html

lisp may be able to do this. I've never noticed this one before

amidst all of Lee's other shareware gems on his site, but I figured I would

be remiss if I didn't take a look.

Thanks Lee! :beer:

Link to comment
Share on other sites

This may work .... :)

(defun c:f2m (/ ss)
 (if (setq ss (ssget "_:L" '((0 . "*TEXT"))))
   ((lambda (i / sn st e)
      (while (setq sn (ssname ss (setq i (1+ i))))
        (if (numberp (setq st (read (cdr (assoc 1 (setq e (entget sn)))))))
          (entmod (subst (cons 1 (rtos (* 0.3048 st) 2 2)) (assoc 1 e) e))
        )
      )
    )
     -1
   )
   (princ)
 )
 (princ)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...