Here is an example iLogic rule that will create a new custom table that has 5 columns and 6 rows, and places it onto your 'active' drawing, and fills it in with generic data.
You can study this example to help you build your own custom table the way you want it.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing Document must be active for this rule to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oTitle As String = "CUSTOM TABLE TITLE"
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oPPoint As Point2d = oTG.CreatePoint2d(0, 0)
Dim oCols As Integer = 5
Dim oRows As Integer = 6
'Number of column titles supplied must match number of columns specified
'Dim oColTitles() As String = {" ", "Dimension L1", "Dimension L2", "Material", "Cost" }
'or
Dim oColTitles(oCols - 1) As String
oColTitles(0) = " " '1st column title
oColTitles(1) = "Column 2 Title" '2nd column title
oColTitles(2) = "Column 3 Title" '3rd column title
oColTitles(3) = "Material" '4th column title
oColTitles(4) = "Cost" '5th column title
'Contents must be a 'single dimension' array of String.
'the number of entries supplied in Contents must match the number of cells in the table
Dim oCells As Integer = (oCols * oRows) -1 'minus the 1, because an array starts at zero, instead of 1
Dim oContents(oCells) As String
For oCell As Integer = 0 To oCells
oContents(oCell) = "Cell " & oCell
Next
'Dim oColWidths() As Double = {1.25, 2.5, 2.5, 1.5, 1.25 }
'or
'could run a function here to determine how wide each column needs to be, then set them individually
Dim oColWidths(oCols - 1) As Double
oColWidths(0) = 1.25 '1st column width
oColWidths(1) = 2.5
oColWidths(2) = 2.5
oColWidths(3) = 1.5
oColWidths(4) = 1.25 '5th column width
'Dim oRowHeights() As Double = {.25, .25, .25, .25, .25, .25 }
'or
'could run a function here to determine how tall each row needs to be, then set them individually
Dim oRowHeights(oRows - 1) As Double
For oRow As Integer = 0 To (oRows-1)
oRowHeights(oRow) = .25
Next
Dim oCTable As CustomTable = oSheet.CustomTables.Add(oTitle, oPPoint, oCols, oRows, oColTitles, oContents, oColWidths, oRowHeights)
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)