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

    Grid Search

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    24 Posts 7 Posters 480 Views 7 Watching
    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.
    • BoxB Offline
      Box
      last edited by

      You might be over complicating things if you are unaware of the move tool copy function.

      Draw a square, select it, using the move tool, hold crtl and click on the corner of the square, move to the edge of the square with the new copy and click again, then type 10x and hit enter.
      Now select those 11 squares, use the move tool in the same way but at right angles to the last move and you will have a grid of 110 squares.

      So by making the original square as you want it and then making it a component, you can create any sort of grid in seconds.

      Edit: You can use it to move specific distance and copy too.

      So if you start with a 2m x 2m square. Delete the face, select the edges and make it into a component. Now with the move tool, ctrl+click and move on the red axes to the right, without clicking again simply type 2100mm and hit enter, then type 9x and hit enter.
      You should now have a row of empty 2m squares spaced 100mm apart. Do the same in the green direction, then select them all and make them a component or group. Use Pilou's suggested tool and you can colour the edges to your hearts content.

      1 Reply Last reply Reply Quote 0
      • BoxB Offline
        Box
        last edited by

        Steve, it loads and is in the draw menu, it opens the spec dialog but it produces nothing when you click OK.

        1 Reply Last reply Reply Quote 0
        • T Offline
          Trogluddite
          last edited by

          Cheers Box, I'll take another look at the code - I think I know what I've done.

          I do fiddly little mechanical stuff rather than buildings, so my default template is rather zoomed in - when I just tested with the default SU template to test the download, I couldn't see anything either - until I did a 'zoom to extents!
          If I hadn't had the Outliner open, I wouldn't have realised it was there!

          Seems I've set the default tile size as if for a miniature doll's house, so small that you can't see the grid because the axes get in the way!! Doh!
          Seems fine if I type in a new size value - it regains its sense of proportion then.

          When I get a moment to dig into the code, I'll fire up an editor and try editing the defaults to something a little more appropriate for the intended job.

          1 Reply Last reply Reply Quote 0
          • BoxB Offline
            Box
            last edited by

            Sorry, no I tried that. And tried again now on another PC, at 1, 2 and 20m nothing.

            1 Reply Last reply Reply Quote 0
            • T Offline
              Trogluddite
              last edited by

              Thanks for testing again Box - I must be not taking something into account to do with how folks have SU set up differently I guess.
              I'll move the download to a "Ruby Help" thread for the time being then, to save anyone else the same frustration.

              1 Reply Last reply Reply Quote 0
              • T Offline
                Trogluddite
                last edited by

                With many thanks to ThomThom and sdmitch, the trouble should now be fixed - also with better handling of invalid input values (thanks D.Rathburn)...

                Seems I was using a Ruby method that looked like a genuine API one, but was actually added by one of the plugins I have installed (RTFM!!!).

                The download is available again in the original post above (to keep it with the instructions)

                And thanks again, Box - your speedy bug reporting is much appreciated.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  Trogluddite
                  last edited by

                  Hi mal,

                  The tips you've been shown so far are well worth knowing and practicing - but your post caught me just as I was looking for an experiment to test out some of the lovely Ruby things that I've learned from the guys here.
                  So, as long as you don't mind being a 'guinea pig' for my first go at creating Ruby geometry, here's a little plugin to do the basics of what you want...
                  EDIT: Download updated.
                  v1.0.1 - to fix the bug reported in the posts below. Apologies to the folks that had already downloaded v1.0.0.

                  Just drop the file into your Plugins folder, and it will add a new item to the 'Draw' menu, called "Tile Grid".
                  You then get a dialogue asking you for the tile and grout sizes, and how many tiles you want.
                  It's pretty crude - the grid is always drawn on the ground at the origin, pointing along the red and green axes. Measurements are in your chosen model units, and you can get a simple grid of squares by simply putting in zero for the grout width.
                  The grid is built as a group, so it acts as a single unit, but won't clutter your component browser - and the group is named "Tile Grid" with the sizes, so that you can find it easily.
                  It will also undo all in one go with CTRL-Z, if it ends up a mess.

                  I've followed the 'safety' guidelines of the Ruby 'gurus' as best I know, and it works reliably here - but as with any new plugin, take precautions! And don't hesitate to give me some grief if it is buggy!

                  1 Reply Last reply Reply Quote 0
                  • BoxB Offline
                    Box
                    last edited by

                    It certainly works now.
                    I'm slightly curious though, it may be unimportant but it creates an unusual structure to the lines. The lines of the grid don't intersect. Are they not all on the same plane? If you throw a surface over them it breaks up into a mixture of overlapping horizontal and vertical bands not squares.

                    I only ask because it surprised me and also made me think would it affect inferencing or measurements if the lines aren't all at 0, which they may well be.

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      Trogluddite
                      last edited by

                      @box said:

                      I only ask because it surprised me and also made me think would it affect inferencing or measurements if the lines aren't all at 0, which they may well be.

                      Aha - well, this is one thing that I did actually test properly!
                      If you use the query tool on the interection inferences, the lines do indeed all intersect on the ground plane - but you're right, they don't actually break each other into segments.
                      IIRC, in older versions of SU, that was the default behaviour, you had to do an explicit intersect to segment the lines - unlike now, where lines made by the tools break up automatically.
                      As I understand it, when adding geometry from Ruby, the lines won't break apart unless you program them to. But in this case, as the lines are intended only as a reference for inferencing, I kept things simple - so long as you don't add extra geometry inside the grid's group, it makes no difference, and keeps the amount of geometry smaller when a grid is made with a large number of 'cells'.
                      I think I will look into that as an option though, and possibly a guidelines option too - it is all good Ruby practice, and those other ways of doing it might be a useful alternative for some users.

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        Crossing lines made with the API don't auto-intersect - unlike the basic Sketchup setup.
                        However, since they are in a group, so use something like.
                        tr=Geom::Transformation.new() group.entities.intersect_with(true, tr, group.entities, tr, true, group.entities.to_a)

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • BoxB Offline
                          Box
                          last edited by

                          Thanks for the explanation Trog.

                          Tig on a side note, does that mean you could turn off auto intersect in normal life? Sometimes it would be nice to move a bunch of curves around and then only have them intersect when you have finished positioning them.

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            Trogluddite
                            last edited by

                            Thanks for the code tips, TIG, I was about to ask someone how to make a collection of entities intersect with themselves using that method.
                            So far, I have it working using a nested group which I later explode, which seems to work well enough - is there any advantage using 'intersect_with' compared to group.explode in this case? (i.e. a single collection of entities that must all intersect each other).

                            1 Reply Last reply Reply Quote 0
                            • M Offline
                              mal
                              last edited by

                              Trogluddite!

                              What a champ! Thats amazing what you've done. Thanks so much. The TileGrid plugin works perfectly, and the instructions you gave to install it are idiot-proof! Just what I need πŸ˜„

                              Thanks also to sdmitch, thom thom and tig for the tips they gave you. πŸ‘ Trog I think you're ready to join the Axis of Awesome!

                              Thanks to you too Box. Your input on this was very much appreciated.

                              Cheers

                              Mal

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

                              Advertisement