guitarguy1685 Posted January 28, 2010 Posted January 28, 2010 Ok so i'm trying to put date in an attribute. I'm having a problem with how it's displayed. This is my code (setq RDate (rtos (getvar "CDATE")) yr (substr RDate 3 2) mo (substr RDate 5 2) dy (substr RDate 7 2) Date (strcat mo "/" dy "/" yr) ) I end up with this as the date, "01/0'/75" when I type CDATE at the command prompt I get Command: cdate CDATE = 20100128.09264312 (read only) Which is what I want to use for strcat. if I type (setq RDate (rtos (getvar "CDATE"))) i get Command: (setq RDate (rtos (getvar "CDATE"))) "1675010'-8 3/32\"" if I take out the rtos I get (setq RDate (getvar "CDATE")) 2.01001e+007 I currently on Autocad 2007 at work. when I did this at home on 2009 it seemed to work fine. any thoughts? Quote
JohnM Posted January 28, 2010 Posted January 28, 2010 it's how your units are set. type units on the command line to view they are set to architectural and that will make the numbers displayed look diffrent. 2 way to handle it is to change the units in autocad or the best way is to set the units in the rtos function (setq RDate (rtos (getvar "CDATE")2) the 2 at the end is setting the conversion to decimals 1 Scientific 2 Decimal 3 Engineering (feet and decimal inches) 4 Architectural (feet and fractional inches) 5 Fractional Quote
guitarguy1685 Posted January 28, 2010 Author Posted January 28, 2010 ahh so easy. thax for catching my silly oversight Quote
Lee Mac Posted January 29, 2010 Posted January 29, 2010 How about using DIESEL? Much easier: (menucmd "m=$(edtime,$(getvar,DATE),MM.DD.YY)") Quote
guitarguy1685 Posted January 29, 2010 Author Posted January 29, 2010 I tried using diesel first but was getting errors in my lisp. How could I set that to a variable? (setq date (menucmd "m=$(edtime,$(getvar,DATE),MM.DD.YY)")) would that work? Quote
Lee Mac Posted January 29, 2010 Posted January 29, 2010 Yes, menucmd returns a string More info here: http://www.crlf.de/Dokumente/Diesel/DieselReference.html Quote
Recommended Posts
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.