20 Replies Latest reply on Nov 28, 2013 5:53 AM by Marc Autret

    hi i want to create a shape with multiple point

    Yogendra_Pal

      My original text frame is:

      first.jpg

      All character make by using the pen tool point

      I used that script(shows below) for first 2 character of that text frame which is create by the use of pen and pencil tool point:

       

      var myTextFrame=myDocument.spreads.item(0).textFrames.add();

       

      W = [["113.324296","212.731144"],["124.871437","212.731144"],["124.871437","205.148222"],["11 3.324296","205.148222"],];

       

      myTextFrame.paths.firstItem().pathType = 1668051812;

       

      W.splice(4,8,["152.405080","190.761163"],["152.405080","232.323775"],["156.821515","232.32 3775"],["156.821515","173.873789"],["153.555194","173.873789"],["152.090595","181.286355"] ,["144.653314","185.104713"],["144.653314","190.761163"],);

      myTextFrame.paths.firstItem().entirePath = W;

      myTextFrame.paths.firstItem().pathType = 1668051812;

       

      but i am getting first both character as:

       

      next.jpg

       

      which is not write.

      i want to the separate character which is make by the pen tool use such as above text frame. please provide me the write script for that type of text frame character. i am also given the path type.

       

       

      Thanks

        • 1. Re: hi i want to create a shape with multiple point
          Trevorׅ Adobe Community Professional

          Presuming you have a font which is the shape you want.

          Just convert the "character" to an outline and then erase the character but keep the outline, make sure the fillcolor is set to none and set the content type to text.

           

          Good Luck

           

          Trevor

          1 person found this helpful
          • 2. Re: hi i want to create a shape with multiple point
            Yogendra_Pal Level 1

            thanks Trevor

             

            But my problem is not that.

            my original Pen tool frame is such as:

             

            NewFirst.jpg

             

            and i getting by your script that here we define only first two character of text frame such as:

             

            newSecond.jpg

             

            here i m not getting the seprate character such as original frame. what is the script which seprate these character and showing in single text frame.

            • 3. Re: hi i want to create a shape with multiple point
              Jump_Over Level 5

              Hi,

               

              Jumping over your goal and your way to reach it, to create your paths use:

               

              var 
                   myDocument = app.activeDocument,
                   myTextFrame=myDocument.spreads.item(0).textFrames.add(),
                   W = [["113.324296","212.731144"],["124.871437","212.731144"],["124.871437 ","205.148222"],["113.324296","205.148222"],];
              
              myTextFrame.paths[0].entirePath = W;
              myTextFrame.paths[0].pathType = 1668051812;
              
              myTextFrame=myDocument.spreads.item(0).textFrames.add();
              W = [["152.405080","190.761163"],["152.405080","232.323775"],[ "156.821515","232.323775"],["156.821515","173.873789"],["153.555194"," 173.873789"],["152.090595","181.286355"],["144.653314","185.104713"],[ "144.653314","190.761163"]];
              myTextFrame.paths[0].entirePath = W;
              myTextFrame.paths[0].pathType = 1668051812;
              

               

               

              However have to ask you:

              Why are you trying to draw a textFrames with above shapes?

              Are you going to type inside?

               

              Jarek

              1 person found this helpful
              • 4. Re: hi i want to create a shape with multiple point
                Trevorׅ Adobe Community Professional

                If you have a shape made by the pen tool and want to convert it into a textframe then after you have made the shape the you just need to do

                 

                myShape.contentType = ContentType.TEXT_TYPE;

                 

                You can then type in that shape.

                 

                I think this is what Jarek was hinting at.

                 

                Trevor

                • 5. Re: hi i want to create a shape with multiple point
                  Jump_Over Level 5

                  Hi,

                   

                  Original code is

                   

                  ...

                  myTextFrame.paths.firstItem().entirePath = W;

                  ...

                   

                  which draws a textFrame as a polyghon shape. It is trying to build a textFrame from separated paths which can not be done.

                  Thats what I am hinting

                   

                  Jarek

                  • 6. Re: hi i want to create a shape with multiple point
                    Yogendra_Pal Level 1

                    thanx jarek.

                     

                    that is right which script u r given.

                    but problem is here you add two text frame, i want both character into a single text frame.

                    i want that such as first image shown in this query.

                     

                    Such as:

                     

                    first.jpg

                    by your Query we find that.

                     

                    Jarek1.jpg

                     

                     

                    Jarek2.jpg

                    here that shows different frame for both.

                    But i want both into a single frame.

                    • 7. Re: hi i want to create a shape with multiple point
                      Trevorׅ Adobe Community Professional

                      like Jarek said you can't do it.

                      If you wan't you can link and group them and then they will look like they are 1 but they will be 2

                      • 8. Re: hi i want to create a shape with multiple point
                        Jump_Over Level 5

                        ...

                        i want that such as first image shown in this query.

                         

                        Such as:

                         

                        first.jpg

                         

                         

                        Well,

                         

                        I am pretty sure your object is not a textFrame.

                        Can you type inside?

                         

                        The problem is we are talking about different goals using different definitions

                         

                        Jarek

                        1 person found this helpful
                        • 9. Re: hi i want to create a shape with multiple point
                          Yogendra_Pal Level 1

                          thanx jarek,

                           

                          that is not a text frame,

                          but when we use selection tool than all character which make by the pen tool into a bounded line as a text frame, and also here is not useing group property.

                          can how it possible through script.

                          • 10. Re: hi i want to create a shape with multiple point
                            Jump_Over Level 5

                            Hi,

                             

                            Continuing your example:

                             

                            var 
                                 myDocument = app.activeDocument,
                                 myObject1, myObject2,
                                 W = [["113.324296","212.731144"],["124.871437","212.731144"],["124.871437 ","205.148222"],["113.324296","205.148222"],];
                            
                            
                            myObject1=myDocument.spreads.item(0).polygons.add();
                            myObject1.paths[0].entirePath = W;
                            myObject1.paths[0].pathType = 1668051812;
                            
                            
                            myObject2=myDocument.spreads.item(0).polygons.add();
                            W = [["152.405080","190.761163"],["152.405080","232.323775"],[ "156.821515","232.323775"],["156.821515","173.873789"],["153.555194"," 173.873789"],["152.090595","181.286355"],["144.653314","185.104713"],[ "144.653314","190.761163"]];
                            myObject2.paths[0].entirePath = W;
                            myObject2.paths[0].pathType = 1668051812;
                            
                            
                            myObject1.makeCompoundPath(myObject2);
                            

                             

                            So first draw objects ==> second make compound path (union)

                             

                            Jarek

                            1 person found this helpful
                            • 11. Re: hi i want to create a shape with multiple point
                              [Jongware] Most Valuable Participant

                              Jarek, although your method works, there is no need to create-then-unite separate paths. The OP is missing the fact that a single *object* can contain multiple *paths*. For instance, the character '0', when converted to outlines, is a single object but it contains 2 paths. (Something that should have been easy to discover by inspecting the original object in the first post.)

                               

                              All you need to do after creating the first object (which, by default, has a single path) is to keep on adding more paths to the same object. Each sub-path has all properties of a regular path (you have to make it "closed"), but it is a single object so color, lines, and fills will be applied to the entire thing, and selecting any part of it will select all of it.

                               

                              var 
                                   myDocument = app.activeDocument,
                                   myObject1, myObject2,
                                   W = [["113.324296","212.731144"],["124.871437","212.731144"],["124.871437 ","205.148222"],["113.324296","205.148222"],];
                              
                              
                              myObject1=myDocument.spreads.item(0).polygons.add();
                              myObject1.paths[0].entirePath = W;
                              myObject1.paths[0].pathType = PathType.CLOSED_PATH;
                              myObject2=myObject1.paths.add();
                              W = [["152.405080","190.761163"],["152.405080","232.323775"],[ "156.821515","232.323775"],["156.821515","173.873789"],["153.555194"," 173.873789"],["152.090595","181.286355"],["144.653314","185.104713"],[ "144.653314","190.761163"]];
                              myObject2.entirePath = W;
                              myObject2.pathType = PathType.CLOSED_PATH;
                              
                              • 12. Re: hi i want to create a shape with multiple point
                                Jump_Over Level 5

                                Hi,

                                 

                                Yeap, I agree.

                                You've displayed something new in front of me, thanks.

                                 

                                Jarek

                                • 13. Re: hi i want to create a shape with multiple point
                                  Trevorׅ Adobe Community Professional

                                  I see that if you put were to put text into this (which doesn't seem to be what you want to do) this is counted as one text frame and not two as a said before.

                                  The text fill vertically and not horizontally like linked text frames. If you try it out you can see what I mean.

                                  • 14. Re: hi i want to create a shape with multiple point
                                    [Jongware] Most Valuable Participant

                                    Trevor, my guess is the OP is confusing the matter because s/he thinks of a frame in the shape of text ∴ it must be a text frame.

                                    • 15. Re: hi i want to create a shape with multiple point
                                      Yogendra_Pal Level 1

                                      thanks to Trevor, Jarek and special thanx to Jongware s/he find my problem and also solve it...

                                       

                                      Again thanx all of you..

                                       

                                      Yogendra

                                      • 16. Re: hi i want to create a shape with multiple point
                                        Yogendra_Pal Level 1

                                        hi friends,

                                         

                                        var
                                             myDocument = app.activeDocument,
                                             myObject1, myObject2,

                                        W = [["768.161646","0.702997"],["962.477412","0.702997"]];

                                         

                                        myObject1=myDocument.spreads.item(0).polygons.add();
                                        myObject1.paths[0].entirePath = W;

                                         

                                         

                                        thats script is given the error  what will be the problem i am not getting it.

                                        plese give me the correct java script.

                                         

                                        i know that is not create a text frame it create only a Line But how i create it.

                                         

                                        Thanx

                                         

                                        Yogendra

                                        • 17. Re: hi i want to create a shape with multiple point
                                          Yogendra_Pal Level 1

                                          hi friends,

                                           

                                          var
                                               myDocument = app.activeDocument,
                                               myObject1, myObject2,

                                          W = [["768.161646","0.702997"],["962.477412","0.702997"]];

                                           

                                          myObject1=myDocument.spreads.item(0).polygons.add();
                                          myObject1.paths[0].entirePath = W;

                                           

                                           

                                          thats script is given the error  what will be the problem i am not getting it.

                                          plese give me the correct java script.

                                           

                                          i know that is not create a text frame it create only a Line But how i create it.

                                           

                                          Thanx

                                           

                                          Yogendra

                                          • 18. Re: hi i want to create a shape with multiple point
                                            Laubender Adobe Community Professional & MVP

                                            @Yogendra – there is no Polygon with only two path points.

                                            Two path points make a GraphicLine object.

                                             

                                            So you could construct it this way:

                                             

                                            var pathPoints = [["0","10"],["100","110"]];
                                            
                                            var gL1 = app.documents[0].graphicLines.add({
                                            
                                                 strokeColor:"Magenta",
                                                 strokeWeight:10
                                                 //… add some more properties
                                            
                                                 });
                                            
                                            gL1.paths[0].entirePath = pathPoints;
                                            

                                             

                                            Uwe

                                            • 19. Re: hi i want to create a shape with multiple point
                                              Yogendra_Pal Level 1

                                              hi friend.

                                               

                                              my script is that:

                                               

                                              var myDocument = app.activeDocument;

                                              var myTextFrame=myDocument.spreads.item(0).textFrames.add( );

                                               

                                              W = [["162.741545","212.557648"],["162.114596","195.597693"],["209.109267","168.419555"],["25 0.681453","164.760574"],["312.133401","179.917906"],["360.332979","213.891495"],["357.9234 33","271.905238"],["347.078395","279.223027"],["315.146608","284.450534"],["251.222635","2 62.044344"],["214.531752","240.546364"],["181.727995","230.531831"]];

                                               

                                              myTextFrame.paths[0].entirePath = W;

                                              myTextFrame.paths[0].pathType = 1668051812;

                                               

                                               

                                              i want to convert these point into a symmetrical form, how i convert it into symmetrical form through java script. plese give me a correct script.

                                               

                                               

                                              Thanx

                                              • 20. Re: hi i want to create a shape with multiple point
                                                Marc Autret Level 4

                                                Do you mean

                                                 

                                                // . . .
                                                // your code here
                                                // . . .
                                                
                                                myTextFrame.paths.everyItem().
                                                     pathPoints.everyItem().
                                                     pointType = PointType.SYMMETRICAL;
                                                

                                                 

                                                ?