3

I created a pattern in Inkscape but its name is not really meaningful. And when there are more patterns in one document, it will be hard to remember which one is which, since there is not visual representation in the dock. Is there a way to rename the pattern easily, without having to dive into the XML editor and manually replace the id and references?

enter image description here

3

You would need to use the xml editor for that. Open it, look into the 'defs' section, and there change the id of the pattern.

As a consequence, you will need to reapply the pattern to all the objects where it is used.

On the picture below, you would still need to click on 'Set' to change the pattern id. Make sure the name only contains characters that can be used for an id in CSS/SVG (no spaces, best restrict yourself to a-zA-Z_-).

enter image description here

  • 1
    This is the same as the answer I posted, but then I deleted it, since the OP informed me he doesn't want to use the XML editor, but still wants to do it using the Inkscape UI. But this isn't possible, unless someone were to write an extension or something. – Billy Kerr Oct 28 '18 at 11:59
  • @BillyKerr I will have to use the XML editor so it seems. :) – wout Oct 28 '18 at 15:24
  • Yes, that or use a plain text editor and use search&replace, as suggested in the other answer. – Moini Oct 28 '18 at 17:31
0

Based on the work of HenkJan van der Pol that published Patterns for mechanical drawings in Inkscape you have two possibilities. But first, you will need to prep the patterns you want to work with. Here's a workflow:

1) Create a file in which you define all the patterns necessary for next use. Let's say "patterns.svg".

2) Then, open this file with a text editor and look for the <defs>...<defs> section.

3) You will find out that for every pattern you will be defined by a xml like this:

<pattern id="Hatch2.4x135"
inkscape:stockid="Hatch 2.4 x -45°"
x="0" y="0" width="11.918216909107768" height="11.918216909107768"
patternUnits="userSpaceOnUse">
  <path
     style="stroke:#000000;stroke-width:0.25mm"
     d="M 8.374909822493594,-3.5433070866141736 15.461523995721942,3.5433070866141736"/>
  <path
     style="stroke:#000000;stroke-width:0.25mm"
     d="M -3.5433070866141736,-3.5433070866141736 15.461523995721942,15.461523995721942"/>
  <path
     style="stroke:#000000;stroke-width:0.25mm"
     d="M -3.5433070866141736,8.374909822493594 3.5433070866141736,15.461523995721942"/>
</pattern> 

4) Change the "id" and "inkscape:stockid" accordingly to the names you will remember.

5) Close the file.

6) Now, with the "patterns.svg" you have two options:

6.1) Open this file every time you need to apply these patterns and copy and paste them to your new drawings.

6.2) Open again the file with a text editor, copy the content inside the <defs>...</defs> tag and append it to the <defs>...</defs> tag on ../share/patterns/pattern.svg . Doing so, you will have these patterns available every time you open inkscape on "fill and stroke" > fill tab > mesh gradient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.