• Informed Design
  • Inventor

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:

  1. Right-click the canvas and select Export 10 blocks.
  • In the Informed Design interface, Rules tab, five lines of blocks with 2 blocks each in the canvas; and in the expanded context menu, Export 10 blocks being selected.
  1. In the Save As dialog, select a location to save the IDC file, name the file, and then click Save.
  • The Save As dialog for exporting the file, with the location and filename highlighted, and the Save button being clicked.

A message confirms that the file was exported successfully.

  • Confirmation message that blocks exported successfully.
  1. Switch to another project file that contains a Product definition. Select Product definition and click Edit.
  • A Product Definition selected in the new project and Edit ready to click.
  1. Select the Rules tab.
  2. Right-click the canvas and select Import Blocks.
  3. In the Import dialog, navigate to and select the previously exported file, then click Open.
  • On the left, the canvas context menu expanded, with Import Blocks highlighted; and on the right, the Import dialog, with the exported file being selected for import.

A message confirms that the import was successful, and a comment code block is added to help identify the imported blocks.

  • Comment code block added above the imported blocks to identify them.

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 expanded Variables library, the blocks that are being exported, including a rule with a function, several named variables, and an unused variable called Test_Var.

In the product definition where the IDC file will be imported, first, verify the existing parameters and variables:

  1. Select the Parameters tab. Here, there is one adopted parameter.
  • The product definition open to the Parameters tab, with one adopted parameter shown.
  1. On the Rules tab, select the Variables library. In this case, no named variables exist.
  • The Variables library expanded to show that there are no named variables in this product definition.

Now, import the file:

  1. 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.

  • A warning message that there are unadopted inputs.

In the canvas, a message icon displays on the Nominal Wall Height block, indicating that it is the unadopted input.

  • On the Nominal Wall Height block, a message icon and the displayed message indicating that the Nominal Wall Height input has not been adopted.

Check that the variables and functions imported properly:

  1. Open the Variables Library. The variables referenced in the exported blocks have been imported, including the unused variable, Test_Var.
  2. Open the Functions Library. The function called Conversion_To_Inch has been imported.
  • In two side-by-side images, the Variables library and the Functions library expanded to show the imported variables and functions.

To resolve the issue with the unadopted parameter:

  1. Open the Parameters tab and select the unadopted parameter from the list.
  • The Parameters tab with the Nominal Wall Height parameter being selected.
  1. Switch back to the Rules tab to see that there is no longer a message on the Nominal Wall Height blocks.
  • On the canvas, the unadopted parameter message no longer appears on the Nominal Wall Height parameter blocks.

Next, blocks containing named variables and functions already in use are imported.

  1. 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.

  • The Variables library expanded to show the auto-incremented variables.

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.