IC Mech Code Generator, create more properties

LAST CHECKED:

October 29, 2026

IC Mech Code Generator, create more properties
Emil Rindell

Emil Rindell

Jonas Bryntesson

Jonas Bryntesson

Henrik Andersson

Henrik Andersson

PUBLISHED:

2025-06-09

Emil Rindell

Emil Rindell

Jonas Bryntesson

Jonas Bryntesson

Henrik Andersson

Henrik Andersson

2025-06-09

Automatically generate names, numbers, and descriptions

‍

Code Generator allows you to automatically generate and assign names, numbers and/or descriptions from values and variables related to the model. This means that if, for example, you retrieve the length of a beam, the thickness of a plate, the length of a 3D curve and want to use these values as User Name, Part Number or Description, or create completely new properties, all this and much more can be done with this tool.

‍

How to use Code Generator

Start by going to the ICM Tools catalog, scroll down until you find Code Generator.

Drag and drop the function on the part you want to configure.

Code Generator IRONCAD

‍

In the upper left corner, there are four icons for loading and saving a configuration (1), saving set rules (2), setting current rules as default (3), and clearing any predefined settings (4).

Place the cursor in the field (User Name, Part Number, Description, or Material) where you want to display a new variable. The variable must be placed within "greater than" and "less than" signs, like this:

‍

‍

Code Generator IRONCAD ICM Tools

‍

On the lower half of the tool window, there are two tabs:

‍CustomData is usedto create and manage values under the part CustomData (own unique part properties).‍

Variables defines the variables to be used for a CustomData, User Name, Part Number, Description, or Material.

‍

CustomData and Variables

‍

The CustomData tab

Defines the values handled as CustomData for the part and how to generate them.

Name - Name to be assigned to CustomData.

Expression - Rule for defining the value to be assigned to CustomData.

Value - Value generated by the rule and placed in CustomData.

‍

custom data IRONCAD

‍

The Variable tab

Variable - The unique name to be assigned to the variable. It is recommended to use an abbreviation, e.g., WKG for reading weight in kilograms (Weight KiloGram).

Get from - A long list of options for where to retrieve the value from.

Name - The name/unit designation of the data to be read.

  • The sizebox length, width, and height are specified by default as L, W, and H.
  • For a parameter value, enter the name of that parameter.
  • For weight, enter the unit kg, g, lb, oz

Dec - The number of decimals.

Len. - Field length (-1 undefined). 3 yields three digits, even if the value has more digits.

Fill Chr - "Padding character" if Len. > 1 and a value is missing. "0" as padding yields "002" for the value "02".

Value - Result of the function. Always displayed in the rightmost column.

‍

Get from Code Generator

‍

Variable type Retrieves this value Alternative name
CustomData Value The value from Custom Data The name of the CustomData contained in the part
User Name Name of the part
Sizebox Height of Element Total height of the part
Sizebox Length of Element Total length of the part SM_Unfold returns the L dimension for the sheet metal part
Sizebox Width of Element The overall width of the part SM_Unfold returns the W dimension for the sheet metal part
Thickness of SheetMetal Sheet thickness
Weight of Element part weight Type of unit designation kg, g, lb, oz
Weight of Element in Water Weight of the part in water Type of unit designation kg, g, lb, oz
Parameter Value Name of parameter The name of the parameter found on the part
Volume of Element Part volume
Shell feature Thickness of the shelled part
Thickness of IPROSteel Thickness of beams with this property
Code of SheetMetal Code value of the sheet metal
Part Number part number
Description Designation
Sweep Path or Extrusion Section Length The length of the guide curve in a sweep (2D or 3D)
3D Curve Length The length of a 3D curve
Document Properties File property value The name of the properties existing in the file
Element Surface Surface area of all surfaces on the part
Global Position X The X value for the absolute position
Global Position Y The Y value for the absolute position
Global Position Z The Z value for the absolute position
Longest Value of Sizebox The longest value (among L, W, H) in the Sizebox
Number of Items Number of linked parts (both internal and external)

‍

‍

Example of how Code Generator can be used

‍

Sheet metal dimensions and material code

Below is an example of how we can display sheet metal dimensions in the history tree and under the part properties of the sheet metal, allowing us to have it displayed in the BOM. If the size of the sheet metal changes, the corresponding values in the properties are updated immediately.

1) Drag and drop Code Generator onto a sheet metal part.

2) Choose to open an existing configuration file (*.cod).

3) Select the file SheetMetal_LxWxT.cod

4) Click on Open.

‍

‍

The sheet metal dimensions and material code are now fetched automatically and can be displayed anywhere, such as the name in the tree structure or the 2D drawing BOM, etc.

‍

A look under Part Properties shows that the current values have been loaded.

‍

‍

Total length of the guide curve from a sweep shape

Here is a simple example of the total length of a guide curve from a Sweep Shape.

First, we drag and drop Code Generator from the ICM Tools catalog onto our part.

1) Variable - As the variable, we write SWL; keep it short and simple. SWL is short for Sweep Length.

2) Get From - Select where the value should be read from. In this case, Sweep Path or Extrusion Section Length

3) Specifies where the SWL variable should be displayed. Do not forget "greater than" and "less than". For simplicity, it is placed here at User Name.

4) Apply.

Nu ser vi att längden från partens Sweep Shape visas som en del av partens namn i historieträdet. Hade vi valt att lägga <SWL> även under Part Number och/eller Description så hade detta värde även visats i en BOM.

‍

Sweep length BOM

‍

Code Generator is available in the IronCAD mechanical add-on, which is included when you have an active support contract.

Do you not have an active support contract? Please contact us at solidmakarna or 08-556 - 185 40 and we will solve it!