If we are talking about native .prt files (not working with NX connected to Teamcenter or some other PLM software), then this would be done with operating system commands. If you are using a .net language, an example can be found here: https://msdn.microsoft.com/en-us/library/system.io.file.setattributes%28...
I'm not sure if it is necessary, but I'd suggest closing the part before changing the "read only" attribute.
re: make file read only
If we are talking about native .prt files (not working with NX connected to Teamcenter or some other PLM software), then this would be done with operating system commands. If you are using a .net language, an example can be found here:
https://msdn.microsoft.com/en-us/library/system.io.file.setattributes%28...
I'm not sure if it is necessary, but I'd suggest closing the part before changing the "read only" attribute.