NAT_Comand_CADtoSUcorquerbz.rbz (995.1 KB) NAT_Comand_CADtoSU.rbz (982.5 KB)
this file Encryption is "NAT_Comand_CADtoSUcorqerbz.rbz
this file origin is "NAT_Comand_CADtoSU.rbz
-I encode my rbz file and import it into sketchup giving me an error
"Extension Errors Report
SketchUp: 25.0.571
OS: Windows 11
Ruby: 3.2.2
In the extension registrar file (NAT_Comand_CADtoSU.rb,) … REMOVE these lines:
# Xác định đường dẫn đến folder chứa loader
plugin_root = File.dirname(__FILE__)
loader_path = File.join(plugin_root, 'NAT_Comand_CADtoSU', 'NAT_Comand_CADtoSU_loader.rb')
# Load mã chính
load loader_path
Sketchup::register_extension will load your extension’s loader file, IF the user has it switched ON in the Extensions Manager. Since you passed true as the 2nd argument, it will be loaded the first time when extension is installed.
# Load các file chức năng
Dir.glob(File.join(PLUGIN_ROOT, '*.rb')).each do |file|
next if File.basename(file) == File.basename(__FILE__)
load file # <<-----<<<< WRONG!
end
Change load file to: Sketchup.require(file) so that it is (Corrected globing):
# Load các file chức năng
Dir.glob(File.join(PLUGIN_ROOT, '*.{rb,rbe}')).each do |file|
next if File.basename(file) == File.basename(__FILE__)
Sketchup.require(file)
end
My file “NAT_Comand_CADtoSU_loader.rb” is used to create menus, toolbars and run files located in the folder with “NAT_Comand_CADtoSU_loader.rb”. When encryption is complete, the file “NAT_Comand_CADtoSU_loader.rb” changes to “NAT_Comand_CADtoSU_loader.rbe” so does it count as I have encrypted the registration file?
Actually, you also need to glob rbe files since they are encrypted:
# Load các file chức năng
Dir.glob(File.join(PLUGIN_ROOT, '*.{rb,rbe}')).each do |file|
next if File.basename(file) == File.basename(__FILE__)
Sketchup.require(file)
end
I deleted "# Specify the path to the folder containing the loader
plugin_root = File.dirname(FILE)
loader_path = File.join(plugin_root, ‘NAT_Comand_CADtoSU’, ‘NAT_Comand_CADtoSU_loader.rb’)
Load main code
load loader_path’ in "NAT_Comand_CADtoSU.rb and replace “# Load function files
Dir.glob(File.join(PLUGIN_ROOT, ‘*.{rb,rbe}’)).each do |file|
next if File.basename(file) == File.basename(FILE)
Sketchup.require(file)
end” in “NAT_Comand_CADtoSU_loader.rb” and re-encrypt it then when I enter into sketchup there is still no error and clicking on the icon nothing happens, I’m a newbie so I really don’t know how to encrypt the file properly.