import com.ptc.cipjava.*; import com.ptc.pfc.pfcSelect.*; import com.ptc.pfc.pfcAssembly.*; import com.ptc.pfc.pfcBase.*; import com.ptc.pfc.pfcModelItem.*; import com.ptc.pfc.pfcObject.*; import com.ptc.pfc.pfcFeature.*; import com.ptc.pfc.pfcSolid.*; import com.ptc.pfc.pfcComponentFeat.*; public class pfcSelectionExamples { public static void createAndHighlightSelection ( Assembly assem, ModelItem iteminpart ) { ComponentPath cmp_path; Selection cmp_selection; Solid parentpart; Features components; intseq int_path; ComponentFeat cmp_feat; ComponentFeat sample_feat; try { parentpart = (Solid)iteminpart.GetDBParent(); components = assem.ListFeaturesByType(new Boolean(true), FeatureType.FEATTYPE_COMPONENT); int_path= intseq.create(); for (int i = 0; i < components.getarraysize(); i++) { cmp_feat = (ComponentFeat)components.get(i); if ( cmp_feat.GetModelDescr().GetFullName().equals(parentpart.GetFullName()) && cmp_feat.GetModelDescr().GetType() == parentpart.GetType() ) { int_path.set(0, cmp_feat.GetId()); cmp_path = pfcAssembly.CreateComponentPath( assem, int_path ); cmp_selection = pfcSelect.CreateModelItemSelection ( iteminpart, cmp_path ); cmp_selection.Highlight(StdColor.COLOR_HIGHLIGHT); } } } catch (jxthrowable x) { System.out.println("Exception Caught: " + x); } } }