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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. 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
22-Sapphire I
(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