I need to update metric numbers on a older CAD file to imperial numbers. Right now it is all single line text. Anyone know of a way to easily convert single line text to some format that could then be converted from metric to imperial? I have stationing, pipe sizes (in milimeter), inverts, etc. Thank-you.
Do you just want something that will read the text, convert to a real number, convert that from meters to feet and then convert back to text? Post your drawing.
Tim
Post your drawing so I can look at your actual text objects.
Which text objects get converted? Only those that have a number followed by mm?
This code will convert the stations in plan view. This was a quick routine to write.
(defun ConvertStationLabelstoImperial ( / ls len ctr ent val stlen stctr str ltr strrm strri entx) (setq ls (ssget "x" (list (cons 8 "1STALBL")(cons 0 "TEXT"))) len (sslength ls) ctr 0) (while (< ctr len) (setq ent (ssname ls ctr) val (cdr (assoc 1 (entget ent))) stlen (strlen val) ) (setq stctr 1 str "") (while (<= stctr stlen) (setq ltr (substr val stctr 1)) (if (/= ltr "+") (setq str (strcat str ltr)) ) (setq stctr (1+ stctr) ) ) (setq strrm (atof str) strri (rtos (* strrm 3.2808) 2 0) ) ;add + back in (setq sufx (substr strri (- (strlen strri) 1) 2) prfx (substr strri 1 (- (strlen strri) 2)) ) (setq strri (strcat prfx "+" sufx)) (setq entx (entget ent)) (setq entx (subst (cons 1 strri) (assoc 1 entx) entx) ) (entmod entx) (entupd ent) (setq ctr (1+ ctr)) );end while );end function
The invert elevations don't always end in a number, so I would have to check for that, and they aren't all the same precision, so I would have to check for adapt to that. That's gonna be more than I have time to do for you today. Maybe Friday...