Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
There used to be a way to swap generic with instance. I've always
wondered where that went. Someone here must know.
I am not sure if this is what you are looking for but you can use PRO/PROGRAM to replace a generic/instance part with other that meets some or a unique parameter for example, sorry about the mess of information I’ve made here, I hope you get it, I could not find the right files of this example to send you so I hope you can reproduce it.
Below you can see the family table of the part 333.prt. The names of the instances can´t be used to determine the correct instance to be loaded in the assbembly, but the dimensions X and Y define wich one will be used.
1. ! Generic part name: 333
2. ! Name d1 d0 d4
3. ! X Y Z
4. ! ==================================================
5. ! GENERIC 3.5 3.0 1.0
6. 431 4.0 3.0 1.0
7. 121134-1 4.0 10.0 2.0
8. 541 5.0 4.0 1.0
9. TEST_PART 8.0 1.0 1.5
10. 651 6.0 5.0 1.0
11. JOE_INST 7.0 10.0 2.0
12. SPEC_22.0 4.0 1.0
13. 890-1 8.0 9.0 1.0
14. PEGGY 2.0 7.0 1.0
15. 2233548 4.0 4.0 5.0
To use the “lookup_inst" function in the model the folowing relation must be created in the assembly mode:
INSTANCE_NAME = LOOKUP_INST("333.PRT",1,"D1",X:1,"D0",Y:1)
INSTANCE_NAME is a parameter created to store the name of the instance that is going to replace the generic in the assembly;
333.PRT Is the generic part that will be checked in order to find the matching parameters
D1 and D0 are the parameters that will be checked in all instances of the generic 333.PRT in order to find a match, below you can see what the PRO|E Help tells about it
{You can automatically replace family table–driven components according to design criteria by using the lookup_inst function. With this function, you can search a component family table to find an instance that fits the values of the search parameters. If the lookup function does not find a match, it returns the name of the generic.
The format for lookup_inst is:
lookup_inst ("generic_name", match_mode, Òparam_name_1Ó, match_value_1, Òparam_name_2Ó, match_value_2,...)
where
●generic name—Name of the generic model with a prt or asm extension
●match_mode—One of the following values:
○–1 (find closest instance with param values less than or equal to supplied values)
○0 (find instance with param values that match supplied values exactly)
○1 (find closest instance with param values greater than or equal to supplied values)
●param_name_1—Family table parameter name
●match_value_1—Value to match against}
The relation must be added in the assembly where the replacement will occur. It can be done editing the program or the relations.
After adding the relation, the program will look like this at the RELATIONS section(“TOOLS / PROGRAM / EDIT DESIGN, looks like you must have ADVANCED ASSEMBLY EXTENSION module to edit programs in assembly mode, part mode is free”):
RELATIONS
INSTANCE_NAME = LOOKUP_INST("333.PRT",1,"D1",X:1,"D0",Y:1)
END RELATIONS
Now indicate which component will be replaced replacing his name by the parameter name:
Original PROGRAM lines for addin the 333.prt file:
In order to replace 333.prt file with one of its instances, we are going to replace its name here by the parameter (INSTANCE_NAME) we’ve created earlier so it can be a dynamic entry.
ADD PART (INSTANCE_NAME)
INTERNAL COMPONENT ID 12
END ADD
This example was created in a scenario where once the “X” and “Y” values are changed in the relation, the lookup_inst command looks into the 333.prt file for a instance that meet the values and replace it in the parameter “INSTANCE_NAME” and the matching instance takes the place of 333.prt in the assembly, you can relate this values with parameters to make it less error prone while changing them.
Warm Regards
Guilherme Rocha - Tech Support Consultant
PLM Solutions do Brasil
“A goal without a plan is just a wish.”