Jump to content

Recommended Posts

Posted

Hi all,

 

We have recently changed the way we store issued drawings. I am looking to for lisp that will create a folder but I want to take the folder that the current drawing is saved in and add \Issued_Drawings and then prompt for the name of the new folder. Can it be setup to have the current date in the format YYYY MM DD as a default in a dialog box?

 

Thanks.

Posted

You can use the CDATE system variable to get current date:

 

(setq theDate  (rtos (getvar "CDATE") 2 6)
     theYear  (substr theDate 1 4)
     theMonth (substr theDate 5 2)
     theDay   (substr theDate 7 2))

 

Regards,

Mircea

Posted

I use the DIESEL edtime function when I require the date, for example:

 

;; Get Date  -  Lee Mac
;; A wrapper for the edtime DIESEL function

(defun LM:GetDate ( format )
   (menucmd (strcat "m=$(edtime,$(getvar,DATE)," format ")"))
)

_$ (LM:GetDate "YYYY MO DD")
"2012 02 06"

_$ (LM:GetDate "HH:MM:SS\",\" DDDD DD MONTH YYYY")
"11:31:55, Monday 06 February 2012"

Reference:

 

edtime     $(edtime,2452000.0,D.M.YYYY) ==> 31.3.2001

converts a real number to a date-formatted string.

First argument: number representing a Julian date in AutoCAD,
e.g. as returned by $(getvar,DATE), or a UNIX date in the original source.

If zero, uses the time/date the macro was started.

Second argument: sequence of formatting codes

D:       day                             4
DD:      day with leading zero          04
DDD:     day of week short             Mon
DDDD:    day of week long              Monday

M:       month                           6
MO:      month with leading zero        06
MON:     month name short              Jun
MONTH:   month name long               June

YY:      year two places                 12
YYYY:    year four places              2012

H:       hour                             7
HH:      hour with leading zero          07

MM:      minutes                         30
SS:      seconds                         30
MSEC:    milliseconds                   300

AM/PM:   upper case AM or PM             AM
am/pm:   lower case am or pm             am
A/P:     upper case  A or P               A
a/p:     lower case  a or p               a

Posted

Excellent stuff LeeMac. Thanks. and you too msasu. I'll be back with questions no doubt.

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