Customizing Automatic Creation of Standard Control Characteristics When the CAD Model Is Checked in With the Annotations Designated as Control Characteristics
Use the Automatically Create Standard Control Characteristics preference to automatically create standard control characteristics in Windchill from CAD (Creo, NX, CATIA V5).
Out of the box, the system creates a new standard control characteristic every time a new iteration of a part that has a new annotation is checked-in in Windchill. You can customize this behavior to use already existing standard control characteristics whenever a new annotation is published in Windchill. Perform the following steps:
1. Access the mpmlink.service.properties.xconf file located at WT_HOME/codebase/com/ptc/windchill/mpml/xconfs.
2. Add an entry for the service class attribute under the property com.ptc.windchill.mpml.delegates.AutoAssociateStandardCCDelegate.
|
The entry for com.ptc.windchill.mpml.delegates.DefaultAutoAssociateStandardCCDelegate is available by default.
|
Consider the following sample code:
/**
* Customizing populateSCC method from @DefaultAutoAssociateStandardCCDelegate to get already persisted SCC
* from DB, based on the ModelItem Subtype and using the same.
*/
@Override
public void populateSCC(List<CreateSCCBean> beanList) throws WTException {
long startTime = PerformanceLogger.getStartTime();
if(beanList == null || beanList.isEmpty() ) {
throw new WTException(" beanList is empty");
}
try {
//get existing scc
for(CreateSCCBean bean : beanList) {
Collection<ModelItem> modelItems = bean.getMiToEpmDocMap().keySet();
for (ModelItem modelItem : modelItems) {
String miSubType = modelItem.getMaster().getItemSubType().toString();
MPMStandardCC scc = null;
switch(miSubType) {
case MI_SUBTYPE_GTOL_CIRCULARITY:
scc = getSCC("0000000003");
break;
case MI_SUBTYPE_GTOL_FLATNESS:
scc = getSCC("0000000002");
break;
default:
scc = getSCC("0000000004");
break;
}
bean.getMiToSCCMap().put(modelItem, scc);
}
}
} catch (WTException e) {
LOGGER.error(e::getLocalizedMessage);
throw new WTException(e);
}
PerformanceLogger.logTimeTaken(startTime);
}
Use bean.getMiToSCCMap().put(modelItem, scc) from the code sample to add standard control characteristics that you want to add to the model annotations. The standard control characteristics that you add can be persisted or non-persisted.