Howdy, Stranger!

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

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

  • edited July 3

    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.

  • edited July 4
    (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,

  • edited July 4

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

    https://xkcd.com/1179/

  • edited July 7

    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.

  • edited July 7

    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.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam