Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
alexanderboogaard
221 Views, 1 Reply

Update layout revision table from changed styles

Hi,

 

Couldn't find a code to update styles and refresh the Revision table using iLogic. Searched the forums and came up with the following:

    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

	'update styles 
	Dim oCDs As ControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
	Dim oUpdateStyles As ControlDefinition = oCDs.Item("UpdateStylesCmd")
	oUpdateStyles.Execute2(False)
	AppActivate(ThisApplication.Caption)
	System.Windows.Forms.SendKeys.SendWait("Y ")
 
    Dim oRTBs As RevisionTables
    oRTBs = oDrawDoc.ActiveSheet.RevisionTables
	
	Dim oLocation As Point2d 

	'delete current table
	If iProperties.Value("Project", "Revision Number") > 0 Then
	oLocation = oRTBs.Item(1).Position
	ActiveSheet.Sheet.RevisionTables.Item(1).Delete
	Else
	oLocation = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)
	End If

	'add updated table
    Dim oRTB As RevisionTable
    oRTB = oRTBs.Add(oLocation)
	
'	Codes used for inspiration:
'	Update Styles: From WCrihfield (https://forums.autodesk.com/t5/Inventor-ilogic-And-vb-Net-forum/ilogic-code-To-update-styles-And-materials-To-Autodesk/m-p/12097339/highlight/true#M155179)
'	Remove table: From Ktomberlin (https://forums.autodesk.com/t5/Inventor-ilogic-And-vb-Net-forum/delete-revision-table/m-p/3911995/highlight/true#M43747)
'	Add table: From  cody.evjen (https://forums.autodesk.com/t5/Inventor-ilogic-And-vb-Net-forum/ilogic-revision-table/m-p/5591728/highlight/true#M55303)

 Just to share back to you all.


Kind regards,
Alexander Boogaard