Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Version: Windchill 12.1
Use Case: I'm trying to create a rule on OIR to number CAD files based on the folder.
Every folder holds files from a different project and my company wants to number then with a specif prefix and have a new sequence for each folder.
Description:
The rule I've written is the following:
In this code the product context is Treinamento, the folder is PJ123 and the number sequence is PJTESTE that I've created for this folder.
This code is to test in which folder it is been created. Further conditions I will create after the folder condition is working.
<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Value algorithm="wt.rule.algorithm.CaseBranch">
<Value algorithm="wt.rule.algorithm.StringInListTest">
<Attr id="folder.id"/>
<Arg>PJ123</Arg>
<Arg>/PJ123</Arg>
<Arg>./PJ123</Arg>
<Arg>Treinamento/PJ123</Arg>
<Arg>/Treinamento/PJ123</Arg>
<Arg>./Treinamento/PJ123</Arg>
<Arg>TreinamentoPJ123</Arg>
<Arg>*/PJ123</Arg>
<Arg>/Default/PJ123</Arg>
<Arg>/Default</Arg>
<Arg>/Default/PJ123*</Arg>
<Arg></Arg>
</Value>
<Arg>0123-</Arg>
<Arg>not123-</Arg>
</Value>
<Arg>{GEN:wt.enterprise.SequenceGenerator:PJTESTE:4:0}</Arg>
</AttrValue>
I've used StringInListTest validation just for track what names for folder I've tried.
The rule is not validating the folder. When I'm creating a CAD file in the folder PJ123, in any other folder and in the root the file is named not123-XXXX.
Does anyone know why it's not working?
Also, as far as I tested the validation to prefix selects either the first value or second, if I need to add the custom sequence how would I do it? I understand that I can't just add the number sequence with the prefix, as the following example:
<Arg>not123-{GEN:wt.enterprise.SequenceGenerator:PJTESTE:4:0}</Arg>
Solved! Go to Solution.
So the solution I've found is either make a listener or a custom class. I didn't had the time to try any, but I'm positive they will solve the problem.
Try to get the folder path with the wt.rule.algorithm for that purpose https://www.ptc.com/en/support/article/CS20230
I've tried that, but then it just ignores the numbering rule and name the files as the default (e.g. PRT0001.PRT)
The code modified below:
<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="wt.rule.algorithm.StringEqualsTest">
<Value algorithm="wt.rule.algorithm.GetFolderPathAlgorithm">
<Attr id="folder.id"/>
</Value>
<Arg>/Default/PJ123</Arg>
</Value>
<Arg>0123-</Arg>
<Arg>not123-</Arg>
</Value>
<Arg>{GEN:wt.enterprise.SequenceGenerator:PJTESTE:4:0}</Arg>
</AttrValue>
When removing only GetFolderPathAlgorithm, and leaving only <Attr id="folder.id"/>, the code runs and returns a negative for every file.
Also tried to look on the Javadoc for windchill 12.1 and didn't find GetFolderPathAlgorithm class there.
The article that your pointed says it's is for Windchill PDMLink 9.1 M070 to 10.0 M020, maybe it's not part of 12.1 anymore.
I've also tried to write the folder path to an attribute the result was nothing, like there was nothing there.
Hi @VR_4000
You're right, the class wt.rule.algorithm.GetFolderPathAlgorithm does not exist in Windchill 13.0+
You can write own.
PetrH
Maybe someone using that version can share it so we can give it a try?
Hi @VR_4000
I have experience, that during the upload CAD file information about the folder is missing in the method.
I tried to solve it with PTC and I've given up because it is internal sw problem that you can not involve.
My case was that a customer wanted to place a CAD to a folder based on some IBA attribute, but the information was not provided in the condition method during upload or checkin operation from the Creo.
I wrote own method and debug it very deeply and carefully and I found that the condition input does not contain the information about the object and it is problem in any OID conditions.
So I guess it would be similar issue in your case.
I solve the users needs by creating listener that moves the new object to correct place folder.
You could do it with renumbering.
PetrH
Just to making sure I understood you right, the folder.id value is not accessible from a OIR, right? And that's why I can't do what I trying to.
And how did you made that listener?
Hi @VR_4000
Actually I described a little bit different issue, but yours seams it is almost same.
Yes I guess that during the check algorithm the method does not contains the correct input from the folder.id
In one specific operation - check-in.
If I upload the CAD the OIR algorithm worked without any issue, but if I check-in the CAD Document then the OIR algorithm is called again, and that moment the input does not contain the correct information about the attribute.
I guess that the main point can be that the path is not really stored in a database that moment and it needs more deep investigation.
Listener is coding customization that can be found in a Customization guide.
CS213788 - How to create a Listener in Windchill PLM
Windchill 13.0.2.0 Customization Guide
PetrH
So the solution I've found is either make a listener or a custom class. I didn't had the time to try any, but I'm positive they will solve the problem.