Passing Strings as Arguments in Relations
The following functions allow you to pass strings as arguments:
• string_length()—Returns the number of characters in a parameter. For example, if the value for the string parameter material is defined as steel, string_length(material) equals 5, because the word "steel" has five letters.
• rel_model_name()—Returns the current model name. For example, if you are currently working in a part called A, rel_model_name() is equal to A. To use this in a relation in an assembly, write the relation as follows:
name = rel_model_name:2()
|
The parentheses ( ) are empty.
|
• rel_model_type()—Returns the current model type. If you are working in Assembly mode, rel_model_type() is equal to assembly.
• exists()—Evaluates whether an item, such as a parameter or dimension, exists. This can apply to the model for which the relation is being evaluated, or to any model, component, or submodel structure.
For example:
◦ if exists("d5:20")—Checks if the model with runtime ID 20 has a dimension d5.
◦ if exists ("par:fid_25:cid_12")—Checks if the feature ID 25 in the component ID 12 has parameter par.
This allows evaluation to be based on a parameter that exists in only one part of a large assembly. For example, suppose that there are several systems in a large assembly (such as hydraulic, pneumatic, or electrical systems), but the majority of objects belong to no system.
In this case, to make evaluations that are based on the parameter, you must assign the appropriate parameter to those models that belong to the system. For example, if items in the electrical system must use a part number in the BOM report table, instead of the model name, you can create a report parameter bom_name and write the following relation:
if exists("asm_mbr_cabling")
bom_name = part_no
else
bom_name = asm_mbr_name
endif