davidlowery Posted October 27, 2014 Share Posted October 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
YZ Posted November 3, 2014 Share Posted November 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
steven-g Posted November 3, 2014 Share Posted November 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
YZ Posted November 19, 2014 Share Posted November 19, 2014 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! Quote Link to comment Share on other sites More sharing options...
SLW210 Posted November 19, 2014 Share Posted November 19, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.