Skip to main content
15-Moonstone
December 15, 2022
Question

API on CAD to fetch value from WTPart

  • December 15, 2022
  • 1 reply
  • 749 views

Hi,

I'm looking for a API in which I want to fetch the value given on the WTPart and map with one on CAD document.

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
December 15, 2022

Hi @DKWc 

 

Follwoing general examples can help you. 

 

API to get WTPart from CAD 

//EPMBuildRule.BUILD_SOURCE_ROLE
QueryResult localQueryResult = PersistenceHelper.manager.navigate(sourceEpmDocument, EPMBuildRule.BUILD_TARGET_ROLE, EPMBuildRule.class, false);

API to get parameters: 

PersistableAdapter wtpObj = new PersistableAdapter(wtpart, null, null, null);
wtpObj.load("name", "number","YOURS_PARAMS");
String number = wtpObj.get("number");
String yourParam = wtpObj.get("YOURS_PARAMS");

API to save parameter:

WTCollection itemsToUpdate = new WTArrayList();
PersistableAdapter obj = new PersistableAdapter(epmDoc, null, Locale.US, new UpdateOperationIdentifier());
obj.load("YOURS_PARAMS");
obj.set("YOURS_PARAMS", yourParam);

EPMDocument epm = (EPMDocument) obj.apply();
itemsToUpdate.add(epm);

PersistenceHelper.manager.store(itemsToUpdate);

 Hope it can help.

 

PetrH