Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi guys,
I'm looking for a JAVA API that is capable to replace a part inside a structure with it's alternate or substitute.
It would be great if someone could also provide sample code for it.
The longer story would be the following:
We subscribed to an event, that fires when a new Module Variant was created.
We loop throw the new Module Variant’s structure and based on some attributes and choices we identify three Object References:
• parent: the part which uses the “original child” that should be replaced by the “replacement child”
• original child: the part that should be replaced
• replacement child: the part which should be used as a replacement (this part is alternate and substitute for the “original child” part)
We thought that we will use the function called WTPartHelper.service.replacePartAssemblies(parent, originalChild, replacementChild) which should do the job, but unfortunately it makes no changes in the structure, and doesn’t return error messages, or exceptions.
Like the function wouldn’t be called.
Thank you for any kind of help.
Br,
Csaba
Solved! Go to Solution.
Hi Guys,
Actually, the WTPartHelper.service.replacePartAssemblies is working fine if you have WTPartMaster as the parent and as the child in a BOM relation.
In other cases, you should look for the WTPartUsageLink object, which is representing the BOM relation between the parent and child, and setting the replacement part as child for the found WTPartUsageLink object.
Br,
Csaba
Hi Guys,
Actually, the WTPartHelper.service.replacePartAssemblies is working fine if you have WTPartMaster as the parent and as the child in a BOM relation.
In other cases, you should look for the WTPartUsageLink object, which is representing the BOM relation between the parent and child, and setting the replacement part as child for the found WTPartUsageLink object.
Br,
Csaba