12 Replies Latest reply on Apr 5, 2011 8:57 AM by KatDeskat

    Measurements / dimensions of elements

    KatDeskat

      Hi all,

       

      I'm trying to indicate dimensions of the different layout elements, as well as the distance between them, on a separate layer, to spare me the time of writing these dimensions myself...

       

      I'd like a tool that would allow me to drag the pointer betweens two points of the layout, and a little box with the distance between these points would be created. These "boxes" should be able to show on one layer of the document, so that I can export the file with, and without these dimension info.


      I read on another forum that a script could allow me to do that, but I've never written any script before. (so please write english )

      Any idea anyone?

        • 1. Re: Measurements / dimensions of elements
          [Jongware] Most Valuable Participant

          Hi Kat! Unfortunately it's not as straightforward as you think ... First off: you cannot add a tool with a Javascript. I'm guessing you are using CS5, and you are thinking of something like the Gap tool. Well -- that sort of functionality cannot be scripted! What I had in mind was more like: you select two objects and this hypothetical script adds a text frame with the distance.

           

          I got something working, but I don't get the exact logic of what you are looking for. How would a script (or a person, for that matter) "know" what dimensions you want to see? If you select one single rectangle, would you want to see its width and height? If you select two rectangles, would you want their respective widths and heights (as if you selected them one by one), or -- since you mentioned distances -- the "distance" from one rectangle to another? If so, how is this measured, on Web pages? Left edge to left edge? Center to center? Nearest edge to nearest edge? And both horizontally and vertically? From corner point to corner point?

           

          This would only work for rectangles. Do you also have rounded rectangles? Circles? Stars? Arbitrary polygon shapes?

           

          That's why I asked if you could draw up a dummy of how you would like to see this. You can insert screenshots in a post using the Camera icon in the forum software.

          • 2. Re: Measurements / dimensions of elements
            KatDeskat Level 1

            Hi,

             

            Thanks for helping.

             

            The kind of dimensions I need are:

            -the coordinates on the page of some elements, top-left corner.

            - and/or the dimensions height and width, of some elements.

            - the distance between elements.

            - the size of an element in % of the page

             

            Here is a screenshot of what I mean:

            Drag the mouse between 2 points and indicate the distance between these points. Vertically or horizontally.

            Only rectangles and gaps.

             

            Easy to say, right?

             

            dimensions.png

            • 3. Re: Measurements / dimensions of elements
              [Jongware] Most Valuable Participant

              KatDeskat wrote:

              Here is a screenshot of what I mean:

              Drag the mouse between 2 points and indicate the distance between these points. Vertically or horizontally.

              Only rectangles and gaps.

               

              Easy to say, right?

               

              Yah, that's not gonna work. This amount of control is *not* possible with Javascript -- you cannot add custom tools. Isn't this, however, exactly what the Gap tool does in CS5?

              • 4. Re: Measurements / dimensions of elements
                KatDeskat Level 1

                Yea I can imagine it is a whole new tool I'm talking about.

                 

                The gap tool makes you adjust the gap size between objects.

                I guess my screenshot was confusing by showing twice "2px".

                My purpose is not to have the same distance between objects or control the alignment, but to show and label distances, whatever they are.

                 

                You mentioned a possibility to label the size (and top-left position?) for rectangles. Is that correct?

                That would already be a big help, I would only have to indicate distances manually.

                 

                Cheers,

                 

                Kat

                • 5. Re: Measurements / dimensions of elements
                  [Jongware] Most Valuable Participant

                  KatDeskat wrote:

                  [..]

                  You mentioned a possibility to label the size (and top-left position?) for rectangles. Is that correct?

                  That would already be a big help, I would only have to indicate distances manually.

                   

                  Yes, that's entirely within scripting range. I'm at work now, I'll have a look-see later.

                  • 6. Re: Measurements / dimensions of elements
                    KatDeskat Level 1

                    Great, thanks!


                    • 7. Re: Measurements / dimensions of elements
                      Mayhem SWE Level 2

                      One could quite easily automate labeling of distances as well. You just couldn't implement it as a custom tool, but rather as a script which prints out the measurements of an existing ordinary line.

                      1 person found this helpful
                      • 8. Re: Measurements / dimensions of elements
                        [Jongware] Most Valuable Participant

                        Sure, but that requires you to draw a line between the items you want to measure -- and it should necessarily be exactly from one element to another. I was thinking of something quite simpler.

                         

                        http://forums.adobe.com/servlet/JiveServlet/showImage/63694/dimensions.png

                         

                        Look at the sample image. I was thinking, if you select a single object, the script could overlay the dimensions and position, and if you select two objects, it could draw a line between them and label that distance instead.

                        1 person found this helpful
                        • 9. Re: Measurements / dimensions of elements
                          KatDeskat Level 1

                          Hey guys,

                           

                          Both ways sound great!

                          Selecting 2 elements and indicating the distance between would work fine, and the alternative of creating a line/box when there is none, is not a problem.

                          How do I do such a script?

                          • 10. Re: Measurements / dimensions of elements
                            KatDeskat Level 1

                            Hey guys,

                             

                            Both ways sound great!

                            Selecting  2 elements and indicating the distance between would work fine, and the  alternative of creating a line/box when there is none, is not a  problem.

                            How do I do such a script?

                            • 11. Re: Measurements / dimensions of elements
                              [Jongware] Most Valuable Participant

                              KatDeskat wrote:

                               

                              Hey guys,

                               

                              Both ways sound great!

                              Selecting 2 elements and indicating the distance between would work fine, and the alternative of creating a line/box when there is none, is not a problem.

                              How do I do such a script?

                               

                              Sorry, normally I'd be right on top of this but I've bin horribly busy lately ... I hope some of the other scripters can help you out, as it's not really a technical challnege.

                               

                              [Jw]

                              • 12. Re: Measurements / dimensions of elements
                                KatDeskat Level 1

                                I understand

                                 

                                Is there anyone who could help me solve this?

                                 

                                Cheers,

                                 

                                Kat