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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Check higher versions for Assembly components

aazkue
11-Garnet

Check higher versions for Assembly components

Hello,

 

We have an application in Java to check, before saving a model in CREO, if a higher version of the model exists, preventing saving in case it exists.

 

It works for the active model. But if the active model is an assembly, and if a component has been modified, when saving the assembly, it checks the assembly’s version, but doesn’t control the versions of the components.

 

I would like to know how to control the components’ versions.

 

This is what we use for the model:

 

import com.ptc.pfc.pfcGlobal.pfcGlobal;
import com.ptc.pfc.pfcModel.Model;
import com.ptc.pfc.pfcSession.Session;

Session curSession = pfcGlobal.GetProESession();

Model model = curSession.GetCurrentModel();

 

Best regards,

Amaia

3 REPLIES 3

You need to traversal thru all sub-assemblies and parts and check it.

The component (sub-assy or part) is a feature (model item) of the assembly.

You can get components by pfcModelItem.ModelItemOwner.ListItems 

Thank you for your information.

Finally I modified the program and could check every component.

RPN
17-Peridot
17-Peridot
(To:aazkue)

Rather to traverse a whole assembly structure and waste CPU Time, you may think about to use the PRO_MDL_SAVE_POST_ALL notifier, which may give you exactly the models you are looking for. In that case, because of post, delete it 🙂

 

Top Tags