Inventor General Discussion

Inventor General Discussion

Reply
Mentor
765 Posts
99 Kudos
Registered: ‎10-26-2008
Post 1 of 13

print date and time

1302 Views, 12 Replies
04-06-2009 11:11 AM
Hi,

In the drawing title block I would like to place a text reading the print, date and time. This should reflect the current system date and time. I would have this done on the template file so that all new drawings will have this feature builtin.



Is there a property that i can have the text to link to?

Is there any third party program for this?



Thanks in advance

C1
C1
Inventor Professional 2015
Vault Professional 2015
Distinguished Contributor
1,462 Posts
5 Kudos
Registered: ‎12-12-2003
Post 2 of 13

Re: print date and time

04-06-2009 11:26 AM in reply to: CAD-One
sketched symbols then text, under properties pick which properly you want then pick type use file name and path.

msk
Distinguished Contributor
1,462 Posts
5 Kudos
Registered: ‎12-12-2003
Post 3 of 13

Re: print date and time

04-06-2009 11:26 AM in reply to: CAD-One
sketched symbols then text, under properties pick which properly you want then pick type use file name and path.

msk
*Expert Elite*
4,360 Posts
508 Kudos
Registered: ‎04-27-2005
Post 4 of 13

Re: print date and time

04-06-2009 11:58 AM in reply to: CAD-One


As close as I can get you to what you want is by putting the SAVED time and date on the idw.



Copy and paste the code below into your idw template. When you save your idw, this macro will write the "SysDate" and "SysTime" to a custom property in the idw. You can use a text box to put these parameters on your drawing.



Attached here is a shot of my title block where I write them onto the drawing.





Public Sub AutoSave()



Call AddSysDateTime



End Sub

Public Sub AddSysDateTime()



On Error Resume Next



'Check if the active document is a Drawing

If ThisApplication.ActiveDocumentType = kDrawingDocumentObject Then



'Add a custom property "SysDate" with system date

Set oPropSet = ThisApplication.ActiveDocument.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

'As a workaround the property must be delete because it can not be changed

oPropSet.Item("SysDate").Delete

Call oPropSet.Add(Format(Date, "mmm-d-yy"), "SysDate")



'Add a custom property "SysTime" with system time

Set oPropSet = ThisApplication.ActiveDocument.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

'As a workaround the property must be delete because it can not be changed

oPropSet.Item("SysTime").Delete

Call oPropSet.Add(Format(Time, "h:mmam/pm"), "SysTime")



'Still having some problems that the last property does not update correct

Call RefreshProperties



End If



End Sub

Private Sub RefreshProperties()



Set oPropSet = ThisApplication.ActiveDocument.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

Call oPropSet.Add("", "MyDummy")

oPropSet.Item("MyDummy").Delete



End Sub








Mentor
765 Posts
99 Kudos
Registered: ‎10-26-2008
Post 5 of 13

Re: print date and time

04-06-2009 12:13 PM in reply to: CAD-One
I see that there is no time stamp available directly through any property. I wish they did.
C1
Inventor Professional 2015
Vault Professional 2015
Mentor
765 Posts
99 Kudos
Registered: ‎10-26-2008
Post 6 of 13

Re: print date and time

04-06-2009 12:14 PM in reply to: CAD-One
Karthur,

Thanks for your valuble macro. Is there a specofic name that I should save this macro as?

Thanks

C1
C1
Inventor Professional 2015
Vault Professional 2015
*Expert Elite*
4,360 Posts
508 Kudos
Registered: ‎04-27-2005
Post 7 of 13

Re: print date and time

04-06-2009 12:37 PM in reply to: CAD-One
In the VB Editor, you will see a "Autodesk Inventor 2009 Objects" folder. Under that folder is a "This document". Right-click on this and chose "View Code". Paste the macro here, exit the editor and save the idw.



Now edit the title block, you will have SysDate and SysTime under the Custom Properties - Drawing type.
Mentor
765 Posts
99 Kudos
Registered: ‎10-26-2008
Post 8 of 13

Re: print date and time

04-06-2009 03:30 PM in reply to: CAD-One
Thanks a ton.
C1
Inventor Professional 2015
Vault Professional 2015
*Expert Elite*
28,623 Posts
2,126 Kudos
Registered: ‎04-20-2006
Post 9 of 13

Re: print date and time

04-06-2009 04:12 PM in reply to: CAD-One
>I see that there is no time stamp available directly through any property

Actually there is a Create Date but not a Plot Date.
Please mark this response as "Accept as Solution" if it answers your question.
-----------------------------------------------------------------------------------------
Autodesk Inventor 2015 Certified Professional
Autodesk AutoCAD 2013 Certified Professional
Certified SolidWorks Professional
Inventor Professional 2015-SP1 64-bit
http://www.autodesk.com/edcommunity
http://home.pct.edu/~jmather/content/DSG322/inventor_surface_tutorials.htm
*Expert Elite*
1,636 Posts
430 Kudos
Registered: ‎06-20-2006
Post 10 of 13

Re: print date and time

04-15-2009 07:46 AM in reply to: CAD-One
Hello Karthur,



I've added your code to our templates and it works like a charm.

One question though:

Every time i start a new drawing from our templates now i get the following warning:

"Warning: You have a non-empty VBA project saved in your template file."

Is there a way to stop this message?



Also, if i only need the date and not the time, can i safely remove the "systime" block?



Regards,



Niels.

Using IV2015 Pro SP1 - upd.2, Win7-64bit
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!