How to edit/create extensions?

advice

#1

I was searching the API docs, but did not find an easy intro to creating extensions…
I guess there must be a beginners tutorial out there, but i did not find it.
Q0:
Is there a “How to” on geting started with editing/creating plugins?

What i tried:
Edit thomthom’s plugin ‘Make Named Group’ so that the focus would be on the name field vs. the layer select.
The API doc had no hint on how to set focus, so i guessed the last element would get it, so i edited the code accordingly.
Q1:
Is that assumption correct?

But installing the edited plugin, i still saw the old behaviour.
With a lot of trying around, i got into some state of inconsistent infos about what’s installed/enabled:

Q2
Can extensions be un/re/installed by just dropping them in the /user/appdata/roaming… directory?
Q3
Under window>preferecnes>extensions i can only disable extensions, not uninstall?

In the Ext.Warehouse, i can uninstall.
Q4
Does it matter how i un/install? Warehouse, preferences, (sketchucation store), …

After not being able to edit, i guessed it might be the file extension_info.txt that contains some kind of id/hash, that did prevent my edit to work… but i found no info on that file.
Q5
What does extension_info.txt do?


Add an option for easy immediate group-naming after creation
#2

Generally speaking, the days of suggesting “file dropping in the ‘Plugins’ folder” ended with the release of SketchUp 8 Maintenance Release 2 (on 2011-01-12.)

SketchUp Application Release Notes said:

  • This version of SketchUp has a simple UI to install and upgrade Ruby extensions.

  • .rbz file format: Ruby extensions typically consist of several files, so Ruby developers had to zip up those files into a standard .zip file and then give their users instructions on how to unzip them and where to place them. Now developers can zip up the files into the .rbz format and users can easily load an .rbz by going to Preferences > Extensions and clicking the “Install Extension” button.

A RBZ archive is simply a renamed ZIP file.


That said if you are a programmer, and understand how SketchUp iterates certain folders at startup, and how ruby loads code files, then yes you can copy edited files (and folders) into the “plugins” folder.

And sometimes “in a pinch” when just testing something quickly, coders will actually do this.

But this is usually NOT what programmers do for an extension project. They usually create a little Ruby script that points to their code repo folder, and they do their editing there outside the %AppData% path, usually somewhere in their “Documents” path. They do this because often they use GitHub or BitBucket to manage their code projects, and these require a local project repository that is synchronized with the repository online.
Another reason is, that each version of SketchUp has it’s own “Plugins” folder, and having multiple versions of your code (in each “Plugins” folder whilst under development) can cause mistakes. (Extension developers usually have 3 or more SketchUp versions installed for testing and support. [I currently have 4 versions installed on my coding notebook.])

So, in this “little” coder’s project awareness script, saved into each SketchUp version’s “Plugin” folder …

… You can push a path for where your various “repo” sub-folders reside, into the SketchUp Ruby environment’s global load path array:

$LOAD_PATH << File.join( ENV["HOME"], "Documents", "Ruby", "Projects")

Then you can load the extension loader script via a simple require statement:

require "sirtet_someplugin.rb"

And Ruby will search each path in it’s $LOAD_PATH array, for the file named “sirtet_someplugin.rb” and if it’s in the project path that you pushed into the array, Ruby will find it, and load it. (And it in turn should load the rest of the extension’s files, of whatever kind.)

Or you can treat the entire “Projects” folder as an alternate “Plugins” folder, by using the global require_all() method defined in “Tools/sketchup.rb” (the “Tools” folder is a sub-folder of the SketchUp program folder.)

projects = File.join( ENV["HOME"], "Documents", "Ruby", "Projects")
$LOAD_PATH << projects
require_all( projects )

#3

First of all, you need to learn standard core Ruby, before you can effectively use the SketchUp API which extends Ruby for use with SketchUp. Ie, The SketchUp API documentation is not a teaching document, it is a technical reference.

See my wikilist, in this category for resources:

… which lists:

Read this on how extensions should be organized for the Extension Warehouse (or generally valid for the SketchUcation PluginStore, but they may have a few different rules):
http://extensions.sketchup.com/en/developer_center/ew_developer


This kind of question is best asked more specifically, by posting a specific code snippet, so readers know what your asking about. The way it is now some reader would need to be intimately familiar with this specific plugin. Also, when speaking of a particular plugin, give a link to it’s GitHub repo, or EW page, etc. If it is only a posted example, give the link to the forum thread in you question post.
So I and other readers are not interested in hunting down what it is your speaking of. You need to understand that there are thousands of plugins, and tens of thousands of code snippet postings on the web.


Correct. This dialog panel is for toggling extensions once they are already installed.

Browse, Install and Uninstall are features of extension / plugin store extensions. (Trimble EW, SketchUcation PluginSotre, etc.)


Yes IF you have opened the EW from INSIDE SketchUp, and it is loaded in a child browser frame, you can browse, install, update and uninstall, from this child browser window.

But not if you open the EW website in an external browser.

This question is unclear. IF you are asking if you can uninstall in multiple ways, then yes. If extension manager extensions have a uninstall available for a installed extension you can use it.

However there may be limitations. The EW may only be able to uninstall those extensions that it itself had installed. The SkecthUcation PluginStore extension may also have the same limits. (You’ll have to read the instructions.)

If you manually install an extension, then eventually you may need to uninstall by manually deleting the extension registrar script and it’s extension sub-folder (which usually have the same name.)


It identifies each particular extension and it’s current version, to the Extension Warehouse server.

This is needed for notifying of updated versions, license management (for paid plugins) and for uninstalling, etc.


#4

A post was split to a new topic: EP Fastener Extension … problem