Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi everybody,
I am trying to get information about creo drawing object (in WIndchill 10.1) and I hit the wall. So far I was able to get information about creo drawing using "Query-Links" webject, and it looked fine, at first, but. The creo part is a part of a assembly and assembly also has a drawing so instead of getting one I got to drawing objects.
<ie:webject name="Query-Links" type="OBJ">
<ie:param name="INSTANCE" data="<%=wtInstance%>"/>
<ie:param name="TYPE" data="wt.epm.structure.EPMReferenceLink"/>
<ie:param name="DIRECTION" data="referencedBy"/>
<ie:param name="OBJECT_REF" data="VR:wt.epm.EPMDocument:162399"/>
<ie:param name="AUTO_NAVIGATE" data="TRUE"/>
<ie:param name="SELECTEDBY" data="LATEST"/>
<ie:param name="OUTPUT_TYPE" data="FULL"/>
<ie:param name="ATTRIBUTE" data="number,name" delim=","/>
<ie:param name="GROUP_OUT" data="output"/>
</ie:webject>
I also tried bunch of other different link types (EPMDerivedRepRule, EPMDerivedRepRule, EPMDescribeLink, ...) but with out result. I stumble on the peace of text in the one of Windchill manuals that say "An association between a part and the engineering drawing derived from its owner-associated CAD model is automatically created upon initial upload. This association is labeled Calculated, and is not a modeled “link” in the database, but is an included association type when CAD documents are collected for actions."
So if anybody can give me advice or point to right direction what is "the name" of calculated link so it can be used in webject (or this can't be done) or is there any other way to get reference to drawing of particular creo part.
Thanks!
Solved! Go to Solution.
The method you are using above if for retrieving Drawing CADDoc from 3D CADDoc.
The calculated link is between a WTPart and a Drawing CADDoc
You can use this API
CADAssociatedParts relationship =
new CADAssociatedParts();relationship.setTypes(
CADAssociatedParts.Type.IMPLICIT);List<Object[]> parts = EPMNavigateHelper.navigate(documents, relationship, CollectItem.SEED_ID,CollectItem.OTHERSIDE).getRawResults();Hello
the calculated link is not persisted in the database.
So I don't think tant the webject QueryLink is able to find it.
It is calculated , by retrieving reference drawings linked to the "owner" 3D CAD Document of the WTpart, and applying an "as stored baseline" filter.
There's java API that permit to retrieve it. You should be able to use them and store the result in a Webject result, if you realy need an InfoEngine return
regards
Gregory
Hi Gregory,
thank yout for your replay. Using info engine is not required. I tried also using java API but I got the sam result (see code). Do you know the method or function name to use calculated link in java?
public static EPMDocument getDrawingModel(EPMDocument model) throws WTException {
// model is creo part object
EPMDocument drawing = null;
qr = EPMStructureHelper.service.navigateReferencedBy((EPMDocumentMaster) model.getMaster(),
null, true);
while (qr.hasMoreElements()) {
drawing = (EPMDocument) qr.nextElement();
System.out.println("obj 1: " + drawing.getIdentity() + "." + drawing.getIterationIdentifier().getValue());
}
return drawing;
}
Best regards
Nenad
The method you are using above if for retrieving Drawing CADDoc from 3D CADDoc.
The calculated link is between a WTPart and a Drawing CADDoc
You can use this API
CADAssociatedParts relationship =
new CADAssociatedParts();relationship.setTypes(
CADAssociatedParts.Type.IMPLICIT);List<Object[]> parts = EPMNavigateHelper.navigate(documents, relationship, CollectItem.SEED_ID,CollectItem.OTHERSIDE).getRawResults();Thank you!
Best regards,
Nenad
Hi Gregory,
just a feed back. Unfortunately I was unable to use suggested API. I created the following code and I tried to run it in couple different ways (as java application "windchill com.runme" as java bean inside the jsp page but without any success. If you were able to run it can you tell me how did you do it. I also contacted PTC support and they said that I have to run in inside Method Server but they did not supply example how to accomplish that and there is nothing in any manual. Also EPMNavigeteHelper is not listed as a class in api help, this is strange.
QuerySpec qs = new QuerySpec(WTPart.class);
SearchCondition sc1 = new SearchCondition(WTPart.class, "master>number", "=", wtpnumber);
qs.appendWhere(sc1);
QueryResult qrA = PersistenceHelper.manager.find(qs);
if (qrA.size() > 0){
WTPart model = (WTPart)qrA.nextElement();
try{
CADAssociatedParts relationship = new CADAssociatedParts();
relationship.setTypes(CADAssociatedParts.Type.IMPLICIT);
List<Object[]> epmdocs = EPMNavigateHelper.navigate(model, relationship, CollectItem.SEED_ID,CollectItem.OTHERSIDE).getRawResults();
EPMDocument relEPMDoc = null;
Iterator it = epmdocs.iterator(); it.hasNext();){
Object nextObj = it.next();
if (nextObj instanceof EPMDocument){
relEPMDoc = (EPMDocument)nextObj;
epmnumber = relEPMDoc.getNumber();
}
}
}
catch(WTException ex){ex.printStackTrace();}
}
Best regards,
Nenad
If you use a jsp or a "runme" class, you are in a "client" app. not in the methodserver
try to use the same code in your class, but call your method with a RemoteMethoServer ...
it should work
Ok, I will try that. Thank you for your reply.
Regards,
Nenad
Have you got this worked out? Perhaps you can try this java drawing qr code.
If you got the solution to your problem, would you mind sharing it with us here. Sorry that I replied to such an old thread, I'm just really curious how this turned out.
Hi Sherley,
the code from previous post worked fine. The trick is, what Gregory suggested, to use Remote Method Invocation, or another way is to embed your code in Windchill GUI than it can run without RMI.
Got it. Thanks for the info!