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

We are happy to announce the new Windchill Customization board! Learn more.

Parameters for operation and part to create MPMOperationToPartLink via API

rzemmali
11-Garnet

Parameters for operation and part to create MPMOperationToPartLink via API

Hello,

I need to create a link between operation and part with MPMOperationToPartLink. I used the method

com.ptc.windchill.mpml.processplan.operation.MPMOperationToPartLink.newMPMOperationToPartLink(MPMOperation operation, WTPartMaster partMaster)

howeveran error message apears that ComponentIdPath is null.

How to set ComponentIdPath? which parameters in the operation or the part are needed to create such link?

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Fadel
22-Sapphire I
(To:rzemmali)

try this :

 WTPart child =  null;//Allocation part
    WTPart parentpart =  null;//Parent part
    WTPart assemblyPart =  null;//Top Assembly part
       MPMOperation operation = null;//Operation 
      WTPartUsageLink parentChildlink = null;//Parent part and Allocation part UsageLink
       WTPartUsageLink assemblyParentlink = null;//Top Assembly part and Parent part UsageLink
    String componentId = parentChildlink.getComponentId;//Parent part and Allocation part is ComponentID in UsageLink.
    String componentIdPath = assemblyParentlink +"|"+componentId ;//Top Assembly part,Parent part and Allocation part is ComponentID in UsageLink. Delimit with a hyphen:demo: XXXXX1|XXXX2

    MPMOperationToPartLink link = MPMOperationToPartLink.newMPMOperationToPartLink(operation, (WTPartMaster) child.getMaster()); 
    link.setComponentIdPath(componentIdPath);
    link.setComponentId(componentId);
    link.setAllocatedPartIterationId(PersistenceHelper.getObjectIdentifier(child).toString());
    link.setPartMstrReference(assemblyPart.getMasterReference());
    link.setAllocationType(MPMOperationToPartLinkType.CONSUMED);
    PersistenceServerHelper.manager.save(link);
Fede

View solution in original post

1 REPLY 1
Fadel
22-Sapphire I
(To:rzemmali)

try this :

 WTPart child =  null;//Allocation part
    WTPart parentpart =  null;//Parent part
    WTPart assemblyPart =  null;//Top Assembly part
       MPMOperation operation = null;//Operation 
      WTPartUsageLink parentChildlink = null;//Parent part and Allocation part UsageLink
       WTPartUsageLink assemblyParentlink = null;//Top Assembly part and Parent part UsageLink
    String componentId = parentChildlink.getComponentId;//Parent part and Allocation part is ComponentID in UsageLink.
    String componentIdPath = assemblyParentlink +"|"+componentId ;//Top Assembly part,Parent part and Allocation part is ComponentID in UsageLink. Delimit with a hyphen:demo: XXXXX1|XXXX2

    MPMOperationToPartLink link = MPMOperationToPartLink.newMPMOperationToPartLink(operation, (WTPartMaster) child.getMaster()); 
    link.setComponentIdPath(componentIdPath);
    link.setComponentId(componentId);
    link.setAllocatedPartIterationId(PersistenceHelper.getObjectIdentifier(child).toString());
    link.setPartMstrReference(assemblyPart.getMasterReference());
    link.setAllocationType(MPMOperationToPartLinkType.CONSUMED);
    PersistenceServerHelper.manager.save(link);
Fede
Top Tags