Author Topic: Rounding Delima  (Read 1520 times)

0 Members and 1 Guest are viewing this topic.

Bill Tillman

  • Guest
Rounding Delima
« on: February 23, 2012, 01:36:08 PM »
The drawing I'm working on is for an architectural product. Thus the units are set to Architectural, 1/16 precision. I have a number which is the weight of all the materials in the assembly which I want to include in an MTEXT section and I code it like this:

Code: [Select]
(setq Std_Notes (strcat Std_Notes "• APPROXIMATE HATCH WEIGHT: " (rtos hatchwt) " LBS."))
The variable in question is "hatchwt" which is currently equal to 142.431. But when this prints, of course it prints 142 7/16 LBS. Technically it's correct but I want this to print at 142.431 lbs. I guess I could change the units on the fly, wait for this to print, and then change the units back to architectural. That seems an awful way to handle this. Any suggestions? I've tried several of Lee Mac's rounding routines and they work great because this variable actually begins it's life as a string like this, 142.4312312883233...it's an incredible complex calculation of numbers that an Excel VBA program dumps to a text file and my VLISP file reads it in. I've used the rounding routine to get it down to three decimal places but the units setting turns this into a fraction rather than a decimal number. If push comes to shove I could round this down to a whole number (142) and just be done with it, but I like the idea of having the VLISP program create a drawing which is in total synch with the Excel file from which it all came.

« Last Edit: February 23, 2012, 01:40:54 PM by Bill Tillman »

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Rounding Delima
« Reply #1 on: February 23, 2012, 01:45:08 PM »
Read the VLIDE documentation on the rtos function and see if you can work it out  :wink:

Bill Tillman

  • Guest
Re: Rounding Delima
« Reply #2 on: February 23, 2012, 01:50:24 PM »
I'll do just that sir. But two -units commands in just the right places got it working okay.

Aha.... I see said the blind man. I wasn't aware that rtos had some extra switches....Thanks dude!

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Rounding Delima
« Reply #3 on: February 23, 2012, 01:59:18 PM »
 :-)