SketchUp Custom Plugin Tray Source Code

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

Plugin Introduction

My SketchUp plugin tray automatically generates buttons and adds them to the tray, pointing to plugin files (.rb format) in the directory for immediate execution.
Note: Since you can create custom plugins, it’s assumed you can program. If you encounter issues, use VSCode with Trace AI - very convenient!

Plugin Interface Demo

Here’s the actual running effect:

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

Source Code (Baidu Netdisk) Extraction code: sg58