Author Topic: Simple Current Date Mtext  (Read 1541 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Simple Current Date Mtext
« on: June 20, 2018, 04:48:48 PM »
 :knuppel2:

... Could I get some direction please? :idiot2:

Code: [Select]
(command "._mtext" "0,0" "0,1" "%<\AcVar SaveDate \f "MMMM d, yyyy">%")
thank you guys.
Civil3D 2020

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Simple Current Date Mtext
« Reply #1 on: June 20, 2018, 05:05:03 PM »
Maybe this? "%<\\AcVar Date \\f \"M/d/yyyy\">%"

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

kpblc

  • Bull Frog
  • Posts: 396
Re: Simple Current Date Mtext
« Reply #2 on: June 20, 2018, 05:09:07 PM »
Code - Auto/Visual Lisp: [Select]
  1. (defun test (/ adoc mt pt)
  2.   (if (and (= (type
  3.                 (setq pt (vl-catch-all-apply (function (lambda () (getpoint "\nSelect point to insert MTEXT <Cancel> : ")))))
  4.                 ) ;_ end of type
  5.               'list
  6.               ) ;_ end of =
  7.            pt
  8.            ) ;_ end of and
  9.            (setq mt (vla-addmtext (vla-get-modelspace adoc) (vlax-3d-point pt) 0. ""))
  10.            (vla-put-textstring mt "%<\\AcVar SaveDate \\f \"MMMM d, yyyy\">%")
  11.            (vla-regen adoc acactiveviewport)
  12.            (vla-endundomark adoc)
  13.            ) ;_ end of progn
  14.     ) ;_ end of if
  15.   (princ)
  16.   ) ;_ end of defun
  17.  
Sorry for my English.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Simple Current Date Mtext
« Reply #3 on: June 20, 2018, 05:16:11 PM »
Thank you guys, The "\\" was throwing me off.

Thanks for the clarification!
Civil3D 2020

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Simple Current Date Mtext
« Reply #4 on: June 20, 2018, 05:17:19 PM »
Here's a vanilla solution too:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ p)
  2.   (and (setq p (getpoint "\nPick a point: "))
  3.        (setq p (entmakex (list '(0 . "TEXT")
  4.                                '(100 . "AcDbEntity")
  5.                                '(8 . "text")
  6.                                '(100 . "AcDbText")
  7.                                (cons 10 p)
  8.                                '(40 . 0.125)
  9.                                '(1 . "%<\\AcVar Date \\f \"M/d/yyyy\">%")
  10.                          )
  11.                )
  12.        )
  13.        (command "_updatefield" p "")
  14.   )
  15.   (princ)
  16. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Simple Current Date Mtext
« Reply #5 on: June 20, 2018, 05:22:38 PM »
Dumb. question. with a simple one line command I like show. There is no way to adjust the "Tracking" Property from 1.0 to 1.5 is there?
Civil3D 2020

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Simple Current Date Mtext
« Reply #6 on: June 21, 2018, 07:47:23 AM »
Again thank you guys for the help...

Just wanted to share the Tracking Piece...

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/has-anyone-figured-out-how-to-accomplish-text-tracking-and/td-p/858427

Code: [Select]
"THIS LINE IS WITHOUT TRACKING.\\P{\\T0.75;AND THIS ISWITH }{\\T4.0;TRACKING}"
Civil3D 2020