On the incorrect loading of the official "htmldialog-examples"

sketchup

#1

Hello everyone! I’m from China and I’m glad to be here. I’ve only recently come into contact with ruby plug-ins. It’s not long before I get into touch with them. So the following questions may seem childish to you. Okay, please forgive me. Thank you!

The problem lies in:
I downloaded an “htmldialog-examples” template from github, but I found that I placed it directly under the “Plugin” folder and opened SketchUp and found that the plug-in could not be loaded. So I had to write a script to load it, but it failed in the end. Can you help me solve it?

Here’s my load script, but I don’t know what the problem is.


HtmlDialog Examples.rb (358 Bytes)


#2

Hello you all,
its very difficult to me to start with html dialogs. I found some examples but I was not able to install them. Especially the above mentioned htmldialog-examples on github. I would be glad someone could explain me how to install them on skechup. Please step by step.
I downloaded all the files as .zip folder. Where do I have to unpack the files? resp. how to start in sketchuppro.
Thank you
spb


#3
  • SketchUp loads a Ruby file at startup if it is in the Plugins folder (C:\Users\<user>\Roaming\SketchUp\SketchUp 2018\Plugins or Library/Application Support/SketchUp 2015/SketchUp/Plugins). The content of the Ruby file is evaluated immediately, so code that is not wrapped in a method and registered in the UI runs at startup.
    Knowing this, you probably have to copy the contents of the src folder into the Plugins folder.

  • Alternatively you can side-load scripts from any location if their requirements are specified relative to their loader file (not relative to the Plugins folder). This is the case for these htmldialog-examples.

    load "/path/to/downloads/src/tutorial.rb"
    
  • Check also out the sketchup-bridge project, which provides a different, unified approach to communicating between Ruby and the dialog in both directions.
    You can test-drive it with this tutorial extension. If you like it, you can clone the Github project. There is also a sample can be copied into your Plugins folder (before making your own project, rename AuthorName and SampleExtension to your personal namespace).


#4

Did you get any errors?
I currently cannot test your loader script, but possibly the file extension was missing:

# …
ext = SketchupExtension.new(("HtmlDialog Examples",File.join(NAME, "tutorial.rb"))
# …

If it loads without error but the toolbar is not visible, the extension is maybe not yet enabled (in Window → Extension Manager) or the toolbar not enabled (in View → Toolbars).