• Login
sketchucation logo sketchucation
  • Login
โ„น๏ธ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Shuffle-ruby script?

Scheduled Pinned Locked Moved Developers' Forum
15 Posts 5 Posters 2.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    miikka1978
    last edited by 9 Mar 2008, 09:09

    Thank you for the help. I am still having some problems. I never get the dialog that asks to merge copies.

    I have Proximity Components folder in this path (C:\Program Files\Google\Google SketchUp 6\Components\Proximity Components) and I have named containers (cont-001-,cont-002-,cont-003-,cont-004-). I have taken the cont-001- and placed it in the drawing => run the Matrix => I get multible copies => I get dialog that asks if I want to drop the componets onto nearest faces => but after that I never get any dialog to asks to merge copies. I have tried this same workflow with components that were alrady in the Proximity Components folder but still it does not ask to merge copies.

    Do you have any idea what could be the problem?

    1 Reply Last reply Reply Quote 0
    • G Offline
      GreyHead
      last edited by 9 Mar 2008, 09:21

      The problem that I found was that the script wasn't able to open the sub-folder. When I open the RubyScript console I saw an error at line 415 (or thereabouts).

      There is a line that reads something like:

      proxdir = (Sketchup.find_support_file "", "Components/Proximity Components/") + "Components//Proximity Components//"
      

      I replaced this with two lines:

      proxdir_1 = Sketchup.find_support_file "", "Components/Proximity Components/"
      proxdir = proxdir_1 + "/Components/Proximity Components/"
      

      Bob

      1 Reply Last reply Reply Quote 0
      • M Offline
        miikka1978
        last edited by 9 Mar 2008, 09:45

        Thank you for helping me. Now it works perfect. ๐Ÿ˜„

        1 Reply Last reply Reply Quote 0
        • G Offline
          GreyHead
          last edited by 9 Mar 2008, 11:35

          Couldn't resist it. Here's a hacked version of the script that adds a 'Density' value to the dialogue box. The image below is at 85% which is the default (change this at line 234 to your preference).

          Bob

          container-3.png


          Back up the original version and copy this to PlugIns folder.

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by 9 Mar 2008, 13:15

            Thanks for saving me some work Greyhead! (from one soon to be grey head to another!)

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 9 Mar 2008, 20:20

              Thanks GreyHead for the error report*. It's over 2 years since the MatrixProximity code was last looked at by me !

              Here's the 'official' Update v1.7 - http://www.sketchucation.com/forums/scf/viewtopic.php?p=46802#p46802

              Note that GreyHead's changed version two posts below has some menu problems in it...

              You might want to hack out his "density" bits if they are useful and add them back in ?

              This fixes those AND the error* problem, with it finding the right directory - caused by changes to the way Ruby 'now' returns the FindFile path with/without a / at the end of a directory... [actually it changed ages ago, but I never caught it...]

              Sorry for the slow response...

              TIG

              1 Reply Last reply Reply Quote 0
              • G Offline
                GreyHead
                last edited by 9 Mar 2008, 20:46

                Thanks TIG - the density bit was very much a hack. More a learning experiment than serious coding. (Though I was quite impressed with myself that I got it to work at all!)

                I forgot that I'd commented out the menu entries ๐Ÿ˜ž - is there a way of editing and rerunning a script that's loaded into a menu without re-starting Sketchup?

                Bob

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 9 Mar 2008, 22:53

                  @greyhead said:

                  Thanks TIG - the density bit was very much a hack. More a learning experiment than serious coding. (Though I was quite impressed with myself that I got it to work at all!)

                  I forgot that I'd commented out the menu entries ๐Ÿ˜ž - is there a way of editing and rerunning a script that's loaded into a menu without re-starting Sketchup?

                  Bob

                  Easy: type, 'load "script_name.rb"', into the Ruby console - it will reload the script completely. You need the 'load menu if script not loaded' test bits at the end - or else you'll get multiple menu entries - even then the latest menu entry's on the end ! - but most scripters add that test in anyway...

                  All /Plugins/ .rb files load automatically at startup, but you can also load any .rb files that have a .txt suffix at any time by using the, 'load "file.txt"' method - that's useful for rarely used scripts that you wouldn't want cluttering things up all the time...

                  .

                  IF the 'density' bit is thought useful I could add it into the 'official' version... Comments please...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    rv1974
                    last edited by 10 Mar 2008, 09:38

                    @TIG: I'd rather use randomselect in this case ๐Ÿ‘

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      miikka1978
                      last edited by 10 Mar 2008, 10:54

                      For my purpose/need this density function is just perfect. Thanks again GreyHead! But right now I can't think any other way to benefit from this function when using MatrixProximity script. I will be fine with this unofficial version.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      1 / 1
                      • First post
                        15/15
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement