Two Questions DCL and Visual Lisp

Discussion in 'AutoCAD' started by Erick J. Icaza, Jun 29, 2004.

  1. 1.- DCL

    How can I get an edit_box to scroll down and not always to the right? An edit_box like the comments edit_box in the summary tab of the AutoCAD dwgProperties dBox?

    2.- AutoLISP

    How do I get to insert the file creation time as a text inside a dialog box (not an alert box)? I managed to get the current date in the same dialog box by using the cdate variable (not a Julian format). TDCREATE gives the creation date in a Julian format, which I do not know how to translate into a MON/DD/YYYY format as I would easily do if I use DIESEL (only for the status bar).
     
    Erick J. Icaza, Jun 29, 2004
    #1
  2. Erick J. Icaza

    ECCAD Guest

    For 2nd question - date into dialog..
    Here's a routine to get the Julian Date, formatted as MM/DD/YYYY.

    ;; Function to get the Julian Date, and make (MM/DD/YYYY) format.
    ;; Use variable fd (string) for text insert or whatever.
    ;;
    (defun fdate ( / A yr mo dax hr mi se)
    (setq fd nil)
    (setq A (rtos (getvar "CDATE") 2 6)) ; get Julian date
    (if (/= A nil)
    (progn
    (setq yr (substr A 3 2)); year (2 digit)
    (setq mo (substr A 5 2)); month
    (setq dax (substr A 7 2)); day
    (setq hr (substr A 10 2)); hour
    (setq mi (substr A 12 2)); minute
    (setq se (substr A 14 2)); second
    (setq fd (strcat mo "/" dax "/20" yr))
    (princ)
    ); end progn
    ); end if
    ); end function fdate
    ;;

    Usage:
    Command: (load"C:/lisp/fdate")
    FDATE

    Command: (fdate)

    Command: !fd
    "06/29/2004"

    Then, make a new edit_box in your .dcl, named key "date".
    and in routine, do:
    (fdate)
    (set_tile "date" fd)

    Bob
     
    ECCAD, Jun 29, 2004
    #2
  3. Erick J. Icaza

    GaryDF Guest

    Here is what I use

    (defun ARCH:C_DATE-ISSUE (j / y d m)
    (setq j (fix j)
    j (- j 1721119.0)
    y (fix (/ (1- (* 4 j)) 146097.0))
    j (- (* j 4.0) 1.0 (* 146097.0 y))
    d (fix (/ j 4.0))
    j (fix (/ (+ (* 4.0 d) 3.0) 1461.0))
    d (- (+ (* 4.0 d) 3.0) (* 1461.0 j))
    d (fix (/ (+ d 4.0) 4.0))
    m (fix (/ (- (* 5.0 d) 3) 153.0))
    d (- (* 5.0 d) 3.0 (* 153.0 m))
    d (fix (/ (+ d 5.0) 5.0))
    y (+ (* 100.0 y) j)
    )
    (if (< m 10.0)
    (setq m (+ m 3))
    (setq m (- m 9)
    y (1+ y)
    )
    )
    (strcat (if (< D 10)
    "0"
    ""
    )
    (itoa (fix D))
    " "
    (nth (1- (fix m))
    (list "Jan" "Feb" "March" "April" "May"
    "June" "July" "Aug" "Sept" "Oct"
    "Nov" "Dec"
    )
    )
    " "
    (substr (itoa (fix Y)) 3 2)
    )
    )

    (setq ARCH#DATE (ARCH:C_DATE-ISSUE (getvar "tdupdate")))

    "29 June 04"

    Gary
     
    GaryDF, Jun 29, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.