Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SVG export suffixing layer names with '_1_'

Explorer ,
Mar 17, 2017 Mar 17, 2017

As per SVG export _1_

When copying a layer to the clipboard the ID for a layers name is suffixed with '_1_' in the SVG code. In the snippet below my layer is called 'layerName' but the copied SVG labels it 'layerName_1_'.

<rect id="layerName_1_" x="0.5" y="0.5" style="&st0;" width="130.6" height="72.7"/>

If I 'Save As' .svg the same file and open up the 'SVG Code...' panel available during export the code looks correct?

<rect id="layerName" x="123.6" y="127.3" style="&st0;" width="130.6" height="72.7"/>

Bug?

Thanks,
Chris

2.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Mar 17, 2017 Mar 17, 2017

Please tell us step by step:

- what you have

- what you're doing

- what you expect to happen

Your version and system

In Illustrator you can't copy a layer. You can only copy an object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 17, 2017 Mar 17, 2017

Hi Monica,

Sorry, layer = object. When you copy an object the svg code gives you the objects name as per the examples I've provided.

Create a rectangle

Name it 'rectangle'

Copy it to your clipboard

Paste it into a text editor

Within that code you should see > rect id="rectangle_1_"

If I 'Save As' .svg the same file and open up the 'SVG Code...' panel available during export the code looks like > rect id="rectangle"

My question is where is the _1_ coming from via the copy/paste method?

We develop a tool in Autodesk Maya that allows you to copy/paste svg files into a 3d scene. We take the objects name from this code so this seemingly extraneous '_1_' appears suffixed to the name. We can't filter it out because someone may name an object _1_ intentionally.

Thanks,
Chris

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2017 Mar 17, 2017

Thank you for the explantion.

To me this looks like Illustrator considers the copy to clipboard operation as a duplicate of the object and treats this like it treats objects when the XML-ID option is checked in Preferences > Units.

I don't know if this is a bug. Since you're developing a plugin/tool, why not try and discuss this in the SDK community. Maybe someone there has faced it as well Illustrator SDK

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 17, 2017 Mar 17, 2017

Hi Monika,

It's less about development as that's all on the Maya side. All we expect a user to have to do is create some artwork, copy it and then paste it into Maya. They can do that from any vector program. So, we just take the clipboard and import that .svg data to Maya. Illustrator seems to be adding this _1_ (other vector apps don't).

I've tried that setting but both give me the same result.

Seems I should report as an (8 year old!) bug?

Thanks,

Chris

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 19, 2020 Feb 19, 2020

If any one else is expericing this _1_ suffix problem you need to ungroup the selection and then regroup them and then rename them, providing there's no other layers with the same name.  There's some sort of background meta data about the layers that SVG uses to refrence them that isn't handled at conversion time.

 

You could just rename it to something else, save, rename it back, export. However that won't work for all the layers nested ids as they'll keep the _1_ suffix.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 21, 2020 Feb 21, 2020
LATEST

It's usually a "hanging" space that isn't visible in the layer name field.

I know, you'll open the layer back up, re-select the layer name and the "hanging" space won't be there (trust me I've been there).

But please do try this:

1. Select the layer name and delete it.

*** let it revert to <Path>

2. Retype it (do not try to copy and paste.)

3. At the end of typing the layer name (for the 20th time, I know), hit delete.

 

This has worked for me in the past. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines