SketchUp Custom Plugin Tray Source Code

2025-03-31·
XIETU
XIETU
· 2 min read · 阅读量

Plugin Introduction

I’ve developed a SketchUp plugin tray that automatically generates buttons and adds them to the tray, each pointing to a plugin file (.rb format) in the specified directory—clicking a button immediately loads and runs the corresponding plugin.
This version has only been tested on SketchUp 2019; compatibility with other versions hasn’t been verified. Additionally, on some computers, the window docking (snap-to-edge) feature may not work properly. I’ve already identified the cause but haven’t had time to fix it yet.
Note: Since you’re already customizing plugins, I assume you have programming experience. If you encounter any issues, feel free to use VS Code together with Trace AI—it’s extremely convenient!

Plugin Interface Demo

Here’s the actual running effect: Demo Video

Main Interface
Docking position and magnetic attraction can be configured
Right Docking
Docked on the right side
Resizable Panel
Can be dragged to any position or resized

Directory Structure

The package contains two files: myplugin_dev_loader.rb and MySketchUpPlugin folder.

myplugin_dev_loader.rb File

Used to load the custom plugin tray when SketchUp starts. Place this file in SketchUp’s plugin directory:
C:\Users\Administrator\AppData\Roaming\SketchUp\SketchUp 2019\SketchUp\Plugins

Code in myplugin_dev_loader.rb:
dev_path = “D:/MySketchUpPlugin/src” # Replace with your actual plugin development path

MySketchUpPlugin Folder

Contains the actual plugin tray content. Directory structure:

MySketchUpPlugin
├── .vscode
│   ├── launch.json # Debug environment configuration
│   ├── tasks.json # Plugin compilation tasks
├── src
│   ├── my_plugin.rb  # Main plugin loader
│   ├── ScreenUtils.rb  # Monitors SketchUp window changes
│   ├── hot_reload.rb  # Auto-reload for debugging
│   ├── my_plugin.html  # Main interface
│   ├── plugins  # Custom plugins
│   │   ├── SpaceCurveCollection # Default plugin folder
│   │   ├── ArtificialMuscle
│   │   │   ├── SinePoints.rb # Plugin code
│   │   │   ├── SinePoints.html # Interface

The tasks.json contains: “windows”: { “command”: “&‘C:/Program Files/SketchUp/SketchUp 2019/SketchUp.exe’ -rdebug ‘ide port=6123 wait’” }, Replace SketchUp.exe path with your actual path.

Download

Get the SketchUp Plugin Tray Source Code Archive on Ko-fi