Skip to main content
Participant
December 30, 2010
Question

Release to Layers(sequence) but retain the name of object?

  • December 30, 2010
  • 1 reply
  • 2992 views

Hi, this is my first post to this forum.

I'm a programmer and never opened illustrator until a few days ago.

I was writing a script to export all layers to png files with layer structure converted to file structure.

(using python, pywin32)

I found there are many layers that my script can't detect and found out that they are not actually layers but objects(or groups).

Found a layer menu (release to layers), but doesn't quite solve the problem perfectly.

initially I have this

- layer 001

   - object 01

      - object 1

      - object 2

release to layers(sequence) on object 01 gives

- layer 001

  - layer 91(whatever the layer number illustrator gives when release to layers are performed)

    - layer 92

       - object 1

    - layer 93

        - object 2

now I need to convert them to (so that layer can retain the name of the object)

- layer 001

  - layer 01

    - layer 1

       - object 1

    - layer 2

       - object 2

I have hundreds of layer 001, and couple thousands of object 01, and wonder if anything can be done with script to do this...

Maybe faster to recreate the artwork than manually do this..

Any help would be greatly appreciated.

This topic has been closed for replies.

1 reply

Participant
December 30, 2010

Maybe, is there a way to detect an object in script? (in any script language)

then, maybe i can implement "release to layers" with name retained.

CarlosCanto
Community Expert
Community Expert
December 31, 2010

do you want to export one object at the time?

here's how you cycle thru all objects with VBA, assuming they're path items. The sample will read its name and the name of the layer

    Dim Iapp As New Illustrator.Application

    Dim Idoc As Illustrator.Document

    Dim obj As Illustrator.PathItem

    Set Idoc = Iapp.ActiveDocument

    For Each obj In Idoc.PathItems

        MsgBox "name = " & obj.Name & " in Layer = " & obj.Layer.Name

    Next

    Set obj = Nothing

    Set Idoc = Nothing

    Set Iapp = Nothing

Participant
December 31, 2010

Thank you..

Found out they are actually compoundPathItems.

As I asked in the next post, I'm wondering If I can get Layers + compoundPathItems in their original order.

object.layers

object.compoundPathItems

will give me all of them, but not in the original order.