sketchucation logo sketchucation
    • 登入
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Curved Staircases

    已排程 已置頂 已鎖定 已移動 Woodworking
    171 貼文 19 Posters 33.1k 瀏覽 19 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • G 離線
      Garry K
      最後由 編輯

      A user with a windows 8 machine running SU 2013 has reported an error that I can't duplicate ( I don't have a windows 8 machine )

      puts "starting: dialog.execute_script( js_command )"
      dialog.execute_script( js_command )

      this code doesn't run

      puts "finished: dialog.execute_script( js_command )"

      it errors out with this

      type: mismatch
      code: 0
      url: file:///C:/Users/Admin/AppData/Local/Temp/skp8C34.tmp

      Is there anyone else with a Windows 8 machine running 2013 who would be willing to try this code.

      ` require 'sketchup.rb'

      #---------------------------------------

      show_dialog

      #---------------------------------------
      def show_dialog()
      dlg = UI::WebDialog.new( "Stair Measurements", false, "DialogTest", 200, 150, 150, 150, true );
      dlg.add_action_callback( "ruby_callback" ) { |dialog, params|
      text = params.to_s

      	if( text == 'loaded' )
      		args =  'inside_stringer=Housed|Sawtooth|None' +
      				'&inside_stringer=1' +
      				'&inside_option=Has Heel|Has Foot|Both|None' +
      				'&inside_option=3' +
      				'&inside_thickness=60' +
      				'&inside_width=300' +
      				'&inside_rail=Guard Rail|Wall Rail|None' +
      				'&inside_rail=2' +
      				'&outside_stringer=Housed|Sawtooth|None' +
      				'&outside_stringer=0' +
      				'&outside_option=Has Heel|Has Foot|Both|None' +
      				'&outside_option=3' +
      				'&outside_thickness=60' +
      				'&outside_width=400' +
      				'&outside_rail=Guard Rail|Wall Rail|None' +
      				'&outside_rail=2' +
      				'&total_rise=2667' +
      				'&risers=15' +
      				'&riser_thickness=12.7' +
      				'&direction=Clockwise|Anti Clockwise' +
      				'&direction=1' +
      				'&stair_width=1000' +
      				'&radius=2400' +
      				'&degrees=90' +
      				'&floor_thickness=60' +
      				'&rail_style=Classic|Modern|Round|Square|Standard|Traditional' +
      				'&rail_style=4' +
      				'&tread_thickness=38' +
      				'&average_run=254' +
      				'&tread_bullnose=12.7' +
      				'&nosing=25.4' +
      				'&flare_amount=0' +
      				'&progressive_flare=20' +
      				'&flare_count=0'
      
      		js_command = "from_ruby( '" + args + "' )"
      		puts( js_command )
      		puts "starting: dialog.execute_script( js_command )"
      		dialog.execute_script( js_command )
      		puts "finished: dialog.execute_script( js_command )"
      	else
      		UI.messagebox( text )
      		puts( text )
      	end
      

      dialog.close();

        }
        html = <<-HTML
      

      <!DOCTYPE html>
      <html>

      <style type="text/css">
      body { background-color: #F9EBD1}
      fieldset { float: left; background-color: #F9EBD1; border-color: black; margin: 3px;}

      fieldset p {display: table-row;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 90%;
      color: black;
      height: 27px}

      fieldset input,
      fieldset select,
      fieldset label {display: table-cell; margin: 2px; width: 120px }

      fieldset label {text-align: right;}

      fieldset input,
      fieldset select {margin-left: 10px; background-color: wheat;}
      }

      </style>

      <head>
      <meta http-equiv="MSThemeCompatible" content="Yes">
      <script>
      function do_click()
      {
      var items = document.getElementsByTagName( '*' );
      var count = items.length;
      var text = "";

      for ( var i = 0; i < count; i++ )
      {
      if ( items[i].type == "select-one" )
      value = items[i].options[items[i].selectedIndex].value;
      else if ( items[i].type == "text" )
      value = items[i].value;
      else if ( items[i].type == "checkbox" )
      value = items[i].checked.toString();
      else
      value = "";

        if ( value.length > 0 )
        {
      	  if ( text.length > 0 )
      		 text += "&";
      
      	  text += ( items[i].id + "=" + value );
        }
      

      }

      ruby_call( text );
      }
      function from_ruby( data )
      {
      var element;
      var pair;
      var pairs = data.split( '&' );
      var count = pairs.length;

      for ( var i = 0; i < count; i++ )
      {
      	pair = pairs[i].split( '=' );
      
      	element = document.getElementById( pair[0] )
      
      	if ( element.type == "select-one" )
      	{
      		if ( pair[1].indexOf('|') == -1 )
      			element.selectedIndex = pair[1];
      		else
      			populate_drop_down( element, pair[1] );
      	}
      	else if ( element.type == "text" )
      		element.value = pair[1];
      	else if ( element.type == "checkbox" )
      		element.checked = pair[1] == '1';
      }
      

      }
      function populate_drop_down( element, data )
      {
      var options = data.split( '|' );
      var count = options.length;
      var option;

      element.innerHTML = "";
      
      for ( var i = 0; i < count; i++ )
      {
      	option = document.createElement( "option" );
      	option.text = options[i];
      	element.add( option, null );
      }
      

      }
      function ruby_call( text )
      {
      query = 'skp:ruby_callback@' + text;
      window.location.href = query;
      }
      function on_load()
      {
      ruby_call( 'loaded' );
      }
      </script>
      </head>

      <body onload="on_load()">
      <form>

      <fieldset>
      <p><label>Inside Stringer:</label><select id="inside_stringer"></select></p>
      <p><label>Options:</label><select id="inside_option"></select></p>
      <p><label>Thickness:</label><input type="text" id="inside_thickness"</p>
      <p><label>Width:</label><input type="text" id="inside_width"</p>
      <p><label>Rail Options:</label><select id="inside_rail"></select></p>
      </fieldset>

      <fieldset>
      <p><label>Outside Stringer:</label><select id="outside_stringer"></select></p>
      <p><label>Options:</label><select id="outside_option"></select></p>
      <p><label>Thickness:</label><input type="text" id="outside_thickness"</p>
      <p><label>Width:</label><input type="text" id="outside_width"</p>
      <p><label>Rail Options:</label><select id="outside_rail"></select></p>
      </fieldset>

      <fieldset>
      <p><label>Stair Direction:</label><select id="direction"></select></p>
      <p><label>Stair Width:</label><input type="text" id="stair_width"</p>
      <p><label>Radius:</label><input type="text" id="radius"</p>
      <p><label>Degrees:</label><input type="text" id="degrees"</p>
      <p><label>Rail Style:</label><select id="rail_style"></select></p>
      <p><label>Open Risers:</label><input type="checkbox" id="open_riser"</p>
      <p><label>Total Rise:</label><input type="text" id="total_rise"</p>
      <p><label>Risers:</label><input type="text" id="risers"</p>
      <p><label>Riser Thickness:</label><input type="text" id="riser_thickness"</p>
      </fieldset>

      <fieldset>
      <p><label>Tread Thickness:</label><input type="text" id="tread_thickness"</p>
      <p><label>Average Run:</label><input type="text" id="average_run"</p>
      <p><label>Tread Bullnose:</label><input type="text" id="tread_bullnose"</p>
      <p><label>Nosing:</label><input type="text" id="nosing"</p>
      <p><label>Flare Amount:</label><input type="text" id="flare_amount"</p>
      <p><label>Progressive Flare:</label><input type="text" id="progressive_flare"</p>
      <p><label>Flare Count:</label><input type="text" id="flare_count"</p>
      <p><label>Floor Thickness:</label><input type="text" id= "floor_thickness"</p>
      <p><label>Create Stair:</label><input type="button" onclick="do_click()" style="background: silver" value="Ok"></p>
      </fieldset>

      </form>
      </body>
      </html>

        HTML
      
        dlg.set_html html
        dlg.show
      end
      

      if ( not file_loaded?( "dialog_test.rb" ) )
      UI.menu( "Plugins" ).add_item( "Web Dialog Test" ) { show_dialog() }
      file_loaded( "dialog_test.rb" )
      end

      ------------------------------------------------`

      1 條回覆 最後回覆 回覆 引用 0
      • G 離線
        Garry K
        最後由 編輯

        Version 1.0.11 06-Mar-2014

        1. Now SU 2014 compatible
        2. Added missing line to gkware_stairmaker_loader.rb. Utils.rbs was only loading if door maker was installed.
        3. Added Config folder to hold user configuration and temp files
        4. Make button images for add Handrail profile and glue edges
        5. Fixed bug in handrail scaling
        6. Auto Sizing of Web Dialog. For some reason – need to add room for scroll – even if it shouldn’t be needed
        7. Fixed bug where trial string keeps growing
        8. Handrail was not going into “Handrail” layer. Fixed
        9. Changed Stringer “Width” to “Depth” in web dialog, language files and in defaults.txt
        10. Made changes to defaults.txt for “imperial_stair_width”
        1 條回覆 最後回覆 回覆 引用 0
        • A 離線
          aconk25
          最後由 編輯

          @garry k said:

          Version 1.0.11 06-Mar-2014

          1. Now SU 2014 compatible
          2. Added missing line to gkware_stairmaker_loader.rb. Utils.rbs was only loading if door maker was installed.
          3. Added Config folder to hold user configuration and temp files
          4. Make button images for add Handrail profile and glue edges
          5. Fixed bug in handrail scaling
          6. Auto Sizing of Web Dialog. For some reason – need to add room for scroll – even if it shouldn’t be needed
          7. Fixed bug where trial string keeps growing
          8. Handrail was not going into “Handrail” layer. Fixed
          9. Changed Stringer “Width” to “Depth” in web dialog, language files and in defaults.txt
          10. Made changes to defaults.txt for “imperial_stair_width”

          error in windows 8 64bit


          error in windows 8 64bit

          1 條回覆 最後回覆 回覆 引用 0
          • M 離線
            mwm5053
            最後由 編輯

            You might want to add .rbz to post or transfer this to plugins forum it's hard to find the file embedded in the middle of topic I can't find maybe I missed it somewhere.

            2011 iMac
            SU 2015 Pro, 2017 Make
            V2 Twilight
            macOS Sierra 10.12.5

            1 條回覆 最後回覆 回覆 引用 0
            • G 離線
              Garry K
              最後由 編輯

              I've been busy learning about JQuery, Ajax, JSONP etc.

              Here are 2 ruby scripts that I would like someone to try on OSX Lion, OSX Maverick and Windows 8.

              The first script is called 'dialog_test_tabs.rb' and is set up with tabs. The tabs code came from user NewOne
              http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=22662

              This works nicely on my machine which is a Windows 7 machine. I have Internet Explorer 11 installed.

              The second script is call dialog_test_5.rb and connects to a test web service on my web site. It just passes a very simple JSONP record {"firstname":"Jeff"} and is suppose to respond with 'Your name is Jeff Hansen'


              Tabbed test dialog


              stair input tab1.JPG


              stair input tab 2.JPG


              Web service test script

              1 條回覆 最後回覆 回覆 引用 0
              • P 離線
                pisosse
                最後由 編輯

                Well i'm on SU2014 and yosemite

                First of all I still get the "HTTP error"

                That is very well the reason I get these outputs of your test files.


                Dialog 5 output


                Dialog tab output

                1 條回覆 最後回覆 回覆 引用 0
                • P 離線
                  pisosse
                  最後由 編輯

                  Installed via the sketchucation plugin and all is good.. Just wonder what to do if stringers have different curvatures ?

                  1 條回覆 最後回覆 回覆 引用 0
                  • G 離線
                    Garry K
                    最後由 編輯

                    Do you have an example of what you mean by different curvatures?

                    My understanding so far is this.
                    Curved stringers do have different curvatures (radius), but they both have the same pivot point. The best I can do right now for irregular stairs is the 2D to 3D portion of the stair maker suite.

                    1 條回覆 最後回覆 回覆 引用 0
                    • P 離線
                      pisosse
                      最後由 編輯

                      Ahh.. ok thanks. Would I mean is that the stringers is curved but not in parallel. On stringer has a sharper curve than the other. Btw. the 2D to 3D feature sounds promising but the documentation in the help file is leaving me a little puzzled. Should I make 2 stringers as pollens and the select them an push the 2Do3D button or do I have to make a face? sorry this is totally obvious to other than stupid old me. Other than that it is a pretty solid piece of coding sir!

                      1 條回覆 最後回覆 回覆 引用 0
                      • G 離線
                        Garry K
                        最後由 編輯

                        I have a few videos on the 2D to 3D stairs.

                        1 條回覆 最後回覆 回覆 引用 0
                        • P 離線
                          pisosse
                          最後由 編輯

                          NICE.. thanks a lot!

                          1 條回覆 最後回覆 回覆 引用 0
                          • 1
                          • 2
                          • 5
                          • 6
                          • 7
                          • 8
                          • 9
                          • 9 / 9
                          • 第一個貼文
                            最後的貼文
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement