Jump to content

Recommended Posts

Posted

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?

Posted

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

Posted

ahh so easy. thax for catching my silly oversight

Posted

How about using DIESEL?

 

Much easier:

 

(menucmd "m=$(edtime,$(getvar,DATE),MM.DD.YY)")

Posted

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?

Posted

Yes, menucmd returns a string

 

More info here:

http://www.crlf.de/Dokumente/Diesel/DieselReference.html

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...