36 Replies Latest reply: Jun 29, 2011 4:06 PM by kalvin4599 RSS

    Control Panel - round to 3 decimal points

    kalvin4599 Community Member

      I create technical Illustrations with Ai. I pull the dimensions in by copying and pasting the information out of the control panel. Currently the control panel shows to the 4th decimal point. How can I set to 3? If there is not a preference, or easy setting, is there someone out there I can pay to alter my copy of Illustrator for me? It slows me down substantially to have to manually round the numbers.

        • 1. Re: Control Panel - round to 3 decimal points
          Grant H Community Member

          are you using CS2 by any chance?

           

          G

          • 2. Re: Control Panel - round to 3 decimal points
            Grant H Community Member

            any way. if thats the case — Cs2 — then you cant change it. And if you had a Intel Mac then you get up to 15 or more... (was an issue till Cs2 update I think)

             

            G

            • 3. Re: Control Panel - round to 3 decimal points
              kalvin4599 Community Member

              I'm using CS4 on an Intel Based Mac.


              • 4. Re: Control Panel - round to 3 decimal points
                kalvin4599 Community Member

                how do you set it?


                • 5. Re: Control Panel - round to 3 decimal points
                  Grant H Community Member

                  hold on: you working in inches right? i forget that some times... inches in CS4 decimals = 4.... mm = 3...

                   

                  Cant change dude.

                   

                  G

                  • 6. Re: Control Panel - round to 3 decimal points
                    kalvin4599 Community Member

                    Yes, inches.

                     

                    Somewhere, there has to be a programmer that can change this for me....

                    • 7. Re: Control Panel - round to 3 decimal points
                      CarlosCanto Community Member

                      kalvin4599 wrote:

                       

                      Yes, inches.

                       

                      Somewhere, there has to be a programmer that can change this for me....

                       

                      I don't know about changing the actual Illustrator palette's decimal places, but there's hope...there's a project (that's been kind of on hold) that does something similar. Unfortunately, faulty Illustrator doesn't work as advertised and interactive palettes don't work.

                       

                      http://forums.adobe.com/thread/805267

                       

                      a working "always on top" window that resembles an AI palette can be programmed in Windows...so...I'm assuming it could be done on a mac too, but it might not.

                      • 8. Re: Control Panel - round to 3 decimal points
                        JETalmage Community Member

                        As to the difficulty of getting AI's scripting to generate a palette that works as expected:

                         

                        For those unfamiliar, the issue is this: The whole purpose of a palette is to enable the dialog to remain on screen, and have its values update accordingly while program focus is changed to the document window (as when one has to change the selection). I, too, have never got this to work as advertised. But I'm not certain I'm not overlooking something.

                         

                        Using a modal dialog (of which Illustrator is excruciatingly full), in a script prevents you from interacting with the page until the dialog is dismissed. So capturing the existing values of an object's position and size is fairly trivial (as is converting the values to the current ruler units). But you have to dismiss the dialog before you can select the object to which you then want to apply the values. Doing so ends the script, so the script no longer "remembers" the values it captured.

                         

                        Nonetheless, a workaround is possible by using a temporary on-page object to contain the values (several of my own scripts resort to this), and run two scripts. For example, a pair of TransferValues scirpts could work thusly:

                         

                        Script one:

                        Captures the values from the current selection.

                        Creates a textFrame somewhere.

                        Names the textFrame.

                        Sets the text of the textFrame to the values.

                        Ends.

                         

                        The user then selects another object.

                         

                        Script two:

                        Finds the textFrame by its name.

                        Grabs the values from the textFrame's content as variables.

                        Applies the variables to the current selection.

                        Ends.

                         

                        Script two can either be made to delete the textFrame, or leave it be so that Script two can be run on as many other objects as desired. Best way depends on the specifics of the intended purpose.

                         

                        Another workaround might be one script, run when multiple objects are selected:

                         

                        First, the user makes sure the object from which the values are to be captured is either frontmost or rearmost.

                        Then, the user selects that object and all objects to which the values are to be applied.

                        The user invokes the script.

                        The script applies the values of the frontmost object of the current selection to all the other objects in the selection.

                         

                        Many of the things a scripter would accomplish with a non-modal Palette could be accomplished by combining Action steps (to playback normal UI moves) with Javascripts run by the Action using the Insert Menu Command---if only Adobe would fix the 6-version-old bug which causes the script calling step to go vacant after a relaunch of the program.

                         

                        JET

                        • 9. Re: Control Panel - round to 3 decimal points
                          kalvin4599 Community Member

                          I don't think I need to generate a palette, but your response did give me an idea: is there a script or utility that would let me copy the information out of the control panel, round it to 3 decimils, and let me paste it?

                          • 10. Re: Control Panel - round to 3 decimal points
                            JETalmage Community Member
                            but your response did give me an idea

                             

                            That's what I just described. I have not written the script, but my previous post describes two possible schemas for doing so. For anyone to write one that would work for your purpose would first require your carefully describing exactly what you want it to do. What values do you want to capture? Do you want to apply them to one other object, or multiple objects? If the other objects are in differing positions on the page, what exactly do you want to occur? And so on.

                             

                            Scripting is very literal. The script will do exactly what you code it to do and nothing more. So you really have to think through the possible scenarios in which you would invoke it, and the caveats those scenarios may present.

                             

                            JET

                            • 11. Re: Control Panel - round to 3 decimal points
                              kalvin4599 Community Member

                              Oh, I really didn't make that part clear. I need to be able to copy the height or width of an object, out of the control panel, then paste it as text into the illustrations. Literally, I select an object, copy it's width, hit escape (to clear out of the control panel) select a text object and paste the value as a label into the illustration. My client has asked me to label the drawing to the 3rd decimal point and I have rounded incorrectly a few times.

                              • 12. Re: Control Panel - round to 3 decimal points
                                JETalmage Community Member

                                So you just need a rudimentary dimension tool.

                                 

                                 

                                The script is dependent upon the presence of a couple of Graphic Styles and Paragraph Styles. So after installing the script, open the AI file named JET_DimensionStyles and follow the instructions to copy/paste the provided object.

                                 

                                After doing that, to use it, get the Line Tool and draw a path corresponding to the dimension you want, snapping to object bounds or anchorPoints (turn on SmartGuides). Then run the script.

                                 

                                Of course if you paste the object into your startup files or templates, you'll have it for any new documents.

                                 

                                JET

                                • 13. Re: Control Panel - round to 3 decimal points
                                  kalvin4599 Community Member

                                  Close, very close, by dimention lines,arrow heads and text lable are already part of the illustration. I just need the part where it copys the width of the object, rounds that data to 3 decimil points and loads it into the pasteboard, so I can then paste the data into the lable.

                                  • 14. Re: Control Panel - round to 3 decimal points
                                    JETalmage Community Member

                                    So just get the text tool, swipe across the text created by the script, copy, delete the group, and paste into your pre-existing textFrame. Pretty much the same thing you'd have to do if the script only drew the textframe object. (Either way seems alot of bother just to round a given value to thousanths.)

                                     

                                    JET

                                    • 15. Re: Control Panel - round to 3 decimal points
                                      kalvin4599 Community Member

                                      Yes, too many steps. I'm looking to shave off seconds. I just need to find a script writer to write me a custom script.

                                      • 16. Re: Control Panel - round to 3 decimal points
                                        PrepressPro1 Community Member

                                        Here is a link to the thread I put up to get a similar task completed. All you would need do is have the script reduce the number to 3 decimal places.

                                         

                                        http://forums.adobe.com/thread/468649

                                        • 17. Re: Control Panel - round to 3 decimal points
                                          kalvin4599 Community Member

                                          I know nothing about writing or editing scripts. If you, or anyone reading this, is willing to write me a custom script, I am willing to pay for it. I downloaded one of JET's scrips (.jsx file), and will able to install and run it, but that is the extent of my knowldedge of scrips.

                                          • 18. Re: Control Panel - round to 3 decimal points
                                            CarlosCanto Community Member

                                            do you always need to label both, height and width? or sometimes H? sometimes W?

                                            does the text box where you paste the dimmensions have other text, besides what you're pasting?

                                             

                                            can you post a screen shot with actual selected object and text frame?

                                            • 19. Re: Control Panel - round to 3 decimal points
                                              kalvin4599 Community Member

                                              Only the width. I just need to be able to copy what is circled in pink, trip a script, and paste it into the existing lable, rounded to 3 decimils.Screen shot.jpg

                                              • 20. Re: Control Panel - round to 3 decimal points
                                                CarlosCanto Community Member

                                                cool, how about this

                                                 

                                                - select both, the text and the object

                                                - run a script

                                                 

                                                the script will get the selected object's width (6.2112) and change the text frame accordingly (6.211).

                                                 

                                                would that work for you? the script would have to run once per pair (object, text frame) at a time

                                                 

                                                ***********

                                                 

                                                another option, if you already have all the text frames labeled correctly but with 4 decimals, we could select all text frames, and run a script to round to 3 decimals in one go.

                                                • 21. Re: Control Panel - round to 3 decimal points
                                                  kalvin4599 Community Member

                                                  The second option would be GREAT!! I created 450 drawings before the client changed their mind to go from 4 to 3 decimal places.

                                                   

                                                  I don't know know to write scripts, so if you are willing to write, I will gladly pay you for it.

                                                  • 22. Re: Control Panel - round to 3 decimal points
                                                    CarlosCanto Community Member

                                                    I'll write one tonight after work

                                                    • 23. Re: Control Panel - round to 3 decimal points
                                                      CarlosCanto Community Member

                                                      here you go, select as many text Frames as you wish before running

                                                       

                                                      #target Illustrator
                                                      
                                                      // script.name = roundSelectedFrames.jsx;
                                                      // script description = rounds selected textFrames to 3 decimals;
                                                      // script.required = select at least one text frame before running;
                                                      // script.parent = CarlosCanto // 6/14/11;
                                                      // script.elegant = false;
                                                      
                                                      var idoc = app.activeDocument;
                                                      sel = idoc.selection;
                                                      if (sel.length>0)
                                                           {
                                                                for (i=0 ; i<sel.length ; i++ )
                                                                     {
                                                                          var iframe = sel[i];
                                                                          iframe.contents = Number(iframe.contents).toFixed(3);
                                                                     }
                                                           }
                                                      else
                                                           {
                                                                alert("select at least one text frame before running");
                                                           }
                                                      

                                                      • 24. Re: Control Panel - round to 3 decimal points
                                                        kalvin4599 Community Member

                                                        I know how to run a .jsx file through Illustrator, but I don't know how to make one from the text you sent.

                                                        • 25. Re: Control Panel - round to 3 decimal points
                                                          CarlosCanto Community Member

                                                          run the ExtendScript Toolkit, on Windows is in the Utilities Folder in the same folder where the other Adobe applications are. Copy the script from here and paste it into a blank document in the ESTK, save it, and you'll have your .jsx

                                                          • 27. Re: Control Panel - round to 3 decimal points
                                                            CarlosCanto Community Member

                                                            I know, if I had a mac, I would have told you where to find it...look for it

                                                            • 28. Re: Control Panel - round to 3 decimal points
                                                              kalvin4599 Community Member

                                                              WOW! I had no idea that program was even on my machine. IT WORKED!!, but only on text frames that contain numbers only. It didn't occure to me, and I failed to mention that most of the text frames have more than just the measurement. Most look something like "8.5421, 4" D (+50%)".

                                                               

                                                              Can we go back to option 1? Where I can copy what is circled in pink, trip a script, and paste it into the existing lable, rounded to 3 decimils.

                                                               

                                                              Screen+shot.jpg

                                                              Thanks for all your help!!


                                                              • 29. Re: Control Panel - round to 3 decimal points
                                                                CarlosCanto Community Member

                                                                try this one

                                                                 

                                                                #target Illustrator
                                                                 
                                                                // script.name = roundSelectedFrames.jsx;
                                                                // script description = rounds selected textFrames to 3 decimals;
                                                                // script.required = select at least one text frame before running;
                                                                // script.parent = CarlosCanto // 6/14/11;
                                                                // script.elegant = false;
                                                                 
                                                                var idoc = app.activeDocument;
                                                                sel = idoc.selection;
                                                                if (sel.length>0)
                                                                     {
                                                                          for (i=0 ; i<sel.length ; i++ )
                                                                               {
                                                                                    var iframe = sel[i];
                                                                
                                                                                    var content = iframe.contents;
                                                                                    var search4decimals = /\d.\d\d\d\d/;
                                                                                    var decimals4 = content.match(search4decimals);
                                                                                    var decimals3 = Number(decimals4).toFixed(3);
                                                                                    var replace = content.replace(decimals4,decimals3);
                                                                                    iframe.contents = replace;
                                                                
                                                                               }
                                                                     }
                                                                else
                                                                     {
                                                                          alert("select at least one text frame before running");
                                                                     }
                                                                
                                                                • 30. Re: Control Panel - round to 3 decimal points
                                                                  kalvin4599 Community Member

                                                                  Thank you!,  Thank you!,  Thank you!,  Thank you!,  Thank you!,  Thank you!

                                                                   

                                                                  It works great!

                                                                   

                                                                  Can I pay you?

                                                                  • 31. Re: Control Panel - round to 3 decimal points
                                                                    kalvin4599 Community Member

                                                                    I have  a hick-up.

                                                                     

                                                                    Some times it does not round correctly.

                                                                     

                                                                    See file http://www.kalgraphics.com/Error.eps.zip

                                                                     

                                                                    1st line: 21.6675 should round to 21.668, but it rounds to 21.667

                                                                     

                                                                    2nd line: 8.103, no rounding needed

                                                                     

                                                                    3rd line: 17.5275 should round to 17.528, but it rounds to 17.527

                                                                     

                                                                    4th line #1: 5.2462 should round to 5.246 and it does

                                                                     

                                                                    4th line #2: 25.5075 should round to 25.508 and it does

                                                                     

                                                                    4th line #3: 5.2462 should round to 5.246 and it does

                                                                    • 32. Re: Control Panel - round to 3 decimal points
                                                                      CarlosCanto Community Member

                                                                      weird, nevermind I changed the line to something else, use this one, version 1.3

                                                                       

                                                                      #target Illustrator
                                                                       
                                                                      // script.name = roundSelectedFrames1.3.jsx;
                                                                      // script.description = rounds selected textFrames to 3 decimals;
                                                                      // script.required = select at least one text frame before running;
                                                                      // script.parent = CarlosCanto // 6/17/11;
                                                                      // script.elegant = false;
                                                                       
                                                                      var idoc = app.activeDocument;
                                                                      sel = idoc.selection;
                                                                      if (sel.length>0)
                                                                           {
                                                                                for (i=0 ; i<sel.length ; i++ )
                                                                                     {
                                                                                          var iframe = sel[i];
                                                                      
                                                                                          var content = iframe.contents;
                                                                                          var search4decimals = /\d.\d\d\d\d/;
                                                                                          var decimals4 = content.match(search4decimals);
                                                                                          var decimals3 = Math.round((Number(decimals4)*1000))/1000;
                                                                                          //var decimals3 = Number(decimals4).toFixed(3);
                                                                                          var replace = content.replace(decimals4,decimals3);
                                                                                          iframe.contents = replace;
                                                                                     }
                                                                           }
                                                                      else
                                                                           {
                                                                                alert("select at least one text frame before running");
                                                                           }
                                                                      
                                                                      • 33. Re: Control Panel - round to 3 decimal points
                                                                        kalvin4599 Community Member

                                                                        this one seems to be working fine. THANKS AGAIN!!

                                                                        • 34. Re: Control Panel - round to 3 decimal points
                                                                          kalvin4599 Community Member

                                                                          It's working GREAT!

                                                                           

                                                                          What are the chances you could get it to add any zeros to always make the numbers 3 digits after the decimal point?

                                                                           

                                                                          So 5.25" would become 5.250"

                                                                          • 35. Re: Control Panel - round to 3 decimal points
                                                                            CarlosCanto Community Member

                                                                            it searches for 4,3, or 2 digits only, here's 1.4

                                                                             

                                                                            #target Illustrator
                                                                             
                                                                            // script.name = roundSelectedFrames1.4.jsx;
                                                                            // script description = rounds selected textFrames to 3 decimals;
                                                                            // script.required = select at least one text frame before running;
                                                                            // script.parent = CarlosCanto // 6/29/11;
                                                                            // script.elegant = false;
                                                                             
                                                                            var idoc = app.activeDocument;
                                                                            sel = idoc.selection;
                                                                            if (sel.length>0)
                                                                                 {
                                                                                      for (i=0 ; i<sel.length ; i++ )
                                                                                           {
                                                                                                var iframe = sel[i];
                                                                            
                                                                                                var content = iframe.contents;
                                                                                                var search4decimals = /\d.\d\d\d\d/;
                                                                                                var decimals = content.match(search4decimals);
                                                                                                if (decimals !=null)
                                                                                                    {
                                                                                                        //alert(decimals);                    
                                                                                                        var decimals3 = Math.round((Number(decimals)*1000))/1000;
                                                                                                     }
                                                                                                else
                                                                                                    {
                                                                                                        var search3decimals = /\d.\d\d\d/;
                                                                                                        var decimals = content.match(search3decimals);    
                                                                                                        if (decimals !=null)
                                                                                                            {
                                                                                                                var decimals3 = decimals;
                                                                                                             }
                                                                                                         else
                                                                                                            {
                                                                                                                var search2decimals = /\d.\d\d/;
                                                                                                                var decimals = content.match(search2decimals);    
                                                                                                                var decimals3 = Number(decimals).toFixed(3);                            
                                                                                                            } 
                                                                                                     }
                                                                                
                                                                                                var replace = content.replace(decimals,decimals3);
                                                                                                iframe.contents = replace;
                                                                                           }
                                                                                 }
                                                                            else
                                                                                 {
                                                                                      alert("select at least one text frame before running");
                                                                                 }