Skip navigation
Currently Being Moderated

Turn selected AI sublayers into top-level layers?

Jun 5, 2008 6:20 PM

Hi, all!

I wanted to ask if by chance any of the scripting gurus here happen to have written an AI script that will take a number of selected sublayers/sub-sublayers and move them so they become top-level layers?
I am really needing this very badly, given that After Effects can only handle AI layers as separate entities. So I find myself moving tens, even hundreds of nested sublayers to the top level all the time.
Is it possible this script exists already?
 
Replies
  • Currently Being Moderated
    Aug 12, 2008 6:51 AM   in reply to Adolfo Rozenfeld
    Hello Adolfo,

    Could you find a solution for your problem?
    As I know the main problem is that a script doesn't see which layers are selected.

    Regards,
    Tom

    --
    Stop monotonity. Start productivity.
    http://softwareautomation.hu/
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2008 7:53 AM   in reply to Adolfo Rozenfeld
    Have you tried the Release to Layers command from the Layers flyout menu?
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2008 8:33 PM   in reply to Adolfo Rozenfeld
    Adolfo,

    After a little experimentation, making a script that moves sublayers to become top-level layers while maintaining the same relative stacking order between them is fairly trivial.

    But what if a layer contains a mix of sublayers and loose objects? Moving the sublayers so that they become top level layers will change the overall stacking order of the illustration, because doing so would move the sublayers to locations above or below the loose objects.

    Is that or is that not a problem in your situation?

    JET
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 15, 2008 6:02 PM   in reply to Adolfo Rozenfeld
    This .zip archive contains an AICS3 file and a draft script.

    Install the script.
    Launch Illustrator.
    Open the AI file.

    Note that an expanded Blend is on the Artboard. Each object from the former Blend is on its own Layer. The Layers palette contains 100 or so Layers, all named sequentially and nested 10 levels deep.

    Run the script a few times. Each time the script runs, an alert tells you the number of existing top-level Layers. It then moves any sublayers nested inside each of those top-level Layers so that they are top-level Layers.

    After you have done this for the number of times necessary in the example, you should see that all the Layers are top-level, and still have the correct stacking order (verified by the correct order of the overlapping paths on the Artboard).

    Again, this is just rough and experimental. This is the only file I have tried it on; but I think it should work on any file, given that there are no loose objects inside the subLayers as you described. Also, it does not operate on only selected Layers, as your original post specifies. Perhaps it will help as a starting point.

    JET
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 13, 2010 8:15 AM   in reply to JETalmage

    Are there any parameters that you can think of that would cause this script not to function properly?

     

    When I try the script on the provided JET_X_Layers.ai file... it works like a champ - but when I try and use it on a file that I am wanting to separate into top layers... I continually get a script alert saying "1 Top Level Layer(s)", and nothing seems to change in my layer palette.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 11:31 AM   in reply to andysapppp

    Still running into this problem.  This script is a real lifesaver, but I can't get it to work on my files... only the sample file that comes with the script.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 11:56 AM   in reply to andysapppp

    What OS and version of AI?  I just tried it on a file. It takes a couple of steps. First select each master layer in your document and run the Release to Layers (Sequence) from the flyout menu. Then run the script twice. The first time it should tell you the number of atarting layers and the second it will move the layers to the top layer list.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 12:16 PM   in reply to Larry G. Schneider

    OS X 10.6.7 using CS5.

     

    I tried releasing to layers (sequence), then ran the script like you suggested, and it told me the number of layers, but then when I try and run it again is just tells me that same number and does nothing in the layer palette.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 12:45 PM   in reply to andysapppp

    Can you post a screenshot of the Layers panel with one of the top layers expanded both before and after running the Release to Layers command? Here's what mine looked like.

     

    Picture 1.pngPicture 2.png

     

    If you can get it to look like the bottom picture, then the script will work.

     

    Picture 5.png

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 1:04 PM   in reply to Adolfo Rozenfeld

    That seems to have done the trick!  I tried it again, and once it was released to layers the script worked for me.

     

    Thanks for your help!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 1:33 PM   in reply to andysapppp

    Glad to help.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 4:11 PM   in reply to Adolfo Rozenfeld

    I had the same problem. In Illy CS6, I found a way though.

     

    1. Release layers (sequence).
    2. Select them all by clicking on the top sub-layer, hold shift and click on the bottom sub-layer.
    3. Drag the whole bunch above the top-level layer they're in. They will all turn into top-level layers.

     

    Unfortunately, the release to layers command doesn't name the sub-layers according to the objects they're in. Aynone has a fix for that?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2013 5:07 PM   in reply to Sampli

    here's a script to rename Sublayers (based on the first object's name), do it like this

     

    1. release layers (ie Layer 1)

    1.1 activate (highlight) layer (Layer 1)

    1.2 run script

     

    2. select them all...

     

    3. drag the whole bunch...

     

    // renameSublayers.jsx - carlos canto
    // http://forums.adobe.com/message/5403549?tstart=0#5403549
     
    var idoc = app.activeDocument;
    var ilayer = idoc.activeLayer;
     
    for (i=0; i<ilayer.layers.length; i++) {
        var isublayer = ilayer.layers[i];
        isublayer.name = isublayer.pageItems[0].name;
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)