using iLogic to read latest revision date

using iLogic to read latest revision date

Anonymous
Not applicable
3,022 Views
21 Replies
Message 1 of 22

using iLogic to read latest revision date

Anonymous
Not applicable

All-

 

I've been sifting through several iLogic posts on the rev table, and I found one close - about assigning a date ... but what I want to do is read the date.

 

We have a rule to generate a PDF with the following format:  "drawing number_rev letter_pg to pgs_rev date.pdf

 

as an example - a rev d file with 3 sheets would look like this.    0070721_D_1-3_031717.pdf

date is formatted mmddyy

 

I read the drawing number from the filename, the rev from iproperties, sheet count from drawing file, and rev I was using system date.

 

the issue - we had to go back and make pdfs for files that we quick-changed- and skipped revisions, skipped initial pdf creation.  I know, bad practice ..

 

anyway - we went back and made PDF - but illogic put today's date on instead which now doesn't match when the revision was actually completed - a week or so ago.

 

how can I read the revision table to pull the latest revision date ... and grab that date as my pdf file date.

 

I was going to use last modified file property - but that changes when you save the file - and we run the pdf rule on file close.

 

thanks -

0 Likes
Accepted solutions (1)
3,023 Views
21 Replies
Replies (21)
Message 2 of 22

Ktomberlin
Advocate
Advocate
Accepted solution

I think I understand the question, all you have to do is reverse the order instead of iproproperty  = variable, variable = iproproties or in this case revision table value.  Now depending on your revision table you'll need to adjust the line below

 

RevDate = oRow.Item(3).Text 

 

to a different number if the date you want to grab is in a different field (1), (2), (3). etc.  There is some extra stuff attached but you should get the idea.

 

Hope this helps.

  

Dim oDoc as Document = ThisApplication.ActiveDocument
Dim editDoc As Document
Dim oDrawDoc As DrawingDocument = oDoc
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
editDoc = oDrawDoc.ActiveSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
Dim invDesignInfo As PropertySet
invDesignInfo = editDoc.PropertySets.Item("Design Tracking Properties")
Dim invPartNumberProperty As Inventor.Property
invPartNumberProperty = invDesignInfo.Item("Part Number")
invSummaryInfo = oDoc.PropertySets.Item("Inventor Summary Information")
invRevNumberProperty = invsummaryInfo.Item("Revision Number")
Dim oPropSets As PropertySets 
oPropSets = oDoc.PropertySets 
Dim oPropSet As PropertySet 
oPropSet = oPropSets.Item("Design Tracking Properties")


Dim RevDate As Date 


Dim MyDwgRev As String
MyDwgRev = invRevNumberProperty.Value
If MyDwgRev > 0
    Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1)
    'total number of revision rows
    Dim N As Integer = oTable.RevisionTableRows.Count
    'the last row in the table
    Dim oRow As RevisionTableRow = oTable.RevisionTableRows.Item(N)
    RevDate = oRow.Item(3).Text 
    Else
    RevDate = oPropSets.Item("Design Tracking Properties").Item("Engr Date Approved").Value
End If
'
MessageBox.Show(RevDate, "Title")

 

Message 3 of 22

Owner2229
Advisor
Advisor

Little correction, cleaning and shortening here:

You can replace "oModel" with "oDoc" if you want to pull the iProperties from the drawing document instead of the model document.

 

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub Dim oModel As Document = oSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument Dim iDesign As PropertySet = oModel.PropertySets("Design Tracking Properties") Dim iSummary As PropertySet = oModel.PropertySets("Inventor Summary Information") Dim PartNumber As String = iDesign("Part Number").Value Dim RevNumber As String = iSummary("Revision Number").Value
Dim RevDate As Date If RevNumber <> vbNullString Then Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1) Dim oRows As RevisionTableRows = oTable.RevisionTableRows Dim oRow As RevisionTableRow = oRows.Item(oRows.Count) RevDate = oRow.Item("DATE").Text Else RevDate = iDesign.Item("Engr Date Approved").Value End If Dim NewFileName As String = PartNumber & "_" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate
MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName)

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 4 of 22

Anonymous
Not applicable

thanks for the replies - as soon as I get a chance (hopefully today yet) I'll try the solutions and close this out if it works....

 

I'll be in touch.

0 Likes
Message 5 of 22

Anonymous
Not applicable

Hello,

 

        i was using your ilogic code to print Rev and date, but only the problem is i am unable to print the creation date / Mfg. Approved Date. This works only if i had a revision table. Is there any way i can print if i am not using in rev. table. Please respond

0 Likes
Message 6 of 22

MechMachineMan
Advisor
Advisor

@Anonymous Yes....

 

 

Change the code...

 

Or fix your template so it isn't populating a revision number that shouldn't be there according to the code..............


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 7 of 22

Anonymous
Not applicable
Hello Actually i a good with revision number, when you see this lines in codes
Dim RevDate As Date
If RevNumber <> vbNullString Then
Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1)
Dim oRows As RevisionTableRows = oTable.RevisionTableRows
Dim oRow As RevisionTableRow = oRows.Item(oRows.Count)
RevDate = oRow.Item("DATE").Text
Else
RevDate = iDesign.Item("Engr Date Approved").Value
End If

