Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
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
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.
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 🙂