Request: Apply Date Routine as MM/DD/YY

Could someone point to a LISP routine with a format similar or able to be modified per the subject line?

Thanks,

Clinton Hill

Comments

  • Roy Klein Gebbinck
    edited July 2019

    Your request is a bit vague. But perhaps this?:

    (menucmd "M=$(edtime,$(getvar,date),MO/DD/YY)")
    
  • My pardons, Roy.

    I appreciate your offering. I am little rusty and need to revisit basic customization: Might this code be assigned to a palette or toolbar button?

    I was searching for an existing LISP program that would would allow the user to select an attribute value an existing value be replaced by the current date with a mouse click.

  • Roy Klein Gebbinck
    edited July 2019
    (defun c:DateToAtt ( / doc enm sel)
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (vla-endundomark doc)
      (vla-startundomark doc)
      (if
        (and
          (setq sel (nentsel))
          (= 2 (length sel)) ; Avoid changing nested attributes.
          (setq enm (car sel))
          (= "ATTRIB" (vle-entget 0 enm))
        )
        (vle-entmod 1 enm (menucmd "M=$(edtime,$(getvar,date),MO/DD/YY)"))
      )
      (vla-endundomark doc)
      (princ)
    )
    

    EDIT: Added a check to avoid changing nested attributes.

  • Have you considered using a FIELD? Depending on your requirements this would be a non-programming method to achieve the same.

    Regards,
    Jason Bourhill
    CAD Concepts

  • @Jason Bourhill said:
    Have you considered using a FIELD? Depending on your requirements this would be a non-programming method to achieve the same.

    Regards,
    Jason Bourhill
    CAD Concepts

    Take care using the FIELD option. The **FIELDEVAL **system variable may cause the date to auto-update, which may not be suitable if you wanted a static string.

    Regards,

  • Kerry Brown
    edited July 2019

    Sorry, I tried, but I can't help myself ... this is a pet peeve of mine

    https://xkcd.com/1179/

  • chillme1
    edited July 2019

    Excellent idea: Fields are very powerful. In this case, I prefer a static value. I appreciate your concern.
    I was hoping someone might have a routine in their customization arsenal.

  • chillme1
    edited July 2019

    I hope I can rise to the LISP programming challenge through creating this routine.

  • @chillme1 You have perhaps missed my 2nd contribution?

  • Indeed I did, sir !!! I thank you for this generous offering.

    My aim is to refer to your code as a learning tool as well as applying it to daily drawing production.

    Thanks, Roy.

    Clint Hill

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!