Converting Groups to Layers in Illustrator |
Top Previous Next |
|
An issue you'll encounter when importing any SVG file into Illustrator is that you'll end up with a hierarchy of groups, not actual Illustrator layers and sublayers. Furthermore, any layer or sublayer will be exported from Illustrator as an ordinary SVG group, the distinction between groups and layers being lost. Since the roundtripping process requires that you place artwork into specially named SVG groups, you might think it necessary to modify the way you draw. For example, you can use the direct selection tool (white arrow cursor) to target objects inside groups.
My preference, however, is to transform the particular groups I need to work with into true layers so that they can be targeted in the usual way. This is only needed when a raw SVG export from Walls is first opened in Illustrator, or when a Walls-updated SVG is being brought back in. At other times we would be maintaining an AI file while doing our drafting and occasionally spinning off SVG files for use by other software.
Caution: Unfortunately, not only is this aspect of the layer structure discarded when Illustrator exports to pure SVG format. When the file is read back in, some art objects, notably brush strokes, will have been "expanded" and will not be as easily editable. Illustrator artwork should never be saved as an SVG file until it's necessary, say for adjustment by Walls.
Using a Script to Convert Groups to Layers. An Illustrator script that can perform this conversion is now installed alongside Walls in its application folder. To make it especially easy to invoke, you'll need to copy file w2dGroupsToLayers.jsx to Illustrator's script folder when Illustrator is not running. (Windows may prompt for permission to do this.) On my computer this folder is
C:\Program Files\Adobe\Adobe Illustrator CS6 (64 Bit)\Presets\en_US\Scripts\.
After that, whenever you open an SVG freshly exported from Walls, select File | Scripts from Illustrator's main menu. The name w2dGroupsToLayers should appear in the list of readily-available scripts. Just clicking on the name will execute the script, which begins with a request for confirmation -- a total of 3 mouse clicks.
The groups that are converted, if they are found, are w2d Legend, w2d Walls, w2d Walls sym, w2d Walls shp, w2d Detail, w2d Detail sym, w2d Detail shp, and w2d Mask. The other w2d groups are placed in an initial locked state. The script makes no changes if the top layer is either empty or it already contains true sublayers. Other layers can exist below the top layer, in which case they shouldn't be affected.
Manually Converting Groups to Layers Here are instructions for converting the key SVG groups into layers using Illustrator's Layer panel functions. They could be performed as described here, after Illustrator opens an SVG file generated by Walls. But even if you've used the above script for that task, you might need to use the manual method on a specific named group you've created earlier as a sublayer, say one now existing as a subgroup of w2d Walls shp.
This amounts to just a few mouse clicks per layer, and with practice the conversion of groups to layers can be done in about 3 minutes. |