spakin / SimpInkScr

Simple Inkscape Scripting
https://inkscape.org/~pakin/%E2%98%85simple-inkscape-scripting
GNU General Public License v3.0
320 stars 31 forks source link

Outset Path #57

Closed h4b4n3r0 closed 1 year ago

h4b4n3r0 commented 1 year ago

Hi, is there a way to outset the SVG path? Kind regards

spakin commented 1 year ago

From what I can determine, SVG itself does not include an outset mechanism. I also don't see anything in the inkex documentation corresponding to Inkscape's PathOutset feature. However, I did find an Inkscape Live Path Effect called "Offset" that may do what you want. Try the following:

cyan_path = path(['M', 369, 185,
                  'C', 172, 326, -60, 562, 272, 527,
                       604, 493, 671, 365, 547, 336,
                       424, 306, 333, 286, 291, 390],
                 stroke_width='4mm',
                 stroke='cyan')
red_path = path(['M', 369, 185,
                 'C', 172, 326, -60, 562, 272, 527,
                      604, 493, 671, 365, 547, 336,
                      424, 306, 333, 286, 291, 390],
                stroke_width='4mm',
                stroke='red')
outset = path_effect('offset', offset=-4, unit='mm')
red_path.apply_path_effect(outset)

Does that help?

h4b4n3r0 commented 1 year ago

Yes, it helped! Thank you! :)