Is it possible to insert current time just like <SW-SHORT DATE> ?

Dec 14, 2006 9 Replies

I have a note on my drawing that displays the current date a drawing was printed , but I would also like the current time it was printed. Is this possible with a default note, or will it involve inserting the time using a macro?



I have a note on my drawing that displays the current date a drawing was printed , but I would also like the current time it was printed. Is this possible with a default note, or will it involve inserting the time using a macro?

"SW Monkey" a écrit dans le message de news: snipped-for-privacy@73g2000cwn.googlegroups.com...

I use the "footnote" (?) function in the print menu, and print date, time and file name of the printed doc.

SW Monkey,

Do you want a static date and time that represents the last time the document was printed on the electronic document itself or do you want the time the document was printed to only show on the paper print.

Regards, Corey

Jean Marc wrote:

de

We create PDFs of our drawings. What I would like is a note that displays the current date/time that the PDF was created. We use the SolidWorks "Save As PDF" option. I can get the current date on the drawing by putting , but how can I do the current time ?

SW Monkey, I have the following in the border of the drawing: $PRP:"SW-Folder Name"$PRP:"SW-File Name" $PRP:"SW-Last Saved Date" $PRP:"SW-Last Saved By"

It looks like this: S:\acaddwg\MANUALS\DWG\TBEI1520manual Wednesday, December 20, 2006

1:34:30 PM bputnam

I think this shows the last time it was saved, not when it was printed. For us, this is close enough.

Brian

SW M>

Well, that could be used to fake the Print Date, by making a macro that saves the drawing, rebuilds it (to update the linked note) and then prints it. Kinda around-about, but I think it would do what you are asking.

Matt

Brian Putnam wrote:

Monkey,

Ok, I come up with the code to add Time stamp to your drawings, with some help from my VAR and from SW API Help. To make this work, add an annotation text with a link to the custom property "Print Time" ($PRP:"Print Time"). Once this note is on your template, simply run this macro (assign it to a toolbar icon or shortcut key). When you run this macro, it will update the time/date stamp on your drawing, then print it to the default printer. [If you wish to make sure you use the same printer each time, you will need to modify the Print instruction (PrintOut2) to callout the specific printer.]

Option Explicit

Public swApp As Object Dim retval As Boolean Dim bret As Boolean Dim Doc As Object

Sub main()

Dim swApp As Object Set swApp = CreateObject("SldWorks.Application") Set Doc = swApp.ActiveDoc

retval = Doc.DeleteCustomInfo("Print Time") retval = Doc.AddCustomInfo("Print Time", "Text", Now)

retval = Doc.ForceRebuild3(False)

bret = Doc.PrintOut2(0, 0, 1, False, 0, 0, False, 0)

End Sub

-------------------

SW M> I have a note on my drawing that displays the current date a drawing

UPDATE: I've uploaded this code (with each function explained) to my site at:

formatting link
Monkey,

"fcsuper" a écrit dans le message de news: snipped-for-privacy@79g2000cws.googlegroups.com...

Thanks for the code, but I still think it is simpler to use the Header / Footer button in the print dialog box. (previous post)

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required