Jump to content

Macro Or Script to Insert Date in Attributed Title Block Automatically (AutoCAD LT)


mwade93

Recommended Posts

So everything I try to do needs AutoLISP but right now I am trying to automate the process of filling in the title block to save time and me being annoyed. I have the -attedit code under control, but I cannot figure out if there is a way to overcome not having autolisp to insert today's date for a revision block. I can insert the code %% with a script but then the text is ### and not the actual date. Preferably it would be a macro, but if I still have to use a script file it is not a big deal. I don't want the date to update.

 

Thank You for your help.

 

Here is what I have so far for a script:

layer
t
REV1

-attedit
n
y
*
REV1_Date
*
c
0,0
3000,3000

XX/XX/XXXX
%<\AcVar Date \f "M/d/yyyy">% 

Edited by mwade93
Link to comment
Share on other sites

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • mwade93

    16

  • Tuns

    14

  • steven-g

    2

Top Posters In This Topic

^C^C-style;[color="blue"]technic;technic_.ttf[/color];;;;;[color="red"]3.5"[/color];-text;1',1';0;REVISED ON:($M=$(EDTIME,0,MON DD"," YYYY H:MM AM/PM));save;

This code can vary but it works on mine. Change what is highlighted in blue to the text style that you use. You may have to run through the -style command to know what to fill into those 2 spaces. Change what is in red to how tall you want the text to be. It inserts the text at the coordinates 1'x1' so you can move it wherever you need it to be afterwards. The date wont update each time you use this. The revdate command you have in yours will update the date every time it is used. If there's anything about this you want me to change or if you have difficulties tell me exactly what you need and I will change as needed. HOWEVER, if you have a default text size already then this will work better:

^C^C-text;1',1';0;REVISED ON:($M=$(EDTIME,0,MON DD"," YYYY H:MM AM/PM));save;

Also, WELCOME TO CADTUTOR! :D

Link to comment
Share on other sites

That works fine, but I need it to change the default attribute value in the title block to the current date. We have a title block with attributes to fill out, I use QP but it would be much quicker to click a button, edit the value of the attribute and be on with my day.

Link to comment
Share on other sites

Oh. Hmm... Put the drawing here I'll take care of it.

 

Thank You, I am only posting the rev block part of the DWG, it is part of the title block. I did not want to put the rest of it on here because they can be really picky about stuff like that here. But, this is exactly the way it will sit on the title block.

Edited by mwade93
Link to comment
Share on other sites

The tags are REV(1-12)_DATE. Their default values are XX/XX/XXXX. I have no problems selecting them ever. My problem was occuring with what was entered inside.

 

There needs to be an extra return key after the 3000,3000 for the upper right corner of crossing window.

Link to comment
Share on other sites

^C^C-attedit;y;;REV1_Date;;0,3000;3000,0;;v;r;($M=$(EDTIME,0,M/DD/YYYY));;save;

There ya go. It should work. the only disadvantage I see is you have multiple revision dates. You would have to change the "REV1_Date" to "REV2_Date" if you have a second revision, so on and so forth. If it doesn't work or you want something else added to it feel free to ask.

Link to comment
Share on other sites

^C^C-attedit;y;;REV1_Date;;0,3000;3000,0;;v;r;($M=$(EDTIME,0,M/DD/YYYY));;save;

There ya go. It should work. the only disadvantage I see is you have multiple revision dates. You would have to change the "REV1_Date" to "REV2_Date" if you have a second revision, so on and so forth. If it doesn't work or you want something else added to it feel free to ask.

 

Thank you so much, you just saved me so much annoying work!

Link to comment
Share on other sites

Oh sorry about that.

^C^C-attedit;y;;REV1_Date;;0,3000;3000,0;;v;r;$M=$(EDTIME,0,M/DD/YYYY);;save;

One thing to note: It doesn't check for the original value so be careful if you don't want it to update. It just finds the selected attribute and replaces it with a new one. I made it like that because changing the string was being a pain in the rear for some reason.

Link to comment
Share on other sites

Oh sorry about that.
^C^C-attedit;y;;REV1_Date;;0,3000;3000,0;;v;r;$M=$(EDTIME,0,M/DD/YYYY);;save;

One thing to note: It doesn't check for the original value so be careful if you don't want it to update. It just finds the selected attribute and replaces it with a new one. I made it like that because changing the string was being a pain in the rear for some reason.

 

I think it is better that way. The only thing I had to change was that you had an extra parenthesis on both ends of the diesel there so it gave the date inside. But again thank you. I am actually on an internship so I will look fantasic too!

Link to comment
Share on other sites

Yeah there's not too many of them around because most have the full version and prefer lisp over macro's. Get 10 posts and add me as a friend so we can keep in touch.

Link to comment
Share on other sites

Yeah there's not too many of them around because most have the full version and prefer lisp over macro's. Get 10 posts and add me as a friend so we can keep in touch.

 

Just because I had a few minutes of down time, here is a picture of what I made out of your code. I made a pull down and a toolbar based on it.

 

[ATTACH=CONFIG]43387[/ATTACH]

Link to comment
Share on other sites

I was going to recommend doing that but most people would say "that's too much work give me one that does it all" or something lazy like that so I left you to do what you wanted.

Link to comment
Share on other sites

I was going to recommend doing that but most people would say "that's too much work give me one that does it all" or something lazy like that so I left you to do what you wanted.

 

Putting it in the actual menu was the easy part, it is just time consuming. I could not figure out how to get that part of the code to work. No joke, I had been trying to figure that out for about 2-3 weeks.

Link to comment
Share on other sites

Yeah the code you had was really awkward. I went through it step by step and it didn't work when I told it to edit multiple attributes at once, but when I told it to edit only one at a time it worked. That was probably the first problem you had there, plus that code you had for the date... I've never seen that before so I looked it up and there's a whole lot more to it than that one part... so a diesel function is the obvious choice.

Link to comment
Share on other sites

I actually am not real good with diesel, that was the one part of the customizing class I took that did not quite sink in.

Link to comment
Share on other sites

I'm self taught. Read about it a few times and it wasn't too difficult to learn. They actually have a class for customizing AutoCAD?

Link to comment
Share on other sites

Yeah I took in at my college. There are not a lot of them available I know. It is something I do need to read more about so I can figure it out.

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...