I am able to print date from revision tables, what if I don’t have a revision table it has to print either a creation date or mfg date. After the line else the rev date is not calling to print output on message.
Could you please suggest what to add in that lines to print
0 Likes
Message 8 of 22

MechMachineMan
Advisor
Advisor

@Anonymous

 

Reading the code in the post I'm responding to, it says that if the REVISION NUMBER IPROPERTY is blank, it will use the Engineering date approved.

 

So... to make it mfg date approved or creation date, simply change the line that says to use the engineering date.

 

RevDate = iDesign.Item("Mfg Date Approved").Value

or

RevDate = iDesign.Item("Creation Date").Value


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 9 of 22

Anonymous
Not applicable

Hello,

 

 

       I did the same way by changing the code to creation date or mfg approved date, but it was not calling the date even after. i was thinking is there any way i can pull the date from iProperties Property creation date.  

0 Likes
Message 10 of 22

MechMachineMan
Advisor
Advisor

Looks like you can only get "creation time" and have to extract the date from it.

 

http://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html

https://forums.autodesk.com/t5/inventor-customization/get-date-value/td-p/2155783

 

 

date = Format(iDesign.Item("Creation Date").Value, "mm-DDD-yy")

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 11 of 22

Anonymous
Not applicable

Still Doesn't work

 

See What i got let me know if any thing is wrong

SyntaxEditor Code Snippet

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub

Dim iDesign As PropertySet = oDoc.PropertySets("Design Tracking Properties")
Dim iSummary As PropertySet = oDoc.PropertySets("Inventor Summary Information")
Dim PartNumber As String = iDesign("Part Number").Value
Dim RevNumber As String = iSummary("Revision Number").Value
Dim RevDate As Date
RevDate = iDesign.Item("Design Tracking Properties").Item("Creation Time").Value 
If RevNumber <> vbNullString Then
    Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1)
    Dim oRows As RevisionTableRows = oTable.RevisionTableRows
    Dim oRow As RevisionTableRow = oRows.Item(oRows.Count)
    RevDate = oRow.Item("DATE").Text
Else

RevDate =  Format(iDesign.Item("Creation Date").Value, "mm-DDD-yy") 

End If

Dim NewFileName As String = PartNumber & "_REV-" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate &"_" & todayDate

MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName)
0 Likes
Message 12 of 22

MechMachineMan
Advisor
Advisor

Give this a whirl and let me know what msgboxes pop up.

 

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oSheet As Sheet = oDoc.ActiveSheet If oSheet.DrawingViews.Count = 0 Then Exit Sub Dim iDesign As PropertySet = oDoc.PropertySets("Design Tracking Properties") Dim iSummary As PropertySet = oDoc.PropertySets("Inventor Summary Information") Dim PartNumber As String = iDesign("Part Number").Value Dim RevNumber As String = iSummary("Revision Number").Value
Dim RevDate As String
If RevNumber <> vbNullString Then Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1) Dim oRows As RevisionTableRows = oTable.RevisionTableRows Dim oRow As RevisionTableRow = oRows.Item(oRows.Count) RevDate = oRow.Item("DATE").Text
MsgBox("MSG#1a" & vblf & _
"RevDate pulled from Rev Table..... Rev Number iProp being non-blank caused this to happen" & vblf & _
"Result: " & RevDate) Else RevDate = Format(iDesign.Item("Creation Time").Value, "mm-DDD-yy")
MsgBox("MSG#1b" & vblf & "RevDate pulled from Creation Time!" & vblf & "Result: " & RevDate) End If Dim NewFileName As String = PartNumber & "_REV-" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate &"_" & todayDate MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName) 

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 13 of 22

Anonymous
Not applicable

Error on Line 21 : Argument not specified for parameter 'format' of 'Public Shared Function Format(enumType As System.Type, value As Object, format As String) As String'.

 

Highlited is the line 21 (Bold Letters)

 

 

SyntaxEditor Code Snippet

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub

Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub

Dim iDesign As PropertySet = oDoc.PropertySets("Design Tracking Properties")
Dim iSummary As PropertySet = oDoc.PropertySets("Inventor Summary Information")
Dim PartNumber As String = iDesign("Part Number").Value
Dim RevNumber As String = iSummary("Revision Number").Value

Dim RevDate As String

If RevNumber <> vbNullString Then
    Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1)
    Dim oRows As RevisionTableRows = oTable.RevisionTableRows
    Dim oRow As RevisionTableRow = oRows.Item(oRows.Count)
    RevDate = oRow.Item("DATE").Text
    MsgBox("MSG#1a" & vbLf & "RevDate pulled from Rev Table..... Rev Number iProp being non-blank caused this to happen")
Else
    RevDate =  Format(iDesign.Item("Creation Time").Value, "mm-DDD-yy") 
    MsgBox("MSG#1b" & vbLf & "RevDate pulled from Creation Time!" & vbLf & "Result: " & RevDate)
