I'd like to be able to lock certain files in a Creo Parametric session similar to how the Windchill workspace lock works. However, Windchill will not be used. The make features read only function doesn't provide complete functionality in stopping the user from modifying the models models. The list of models to "lock" would likely be a simple .txt, .csv, or similar file, and the user could manually lock a model, on the fly so to speak, in session via a menu pick.
So far, most of our "customizations" haven't used toolkit, but we're getting to the point where we can't do what we want without it.
1) Look at Toolkit User's Guide Event-driven Programming: Notifications. You can abort save file operations
2) Using MS Windows functionality to set file property Read only
Thanks for the suggestions, however, those options will only prevent the model from being saved. I was looking to prevent the user from making any model changes in the first place.
The functionality I'm looking for already exists when using Windchill. I was hoping PTC had the functionality within the Toolkits that would allow files to be locked without Windchill.
Even a read-only file in a Creo session from Windchill can be modified in the Creo session by changing the flag and allowing the changes. The user will still be prevented from checking-in or saving the changes, but nothing prevents them from doing a Save-As to another filename and/or location.
What do you mean by "changing the flag"? Are you referring to the user un-locking the file via the FILE > MANAGE FILE > LOCK command (which acts as a lock/unlock toggle)? If so, the user can certainly modify and save the file to their local WS since it's now unlocked in their local WS. It will show in their WS as locally modified, but not checked out.
If we could get a file lock to work in Creo Parametric without Windchill, the Save-As doesn't bother us because the user's files would have a new filename, and the existing data is still unchanged. Hopefully the users don't shoot themselves in the foot and do a Save-As on everything with a suffix of "_". We cannot cure stupid.
The file backup may not be an issue either, since our thoughts were controlling which files are locked based on the filename in a masterlocklist.txt file (or similar file), not from where the file was opened. If the user tries to backup a file in hopes of being able to modify the backup file, the toolkit would still "lock" the backup file because it's filename is in the lock list.
There is only so much we can do with the basic file control config.sup options (below), OS ACLs, and detailed instructions/procedures.
Overall, we're looking for methods for better and simple file management without a PDM system. The file lock in Creo Parametric capability would certainly be of help in preventing unwanted changes.
I would look at setting all the released files into a set of directories that are set to read-only. The work would all be done in a group/individual folder and search paths to control the retrieval. Simple enough to have a program watch the work folder and delete anything that is on the big 'delete list' so that even if someone saves an item there it doesn't stay long.
When the time is right, the desired items are moved to the read-only folder as appropriate by the admin, possibly by having the users move the files first to a 'ready' folder where the Admin can validate they open and operate correctly.
Users can change things all they want, but it will do no good. Back to square 1 the next time they start, except for the parts they are supposed to work on.
Other than that, there's a reason companies spend the money for Windchill - to avoid the hassle of do-it-yourself solutions. I wish they had a cheaper version that just did the simple file locking as you are looking to do, but I can already feel feature creep starting a buildup back to Windchill level requirements.
But if the users can't save the file, it is really mattered did they can make changes or not?
Another way: it is possible to set Readonly status to all model features ProFeatureReadonlySet. But, users can clear this status manually Model - Operation -Read Only. So, need find the way to catch modification events and set the status once again if this status was cleared by user. For example, using Event-driving programming: Model and Feature Modification Events. This is just thinking out loud.