Skip to main content
7月 10, 2025 1:08 下午 UTC
已解决

get representation from part

Hi so I'm working on this Thing that takes information from windchill, and puts it though a calculator to return times for the part. but is there anyway to use an O data connector or any feature to get a representation from windchill, there is the WRS partGetRepresentation but I do not know how to implement that into a service that can be called with a part Id or number, I currently am using getJSON to get the urls but that needs credentials in the code but is there a way to avoid having to log in each time by doing it another method that doesnt need to login.

var url = "XXXXXXXXXXXXXXXXXX/Windchill/servlet/odata/v7/ProdMgmt/Parts('" + input + "')/Representations";

var result;

try {
 var response = Resources["ContentLoaderFunctions"].GetJSON({
 		url: url,
 username: user,
 password: pass,
 timeout: 10 
 });

 if (response.value && response.value.length > 0) {
 var rep = response.value[0];

 // Check for valid 2D/3D thumbnail URLs
 if (rep.TwoDThumbnailURL && rep.TwoDThumbnailURL.URL) {
 var imageURL = rep.TwoDThumbnailURL.URL;
 logger.warn("2D image URL: " + imageURL);

 try {
 var imageResponse = Resources["ContentLoaderFunctions"].LoadImage({
 url: imageURL,
 username: user,
 password: pass
 });
 result = imageResponse;
 } catch (imgErr) {
 logger.error("Image load failed: " + imgErr.message);
 result = null;
 }
 } else {
 logger.warn("No valid thumbnail URL found.");
 result = null;
 }
 } else {
 logger.warn("No representations found.");
 result = null;
 }
} catch (err) {
 logger.error("Windchill fetch failed: " + err.message);
 result = null;
}

 

7月 22, 2025 2:13 下午 UTC

Found a solution, not the fastest solution i think but it does work but you can use the service GetSearchResults in the thing NavigateSearchThing, that returns an infotable with search results which can be filtered for the version needed and a column is a TwoDThumbnail which can be extracted.

2回复

Community Manager
7月 16, 2025 1:05 下午 UTC

Hi @LH_10747950 

Thank you for your question. 

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

Also, feel free to add any additional information you think might be relevant. It sometimes helps to have screenshots to better understand what you are trying to do.

 

Best regards,

LH_10747950作者回答
7月 22, 2025 2:13 下午 UTC

Found a solution, not the fastest solution i think but it does work but you can use the service GetSearchResults in the thing NavigateSearchThing, that returns an infotable with search results which can be filtered for the version needed and a column is a TwoDThumbnail which can be extracted.