Plugins Drop Down menu is wrong
-
I have a lot more rubies than I usually need. Whatever I don't use, I just rename the extension of so they don't clutter my Plugin menu that much. When I need them, just rename them back.
-
@gaieus said:
I have a lot more rubies than I usually need. Whatever I don't use, I just rename the extension of so they don't clutter my Plugin menu that much. When I need them, just rename them back.
Sounds like a smart plan
-
I suppose you could also use the organizer ruby available from Smustard to help order your plugins.
-
Anybody programming Sketchup extensions should use the Extension class. A good way to program an extension with this class could be: Use a "loader", which should be saved directly to the Plugins / Tools directory. In this file you set up your Sketchup extension. Put your Sketchup extension code to another file in a subfolder of the Plugins / Tools folder. If you would put it diretly to Plugins / Tools, it would be loaded automatically. But with the subfolder and the Extension Ruby class Sketchup can decide whether to load your Sketchup extension. This is needed for extensions, which can be switched on and off via menu "Fenster > Voreinstellungen > Erweiterungen" (should be: "Window > Preferences > Extensions"). Switching off extensions take effect after a Sketchup restart. This way you do not need to edit the file name of the Sketchup extensions as Gaieus mentioned.
Code for the "loader":
require 'sketchup.rb' require 'extensions.rb' filename = File.basename(__FILE__) if(not file_loaded?(filename)) ext = SketchupExtension.new "EXTENSION NAME", "SUBFOLDER/FILE.rb" ext.description = "DESCRIPTION" ext.creator = "YOUR NAME" ext.copyright = "COPYRIGHT" ext.version = "VERSION" Sketchup.register_extension ext, true file_loaded filename end
azuby
-
@azuby said:
Anybody programming Sketchup extensions should use the Extension class. A good way to program an extension with this class could be: Use a "loader", which should be saved directly to the Plugins / Tools directory. In this file you set up your Sketchup extension. Put your Sketchup extension code to another file in a subfolder of the Plugins / Tools folder. If you would put it diretly to Plugins / Tools, it would be loaded automatically. But with the subfolder and the Extension Ruby class Sketchup can decide whether to load your Sketchup extension. This is needed for extensions, which can be switched on and off via menu "Fenster > Voreinstellungen > Erweiterungen" (should be: "Window > Preferences > Extensions"). Switching off extensions take effect after a Sketchup restart. This way you do not need to edit the file name of the Sketchup extensions as Gaieus mentioned.
Code for the "loader":
require 'sketchup.rb' > require 'extensions.rb' > filename = File.basename(__FILE__) > if(not file_loaded?(filename)) > ext = SketchupExtension.new "EXTENSION NAME", "SUBFOLDER/FILE.rb" > ext.description = "DESCRIPTION" > ext.creator = "YOUR NAME" > ext.copyright = "COPYRIGHT" > ext.version = "VERSION" > Sketchup.register_extension ext, true > file_loaded filename > end
azuby
I have great respect and admiration for you (as Gaius put it "Ruby Guru's") and
I mean this with the utmost respect, but what is all this in layman's terms, as a fairly new user this seems way over my head, but, if understood, could be very usefull..Philip
-
There's nothing special with programmers
You also can become one of us
Here's your first attempt:
Choose one of the Ruby scripts in your Sketchup Plugins / Tools folder, which you do not need often. Copy it to the Desktop (to be able to restore it later). Now create a folder in the Plugins / Tools folder; i.e. the choosen Ruby script was "abc.rb" it's clever to name the folder "abc" Move the "abc.rb" into the new folder. Create a new text file (with Notepad) in your Plugins / Tools folder, maybe "abc.rb", but better "abc_loader.rb" (or "the_simpsons.rb"
). Copy the code I wrote down to that file AND replace the upper-cased terms. In the "abc" case it could be:
require 'sketchup.rb' require 'extensions.rb' filename = File.basename(__FILE__) if(not file_loaded?(filename)) ext = SketchupExtension.new "Philip's ABC Plugin", "abc/abc.rb" ext.description = "Philip's ABC Plugin is just an example on how to program Sketchup Ruby extensions." ext.creator = "Philip" ext.copyright = "Oh well, ask me again in some years..." ext.version = "47.11" Sketchup.register_extension ext, false file_loaded filename end
Save the file, (re-)start Sketchup, look into the Preferences I mentioned in my last posting. The "true" / "false" in the third-last line says Sketchup: Do not load this extension by default. So the checkbox for the extension in the Preferences isn't checked.
azuby
-
@azuby said:
There's nothing special with programmers
You also can become one of us
Here's your first attempt:
Choose one of the Ruby scripts in your Sketchup Plugins / Tools folder, which you do not need often. Copy it to the Desktop (to be able to restore it later). Now create a folder in the Plugins / Tools folder; i.e. the choosen Ruby script was "abc.rb" it's clever to name the folder "abc" Move the "abc.rb" into the new folder. Create a new text file (with Notepad) in your Plugins / Tools folder, maybe "abc.rb", but better "abc_loader.rb" (or "the_simpsons.rb"
). Copy the code I wrote down to that file AND replace the upper-cased terms. In the "abc" case it could be:
require 'sketchup.rb' > require 'extensions.rb' > filename = File.basename(__FILE__) > if(not file_loaded?(filename)) > ext = SketchupExtension.new "Philip's ABC Plugin", "abc/abc.rb" > ext.description = "Philip's ABC Plugin is just an example on how to program Sketchup Ruby extensions." > ext.creator = "Philip" > ext.copyright = "Oh well, ask me again in some years..." > ext.version = "47.11" > Sketchup.register_extension ext, false > file_loaded filename > end
Save the file, (re-)start Sketchup, look into the Preferences I mentioned in my last posting. The "true" / "false" in the third-last line says Sketchup: Do not load this extension by default. So the checkbox for the extension in the Preferences isn't checked.
azuby
Hi azuby
I had a go at this, (I still have a bit to learn
), but I will keep plugin till it sinks in
-
There's been some previous discussion on where to load scripts. The previous consensus was to locate things in the Plugins folder, and leave the Tools folder for SU internal files. I understand about the ability to load/unload things using extensions, but it adds a layer of complexity for some users who would be better served with other solutions.
-
Well, if you think, renaming script files is more user friendly against a simple checkbox ... go on
(especially for user not beeing admin on their machine). They won't "feel" the "layer of complexity" if programmers would switch-on their -> extensions by default. Using "Tools" and/or "Plugins" folder seems to be a secret of Google and should be less important to users.
azuby
-
Just commenting that there had been previous discussion, and what it entailed.
The "other solutions" implied Organizer, not renaming or relocating files. -
I spoke about Gaieus' idea of renaming files for disabling their contained Ruby plugins some postings before - not about the Organizer (because we know what wents wrong with the Menu class and so on). A Plugins (or Tools) menu with 4711 entries communicates to me: "The user has very, very, very complex modells and really needs all these plugins" or "The user thinks, the plugins might be useful, but he has resigned and accepts, that his Sketchup isn't really slim as it could be" And I think, each developer should care about his "victims"
that they have as much comfort as possible. That's the reason why I support the idea of exceptions instead of having "only" "scripts" Most of our "scripts" are tools and plugins (and all in all: extensions), so we should provide them this way.
azuby
-
I don't think we disagree about anything. I may have misread one of your posts, thinking you were saying to put downloaded .rb files into the Tools folder, and that's what prompted my first post here. If you didn't mean to say that, then my comment was irrelevant.
Regards,
Advertisement