Message 1 of 4
iLogic revision tables

Not applicable
11-15-2017
07:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this code that I am running to speed up the revision table process.
Most of it works the way it should.
I want to add a revision table to the drawing if there isn't one already. If there is one I want to delete it and insert a new one with two rows already filled out.
I can get the initial row to display the information I want it to, but when it comes to adding a row and changing that new rows information I get stuck.
I don't understand how you use the count function when calling up the second row, in the first instance of count rows there is only the one row so it is ok.
This code has been largely borrowed from these forums.
Anyone throw any light on this for me?
SyntaxEditor Code Snippet
Sub Main() 'check to see if this is a drawing type file, if it isn't sub routine closes. If ThisApplication.ActiveDocumentType <> kDrawingDocumentObject Exit Sub End If Dim oDoc as Document = ThisApplication.ActiveDocument Dim oUser As String: oUser=ThisApplication.GeneralOptions.UserName() Dim oRow As RevisionTableRow Dim oSheet As Sheet 'For Each osheet For Each osheet In odoc.sheets oSheet.Activate Dim oTablePt As Point2d oTablePt = ThisApplication.TransientGeometry.CreatePoint2d((oSheet.Width - 21.2), 58.4) Dim oRevTable As RevisionTable If oSheet.RevisionTables.Count = 1 Then For Each oRevTable In oSheet.RevisionTables oRevTable.Delete Next End If If oSheet.RevisionTables.Count = 0 Then oRevTable = oSheet.RevisionTables.Add(oTablePt) 'ADDS A POINT FOR THE REV TABLE TO ATTACH TO IF THERE IS NOT A REVISION TABLE IN THE DRAWING End If 'Dim oRevTable As RevisionTable = oDoc.ActiveSheet.RevisionTables.Item(1) 'oRevTable.RevisionTableRows.Add() oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count) ' Make sure we have the active row If oRow.IsActiveRow Then Dim oCell1 As RevisionTableCell = oRow.Item(1) 'Set it TO 0 oCell1.text= ("0") iProperties.Value("Project", "Revision Number") = oCell1.text Dim oCell2 As RevisionTableCell = oRow.Item(2) 'Set it ISSUED FOR APPROVAL oCell2.Text= ("ISSUED FOR APPROVAL") Dim oCell3 As RevisionTableCell = oRow.Item(3) 'Set it equal to the the current date oCell3.Text= ("13/11/2017") Dim oCell4 As RevisionTableCell = oRow.Item(4) 'Set it equal to the the current date oCell4.Text= iProperties.Value("Summary", "AUTHOR") Dim oCell5 As RevisionTableCell = oRow.Item(5) 'Set it equal to the the current date oCell5.Text= ("") End If Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows oRows.Add() Dim oRow1 As RevisionTableRow oRow1 = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count) If oRow1.IsActiveRow Then Dim oCell6 As RevisionTableCell = oRow1.Item(1) 'Set it TO 1 oCell6.text= (1) iProperties.Value("Project", "Revision Number") = oCell6.text Dim oCell7 As RevisionTableCell = oRow1.Item(2) 'Set it ISSUED FOR CONSTRUCTION oCell7.Text= ("ISSUED FOR CONSTRUCTION") Dim oCell8 As RevisionTableCell = oRow1.Item(3) 'Set it equal to the the current date oCell8.Text= DateTime.Now.ToString("d") Dim oCell9 As RevisionTableCell = oRow1.Item(4) 'Set it equal to the the current date oCell9.Text= iProperties.Value("Summary", "AUTHOR") Dim oCell10 As RevisionTableCell = oRow1.Item(5) 'Set it equal to the the current date oCell10.Text= ("") End If Next ActiveSheet = ThisDrawing.Sheet("Sheet:1") End Sub