Please review the SketchupExtension
class. It needs each plugin (extension) to be in it’s own sub folder of the user “Plugins” folder.
This way the user can switch extensions on or off using the Extension Manager dialog.
You do not need to do this for every file or extension as these files are loaded by SketchUp just after it loads Ruby core, and before it begins to load any extensions.
The classes need only be loaded before making the call. You are calling a class that is in memory, not actually from a file.
The last statement has not problem accessing the Class1
object, but does not do anything with it.
Classes are meant to be instantiated. So you create an instance such as …
module MajidMahmoudi
module Main
class Main
@instance1 ||= MajidMahmoudi::Plugin1::Class1.new
end
end
end
You are asking basic Ruby programming questions.
Please read some of the Ruby books that are available free.
This block is missing it’s closing end
, and internally has incorrect indentation for the {
… }
block.
Also, this is run once at load code that should be within a module, not a class.
But the “main” issue (pub intended) is that you are creating an instance of a class from within that same class itself. This would be a vicious circle. You would create the instance from outside a class definition.