Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am currently trying to make an automatic revision table, when you use the rule, it will update the letter in the revision block as well as on the sheet. But So far i am running against some problems with the revision table:
- And it is not updating the iProperty's Revision Number
Sub Main()
Dim Odoc As Document = ThisDoc.Document
Dim DrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Dim visibleRowsWanted As Integer = 3
For Each oSheet In DrawDoc.Sheets
If oSheet.RevisionTables.Count = 0 Then
Call AddRevTable(DrawDoc)
Else
Call AddRevRow(DrawDoc)
Call PurgeRev(DrawDoc, visibleRowsWanted)
End If
Next
InventorVb.DocumentUpdate()
End Sub
Sub AddRevTable(DrawDoc As DrawingDocument)
' Dim oDrawDoc As DrawingDocument
' oDrawDoc = ThisApplication.ActiveDocument
Dim oRTBs As RevisionTables
oRTBs = DrawDoc.ActiveSheet.RevisionTables
Dim oLocation As Point2d
oLocation = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)
'add a new table
Dim oRTB As RevisionTable
oRTB = oRTBs.Add2(oLocation, True, True, True, "A")
iProperties.Value("Project", "Revision Number") = "A"
End Sub
Sub AddRevRow(DrawDoc As DrawingDocument)
' Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
' Get the revision table
Dim oRevTable As RevisionTable = DrawDoc.ActiveSheet.RevisionTables.Item(1)
' Get last row
Dim oRow As RevisionTableRow
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)
' Make sure we have the active row
If oRow.IsActiveRow Then
' Go through all columns in that row
For i = 1 To oRevTable.RevisionTableColumns.Count
Dim oCell As RevisionTableCell = oRow.Item(i)
' Set all cells to static
oCell.Text = oCell.Text
' or static and blank'oCell.Text = ""
Next
End If
' Add another row at the end
Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows
oRows.Add()
End Sub
Sub PurgeRev(DrawDoc As DrawingDocument, visibleRowsWanted As Integer)
For Each sheet As Sheet In ThisDrawing.Document.Sheets
For Each revTable As RevisionTable In Sheet.RevisionTables
Trace.WriteLine(" --- " & revTable.Title)
Dim rows As RevisionTableRows = revTable.RevisionTableRows
Dim numberToHide As Integer = rows.Count - visibleRowsWanted
If (numberToHide <= 0) Then Continue For
For i = 1 To numberToHide
rows(i).Visible = False
Next
Next
Next
End Sub
So far I have this, how can i make sure it also updates the iProperties?
Solved! Go to Solution.