See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: Field for Date

  1. #1
    All AUGI, all the time
    Join Date
    2009-11
    Location
    Raleigh, NC
    Posts
    944
    Login to Give a bone
    0

    Default Field for Date

    I have created a Date field.

    It will not change from the date shown from first creating the field.

    I have done the redraw.
    Attached Images Attached Images

  2. #2
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,507
    Login to Give a bone
    1

    Default Re: Field for Date

    Look into the FIELDEVAL variable, it controls when that field gets updated.
    upon Open, upon Save, upon Regeneration etc

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    1

    Default Re: Field for Date

    You can also manually update it with the UPDATEFIELD command.
    C:> ED WORKING....


    LinkedIn

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    1

    Default Re: Field for Date

    UPDATEFIELD will not update Date fields, I use this lisp by lpseifert that updates All fields by saving "UpdateAllfields.lsp" in a Trusted Support folder & adding the macro: ^P(or C:UpdateAllfields (load "UpdateAllfields.lsp"));UpdateAllfields
    Code:
    ; by lpseifert for updating date fields not updated automatically based on the setting of the FIELDEVAL system variable.
    ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/programmatically-update-a-date-field/m-p/2357937#M268137
    ; ^P(or C:UpdateAllfields (load "UpdateAllfields.lsp"));UpdateAllfields
    (defun c:UpdateAllfields (/ ss1 sslen count)
      (setq ss1 
        (ssget "x"
          '(
            (-4 . "<and")
              (-4 . "<or")
                (0 . "insert")
                (0 . "*text")
              (-4 . "or>")
            (-4 . "and>")
          )
        )
        sslen (sslength ss1)
        count 0
      )
      (command "updatefield" ss1 "")
      (while (< count sslen)
        (entupd (ssname ss1 count))
        (setq count (1+ count))
      )
      (princ)
    ;  (command "regen")
    )

  5. #5
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    1

    Default Re: Field for Date

    Hi Tom, UPDATEFIELD does update a DATE field. I just tested it. In fact, this lisp uses UPDATEFIELD to do the update. It just automates the entity selection. Manually running UPDATEFIELD prompts you to select the field. It's just that date fields, by design, are not automatically updated. Most people use them like a timestamp and it shouldn't change when you open/save a dwg.
    C:> ED WORKING....


    LinkedIn

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Field for Date

    Quote Originally Posted by Ed Jobe View Post
    Hi Tom, UPDATEFIELD does update a DATE field. I just tested it. In fact, this lisp uses UPDATEFIELD to do the update. It just automates the entity selection. Manually running UPDATEFIELD prompts you to select the field. It's just that date fields, by design, are not automatically updated. Most people use them like a timestamp and it shouldn't change when you open/save a dwg.
    Generally all our drawings include the SaveDate when the drawing was last updated and the date the survey work was completed saved in custom properties. Neither of them would be modified by UPDATEFIELD with or without the lisp. With the default value for FIELDEVAL all fields update themselves anytime they're needed.

    While the lisp would update the Date field I'm thinking now what Tim should probably be using is the SaveDate field instead. I could see using the Date field and updating it one time when a new user takes over modifying the drawing or creates a new drawing from a template that has the Date field in it, maybe that's what Tim is doing. Odd that the date in the image he posted was the same as the date he posted it, maybe what he actually wanted was MM/dd/yyyy format instead?

Similar Threads

  1. Date Field - all in CAPS?
    By cholmes in forum AutoCAD Fields
    Replies: 13
    Last Post: 2016-05-16, 02:26 PM
  2. Date - Field
    By rhayes.99001 in forum ACA General
    Replies: 8
    Last Post: 2007-09-06, 02:18 PM
  3. Can I lock a date field?
    By GreyHippo in forum AutoCAD Fields
    Replies: 2
    Last Post: 2006-01-11, 11:11 PM
  4. Date field does not update automatically
    By scott.wilcox in forum AutoCAD Fields
    Replies: 4
    Last Post: 2005-05-23, 05:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •