Wednesday, November 16, 2022

iLogic Rule to Update Drawing Resources

 

iLogic Copy Drawing Resources Autodesk Inventor


Issue:
You have drawings that you want to update with a new border, title block, sketch symbol or other Drawing Resource item.

Solution:
Here is a quick iLogic rule to do this.


oBorderName = "My Border"
oTitleBlockName = "My Title Block"
oSymbolName = "My Symbol"

oResourceFile = "C:\Temp\MyDrawingResourceFile.idw"

'open source file
Dim oSourceFile As DrawingDocument
oSourceFile = ThisApplication.Documents.Open(oResourceFile, False)

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

'copy the resources from the source file, replace existing
oSourceFile.BorderDefinitions.Item(oBorderName).CopyTo(oDoc, True)
oSourceFile.TitleBlockDefinitions.Item(oTitleBlockName).CopyTo(oDoc, True)
oSourceFile.SketchedSymbolDefinitions.Item(oSymbolName).CopyTo(oDoc, True)

'close source file
oSourceFile.Close(True)