module MyFeature unless file_loaded?() UI.menu('Plugins').add_item('Start My Tool') do Sketchup.active_model.select_tool(MyTool.new) end file_loaded( FILE ) end end 4. Adding a UI Dialog (HTML/CSS/JS) SketchUp 2024 supports WebDialog :
def self.run model = Sketchup.active_model return UI.messagebox('Open a model first.') unless model
my_feature_loader/ ├── my_feature.rb ├── my_feature_main.rb └── my_feature/ └── (additional modules/files) # my_feature.rb require 'sketchup.rb' require 'extensions.rb' module MyFeature extension = SketchupExtension.new('My Awesome Feature', 'my_feature_main.rb') extension.description = 'Does something cool in SketchUp 2024' extension.version = '1.0.0' extension.copyright = '2024, Your Name' extension.creator = 'Your Name'
Sketchup.register_extension(extension, true) end # my_feature_main.rb require 'sketchup.rb' module MyFeature unless file_loaded?( FILE ) UI.menu('Plugins').add_item('Run My Feature') do self.run end file_loaded( FILE ) end
class MyTool def activate puts 'Tool activated' end def onMouseMove(flags, x, y, view) # Update preview end
UI.messagebox('My feature is running!') # Your feature code here end end Replace my_feature_main.rb with a tool:
HiOSO Technology CO.,Ltd Founded in 2002, Hioso Technology CO., Ltd. is the optic communication product manufacturer after Huawei and ZTE. We engaged in the R&D, design, manufacture, sell FTTH and ...
We have our quality control team. Their main task is checking all the finished products before shipping them out! And for those not to be quality requirement, our quality team will ask our workers to ...
Address : 4F,BUILDING10,NANGANG NO.2 INDUSTRIAL ZONE,NO.126,SONGBAI ROAD,XILI STREET,NANSHAN DISTRICT,SHENZHEN CITY,GUANGDONG PROVINCE 518055
Worktime: 8:30-18:00 (Beijing time)
Business Phone : 86-755-83113365(Working time) 86--13760140712(Nonworking time)
FAX : 86-755-83151488
Email : sale2@hioso.com