Bcc.EncryptBcPstFile(org_post_file_location, encrypted_post_file_location, {customer_id = {ids}, license_id = {ids})

Description

This function is utilized to encrypt a post processor through the use of a Lua plugin. Commonly used to encrypt specific Scripting Blocks in the post processor.


Note: Make sure you set your encrypted data areas in the orginal post processor first before running this function. For example, use the syntax <--BEGIN ENCRYPT on the line above where you want the encryption to start and <--END ENCRYPT below the line where you want the encryption to stop. 

Parameters

  • org_post_file_location – The location and name of the target post processor to encrypt
  • encrypted_post_file_location – The location and name of the encrypted post processor to be placed when complete
  • customer_id – A table with a list of the customer IDs for who can use the encrypted data
  • license_id – A table with a list of the customer IDs for who can use the encrypted data


Return

Returns a Boolean type value, indicating the encryption succeed or failed.


BobCAD Version Added: BobCAD-CAM V38, BobCAM for SolidWorks V13


Examples


-- Example 1 

-- Create an encrypted BC_3x_Mill.BCPst for use with customer IDs 1234, 4321 and license IDs 35912217,5678, 8765. Then, place the encrypted post processor in a specific folder location and choose a name (eg. BC_3x_Mill_Encrypt.BCPst)

local ret = Bcc.EncryptBcPstFile("C:\\BobCAD-CAM Data\\BobCAD-CAM V38\\Posts\\Mill\\BC_3x_Mill.BCPst", "C:\\BobCAD-CAM Data\\BobCAD-CAM V38\\Posts\\Encrypt\\BC_3x_Mill_Encrypt.BCPst", {customer_id = {1234, 4321}, license_id = {35912217,5678, 8765}})


-- Example 2

-- Create an encrypted BC_1T_2S_Y.BCPst for use with customer IDs 1234, 4321 and license IDs 35912217,5678, 8765. Then, place the encrypted post processor in the "Encrypted Post" folder and keep the same name. If the plugins fails to encrypt the post, notify the user that the Post Processor failed to encrypt.

full_post_name = "BC_1T_2S_Y.BCPst"

customer_id_table = {1234, 4321}

license_id_table = {35912217,5678, 8765}

orginal_post_file_location = Bcc.GetDataFolder().."Posts\\MillTurn\\" .. full_post_name

encrypt_post_file_location = Bcc.GetDataFolder().."Encrypted Post\\Posts\\MillTurn\\" .. full_post_name


-- Replace single backslashes with double backslashes

orginal_post_file_location = string.gsub(orginal_post_file_location, "\\", "\\\\")

encrypt_post_file_location = string.gsub(encrypt_post_file_location, "\\", "\\\\")


local ret = Bcc.EncryptBcPstFile(

    orginal_post_file_location, 

    encrypt_post_file_location, 

    {customer_id = customer_id_table, license_id = license_id_table}

)

if ret == false then

    Bcc.ShowMessageBox("Error: Failed to encrypt the Post Processor.")

    return

end