Emil Rindell
Jonas Bryntesson
Henrik Andersson
2022-11-21
Emil Rindell
Jonas Bryntesson
Henrik Andersson
2022-11-21
Code Generator allows you to automatically generate and assign names, numbers and/or descriptions according to 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, all this and much more can be done with this tool.
Start by going to the ICM Tools directory, scroll down until you find Code Generator.
Drag and drop the function on the party you want to configure.
In the top left corner, there are four icons to load and save a configuration (1), save set rules (2), set current rules as default (3) and delete 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" characters, like this:
There are two tabs on the bottom half of the tool window:
CustomData is used to create and manage values under the party CustomData (own unique party properties).
Variables defines the variables to be used for a CustomData, User Name, Part Number, Description or Material.
Defines the values handled as CustomData for the party and how to generate them.
Name - Name to be assigned to CustomData.
Expression - Rule to define the value to be assigned to CustomData.
Value - Value generated by the rule and placed in CustomData.
Variable - The unique name to be assigned to the variable. Use an abbreviation, e.g. WKG to read weight in kilograms (Weight KiloGram).
Get from - A long list of options where to get the value from.
Name - The name/device name of the data to be loaded.
Dec - The number of decimal places.
Len. - length of the field (-1 undefined). 3 gives three digits, even if the value has more digits.
Fill Chr - "fill character" if Len.> 1 and value is missing. "0" as fill gives "002" for value "02".
Value - Result of the function. Always displayed in the rightmost column.
Below is an example of how we can display sheet metal dimensions in the history tree and under the sheet metal part properties, which allows us to make it appear in the BOM. If the size of the plate is changed, the corresponding values in the properties are updated directly.
1) Pull out and drop the Code Generator on a plate.
2) Choose to open an existing configuration file (*.cod).
3) Select the file Sheet_LxWxT.cod
4) Click on Open.
Now the sheet dimensions and material code are automatically retrieved and can be displayed anywhere, e.g. the name in the tree or the 2D drawing BOM etc.
A look at Part Properties shows that current values have been loaded.
Here is a simple example of the total length of a guide curve from a Sweep Shape.
First, we pull out and release the Code Generator from the ICM Tools catalog on our part.
1) Variable - As a variable we write SWL, please keep it short and simple. SWL is short for Sweep Length.
2) Get From - Select from where to read the value. In this case Sweep Path or Extrusion Section Length
3) Specifies where to display the SWL variable. Don't forget "greater than" and "less than". Here, for simplicity, it is placed at User Name.
4) Implement.
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.
Code Generator is available in the add-on program IronCAD Mechanical which is included when you have an active support contract.
Do you not have an agreement? Please contact us at info@solidmakarna.se or 08-556 - 185 40.
More articles