End If

Dim NewFileName As String = PartNumber & "_REV-" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate &"_" & todayDate

MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName) 

 

0 Likes
Message 14 of 22

MechMachineMan
Advisor
Advisor

forgot this is iLogic. lol.

 

Try this:

 

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub

Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub

Dim iDesign As PropertySet = oDoc.PropertySets("Design Tracking Properties")
Dim iSummary As PropertySet = oDoc.PropertySets("Inventor Summary Information")
Dim PartNumber As String = iDesign("Part Number").Value
Dim RevNumber As String = iSummary("Revision Number").Value

Dim RevDate As String

If RevNumber <> vbNullString Then
    Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1)
    Dim oRows As RevisionTableRows = oTable.RevisionTableRows
    Dim oRow As RevisionTableRow = oRows.Item(oRows.Count)
    RevDate = oRow.Item("DATE").Text
    MsgBox("MSG#1a" & vbLf & "RevDate pulled from Rev Table..... Rev Number iProp being non-blank caused this to happen")
Else
    RevDate =  iDesign.Item("Creation Time").Value.ToString("yyyymmdd") 
    MsgBox("MSG#1b" & vbLf & "RevDate pulled from Creation Time!" & vbLf & "Result: " & RevDate)
End If

Dim NewFileName As String = PartNumber & "_REV-" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate &"_" & todayDate

MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName) 

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 15 of 22

Anonymous
Not applicable

I was getting this message

 

 

Error in rule: New, in document: 152-001.idw

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

0 Likes
Message 16 of 22

MechMachineMan
Advisor
Advisor

Well, I just revised it so it uses the rev table if it finds one, or creation time if it doesn't.

 

You should modify the .ToString("") line to use whatever date format matches your standard.

 

You should modify the oRevTableDateColumn integer to match your revision table styles.

 

oRevTableDateColumn = 3

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub

Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub

Dim iDesign As PropertySet = oDoc.PropertySets("Design Tracking Properties")
Dim iSummary As PropertySet = oDoc.PropertySets("Inventor Summary Information")
Dim PartNumber As String = iDesign("Part Number").Value
Dim RevNumber As String = iSummary("Revision Number").Value

Dim RevDate As String
RevDate =  iDesign.Item("Creation Time").Value.ToString("yyyymmdd") 

If oSheet.RevisionTables.Count > 0 Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1) Dim oRows As RevisionTableRows = oTable.RevisionTableRows Dim oRow As RevisionTableRow = oRows.Item(oRows.Count) RevDate = oRow.Item(oRevTableDateColumn).Text
End if Dim NewFileName As String = PartNumber & "_REV-" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate &"_" & todayDate MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName)

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 17 of 22

Anonymous
Not applicable

 

Even though i matched my format styles i get the following error message

 

 

Conversion from string "yyyymmdd" to type 'Integer' is not valid.

0 Likes
Message 18 of 22

Owner2229
Advisor
Advisor

Hey, try this instead:

 

Dim RevDate As String
RevDate = DateTime.Parse(iDesign.Item("Creation Time").Expression).ToString("yyyy/MM/dd")

 

Or, to use the original format of the code:

 

Dim RevDate As Date
RevDate = DateTime.Parse(iDesign.Item("Creation Time").Expression)

MsgBox("CreationDate: " & RevDate.ToString("yyyy/MM/dd"))
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 19 of 22

Anonymous
Not applicable

Hello,

 

              Seems like this will work, i don't understand it pops up a message End of Statement Expected. Can you help me out 

0 Likes
Message 20 of 22

MechMachineMan
Advisor
Advisor

@Owner2229 and after 1.5 hrs of searching, I was almost convinced there was no easy way to convert the date. Smiley LOL Thanks for proving me wrong!

 

@Anonymous the below code should work for you. You should note that all it does is shows a message box with the date format, and doens't actually populate it anywhere.

 

 

oRevTableDateColumn = 3

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then MsgBox("Drawings only!"): Exit Sub

Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then MsgBox("No Views on Drawing... Aborting Rule!"): Exit Sub

Dim iDesign As PropertySet = oDoc.PropertySets("Design Tracking Properties")
Dim iSummary As PropertySet = oDoc.PropertySets("Inventor Summary Information")
Dim PartNumber As String = iDesign("Part Number").Value
Dim RevNumber As String = iSummary("Revision Number").Value

Dim RevDate As String
RevDate =  DateTime.Parse(iDesign.Item("Creation Time").Value).ToString("yyyyMMdd") 

If oSheet.RevisionTables.Count > 0 
    Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1)
    Dim oRows As RevisionTableRows = oTable.RevisionTableRows
    Dim oRow As RevisionTableRow = oRows.Item(oRows.Count)
    RevDate = oRow.Item(oRevTableDateColumn).Text
End If

Dim NewFileName As String = PartNumber & "_REV-" & RevNumber & "_1-" & oDoc.Sheets.Count & "_" & RevDate &"_" & todayDate

MsgBox("Revision Date: " & RevDate & vbLf & "New File Name: " & NewFileName) 

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes