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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

API on CAD to fetch value from WTPart

DKWc
13-Aquamarine

API on CAD to fetch value from WTPart

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 1
HelesicPetr
21-Topaz II
(To:DKWc)

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

Top Tags