Fundamentals > Program > Editing a Design > Replacing Components in Assembly Designs > Example: Replacing Family Table-Driven Components
Example: Replacing Family Table-Driven Components
Given an assembly that consists of a block and a peg, assemble the instance that matches the diameter of the hole in the block.
inst_name = declared string parameter initialized to generic part name
generic_name = peg.prt. This part contains a number of instances based on diameter dimension (d) and length dimension (d1).
Family instance names of peg.prt include:
2 x 4 - d0 = 2, d1 = 4
2 x 5 - d0 = 2, d1 = 5
2 x 6 - d0 = 2, d1 = 6
3 x 4 - d0 = 3, d1 = 4
3 x 5 ............
3 x 6 ............
Add a relation to the control in which peg.prt is added to an assembly controlled by dimensions of a feature in block.prt. The relation is:
inst_name = lookup_inst ("peg.prt", 0 , "d2", d6:0, "d1", d5:0 +1)
In this way, the instance of peg.prt being assembled to blockpeg.asm is controlled, based on the dimensions of the hole in block.prt.
The Pro/PROGRAM listing would look like this:
INPUT
END INPUT
RELATIONS
INST_NAME = LOOKUP_INST ("PEG.PRT", 0, "D2", D6:0, "D1", D5:0 + 1)
END RELATIONS
ADD PART BLOCK
INTERNAL COMPONENT ID 1
END ADD
ADD PART (INST_NAME)
INTERNAL COMPONENT ID 2
PARENTS = 1 (#1)
END ADD
MASSPROP
END MASSPROP