cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

JAVA API for replacing a part with it's Alternate / Substitute in a structure.

Csaba
7-Bedrock

JAVA API for replacing a part with it's Alternate / Substitute in a structure.

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

ACCEPTED SOLUTION

Accepted Solutions
Csaba
7-Bedrock
(To: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

View solution in original post

1 REPLY 1
Csaba
7-Bedrock
(To: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

Announcements

Top Tags