Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
How to retrive the assembly information of a part using api?
package geo.limited.windchill;
import wt.fc.QueryResult;
import wt.part.WTPart;
import wt.part.WTPartUsageLink;
import wt.vc.VersionControlHelper;
import wt.vc.config.LatestConfigSpec;
import wt.vc.struct.StructHelper;
public class RetrivingChildParts {
public void getPartStructure(WTPart parentPart) throws Exception {
System.out.println("In getPartStructure!!"+parentPart.getNumber());
LatestConfigSpec lcs = new LatestConfigSpec();
QueryResult usesLinks = StructHelper.service.navigateUses(parentPart, false);
System.out.println("usesLinks :"+usesLinks);
while(usesLinks.hasMoreElements()){
//FileWriter writer = new FileWriter(path, true);
WTPartUsageLink usageLink = (WTPartUsageLink) usesLinks.nextElement();
System.out.println(usageLink);
WTPart childPart = (WTPart) lcs.process(VersionControlHelper.service.allVersionsOf(usageLink.getUses())).nextElement();
getPartStructure(childPart);
}
}
}
When i am trying with above code below exception is coming can u please help me out.
wt.services.applicationcontext.UnableToCreateServiceException
: Unable to create new instance of wt.vc.config.InUseDelegate. Nested exception is:
wt.services.ac.ACRuntimeException
: Unable to find implementation class "wt.vc.config.WorkableInUseDelegate". Nested exception is:
java.lang.ClassNotFoundException
: wt.vc.config.WorkableInUseDelegate
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(
Native Method
)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(
Native Method
)
at java.lang.Class.forName(Unknown Source)
at wt.services.ac.impl.DefaultServiceImplementation.getImplementationClass(
DefaultServiceImplementation.java:206
)
at wt.services.ac.impl.DefaultServiceImplementation.getSingleton(
DefaultServiceImplementation.java:198
)
at wt.services.ac.impl.DefaultServiceImplementation.getService(
DefaultServiceImplementation.java:74
)
at wt.services.ac.impl.DefaultACServiceProvider.getServices(
DefaultACServiceProvider.java:485
)
at wt.services.ac.impl.DefaultACServices.getServices(
DefaultACServices.java:449
)
at wt.services.applicationcontext.ACServicesAdapter.getServices(
ACServicesAdapter.java:227
)
at wt.vc.config.InUseDelegateFactory.getInUseDelegates(
InUseDelegateFactory.java:267
)
at wt.vc.config.InUseDelegateFactory.getInUseDelegates(
InUseDelegateFactory.java:196
)
at wt.vc.config.LatestConfigSpec.process(
LatestConfigSpec.java:230
)
at geo.limited.windchill.RetrivingChildParts.getPartStructure(
RetrivingChildParts.java:24
)
at geo.limited.windchill.SearchWTParts.searchWTParts(
SearchWTParts.java:39
)
at geo.limited.windchill.TestWTPart.main(
TestWTPart.java:30
)