# Inkscape: Divide Closed Path in Arbitraty Fractions / Segments

I have a closed path that is taken from here (Wikipedia). It's the race track of the 24 Hours of Le Mans race (also known as " Circuit de la Sarthe").

I am new to Inkscape and co.

## The Basic Problem

I want to indicate the "progress of the race" on a percentage basis by coloring a specific fraction of the path like in the following illustrations (the text is there to make it clear, I don't want the text in the final image).

## Why do I want this?

The background is, that I want to use this as a kind of progress bar in a PowerPoint presentation (instead of the common"slide 4/23").

## What would be the ideal outcome?

Ideally, there is a batch function that exports 0 to 100 percent in a 1 percent step, like 0.pdf | 1.pdf | 2.pdf | ... | 99.pdf | 100.pdf (pdf or PNG).

## Update - LaTeX solution

I am more active on the LaTeX version of stackexchange - inspired by the solution here I figured out an alternative approach (using a custom dashed pattern):

https://tex.stackexchange.com/questions/347336

• circuit de la sarthe! :) Commented Jan 6, 2017 at 15:40
• I was just reliving my Gran Turismo career haha Commented Jan 6, 2017 at 19:15

# Manual Approach

Draw a short, vertical line (blue). Holding [ctrl] helps to draw the line exactly vertical.

Select the path (black) and the line (blue) and click `Extensions > Generate From Path > Pattern Along Path`. Use the settings from the image below. You may adjust the setting `Space Between Copies` as you like. Using the live preview can be useful here. You can also use `Extensions > Visualize Path > Measure` to show the length of the path and then compute the required spacing to obtain N segments.

Apply the path effect. Now you should have segments drawn over the path.

Select the segments and the path. Click `Path > Cut Path`. The blue segments should disapear and the path should be cut into small segments which you can select and color manually.

Hint: You can copy and paste styles. Select one segment. Color the segment red and press [ctrl]+[c]. Select one or multiple other segments and press [ctrl]+[shift]+[v]. The other segments are now red too.

# Automated Approach

I'm not aware of an Inkscape feature or plug-in, that animates the path and exports all images. But there is an old trick for animating svg paths which can be used to write a small script which animates the path for you:

Strokes can be dashed and we can choose how big the dashes and gaps in between them are (in Inkscape, you probably have to use the XML editor to do so). In your case, the animation works as follows:

• Duplicate the black path and put it above the black path, but under the black start circle.
• Color the duplicate red and use a custom dash pattern with gaps bigger than the length of the path.
• Change the length of the dashes from 0 to the length of the path.

Please have a look at the linked website for illustrations.

• Thanks for the hint. The automated export is not the main aim. I am happy if I can color specific fractions of the path. As I understand, I cannot change the length of the dash stroke manually in the GUI? Commented Jan 5, 2017 at 21:23
• Yes, at least as far as I know. But if automation is not your main goal, I may have a better answer for you. Hang in there. I edit the answer. Commented Jan 5, 2017 at 21:28