(1) Ruby uses 2 space indents, not 4.
(2) Your code blocks, classes and methods are not indented properly.
(3) faces = sel.select{|e| e.typename == 'Face'}
Do not use #typename
, it is SLOW! … Use:
faces = sel.grep(Sketchup::Face)
Most SketchUp collection type classes have the Enumerable
module mixed into them. (This is where the #grep
method comes from.)
(4) Do not use global variables. Use @@menu_loaded ||= false
at top of your extension module instead of a $Vetrate_menu_loaded
global variable. Then set it true after the menus have been loaded.
(5) Use an outer company module and an inner extension module.
Read the guidelines …
Data is saved into Attribute Dictionary objects. Parametric code should do this for you.