Inventor General Discussion

Reply
Mentor
CAD-One
Posts: 760
Registered: ‎10-26-2008
Message 1 of 13 (1,240 Views)

print date and time

1240 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
msklein
Posts: 1,454
Registered: ‎12-12-2003
Message 2 of 13 (1,240 Views)

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
msklein
Posts: 1,454
Registered: ‎12-12-2003
Message 3 of 13 (1,240 Views)

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*
karthur1
Posts: 4,257
Registered: ‎04-27-2005
Message 4 of 13 (1,241 Views)

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
CAD-One
Posts: 760
Registered: ‎10-26-2008
Message 5 of 13 (1,241 Views)

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
CAD-One
Posts: 760
Registered: ‎10-26-2008
Message 6 of 13 (1,241 Views)

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*
karthur1
Posts: 4,257
Registered: ‎04-27-2005
Message 7 of 13 (1,241 Views)

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
CAD-One
Posts: 760
Registered: ‎10-26-2008
Message 8 of 13 (1,241 Views)

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*
JDMather
Posts: 27,438
Registered: ‎04-20-2006
Message 9 of 13 (1,241 Views)

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 2014 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*
-niels-
Posts: 1,575
Registered: ‎06-20-2006
Message 10 of 13 (1,241 Views)

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 IV2014 Pro SP2 - upd.1, Win7-64bit
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.