Time stamp on Plots
Time stamp on Plots
(OP)
Hello,
Is there a way to print a time stamp on all drawings? We've got a date stamp by putting an annotation in our drawing template sheet formats and inserting the SW-Date Document property. The problem is there is not a similar property for the time.
Is there a way to extract the time with the API or something like that?
Is there a way to print a time stamp on all drawings? We've got a date stamp by putting an annotation in our drawing template sheet formats and inserting the SW-Date Document property. The problem is there is not a similar property for the time.
Is there a way to extract the time with the API or something like that?
Craig Sink
Mechanical Engineer
Force Design, Inc.
www.forcedesign.biz






RE: Time stamp on Plots
RE: Time stamp on Plots
Set swApp = CreateObject("SldWorks.Application")
Set DrawingDoc = swApp.ActiveDoc
MyString = Str(Time)
retval = DrawingDoc.DeleteCustomInfo("Time")
retval = DrawingDoc.AddCustomInfo("Time", "Text", Str(Time))
DrawingDoc.EditRebuild
This will update the property to your system time.
SolidWorks 2006 - SP3.0
UG NX3
Pro/Engineer Wildfire 2.0
RE: Time stamp on Plots
Inside the print dialog, you will see document options header/footer. Inside the footer, you can add a time field. If you want to get this text to line up with a box in the title block, it may take a little futzing but you can probably do it.
-Shaggy
RE: Time stamp on Plots
Jason
UG NX2.02.2 on Win2000 SP3
SolidWorks 2006 SP5.0 on WinXP SP2
SolidWorks 2007 SP2.0 on WinXP SP2
RE: Time stamp on Plots
Craig Sink
Mechanical Engineer
Force Design, Inc.
www.forcedesign.biz
RE: Time stamp on Plots
We tried that header footer for awhile. When we changed format the text got large for some reason, so we quit. Now we put $PRP:"SW-Short Date" in the lower left corner. Great control and the font size never changes.
Bradley
SolidWorks 2007 SP2.0
RE: Time stamp on Plots
I found it on the web, but can't find the source anymore... my guess is Oklahoma SolidWorks User Group but their links are dead.
www.paul-flores.com/macros/stamp.zip
SW07 SP2.0
Flores
RE: Time stamp on Plots
I just made a macro for this last month here:
http:/
Enjoy
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php
RE: Time stamp on Plots
Is there any way to call this macro when I print? Probably using the API which I'm not very adept at. Or maybe there's another approach?
Craig Sink
Mechanical Engineer
Force Design, Inc.
www.forcedesign.biz
RE: Time stamp on Plots
CODE
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
' Error handler for no document loaded
If Doc Is Nothing Then MsgBox "No drawing loaded!", vbCritical: End
' Error handler for document not being a drawing
If Doc.GetType = 3 Then
' Assign the current time and date to custom property
retval = Doc.DeleteCustomInfo("Print Time")
retval = Doc.AddCustomInfo("Print Time", "Text", Now)
' Refresh drawing display to show updated time and date
retval = Doc.ForceRebuild3(False)
End If
' Print
bret = Doc.PrintOut2(0, 0, 1, False, 0, 0, False, 0)
End Sub
RE: Time stamp on Plots
I was just thinking that you may also wish to add a line to the end that clears the value after printing so if someone does print via another method, it will appear blank on the drawing rather than providing a previously used date. Maybe just add "retval = Doc.DeleteCustomInfo("Print Time")" to the end after the bret line. Handleman, is there a cleaner way do to this?
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php