Jump to content

Date stamp


davidlowery

Recommended Posts

I would like to create a toolbar button that when clicked, it puts the current date in a large font in defpoints layer on my drawing. I looked up and found that if you enter this:

 

%%

 

in a dtext string, it displays the date and time, which would work, but I cannot figure out how to make this all work with a button using macros I guess.

Link to comment
Share on other sites

One way I have accomplished this is by inserting a block called DateStamp, or something, in defpoints.

 

The only way I know how to insert particular text is through attibutes (a Text or MText object will not accept input from a macro).

 

Insert block with an attribute and have the macro enter the string above upon insertion.

Link to comment
Share on other sites

YZ's method offers a way to allow you to format the output of the date, if you want it as a text object the best I can get you is a macro that calls a script, the script will allow the text "%%" to be entered and the macro can be used with a button to call the script.

This is the macro (you can place this into your button or toolpalette)

^C^C^Cscript;"C:/Scripts/Here/date.scr";

and this is the script (change the location to match where you saved the file, a script file has to have the extension "*.scr")

-text
10,10
0
%<\AcVar Date \f "%#c">%

the script has to be finished with a line return, this places the current date and time at location 10,10 so alter that to suit your needs, I did try adding in the ability to then move the text to a point you can choose, but unfortunately that corrupts the text, if it is in the same macro.

Link to comment
Share on other sites

  • 3 weeks later...

Nice work steven-g, I have never been able to enter text from a macro, it usually just stops midway at the point of entering the actual text value. Putting in to a script is a great idea I had not considered. Much simpler than my way of creating blocks to then edit!

Link to comment
Share on other sites

In the OP's case, since it is on a layer not used by anything else Object-wise (I would recommend NOT using Defpoints, but to create a new No-Plot Layer), wouldn't Freeze/Thaw that layer with a button Macro work better with the Text already in the drawing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...