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

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

Remove part structure details from the engineering part

ashiq_097
8-Gravel

Remove part structure details from the engineering part

Version: Windchill 12.0

 

Use Case: hi, I want to delete the part structure details for many of the parts at a time , such that it removes the structure details of the parent part completely for the current revision.


Description:

is there any utility or API  to help get the changes updated ? please assist if anything helps

11 REPLIES 11
avillanueva
22-Sapphire II
(To:ashiq_097)

Are you looking at whacking the part from a BOM? That data is housed in the WTPARTUSAGELINK table I believe. normally this is done via the interface via check out and in process since this change should be done under an iteration. Are you looking at removing history? Like all instances of the linkage in the past?

Correct, I want to remove the history of the Bom details like the link needs to be removed.

avillanueva
22-Sapphire II
(To:ashiq_097)

Yes, there exists an API (PersistenceHelper) but there is likely more involved they just removing this link in all of history. I am sure there are other tables that could be impacted like Occurrences, substitutes, etc. Removing via API at a low level might circumvent some data integrity checks causing missing references and errors in the database records. Not something I would want to try out in production. If possible, better approach if scope is limited is to check out, remove links, check in, then purge history of those items. Its a PITA but its clean.

@ashiq_097 

I don’t believe there is an OOTB utility to do this.

That said, I can write a utility to do it that, given a WTPart version, would remove all Parts in the structure of all iterations of the given WTPart version WITHOUT iterating anything.

My code runs without checkout/checkin.

Note, checkout/checkin would remove the structure from only the newly created checkin iteration.

That’s not going to get the job done for you.

You want the structure removed from ALL iteration of the given version. Therefore, checkout/checkin is NOT the way to get there.

 

David

I could resist so I wrote a utility to remove all parts from all iterations of a WTPart's structure given the WTPart's number and revision.

Runs in a Windchill shell and is bombproof. 😊

 

In my example I have WTPart number 0000000003 which has rev A and B.

I want to remove the structure from all iterations of Rev A only.  There are six iterations of Rev A

Iteration 6

d_graham_0-1729889210435.png

 

Iteration 5

d_graham_1-1729889307774.png

Iterations 4, 3 and 2 also have a part structure.

 

I run the utility in a Windchill shell entering the WTPart's number and revision.

d_graham_2-1729889472311.png

 

After running note that no WTParts were iterated, but their structures have been completely removed.

d_graham_3-1729889722746.png

 

Here's iteration 6 after running the utility.

d_graham_4-1729889880852.png

Here's iteration 5 after running the utility.

d_graham_5-1729889964441.png

All gone. 😊

 

Same is true for the part structures of iterations 4, 3 and 2, all gone.

@d_graham  could you please explain this use case and share the code snippet if possible 😊 thanks.

@ashiq_097 , I think I already explained exactly what the code does so I'm a bit confused about your asking to "explain this use case".

That said, again, given two arguments, a number and a revision, all iterations of that WTPart's revision have their Part Structure removed.

Isn't that what your post asked for?

 

The utility I wrote does not reclusively go through the entire structure, although that would be easy enough to write.  It only does the top-level structure for the number and revision entered. 

@d_graham can you explain like which methods do need to utilize to get the structure of the part removed ?

private static void removePartStructure(WTPart part) throws WTException {

QueryResult usageLinks = PersistenceHelper.manager.navigate(part, "uses", WTPartUsageLink.class);

while (usageLinks.hasMoreElements()) {

WTPartUsageLink usageLink = (WTPartUsageLink) usageLinks.nextElement(); PersistenceHelper.manager.delete(usageLink); }

 

this will work right

@ashiq_097 

No it won’t because the part is not checked out.

 

The conundrum is if you checkout/checkin only the newly checked in iteration will be free of the link. This doesn’t really help because you want all iterations of the specified revision to be free of the links.

what logic can we get add here or how can we implement to do this in a code ?

Announcements

Top Tags