Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi all,
I am Exporting Multilevel BOM from Windchill by API.. it Works..
now i want to export all BOM's present in Whindchill, so first i need to be find out the "0" Level Items from Windchill.
Plese let me know how i can do this ?
How i can find the TOP_LEVEl Parts from Windchill..
Thanks,
Vivek
Solved! Go to Solution.
Hi,
In this line QueryResult rs = WTPartHelper.service.getUsesWTPartMasters(part); you are passing the part variable value as null which is leading to error.
Thanks and Regards,
Kaushik
Hi Vivek,
you can use queryspec to querying the database to get all the end items
If you use "End Item" to track top level assemblies , you can query the DB as Kaushik said.
if not , you have to query all WTPartsMasters, where the oid (ida2a2) does not exist is the WTPartUsageLink table (ida3b5). ie WTpart that are not used as child in a BOM.
You can do that query by API
Hi All,
I found a new way by using partUsageLink to find the TOP level parts from asm, but the code gives some error,
Please can you help me to sort out issu.
Code is:
WTPart part = null;
QueryResult rs = WTPartHelper.service.getUsesWTPartMasters(part);
while(rs.hasMoreElements()){
System.out.println(""+rs.size());
System.out.println(part.getNumber()+"----Has----Child---"+rs.size());
WTPartMaster partMaster=(WTPartMaster)part.getMaster();
QueryResult qr_parents=WTPartHelper.service.getUsedByWTParts(partMaster);
while(qr_parents.hasMoreElements()){
WTPart parentPart = (WTPart)qr_parents.nextElement();
System.out.println(partMaster.getNumber()+"----Has----Parents---"+parentPart.getName());
partMaster =(WTPartMaster)parentPart.getMaster();
}
}
Hi,
In this line QueryResult rs = WTPartHelper.service.getUsesWTPartMasters(part); you are passing the part variable value as null which is leading to error.
Thanks and Regards,
Kaushik
Hi Kaushik,
Thanks for your reply,
I need some more help from you, if u don't mine.
I want to create a very Simple WTPart and WTDocument by using Windchill API,
for that i raise a query to PTC tech support but unfortunatly i not gting any code from them,
can you share the very simple code to create WTPart nad WTDocument ?
Thanks,
Vivek
Hi Vivek,
The basic code to create WTPart.
WTPart part = WTPart.
newWTPart(“Myname”,”MyNumber”);
try {
part.setContainer(container);
Persistable persistable = PersistenceHelper.
manager.save(part);
}
catch (WTPropertyVetoException e) {
//
TODO
Auto-generated catch block
e.printStackTrace();
}
{
you can also use the code in workflow.
For document use WTDocument.
If you want to create Subtype if WTPart.
use
part.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference("wt.part.WTPart|com.ptc.ElectricalPart"));
See the various methods in LoadPart and LoadDoc class for better understanding.
Thanks and Regards
Kaushik