Codeblocks - export and import blocks
Save or reuse your Informed Design code block rules, with export or import to an IDC file.
Step-by-step guide
Codeblocks can be imported and exported from a Product definition. Exported information is stored in a file with an IDC extension. The exported file can be used for backup, to revert to a previous version, or to restore accidentally deleted blocks. The IDC file can be imported into another product definition within a different Inventor project, allowing for reuse of already-defined logic.
In this example, code blocks for key parameters are already defined. There are five lines of blocks comprised of two blocks each, resulting in 10 blocks.
To reuse these blocks in another project:
- Right-click the canvas and select Export 10 blocks.
- In the Save As dialog, select a location to save the IDC file, name the file, and then click Save.
A message confirms that the file was exported successfully.
- Switch to another project file that contains a Product definition. Select Product definition and click Edit.
- Select the Rules tab.
- Right-click the canvas and select Import Blocks.
- In the Import dialog, navigate to and select the previously exported file, then click Open.
A message confirms that the import was successful, and a comment code block is added to help identify the imported blocks.
Sometimes imported blocks contain parameters that do not exist in the product definition, variables that already exist, or duplicate functions. To demonstrate how this is handled, a rule with a function, several named variables, and an unused variable called Test_Var are being exported to an IDC file.
In the product definition where the IDC file will be imported, first, verify the existing parameters and variables:
- Select the Parameters tab. Here, there is one adopted parameter.
- On the Rules tab, select the Variables library. In this case, no named variables exist.
Now, import the file:
- In the canvas, delete any existing blocks. Right-click and select Import Blocks, select the IDC file, and then click Open.
A message indicates that the rule contains one or more inputs that have not been adopted.
In the canvas, a message icon displays on the Nominal Wall Height block, indicating that it is the unadopted input.
Check that the variables and functions imported properly:
- Open the Variables Library. The variables referenced in the exported blocks have been imported, including the unused variable, Test_Var.
- Open the Functions Library. The function called Conversion_To_Inch has been imported.
To resolve the issue with the unadopted parameter:
- Open the Parameters tab and select the unadopted parameter from the list.
- Switch back to the Rules tab to see that there is no longer a message on the Nominal Wall Height blocks.
Next, blocks containing named variables and functions already in use are imported.
- Review the blocks on the canvas and in the blocks library.
The variables and functions found to be present or in use are automatically given the same name plus a number, such as Height1 and Length1.
In summary, code block information can be exported and then imported between product definitions, enabling reuse across multiple projects. The code block information is saved as an IDC file. Once the code block information has been imported, an additional comment code block is added to assist in organization and tracking of imported rules.