iLogic + Drawing Date/Time Stamp Update Upon Saving or Printing Files

iLogic + Drawing Date/Time Stamp Update Upon Saving or Printing Files

Anonymous
Not applicable
5,628 Views
33 Replies
Message 1 of 34

iLogic + Drawing Date/Time Stamp Update Upon Saving or Printing Files

Anonymous
Not applicable
Hello,

I know currently there is 2 ways to have a save date/time stamp updated in the title blocks of drawings. 1 is from a dll file, which works on 32-bit systems. The other is a VB Macro thats embedded in the file itself or in a "common" script file system. I know the embedded VB Macro isn't the way to really go or at least that is what people have said in the past, I've yet to run into issues during test cases of 30+ files open with the script but im not sure.

Anyways so with that I've come to look for help, or assistance in getting possibly iLogic to do the work? Im not sure if its any different from running an embedded VB Macro or from a network file. As for the network file I'd need help trying to figure out how to excute the script by hitting save for instance, since the basic code does not work. I know it has some nice features and im exteremly basic to any programing currently (trying to work my way up). I wasn't sure what would be better but I know I'm hopping to dig deeper into iLogic in the near future.

As well as the Save Date/Time Stamp, is it possible to run a function to do something similar when doing a print, or even a save copy/save copy as? Trying to make sure that if someone prints something and weather its a few prints or just people trying to cover mistakes or "fixes" to drawings the easy way, there is a way to force document the change.

Any input or help on code would be appreciated.

Thanks in advance,
Dan
0 Likes
5,629 Views
33 Replies
Replies (33)
Message 2 of 34

Anonymous
Not applicable
This is the code im working with currently.

{code}
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, "m-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{code} Edited by: djteresinski on Sep 8, 2009 3:16 PM
0 Likes
Message 3 of 34

Anonymous
Not applicable
Actually NM on this, finally was able to figure out through lots of searching how to do it in a addon pack and finally got it to work with 64-bit.
0 Likes
Message 4 of 34

RogerCamp
Advocate
Advocate
Hello!

I've spent almost all day long trying to find a way to have a date property in my idws to be updated automatically whenever I save my drawings. The doesn't work. I've tried iProperty Collection either.
I'm using IV 2010 64bits, where did you find that addon pack? Can I download it?

Thanks

Roger
0 Likes
Message 5 of 34

MjDeck
Autodesk
Autodesk
You can do this with iLogic. (iLogic is an Inventor 2009 or 2010 add-in that is available to subscription customers).

You can create an external iLogic rule that will automatically run right before the document is saved. (It also works for Save As). This rule can update a custom iProperty that is linked to text in the drawing. I recommend using an external rule because it can be shared by many drawings and this saves memory. You can add this behavior to a drawing template and use it for new drawings.

This won't automatically update the timestamp on Print, but only on Save.

Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 6 of 34

ace_guru
Advocate
Advocate
Hey Guys,

Brilliant piece of programing up there!!

Just one question out of curiosity, how would you add the user name. I'm not after the author or designer details but the current user of the whichever PC that was plotted from(as in the person that's logged in)?


Thanks
0 Likes
Message 7 of 34

Cris_Davis
Enthusiast
Enthusiast

Can someone help me I am trying to run this rule.  I-logic is giving me this error as followed "Error in rule pramgram format:  All other Sub's or Function's must be after Sub Main() 

 

Thanks

Cris

 

0 Likes
Message 8 of 34

MjDeck
Autodesk
Autodesk

The code posted here is VBA code, not iLogic.  Can you use it in VBA?

 

Let me see if it can be converted easily to iLogic.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 9 of 34

Cris_Davis
Enthusiast
Enthusiast

If you could convert it to I-logic that would be awesome!

0 Likes
Message 10 of 34

Anonymous
Not applicable

@MjDeck wrote:
You can do this with iLogic. (iLogic is an Inventor 2009 or 2010 add-in that is available to subscription customers).


Our Subscription Coordinator never  bothered to download iLogic for Inventor 2010. We are not on Subscription anymore.

Is there any other way to get iLogic for 2010?

 

Mike

0 Likes
Message 11 of 34

MjDeck
Autodesk
Autodesk

I'm not sure... there might be a way to get it.  I will try to find out.

 

Are you thinking of upgrading to Inventor 2011?  iLogic is included as standard in 2011.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 12 of 34

Cris_Davis
Enthusiast
Enthusiast

Upgrade to 2011.  It comes with the package.

0 Likes
Message 13 of 34

Anonymous
Not applicable

I'm always thinking of upgrading. The trick, is getting upper management to spend $. Smiley Surprised

 

Thanks!

 

Mike

 

0 Likes
Message 14 of 34

MjDeck
Autodesk
Autodesk

Here's an iLogic rule to assign the current date to a custom property.  There's also a line to assign the current user, but you could take that out if you don't need it.

 

 Before adding the rule to a drawing, create a custom iProperty named "Date Saved" of type Date  (and optionally "Saved By" of type Text).  Then add this rule:

 

iProperties.Value("Custom", "Date Saved") = Now
iProperties.Value("Custom", "Saved By") = Environment.UserName
InventorVb.DocumentUpdate()

 

 To make the rule run when you save the document,  use iLogic Utilities -> Rules Triggered by Events (in Inventor 2010) or Event Triggers (in 2011).  Right-click on the Before Save Document event, and attach your rule to that event.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 15 of 34

Cris_Davis
Enthusiast
Enthusiast

Can you have it trigger when someone hits print?

0 Likes
Message 16 of 34

MjDeck
Autodesk
Autodesk

Sorry, it can't be triggered by the Print command.    We could possibly add this event to a future version of iLogic.

 

You can always run the rule manually before printing.  That saves you a bit of time, but it would be easy to forget to do it (so the date wouldn't always be right).


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 17 of 34

Anonymous
Not applicable

Amazing what all can be done with iLogic.

 

I did convert a old Addin that Brian helped Steve Krause write over to 64 bit, and added a few options for formating the date etc.

 

You can check it out here

0 Likes
Message 18 of 34

Anonymous
Not applicable

Mike,

Is there a list of ALL of the functions/snippets available in iLogic?

I keep finding stuff by stumbling on them more than finding references to them.

 

 

0 Likes
Message 19 of 34

MjDeck
Autodesk
Autodesk

The snippets are all listed in the rule editor dialog.  Documentation for the functions is in the help under:

Autodesk Inventor -> iLogic -> Functions -> Quick Reference

 

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 20 of 34

Anonymous
Not applicable

Thank you for the reference, however, already found that and it was not good enough.  What other references are available?

0 Likes