Custom dash styles

Share your Inkscape tricks and tutorials here.
Hans Dybkjær
Posts: 2
Joined: Sun Feb 08, 2009 9:10 pm

Custom dash styles

Postby Hans Dybkjær » Sun Feb 08, 2009 9:57 pm

I draw origami diagrams such as http://papirfoldning.dk/images/pechakucha/Engel.pdf. I normally use Inkscape 46's built-in dash-dot for mountain folds (such as the diagonals in step 4), but really I should have a dash-dot-dot style dashed line.
I now found out that I can get such a mountain fold line this way:
0) Close Inkscape
1) Locate and open for edit preferences.xml file (on my computer it is located in Documents and Settings\USERNAME\Application Data\Inkscape).
(make a backup-copy first).
2) Locate the dashes group (inside the palette group).
4) Add this endtry:
<dash
id="dash-5-2-1-2-1-2"
style="stroke-dasharray:5,2,1,2,1,2" />
at the bottom of the group. Please note that the existing dash-dot appears as dash-4-2-1-2 (and in one other version).
You can define other dash styles the same way. The values 5,2,1,2,1,2 represent alternating lengths of stroke and space, beginning with a stroke and ending with a space. I named the id correspondingly as it seems conventional.
6) Open Inkscape. The new dash style can now be selected from the dashes list in the Ctrl-Shift-F stroke style tab.

An example result may be seen in: http://papirfoldning.dk/temp/engel04-ne ... inline.png.

Of course, moving to another computer will require moving this preferences.xml, too.
And you will have to trust that the dashes group in preferences.xml will be supported in future versions of Inkscape.

Best regards,
Hans

zipe
Posts: 4
Joined: Mon Feb 09, 2009 5:47 pm

Re: Custom dash styles

Postby zipe » Tue Feb 10, 2009 12:22 am

sounds like a good trick - unluckyly i cannot locate the "peferences.xml". i am using inkscape with macos10.5, and there is no a inkscape folder at the usual places for preferences (Library/Application Support ....., neither in main, nor in user-Library). can anybody hint me, where i might find it?

tomh

Re: Custom dash styles

Postby tomh » Thu Feb 12, 2009 1:23 am

nice, always wondered what those numbers stand for ;-)

Preferences.xml: they are in a standard location, but they happen to follow the Linux standard (note, I don't own a mac)...
try looking at this thread:
viewtopic.php?f=22&t=1712
hope that helps

zipe
Posts: 4
Joined: Mon Feb 09, 2009 5:47 pm

Re: Custom dash styles

Postby zipe » Thu Feb 12, 2009 4:16 am

thanks tomh, i found it, posted more detailed here: viewtopic.php?f=29&t=884&p=12237#p12237

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Custom dash styles

Postby RobA » Wed Oct 14, 2009 1:02 am

Don't worry about future support. The dash pattern is stored directly in the svg file itself, the entry in the preferences.xml is just for the pick list.

You can also select an object and go into the xml editor and edit the dashtype definition (like "stroke-dasharray:10, 20, 20, 20, 5, 20, 20, 20") into the style manually:
2009-10-13_105941.jpg
change style in xml editor
2009-10-13_105941.jpg (237.91 KiB) Viewed 16517 times


-Rob A>


Return to “Tricks & Tutorials”