iLogic Revision Table

iLogic Revision Table

cody_evjen
Enthusiast Enthusiast
4,359 Views
5 Replies
Message 1 of 6

iLogic Revision Table

cody_evjen
Enthusiast
Enthusiast

I have this code that generates a new revision table. However it generates the Revision Index as Numeric, we require the Revision Index as Alpha.

Does anyone out there know a snippet of code that will change the default to "Alpha" Revision Index?

 

SyntaxEditor Code Snippet

 
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
 
    Dim oRTBs As RevisionTables
    oRTBs = oDrawDoc.ActiveSheet.RevisionTables
 
    Dim oLocation As Point2d
    oLocation = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)
 
    'add a new table
    Dim oRTB As RevisionTable
    oRTB = oRTBs.Add(oLocation)
    
Accepted solutions (1)
4,360 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Try definig the table with the Add2 Method. See the format below from the documentation.

I beleive the part of code your looking for is [AlphaIndex As Boolean = False] should be set to True.

 

Function Add2(PlacementPoint As Point2d, [IsSheetScope As Boolean = False], [AutoIndex As Boolean = True], [AlphaIndex As Boolean = False], [StartValue As String], [RevisionTableStyle], [Layer]) As RevisionTable
    Member of Inventor.RevisionTables
    Creates a new RevisionTable object on the sheet

 

 

Message 3 of 6

Anonymous
Not applicable
Accepted solution

Try this macro out.

 

Option Explicit
Sub CreateRevTable()
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
 
    Dim oRTBs As RevisionTables
    Set oRTBs = oDrawDoc.ActiveSheet.RevisionTables
 
    Dim oLocation As Point2d
    Set oLocation = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)
 
    'add a new table
    Dim oRTB As RevisionTable
    Set oRTB = oRTBs.Add2(oLocation, True, True, True, "A")
End Sub

 

Message 4 of 6

cody_evjen
Enthusiast
Enthusiast

Thanks Ken!

This worked perfect once I removed the "Set" from each line as iLogic wasnt accepting it.

Very appreciated. 

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hello,

 

This macro works for me fine, but now I want to add a revision, so it becomes "B". And now the problem is that it doesn't update in the iProperties.

 

Anyone know how to fix this?

 

Best Regards,

 

Bram

0 Likes
Message 6 of 6

cody_evjen
Enthusiast
Enthusiast

so this is the code i use to add a row.

 

SyntaxEditor Code Snippet

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
' Get the revision table
Dim oRevTable As RevisionTable = oDrawDoc.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()

We also use a form and in the form i have a spot to update the revision property. For example if we are redrawing a autocad file and we wand to start on rev D instead of A we would go and enter it in the form. For the iprops in the form you have to click "apply" or "ok" the you can hit the global update button (lighting bolt) and save. This works for us unless its an iprop run thru a parameter in which case then you need to run a rule that sets the iprop value to the corresponding parameter. I have a simple piece of ilogic code that sets all parameters for the iprops related to the drawing, globally updates the file, and saves the file. Anytime we change something in the form the process to click the apply button and run said ilogic by clicking a button I entitled Update All iprops.

Hopes this helps. If not respond back and I will try to assist further, what you are trying to do is completely possible and we used it everyday without issue.

 

 

0 Likes