Highlighted

Naming paths ID's for SVG files.

New Here ,
Sep 30, 2012

Copy link to clipboard

Copied

I'm in the process of creating an SVG file. I'll have a large number of paths of which all have a seemingly random ID's assigned to them, for example path4758 (see below). Ideally, I'd love to be able to set my own ID for a path, it would help when I parse my SVG file with a Python script. Is it possible to change the ID that is assigned to a path inside of Illustrator? If so, how would I be able to do so?

Sample Path

<path id="path4758" fill="#6DBE45" stroke="#727271" d="M76.872,481.133C76.012,484.881,74.835,481.123,76.872,481.133z"/>

SVG Save Options

SVG Profile 1.1

Thanks!

Select the path and right click.

Choose "create compound path".

Look at your layers panel and you'll notice the shape or path you selected has been renamed to "<Compound Path>".

You can now change "<Compound Path>" to whatever you want the id to be.

Save the file as an SVG if you haven't already.

Done!

Views

20.6K

Likes

Translate

Translate

Report

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

Naming paths ID's for SVG files.

New Here ,
Sep 30, 2012

Copy link to clipboard

Copied

I'm in the process of creating an SVG file. I'll have a large number of paths of which all have a seemingly random ID's assigned to them, for example path4758 (see below). Ideally, I'd love to be able to set my own ID for a path, it would help when I parse my SVG file with a Python script. Is it possible to change the ID that is assigned to a path inside of Illustrator? If so, how would I be able to do so?

Sample Path

<path id="path4758" fill="#6DBE45" stroke="#727271" d="M76.872,481.133C76.012,484.881,74.835,481.123,76.872,481.133z"/>

SVG Save Options

SVG Profile 1.1

Thanks!

Select the path and right click.

Choose "create compound path".

Look at your layers panel and you'll notice the shape or path you selected has been renamed to "<Compound Path>".

You can now change "<Compound Path>" to whatever you want the id to be.

Save the file as an SVG if you haven't already.

Done!

Views

20.6K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 30, 2012 0
Most Valuable Participant ,
Sep 30, 2012

Copy link to clipboard

Copied

They are AI's internal object IDs. Only excessive scripting can change them. it would probably be a lot easier if you simply handle that part in your Py script.

Mylenium

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2012 0
New Here ,
Feb 04, 2013

Copy link to clipboard

Copied

I've found that simply changing the name of the particular path in the Layers palette sets the id for that path. Seems dodgy for some reason when implementing interactivity and there are compound paths involved, but certainly works for simpler cases.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 04, 2013 2
Community Beginner ,
Jan 05, 2015

Copy link to clipboard

Copied

Any object or layer that uses a number as a leading character in Illustrator will be converted into some crazy id in the resulting SVG.

For instance:

A layer called "1st-floor-rooms" in Illustrator will become "_x31_st-floor-rooms" in the SVG.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 05, 2015 1
Community Beginner ,
Jan 06, 2017

Copy link to clipboard

Copied

yes that's cause id's in html can never start with a number

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 06, 2017 0
New Here ,
Jan 25, 2019

Copy link to clipboard

Copied

Select the path and right click.

Choose "create compound path".

Look at your layers panel and you'll notice the shape or path you selected has been renamed to "<Compound Path>".

You can now change "<Compound Path>" to whatever you want the id to be.

Save the file as an SVG if you haven't already.

Done!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 25, 2019 0
New Here ,
Sep 04, 2020

Copy link to clipboard

Copied

I’ve tried this, and sometimes it works whilst others it still retains the original path ID on export even though the name is changed in the layer palette

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 04, 2020 0