Fundamentals > Program > Editing a Design > Replacing Components in Assembly Designs > To Interchange Components Programmatically
To Interchange Components Programmatically
1. Include a string variable in the INPUT statement in an Assembly design.
For example:
INPUT
fastener_name STRING
"Enter name of fastener to be used in cam:"
END INPUT
2. In the associated ADD statement, put the name of the string variable in parentheses.
For example, to add a part specifically to the assembly:
ADD PART (fastener_name)
...
END ADD
3. To interchange a part named washer for a subassembly or vice versa, use an ADD COMPONENT statement, using this format:
ADD COMPONENT (name with an extension, or variable)
COMPONENT ID <component Id>
For example:
ADD COMPONENT washer.prt
COMPONENT ID 4
...
END ADD