Lisp - save info as mtext and not as field

Lisp - save info as mtext and not as field

cool.stuff
Collaborator Collaborator
322 Views
3 Replies
Message 1 of 4

Lisp - save info as mtext and not as field

cool.stuff
Collaborator
Collaborator

Hi!

 

I've found this lisp online

 

(defun c:foo (/ p)
(and (setq p (getpoint "\nPick a point: "))
(setq p (entmakex (list '(0 . "TEXT")
'(100 . "AcDbEntity")
'(8 . "text")
'(100 . "AcDbtext")
(cons 10 p)
'(40 . 0.125) ; text height
'(1 . "%<\\AcVar Date \\f \"dd/MM/yyyy HH:mm:ss\">%")
)
)
)
(command "_updatefield" p "")
)
(princ)
)

 

And I have made changes to date and time format.

I dont know lisp programming, nad I would like it to write that date and time format to mtext and not as a field.

 

Can someone help?

 

Many thanks

0 Likes
Accepted solutions (1)
323 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

Try this not tested

 

 

(defun c:foo (/ p DATE TIME PDATE)
(and (setq p (getpoint "\nPick a point: "))
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/write-date-and-time-to-text-file/td-p/1689431
(setq DATE (menucmd "M=$(edtime,$(getvar,date),DDD MON DD YYYY)")
;diesel for date
           TIME (menucmd "M=$(edtime,$(getvar,date), HH:MM:SS AM/PM) ")
;diesel for time
            PDATE (strcat DATE TIME ) ;writes text string
)
(setq p (entmakex (list '(0 . "TEXT")
'(100 . "AcDbEntity")
'(8 . "text")
'(100 . "AcDbtext")
(cons 10 p)
'(40 . 0.125) ; text height
(cons 1 PDATE)
)
)
)
)
(princ)
)

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 4

cool.stuff
Collaborator
Collaborator
Works like a charm!!
Many thanks 🙂
0 Likes
Message 4 of 4

paullimapa
Mentor
Mentor

 glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes