From e99e07daa65a9f745579e9cc30e9031bb0b73c50 Mon Sep 17 00:00:00 2001 From: windelloskay Date: Mon, 20 Sep 2010 00:53:42 +0000 Subject: [PATCH] Add presethatch extension git-svn-id: https://eggbotcode.googlecode.com/svn/trunk@124 72233254-1b6c-9e9c-5072-401df62706fb --- inkscape_driver/eggbot_presethatch.inx | 30 +++++++++++++++ inkscape_driver/eggbot_presethatch.py | 52 ++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100755 inkscape_driver/eggbot_presethatch.inx create mode 100755 inkscape_driver/eggbot_presethatch.py diff --git a/inkscape_driver/eggbot_presethatch.inx b/inkscape_driver/eggbot_presethatch.inx new file mode 100755 index 0000000..04acd1e --- /dev/null +++ b/inkscape_driver/eggbot_presethatch.inx @@ -0,0 +1,30 @@ + + + <_name>Preset hatch for fills + command.evilmadscience.hatch.eggbot + eggbot_presethatch.py + inkex.py + <_param name="title" type="description" xml:space="preserve"> +This extension applies a set of eggbot-friendly +default presets to the live path effect called +"Hatch (rough)." + +It affects all objects in your document that +already have the live hatch effect applied. + +After using this tool to apply presets, use +the "Edit paths by node" tool to change the +frequency, direction, and/or bending of the +hatching, by dragging the diamond control +points. + + + path + + + + + + diff --git a/inkscape_driver/eggbot_presethatch.py b/inkscape_driver/eggbot_presethatch.py new file mode 100755 index 0000000..2685c48 --- /dev/null +++ b/inkscape_driver/eggbot_presethatch.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +''' +Copyright (C) 2010 Windell Oskay, drwho@evilmadscientist.com + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +''' +import inkex + +class PresetHatch(inkex.Effect): + def __init__(self): + inkex.Effect.__init__(self) + self.OptionParser.add_option("--title") + def effect(self): + self.svgDefRead = False; + self.svg = self.document.getroot() + self.recursiveDefDataScan(self.svg) + + def recursiveDefDataScan( self, aNodeList ): + for node in aNodeList: + if (node.tag == inkex.addNS( 'defs', 'svg' ) or node.tag == 'defs'): + self.recursiveDefDataScan( node ) + elif ( node.tag == inkex.addNS( 'path-effect', 'inkscape' )): + if (node.get( 'effect' ) == 'rough_hatches' ): + node.set( 'dist_rdm', '0;1' ) + node.set( 'growth', str( 0 ) ) + #node.set( 'do_bend', 'false' ) + node.set( 'bottom_edge_variation', '0;1' ) + node.set( 'top_edge_variation', '0;1' ) + node.set( 'bottom_tgt_variation', '0;1' ) + node.set( 'top_tgt_variation', '0;1' ) + node.set( 'scale_bf', str( 2 ) ) + node.set( 'scale_bb', str( 2 ) ) + node.set( 'scale_tf', str( 2 ) ) + node.set( 'scale_tb', str( 2 ) ) + node.set( 'top_smth_variation', '0;1' ) + node.set( 'bottom_smth_variation', '0;1' ) + node.set( 'fat_output', 'false' ) + +e = PresetHatch() +e.affect()