require 'sketchup.rb' #--------------------------------------- # show_dialog #--------------------------------------- def show_tabs_dialog() windows = (RUBY_PLATFORM =~ /darwin/i) == nil @html = get_html() @data = get_data() dlg = UI::WebDialog.new("Stair Measurements", false, "DialogTest_tabs", 850, 500, 100, 100, true); dlg.add_action_callback("ruby_callback") { |dialog, params| text = params.to_s if (text == 'loaded') js_command = "from_ruby( '" + @data + "' )" puts js_command dialog.execute_script( js_command ) else UI.messagebox( text ) end } dlg.set_html @html if (windows) dlg.show() else dlg.show_modal() end end def get_tab_data() data = 'inside_stringer=Housed|Sawtooth|None=1' + '&inside_option=Has Heel|Has Foot|Both|None=3' + '&inside_rail=Guard Rail|Wall Rail|None=2' + '&outside_stringer=Housed|Sawtooth|None=0' + '&outside_option=Has Heel|Has Foot|Both|None=3' + '&outside_rail=Guard Rail|Wall Rail|None=2' + '&direction=Clockwise|Anti Clockwise=1' + '&rail_style=Classic|Modern|Round|Square|Standard|Traditional=4' + '&inside_thickness=60' + '&inside_width=300' + '&outside_thickness=60' + '&outside_width=400' + '&total_rise=2050' + '&risers=15' + '&riser_thickness=12.7' + '&stair_width=1000' + '&radius=2400' + '°rees=90' + '&floor_thickness=60' + '&tread_thickness=38' + '&average_run=254' + '&tread_bullnose=12.7' + '&nosing=25.4' + '&flare_amount=0' + '&progressive_flare=20' + '&flare_count=0' + '&open_riser=1' + '&language=en' + '&debug_level=0' + '&force_silhouettes=1' + '&segments=3' + '&inside_segments=3' + '&outside_segments=4' + '&min_riser_ht=125' + '&max_riser_ht=200' + '&min_run=210' + '&max_run=355' + '&min_stair_wd=800' + '&rail_clearance=40' + '&stair_rail_ht=800' + '&level_rail_ht=900' + '&minimum_radius=50' + '&top_riser_thickness=19' + '&riser_nosing=12.7' + '&dado_depth_tread=12.7' + '&dado_depth_stringer=12.7' + '&stringer_above_floor=12.7' + '&housed_stringer_reveal=38'; end def get_html() @html = <<-HTML

HTML end if ( not file_loaded?( "dialog_test_tabs.rb" ) ) UI.menu( "Plugins" ).add_item( "Web Dialog Test Tabs" ) { show_tabs_dialog() } file_loaded( "dialog_test_tabs.rb" ) end # ------------------------------------------------ __END__