If I’m not mistaken and from what I read here in the forum, there is no method of blocking a 3dm file by password,
Ok, I need to lock a file, so I thought of a method to do it, (I just need to block a file when using my plugin)
The principle is very basic:
1ºCreate a SetDocumentData “password” with the “password chosen”
2º On “RhinoDoc.EndOpenDocument” check the SetDocumentData “password”
if password match then open document, if not match close document
Although it is a very corny method, it works and does not let open any document that has password.
I make some testes, and the problem is open by the spash screen on rhino startup, it seems to me that when opened here events “RhinoDoc.EndOpenDocument” are ignored.
Rather than do something in a RhinoDoc.EndOpenDocument, why don’t you just want until the use uses one of your commands? You could maintain a flag on your plug-in and only ask when the flag is unset.
You could also pack the 3dm inside an password protected archive, optionally giving it a „unique“ file ending and making your plugin the „only“ (obvious) way to extract the archive. That makes it at least a little bit more secure, because its at least encrypted then. But in case you store the password/key locally you won‘t get any true security at all. But yes, its for the average joe, so it will work good enough🙂