cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Windchill API call that gets only the direct drawing Referenced By?

bbailey
8-Gravel

Windchill API call that gets only the direct drawing Referenced By?



Hi All,

We are in the process of having some CAD verification software developed
and are running into an issue. Part of the requirements are that the tool
be able to traverse an objects (typically .prt or .asm) configuration and
check to see if any of the dependents are directly represented in a
drawing. The solution as delivered uses a call that returns ALL drawings
that the a dependent object appears in the structure above it. That is all
the way up the assembly structure, whether the object is a direct dependent
or not. This may be many in the case of a small piece part used in a large
assembly.

Is there a Windchill API call that only returns the Drawings that directly
reference an object?

Thanks,

Benjamin A Bailey
Department Manager
Information Technology
Engineering Data Systems/PDM
Missile Systems
Raytheon Company

+1 520.545.6579 (office)
+1 520-403-1842 (cell)
-

6221 S Palo Verde Rd
Tucson, AZ 85706-5093 USA
www.raytheon.com

Raytheon Sustainability

This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this
message in error, please so advise the sender by reply e-mail and delete
this message. Thank you for your cooperation.
4 REPLIES 4


Ben,

Here is an excerpt of the code that I use:


// Get references for drawing
QueryResult references = wt.epm.structure.EPMStructureHelper.service.
navigateReferences(latestDoc, null, false);

// Loop through all references if not null
while (references != null && references.hasMoreElements()) // may
want to add code to exit when found
{
// Get the next reference
EPMReferenceLink link = (EPMReferenceLink)
references.nextElement();

// Print Debug information for references found
System.out.print("Link Type: " + link.getDepType() + " ; ");
System.out.println("Reference Name: " + ((EPMDocumentMaster)
link.getReferences()).getName());

// Check to see if the link dependency type is for the master
model
if (link.getDepType() == 4) // '4' is the value for the master
reference in the drawing
{

// Get the EPM Document Master for the master model
reference in the drawing
EPMDocumentMaster epmDM = (EPMDocumentMaster)
link.getReferences();

// Do something with this information
// Add boolean to trigger exit from while loop?

} // end if drawing reference found

} // end while references and not updates



Regards,

Mark S. Bohannon
MDA System Administrator/Programmer



2D barcode - Phone: 1-919-543-5164 | Mobile: 1-919-771-8590 IBM
encoded with E-mail: msbohann@us.ibm.com
contact information Find me on: LinkedIn: 3039 E Cornwallis Rd

Thank you Mark! It works perfectly.

Hi Mark,

 

Can you please let me know if you do have any sample code to retrieve the latest drawing for a CAD Part or some sample API Regarding the same.

 

Thanks in advance.

 

Best Regards,

Aditya

Here is an exampleAPI to get Models (.prt /.asm) from drawing. You can trytweaking this code and check the reverse can be done.


List<epmdocument> models = new ArrayList<epmdocument>();
spec.appendClassList(EPMReferenceLink.class, false);

while (refIterations.hasMoreElements()) {
EPMDocument doc = (EPMDocument) perData[1];
models.add(doc);
}


}


ConfigSpec cSpec = null;
EPMAsStoredConfig asStoredcSpec = (EPMAsStoredConfig) asStoredConfigReference.getObject();


cSpec = EPMAsStoredConfigSpec.newEPMAsStoredConfigSpec(asStoredcSpec);
return null;
return null;
return cSpec;
Thanks


Announcements


Top Tags