
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Everyone,
So, I am trying to add a copyright year to a title block in a drawing template file used through out my company. I want to base the year off of the creation date property - I am trying to find a way to truncate this property such that only the year is displayed. Ideally, any time the creation date property is changed, the copyright year will also update.
We are currently running Inventor 2010.
My thoughts:
Normally, I would just write an iLogic rule with an event trigger, but this would require everyone to install the iLogic addin which just won't happen.
Even easier, I could make a custom iProperty and just have people manually type in the year when they start a new drawing - this will be worst case scenario as a ton of people will forget and I'll just make more work for myself.
I also have VBA code which is pretty simple:
Public Sub SetYear()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Dim customPropSet, customPropSet2 As PropertySet
Set customPropSet2 = oDoc.PropertySets.Item("Design Tracking Properties")
Set customPropSet = oDoc.PropertySets.Item("Inventor User Defined Properties")
Dim customProp, creationDate As Property
Set customProp = customPropSet2.Item(1)
Set creationDate = customPropSet.Item("CreationYear")
Dim year, newYear, newerYear As String
year = customProp.Value
Dim count As Integer
count = InStr(year, " ")
newYear = Left(year, count - 1)
newerYear = Right(newYear, 4)
creationDate.Value = newerYear
oDoc.Update
End Sub
The issue would be getting this VBA code to trigger and to "stick" to the template file.
I can just as easily write this code in VB.NET or C#, and go through the hassle of creating an add-in, but again, how would I get it to trigger and stick to the template file.
With that being said, if any one can provide suggestions to my current thoughts or any alternatives, it would be greatly appreciated. Thank you!
Solved! Go to Solution.