I have just recently gotten into coding with ruby and sketchup and wrote myself a small code (see below). I manually installed it using the Extension Manager, after having changed .txt to .rb, placing it in .zip file and changing to .rbz.
After having installed extension, it came up as signed in the Extension Manager. Anyone able to explain why?
Well, renaming the file makes it unsigned, but shouldn’t it be a bit more difficult than that to hijack a signed object? I haven’t installed an extension named box before, either, in case that’s what you meant?
I realise from the posts I’ve read that signed and unsigned doesn’t really make much difference, its just there for Trimbles legal protection, but really?
The name of the RBZ is unimportant - it’s the file names it contains…
Is the RB named ‘box’ or ‘linefromto’ ?
The menu adding code checks for the latter name and prompts for a line not a box !
Since the code tries to draw a box I expect the former ?
Your post is unclear…
It is odd either way, because when [‘box’ or] ‘linefromto.rb’ loads SketchUp searches for a subfolder named [‘box’ or] ‘linefromto’, this contains at least the signed files [hash etc], if it’s not found it reports it as unsigned, if the files exist then the RB should be checked against the hashed data and if it doesn’t match then the signing is reported as ‘broken’ [invalid], or perhaps out-dated.
If there’s a full match it says ‘signed’.
Unless by some miracle your code matches some other code, which was signed by someone else and its subfolder is named to match your RB etc then it should not report as being properly signed ??
What does your Extension Manager show exactly ?
I’d guess signed but invalid, and there’s a subfolder in your Plugins subfolder with a matching name and mismatched hash files etc…
Your code is also very muddled, as the command run by the menu item ‘shed_size’ is undefined.
Whereas ‘box’ is defined and the prompt doesn’t match either…
You really ought to nest your own code inside your own module, named say “Poyda”, e.g.
module Poyda
def self.box()
###your code goes here
end
unless file_loaded?(__FILE__)
UI.menu("Draw").add_item("Draw a Box") { self.box() }
end
end#module Poyda
To run in the Ruby Console you’d use
Poyda.box()
You could even add sub-modules, like this
module Poyda
module Draw
### your own methods
def self.box()
### etc
end
### set up menu here
end#module Draw
end#module Poyda
To run in the Ruby Console you’d use
Poyda::Draw.box()
This allows you to have several methods named ‘box’ used by different sub-modules… like Draw, Scale, Color etc…
Ahah!
So having two loading RB files [in different loading folders] using the same RB name sidesteps the [useless!] signing-checks…
Probably something that SketchUp needs to address…
The first one has valid signing, the second one doesn’t…
Surely the second-loading RB should be barred from loading at all ?