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

Translate the entire conversation x

How to add WTPart as a child to Parent part in Part Structure Browser without iterating parent part

AKC
13-Aquamarine
13-Aquamarine

How to add WTPart as a child to Parent part in Part Structure Browser without iterating parent part

I have a requirement where if I add a specific type of WTPart to existing Part in Part structure using OOTB actions "add existing"/"add new", the Parent part to which I want to add child part should not iterate.  For this I have implemented listener and catch the PRE_STORE event and could found the target object which is WTPartUsageLink. From this I got both  roleA and roleB objects, and then I undo check out the roleA (parent) and then created an usagelink and finally tried to save it using PersistenceHelper.manager.insert() API

Here the issue is probably in back end after PRE_STORE , there is PRE_CHECKIN event that might be calling so I am getting exception that unable to find the checked-out copy. Here there will not be any working copy because I undo check out it using WorkInHelper.. API. 

My overall intension is that parent part should not iterate but need to create usagelink by adding a  child part (of specific type).

 

Note: This I need only when I am trying to add a specific type of part which will not involve any release. I have an option in my mind of creating custom action followed by implementing custom Form Processor, however, I want to know the feasibility of using existing OOTB actions by implementing listeners.

Can anyone help me out for this? Thanks in advance 

12 REPLIES 12
TDT
15-Moonstone
15-Moonstone
(To:AKC)

Hi @AKC,

At first place why the parent part shouldn't iterate?

AKC
13-Aquamarine
13-Aquamarine
(To:TDT)

Hi @TDT ,

 

The part which we would like to add in part structure is of specific type which will not be go for production release to any plant. This is just to add some information to existing parent part. So I just want to know the feasibility if we can achieve this with OOTB actions itself 

Fadel
22-Sapphire III
(To:AKC)

Without iterating is against Windchill specs, he only way is to go through SQL and do an insert into WTPartUsageLink

 table, but this not really supported .

Fede

@Fadel ,

 

I just wrote code using only APIs (no SQL dB insert was used) to add a Part to structure without iterating the parent part.

Here's parent part before. Note version A.1

d_graham_0-1748624205880.png

 I run code in Windchill shell.

d_graham_1-1748624891522.png

 

I refresh structure page and we see

0000000034, test 1, A.1 now uses 0000000035, test 2, A.1

 

0000000034, test 1, A.1 was NOT iterated.

d_graham_2-1748625030660.png

 

AKC
13-Aquamarine
13-Aquamarine
(To:d_graham)

Hi @d_graham ,

 

Could you please explain the process you followed to achieve this?

d_graham
18-Opal
(To:AKC)

I did get this to work in the UI using only supported APIs. No SQL was used.

I used the Insert Existing option and added a new part without iterating the parent part.

 

d_graham_0-1748779818771.png

I add the new part.

d_graham_1-1748779994376.png

 

Then I refresh the page, and we the new part is in fact added to the structure of A.1. 😊

So, it is doable to add a new part to structure in the UI without iterating the parent part.

d_graham_2-1748780112279.png

 

 

 

Fadel
22-Sapphire III
(To:d_graham)

Is the part automatically checked in as A.1 , if yes this a BUG , the A.1 may be already sent to ERP with 1 usage link , and adding another usage with no iteration may create inconsistencies between PDM and ERP ,

Fede

No, it is NOT automatically checked in as A.1.

@AKC wants to add a child part to the part’s structure without iterating the part. That’s exactly what I did.

Fadel
22-Sapphire III
(To:d_graham)

I don't really follow you , initially the part was A.1 checked in , then insert existing checks the A.1 out second screenshot .

then on the third on we have  2 usages and A.1 checked in ,I'm not sure how you got A.1 back checked in without moving to A.2 ?

Fede
HelesicPetr
22-Sapphire II
(To:Fadel)

Hi @Fadel 

He just used some API that exists and you can add the usage link without iterating the parent.

But it is a developer's know-how or trick :D. As @d_graham said. It is doable.

PetrH   

@Fadel ,

 

@HelesicPetr is correct.

It’s a trick I developed when I first had a request to do whatever without iterating while still using supported APIs.😁

anursingh
Moderator
(To:AKC)

Hi @AKC,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag

Announcements
Top Tags