Hello All,
I am trying to Retrive BOM from Windchill using Windchill/Java Api.
i am now find out the all Top Level Assemblys from Windchill Database by using APi.
but i not able to find out the Child Parts form Assemblys and its Levels.
Anyone can help me to find out this stuff or if u have a same programe to get BOM from Windchill ?
Any help will be Great !!
Thanks,
Vivek
Hello
you will have some API in wt.part.WTPartHelper service
You will need to use a "configspec" (LATEST, baseline, effectivities ...) to navigate the multilevel BOM . As when setting a filter in the structure tab.
regards
Thanks Gregory,
I did some code with your approch.. as given below..
public Map<Object,List> getNodes(List parents) throws WTException {
if (configSpec == null) {
configSpec = getDefaultConfigSpec();
}
Map<Object,List> result = new HashMap<Object,List>();
//API returns a 3D array where the 1st dim is the parent parts,
//the 2nd dim is the list of children for a given parent,
//and the 3rd dim is 2 element array w/the link obj at 0 and the child part at 1
Persistable[][][] all_children = WTPartHelper.service.getUsesWTParts( new WTArrayList(parents), configSpec);
for (ListIterator i = parents.listIterator(); i.hasNext();) {
WTPart parent = (WTPart)i.next();
Persistable[][] branch = all_children[i.previousIndex()];
if (branch == null) {
continue;
}
List children = new ArrayList(branch.length);
result.put(parent,children);
for (Persistable[] child : branch) {
children.add(child[1]);
}
}
System.out.println("######### By New Method ######### "+result);
// log.debug("ParentsToChildren: " + result);
return result;
}
private ConfigSpec getDefaultConfigSpec() throws WTException {
return ConfigHelper.service.getDefaultConfigSpecFor(WTPart.class);
}
But in above code .. am not able to declare configspec?
do you have anuy idea how i will declare configspec in above programe..
or do you have any code for BOM?
Thanks,
Vivek
... Sorry ... I have not coded since a long time ... so can't tell you the exact API
look at wt.part.WTPartConfigSpec
but here, you use the default configSpec for WTPart . So I assume it will navigate the BOM with "LATEST" configspec
there's API to build your own configspec. different types:
-LATEST + lifecycle state
-dated effectivities
-config item with date/lot/serial numbers effectivities
-baseline
and Think there's new API in 10, as now we can use "composite" Configspecs, with ordered filters ..
for example:
-effectivities lot 1 + latest Release ...
Hi Vivek -
Basically you could navigate use
LatestConfigSpec lcs = new LatestConfigSpec();
QueryResult usesLinks = StructHelper.service.navigateUses(parentPart, false);
lcs.process(VersionControlHelper.service.allVersionsOf(usageLink.getUses())).nextElement();
Got the answer from
http://ezcollab.com/questions/123/how-to-get-multilevel-bom-in-windchill-by-using-windchill-api
However this is just one way. There are several other ways.
You could also use something called NavigationCriteria..This a whole new subject. NavigationCriteria APIs are very powerful for navigating structures and PTC uses it for presenting structures as well as bom compare..Not sure if you want to go into this detail