Skip to main content
11-Garnet
February 22, 2024
Question

Check higher versions for Assembly components

  • February 22, 2024
  • 1 reply
  • 1157 views

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

1 reply

17-Peridot
March 5, 2024

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 

aazkue11-GarnetAuthor
11-Garnet
April 4, 2024

Thank you for your information.

Finally I modified the program and could check every component.

RPN
18-Opal
April 5, 2024

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 🙂