& Construction
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing
Professional CAD/CAM tools built on Inventor and AutoCAD
When working with code blocks, we can import and export blocks from a product definition. The information being imported or exported is stored in a file with an IDC extension. The exported file can be used for backup, allowing us to revert to a previous version or allow us to restore accidentally deleted blocks.
The IDC file can also be imported into another product definition within a different inventor project, allowing for quick and easy reuse of previously defined logic.
Here we have code blocks for key parameters in our current product definition that we would like to reuse in another project.
Right clicking in the canvas presents an option to export blocks.
More specifically, export ten blocks.
In this example, each of the five lines of blocks is comprised of two blocks.
To the left of the equal sign is the parameter block, and on the right, a block defining the value.
When choosing the export blocks option, a save as dialogue box will allow you to choose the desired location for your saved code block IDC file.
Here, we'll give this file a meaningful name and save it to a code block library location so that we can reuse it later.
Upon clicking the save button, an informational message displays to let us know the file exported successfully.
Switching to another project file which contains a product definition we are just beginning to define, our goal is to import the code blocks we previously exported.
Editing the product definition and going to the rules tab, we'll find the canvas is empty and ready for us to add code blocks.
Right clicking in the canvas, we'll find the import blocks option.
Selecting import blocks will open the import dialogue window, allowing us to navigate to a previously saved code block IDC file.
Clicking the open button imports the blocks and returns us back to the canvas where we are greeted with an informational message to let us know the import was successful.
Once imported, an additional comment code block is added to indicate that the blocks below the comment were the ones we imported.
When importing code blocks containing parameters that aren't present, variables that already exist, or duplicate functions, we want to be aware of how these are handled.
Here we have a rule containing a function and a few named variables as well as a variable called test var that the rule isn't using.
To demonstrate what happens when these items are imported, we'll first export them to an IDC file.
Next, within a different product definition, we'll look at the parameters and note that only one has been adopted.
Going to the rules tab, we'll take a look at the variables blocks and note that no named variables exist yet.
Since our plan is to import blocks from an IDC file, we'll remove the existing block and then right click and choose import blocks.
Upon doing so, we are greeted by a message informing us that the rule now contains one or more inputs that have not yet been adopted.
We'll also see the nominal wall height block indicates that it is the imported input in question.
A quick look at the variables blocks, and we find that the variables referenced in the exported blocks have been imported and are now listed, as well as that unused variable called test var.
A look at the functions blocks, and we see the function called conversion to inch has been imported and is listed also.
To resolve the issue with the unadopted parameter, we'll return to the parameters tab and select the parameter from the list.
Returning to the rules tab, we see the nominal wall height blocks no longer indicate the unadopted status.
Let's see what happens when we import blocks containing named variables and functions that are already present in the rule.
What we find is that importing an IDC file with references to variable or function names already in use causes the names to auto increment as shown.
Here, each item found to be present or in use is imported with the same name plus the number one.
But what about our conversion function?
Yep. It's incremented as well.
In summary, code block information can be imported and exported between product definitions, enabling the reuse across multiple projects.
The code block information is saved as an IDC file and should be given a meaningful name and saved in a meaningful location for future access. Once the code block information has been imported, an additional comment code block is added to assist an additional organization and tracking in extensive rule definition situations.