Encrypt PythonPart script

As of Allplan 2022-1, it’s possible to encrypt the py-files. The encrypted files are unreadable and allow to protect the source code for a created PythonPart.

The encrypted files are given the extension pye and are used if no py file is available. Instead of the py files the pye files can be delivered to the client of the PythonPart developer.

The encryption of the py files can be executed by the PythonPart EncryptPythonPartScript, located in \etc\Examples\PythonParts\ToolsAndStartExamples.


../../_images/EncryptPythonPartScript.png

The encryption can be executed for a single file or a directory. If a directory is selected, the files from the sub directories are also encrypted. The sub directories are created in the target directory, if they don’t already exist there.

Testing the PythonPart using the encrypted file(s) can be done as follows:

  • create a directory xxx_Encrypt with xxx is the location of the py file(s)

  • create the pye file(s) with the PythonPart EncryptPythonPartScript

  • temporary modify the <Name> tag in the pyp file by using xxx_Encrypt

  • execute the PythonPart