Welcome to the forum, A tip you can copy the rule directly from the ilogic editor and paste in the post text area, it will then turn up as text that is easy to read and other user can help out without rewriting the rule. An image can be hard to read as well
There is samples and other information other than the forum located beside your user name in the ribbon beside the ? symbol and under help and Programming API help under search "revision row" Then "RevisionTable Object" Then scroll To the bottom And click "Query revision table"
For the indexing do you want to use -,0,1,2,3,4.?
This would go against the normal indexing which would start at 0 and 1 and user would not be able to replicate this manually. As it will jump from - to 1 as 0 is not the start point. In the rule below the the built in indexing is used for the revision number so it will go from 0,1,2,3,4. If you need a custom rev number you will need to build all this in as value for cell1.
The below rule might be more than you need here as it has additional functionality. So modify as necessary.
Functions are:
- Adds a table if there is none on the drawing and adds it to a given style change called "TEST" as needed.
- To modify the existing rev row with option to add row with options for contents.
- Move revision table to above the title block and moves it each time you add a row.
- Date has special format as our computer system is American date system (month day year) and we are using day month year in our revision box. Change as needed see windows VB.net help
'Change Revision Table Style
'https://forums.autodesk.com/t5/inventor-customization/ilogic-rule-to-switch-revision-table-sizes-defined-in-styles/td-p/3209372
'https://forums.autodesk.com/t5/inventor-customization/creating-sheet-scope-revision-table-using-ilogic/td-p/6282070
Sub Main
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oTablePt As Point2d = oTG.CreatePoint2d(0, 0)'loosely position Table
Dim oRevStyle As RevisionTableStyle
Dim oRevTable As RevisionTable
oRevStyle = oDrawDoc.StylesManager.RevisionTableStyles.Item("TEST")'You can enter in a revision style by name sample "Rev Table 1"
If oSheet.RevisionTables.Count = 1 Then
Call Positiontable(oTablePt,oSheet)
oRevTable = oSheet.RevisionTables.Item(1)
'Change RevTable Style
oRevTable.Style = oRevStyle
Dim oRow As RevisionTableRow
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)
'Enter 1st row Contents
booleanParam = InputRadioBox("Pick One", "Continue Editing Current REV", "Add REV",True, Title := "Revision Box Options")
If booleanParam = True
Call RevisionTableContents(oRow)
ElseIf booleanParam = False
Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows
'add new empty row
oRows.Add()
Call Positiontable(oTablePt,oSheet)
'Get current Row by counting
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)
'Add new row contents
Call RevisionTableContents(oRow)
End If
ElseIf oSheet.RevisionTables.Count = 0 Then
Dim oRTBs As RevisionTables
oRTBs = oSheet.RevisionTables
'add a new revision table instructions
'RevisionTables.Add2( PlacementPoint As Point2d, [IsSheetScope] As Boolean,
'[AutoIndex] As Boolean, [AlphaIndex] As Boolean, [StartValue] As String,
'[RevisionTableStyle] As Variant, [Layer] As Variant ) As RevisionTable
Dim oRTB As RevisionTable
oRTB = oRTBs.Add2(oTablePt,False, True, False, "0" )'oLocation
'Position Table after initial insert
Call Positiontable(oTablePt, oSheet)
oRevTable = oSheet.RevisionTables.Item(1)
'Change RevTable Style
oRevTable.Style = oRevStyle
Dim oRow As RevisionTableRow
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)
If oRow.IsActiveRow Then
'Enter 1st row Contents
Call RevisionTableContents(oRow)
'ensure rev block is set to write to iProperty, This can be modified in two places in the editor and in the template when placing
oRTB.UpdatePropertyToRevisionNumber = True
End If
End If
Call Positiontable(oTablePt,oSheet)
End Sub
Sub RevisionTableContents(oRow)
'[Revision COL 2 Date
Dim oCell2 As RevisionTableCell = oRow.Item(2)
'Set it equal to the the current date, date format change from Computer default
oCell2.Text= DateTime.Now.ToString("dd-MM-yyyy")
'dt.ToString("dd/MMMM yyyy, dddd")
'[Revision COL 3 Description
Dim MyArrayList3 As New ArrayList
MyArrayList3.Add("FOR CUSTOMER REVIEW")
MyArrayList3.Add("FOR CUSTOMER APPROVAL")
MyArrayList3.Add("INITIAL RELEASE")
MyArrayList3.Add("ENTER CUSTOM COMMENT")
oArray3 = InputListBox("Select one:", MyArrayList3, "", "iLogic", "REV Description")
If oArray3 = "" Then
ElseIf oArray3 = "ENTER CUSTOM COMMENT" Then
oInput3 = UCase(InputBox("What did you change?", "REV", "UPDATED REVISION...."))
If oInput3 = "" Then
Else
Dim oCell3 As RevisionTableCell = oRow.Item(3)
oCell3.Text = oInput3
End If
Else
Dim oCell3 As RevisionTableCell = oRow.Item(3)
oCell3.Text = oArray3
End If
']
'[Revision COL 4 Approved
Dim MyArrayList4 As New ArrayList
MyArrayList4.Add("AAA")
MyArrayList4.Add("BBB")
MyArrayList4.Add("CCC")
MyArrayList4.Add("DDD")
oArray4 = InputListBox("Select one:", MyArrayList4, "", "iLogic", "Drawn By")
If oArray4 = "" Then
Else
Dim oCell4 As RevisionTableCell = oRow.Item(4)
oCell4.Text = oArray4
End If
']
'[Revision COL 5 Zone
Dim MyArrayList5 As New ArrayList
MyArrayList5.Add("ZONE1")
MyArrayList5.Add("ZONE2")
MyArrayList5.Add("ZONE3")
MyArrayList5.Add("ZONE4")
oArray5 = InputListBox("Select one:", MyArrayList5, "", "iLogic", "Checked By ")
If oArray5 = "" Then
Else
Dim oCell5 As RevisionTableCell = oRow.Item(5)
oCell5.Text = oArray5
End If
End Sub
']
Private Sub Positiontable( oTablePt As Point2d,oSheet As Sheet)
Dim oRevTableItem As RevisionTable
oRevTableItem = oSheet.RevisionTables.Item(1)
Dim oWidthRevTable As Double
oWidthRevTable = oRevTableItem.RangeBox.MaxPoint.X - oRevTableItem.RangeBox.MinPoint.X
Dim oHeightRevTable As Double
oHeightRevTable = oRevTableItem.RangeBox.MaxPoint.Y - oRevTableItem.RangeBox.MinPoint.Y
oTablePt = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Border.RangeBox.MaxPoint.X - oWidthRevTable, oSheet.TitleBlock.RangeBox.MaxPoint.Y + oHeightRevTable)
oRevTableItem.Position = oTablePt
End Sub
']
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan