Author Topic: Divide number in text by 25.4 (to metric)?  (Read 1929 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Swamp Rat
  • Posts: 502
Divide number in text by 25.4 (to metric)?
« on: March 29, 2006, 01:40:07 PM »
I have a large drawing, which contains dims that were exploded in the past by some highly intelligent life form. (management ?).
I have to convert this drawing from metric to inches with 3 decimal places. I’m looking for a routine that would let me:
1.   Select the text in these exploded dims
2.   Divide the current value by 25.4
3.   Replace the old value with the new
This does not have to be a global thing. I prefer single selection.
Any help would be greatly appreciated. Using ACAD2002 with Windows XP Professional

Many thanks
« Last Edit: March 29, 2006, 03:18:22 PM by CAB »

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Divide number by 25.4
« Reply #1 on: March 29, 2006, 02:03:47 PM »
Does this work for you?
Code: [Select]
(defun C:Dec2Inch ( / CurSet NewStr OldStr TxtObj)
 (vl-load-com)
 (if (setq CurSet (ssget "_:S:E:L" '((0 . "MTEXT"))))
  (progn
   (setq TxtObj (vlax-ename->vla-object (ssname CurSet 0))
         OldStr (vla-get-TextString TxtObj)
         NewStr (rtos (/ (atof OldStr) 25.4) 2 3)
   )
   (vla-put-TextString TxtObj NewStr)
  )
 )
 (princ)
)
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Divide number by 25.4
« Reply #2 on: March 29, 2006, 02:25:48 PM »
dimension same layer as text ?
same color as text ?
same size as text ?

you can use filter...
Keep smile...

Biscuits

  • Swamp Rat
  • Posts: 502
Re: Divide number by 25.4
« Reply #3 on: March 29, 2006, 02:41:23 PM »
Jurg had the perfect routine.

Thank you very much (Swiss quality strikes again)