11 Replies Latest reply on Dec 16, 2016 11:00 AM by Obi-wan Kenobi

    How to align hexagons to each other with the diagonal edge?

    Jace_Yearbook

      Hello Forums!

       

      My name is Jace and I am a staff member for my high school's yearbook. Its my 2nd year and I am quite experienced with InDesign CS6, yet there are still some things I have yet to figure out. This year's theme includes many hexagons and honey comb patterns, and while I know you can create a tile pattern with the same alignment distance, there is no way (to my knowledge) on how to align individual edges. Ill attach a photo to explain it. You can free hand it, which I feel i will probably have to do, but our required spacing is 0p6. Is there a tool in the program that allows it or does anyone else know of an easier way rather than free handing it and hoping for the best?

       

      (YES THE LAYOUT MAY NOT BE PERFECT, IT'S A WORK IN PROGRESS HAHA XD)

       

      Thanks XDScreenshot (1).png

        • 1. Re: How to align hexagons to each other with the diagonal edge?
          Laubender Adobe Community Professional & MVP

          Hi Jace,

          yes, that's doable. But would require perhaps two or three steps.

          The trick is using InDesign's Smart Guides feature.

           

          Smart Guides are working best in 90° situations, so to say.

          And to get to a 90° configuration when using two hexagons you have to align the two segments you want to align to 90° or 180° respectively.

           

          Some screenshots are showing this:

           

          Task-AlignTwoSegments.png

          Step-1-RotateByMinus60Degrees.png

          Step-2-MoveTheObjects-CheckTheSmartGuides.png

          Step-3-RotateBackBy60Degrees.png

          That's all…

           

          Regards,
          Uwe

          2 people found this helpful
          • 2. Re: How to align hexagons to each other with the diagonal edge?
            Michael Witherell Adobe Community Professional

            1. Go to Illustrator

            2. Use the Polygon tool to draw a 6-sided polygon. Be sure to hold the shift key while dragging out a hexagon.

            3. Drag and drop the hexagon into the Swatches panel

            4. Double-click the new fill swatch; the Pattern Options editor panel opens up

            5. Set the Tile Type to "Hex by Column"; click Done

            6. Apply fill pattern to a larger rectangle; then object > expand it to separate shapes

            7. Copy and paste into InDesign as frame shapes

            8. Reward yourself with food and drink

            2 people found this helpful
            • 3. Re: How to align hexagons to each other with the diagonal edge?
              Obi-wan Kenobi Adobe Community Professional

              Hi,

               

              It's just a simple problem of geometry! 

               

              So …

               

              Capture d’écran 2016-12-15 à 13.30.23.png

               

              We want to align the hexagons by reference to the "Red" one! …

               

              So "Blue" hexagon to be selected and 1 click! 

               

              Capture d’écran 2016-12-15 à 13.30.38.png

              Capture d’écran 2016-12-15 à 13.30.52.png

               

              var gB1 = app.selection[0].geometricBounds; 
              var gB2 = app.selection[1].geometricBounds;
              
              
              var center1_H = gB1[1] + ((gB1[3] - gB1[1])/2);
              var center1_V = gB1[0] + ((gB1[2] - gB1[0])/2);
              
              
              app.selection[1].move([center1_H - ((gB2[3] - gB2[1])/2), center1_V - ((gB2[2] - gB2[0])/2)]);
              
              var NewgB2 = app.selection[1].geometricBounds;
              
              
              var W1 = gB1[3] - gB1[1];
              var H1 = gB1[2] - gB1[0];
              var W2 = NewgB2[3] - NewgB2[1];
              var H2 = NewgB2[2] - NewgB2[0];
              
              
              var MoveX = NewgB2[1] - ((H1 + H2) * 0.866 / 2);
              var MoveY = NewgB2[0] - ((W1 + W2) * 0.866 / 4);
              
              
              app.selection[1].move([MoveX, MoveY]);        
              

               

               

              "Green" one now! 

               

              Capture d’écran 2016-12-15 à 13.31.20.png

               

              var gB1 = app.selection[0].geometricBounds; 
              var gB2 = app.selection[1].geometricBounds;
              
              
              var center1_H = gB1[1] + ((gB1[3] - gB1[1])/2);
              var center1_V = gB1[0] + ((gB1[2] - gB1[0])/2);
              
              
              app.selection[1].move([center1_H - ((gB2[3] - gB2[1])/2), center1_V - ((gB2[2] - gB2[0])/2)]);
              
              var NewgB2 = app.selection[1].geometricBounds;
              
              
              var W1 = gB1[3] - gB1[1];
              var H1 = gB1[2] - gB1[0];
              var W2 = NewgB2[3] - NewgB2[1];
              var H2 = NewgB2[2] - NewgB2[0];
              
              
              var MoveX = NewgB2[1] + ((H1 + H2) * 0.866 / 2);
              var MoveY = NewgB2[0] - ((W1 + W2) * 0.866 / 4);
              
              
              app.selection[1].move([MoveX, MoveY]);        
              

               

               

              "Yellow" and "Grey" ones ! …

               

              Capture d’écran 2016-12-15 à 13.31.53.png

               

               

              var gB1 = app.selection[0].geometricBounds; 
              var gB2 = app.selection[1].geometricBounds;
              
              
              var center1_H = gB1[1] + ((gB1[3] - gB1[1])/2);
              var center1_V = gB1[0] + ((gB1[2] - gB1[0])/2);
              
              
              app.selection[1].move([center1_H - ((gB2[3] - gB2[1])/2), center1_V - ((gB2[2] - gB2[0])/2)]);
              
              var NewgB2 = app.selection[1].geometricBounds;
              
              
              var W1 = gB1[3] - gB1[1];
              var H1 = gB1[2] - gB1[0];
              var W2 = NewgB2[3] - NewgB2[1];
              var H2 = NewgB2[2] - NewgB2[0];
              
              
              var MoveX = NewgB2[1] - ((H1 + H2) * 0.866 / 2);
              var MoveY = NewgB2[0] + ((W1 + W2) * 0.866 / 4);
              
              
              app.selection[1].move([MoveX, MoveY]);        
              

               

               

              var gB1 = app.selection[0].geometricBounds; 
              var gB2 = app.selection[1].geometricBounds;
              
              
              var center1_H = gB1[1] + ((gB1[3] - gB1[1])/2);
              var center1_V = gB1[0] + ((gB1[2] - gB1[0])/2);
              
              
              app.selection[1].move([center1_H - ((gB2[3] - gB2[1])/2), center1_V - ((gB2[2] - gB2[0])/2)]);
              
              var NewgB2 = app.selection[1].geometricBounds;
              
              
              var W1 = gB1[3] - gB1[1];
              var H1 = gB1[2] - gB1[0];
              var W2 = NewgB2[3] - NewgB2[1];
              var H2 = NewgB2[2] - NewgB2[0];
              
              
              var MoveX = NewgB2[1] + ((H1 + H2) * 0.866 / 2);
              var MoveY = NewgB2[0] + ((W1 + W2) * 0.866 / 4);
              
              
              app.selection[1].move([MoveX, MoveY]);        
              

              Capture d’écran 2016-12-15 à 13.32.30.png

               

              Just for fun! 

               

              [ code quickly written, Thanks for comments! ]

               

              (^/)

              1 person found this helpful
              • 4. Re: How to align hexagons to each other with the diagonal edge?
                Obi-wan Kenobi Adobe Community Professional

                … Of course, everybody understood that "0.866" is the square root of 3! 

                 

                (^/)

                • 5. Re: How to align hexagons to each other with the diagonal edge?
                  Obi-wan Kenobi Adobe Community Professional

                  … square root of 3 divided by 2!

                   

                  Am I the only one to know how to count here!? 

                   

                  (^/)

                  • 6. Re: How to align hexagons to each other with the diagonal edge?
                    Laubender Adobe Community Professional & MVP

                    Hm. Or did you rather mean the square root of 3/4 and you dropped the /4 from the 3 ?

                     

                    Math.sqrt(3/4)
                    // Result: 0.86602540378444
                    

                     

                    Cheers,
                    Uwe

                    • 7. Re: How to align hexagons to each other with the diagonal edge?
                      Obi-wan Kenobi Adobe Community Professional

                      Pythagore of course! 

                       

                      Capture d’écran 2016-12-15 à 19.57.15.png

                       

                      (^/) 

                      • 8. Re: How to align hexagons to each other with the diagonal edge?
                        Roger Breton

                        Did you solve the problem already?

                        Does not seem such a great difficulty.

                        • 9. Re: How to align hexagons to each other with the diagonal edge?
                          Jace_Yearbook Level 1

                          How do I even put that code into it? is the code just showing the order of what is happening or is that a way of making indesign do it? sorry im a noob at coding right now but im finding the "rotating" them easier as of now, or just freehanding it with the arrow keys

                          • 10. Re: How to align hexagons to each other with the diagonal edge?
                            Roger Breton Level 1

                            Coding is very honorable -- wish I could learn to code.

                            Rotating works fine, too, IMO.

                            Use what works for you ;-)

                            • 11. Re: How to align hexagons to each other with the diagonal edge?
                              Obi-wan Kenobi Adobe Community Professional

                              Hi,

                               

                              Learn how to get written code given on Adobe forums and import them as .jsx into InDesign.

                               

                              About what the code I've written, imagine: with the mouse, sweep the page selecting first the "red" hexagon then the "blue" one? As you have associated keyboard shortcuts to the four scripts [e.g., on Mac, Cmd-[num]7, Cmd-[num]9, Cmd-[num]1 and Cmd-[num]3], just play the game with 1 click at each time!  Cool!