5 Replies Latest reply on Aug 29, 2016 12:51 PM by kglad

    JSFL Convert Lines to Fill

    gregmax34

      Just like the title says, I'm writing a script that I want to convert all lines in the library to fill.

       

      Every time I do try to call it, I get an error "Error: The function convertLinesToFills() is currently unavailable."

       

      Any reason why?

        • 1. Re: JSFL Convert Lines to Fill
          kglad Adobe Community Professional & MVP

          are you selecting an object and then using:

           

          fl.getDocumentDOM().convertLinesToFills()

          1 person found this helpful
          • 2. Re: JSFL Convert Lines to Fill
            gregmax34 Level 1

            Yep, sure am. I have done some more digging and found out that the shape object had vector lines, because calling convertLinestoFills without breaking apart would cause function is unavailable error. So I had to break that element apart. And breaking things apart wasn't easy either. I had to lock all the layers except the layer and frame I want to edit and then call break apart.

             

            However, it still doesn't apart to convert the lines to fills.

             

            This is what I'm doing:

             

            if ( member.isDrawingObject )

            {

                var tl = dom.getTimeline();

                for ( var i = 0; i < tl.layers.length; i++ )

                    tl.layers[i].locked = i !== currentLayer;

             

                tl.currentFrame = currentFrame; //

                tl.currentLayer = currentLayer;

             

                 dom.selectAll(); // WHY must I select everything? seems a bit scary

                // dom.selection = [member]; // THIS is what I want!

                dom.breakApart();

                dom.convertLinesToFills(); // still not working

                dom.selectNone();

            }

            • 3. Re: JSFL Convert Lines to Fill
              kglad Adobe Community Professional & MVP

              the first problematic line i see is,

               

              if ( member.isDrawingObject )

               

              which should probably be deleted.

               

              though this doesn't look right, either:

               

              tl.layers[i].locked = i !== currentLayer;

               

              what are you trying to do with that line of code?

              1 person found this helpful
              • 4. Re: JSFL Convert Lines to Fill
                gregmax34 Level 1

                That line of code is not the problem from what I understand from this: The function breakApart() is currently unavailable!?

                 

                I need to lock all layers except the one I want to break apart.

                • 5. Re: JSFL Convert Lines to Fill
                  kglad Adobe Community Professional & MVP

                  what's that line of code supposed to be doing?