Merge pull request #175 from evil-mad/Inkscape_v1

Prep work for merging current Inkscape driver -- with Inkscape v1 support -- into Master
pull/176/head
Windell Oskay 2022-05-20 10:54:06 -07:00 zatwierdzone przez GitHub
commit bfa9559bd5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
9 zmienionych plików z 100 dodań i 113 usunięć

Wyświetl plik

@ -4,7 +4,6 @@
<id>command.evilmadscientist.eggbot.rev280b1</id> <id>command.evilmadscientist.eggbot.rev280b1</id>
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency> <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
<dependency type="executable" location="extensions">eggbot.py</dependency> <dependency type="executable" location="extensions">eggbot.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="tab" type="notebook"> <param name="tab" type="notebook">
<page name="splash" _gui-text="Plot"> <page name="splash" _gui-text="Plot">
@ -172,9 +171,9 @@ selected number, which can be up to 100.
<_param name="instructions_general" type="description" <_param name="instructions_general" type="description"
xml:space="preserve"> xml:space="preserve">
EggBot Control Inkscape extension EggBot Control Inkscape extension
Release 2.8.1, dated 2019-06-19 Release 2.8.5, dated 2021-08-09
* EBB Firmware 2.5.1 or newer is recommended. * EBB Firmware 2.6.3 or newer is recommended.
Known issues: Known issues:
* "Cancel" function does not work while plotting. * "Cancel" function does not work while plotting.

Wyświetl plik

@ -3,7 +3,6 @@
<_name>Preset hatch for fills</_name> <_name>Preset hatch for fills</_name>
<id>command.evilmadscience.hatch.eggbot</id> <id>command.evilmadscience.hatch.eggbot</id>
<dependency type="executable" location="extensions">eggbot_presethatch.py</dependency> <dependency type="executable" location="extensions">eggbot_presethatch.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<_param name="title" type="description" xml:space="preserve"> <_param name="title" type="description" xml:space="preserve">
This extension applies a set of eggbot-friendly This extension applies a set of eggbot-friendly
default presets to the live path effect called default presets to the live path effect called

Wyświetl plik

@ -17,8 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import inkex
from lxml import etree
from plot_utils_import import from_dependency_import # plotink
inkex = from_dependency_import('ink_extensions.inkex')
class PresetHatch(inkex.Effect): class PresetHatch(inkex.Effect):
def __init__(self): def __init__(self):

Wyświetl plik

@ -3,8 +3,6 @@
<_name>Reorder Paths for Speed</_name> <_name>Reorder Paths for Speed</_name>
<id>command.evilmadscientist.eggbot.reorder</id> <id>command.evilmadscientist.eggbot.reorder</id>
<dependency type="executable" location="extensions">axidraw_svg_reorder.py</dependency> <dependency type="executable" location="extensions">axidraw_svg_reorder.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<_param indent="5" name="splashpage" type="description" <_param indent="5" name="splashpage" type="description"
appearance="header">EggBot Plot Optimization Tool</_param> appearance="header">EggBot Plot Optimization Tool</_param>

Wyświetl plik

@ -2,13 +2,7 @@
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>Stretch</_name> <_name>Stretch</_name>
<id>command.eggbot.contributed.stretch</id> <id>command.eggbot.contributed.stretch</id>
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
<dependency type="executable" location="extensions">eggbot_stretch.py</dependency> <dependency type="executable" location="extensions">eggbot_stretch.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<dependency type="executable" location="extensions">simpletransform.py</dependency>
<dependency type="executable" location="extensions">cubicsuperpath.py</dependency>
<dependency type="executable" location="extensions">cspsubdiv.py</dependency>
<dependency type="executable" location="extensions">bezmisc.py</dependency>
<_param name="Header" type="description" xml:space="preserve"> <_param name="Header" type="description" xml:space="preserve">
This extension will horizontally stretch your drawing. The This extension will horizontally stretch your drawing. The

Wyświetl plik

@ -19,13 +19,17 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import math import math
from lxml import etree
from plot_utils_import import from_dependency_import # plotink
simplepath = from_dependency_import('ink_extensions.simplepath')
bezmisc = from_dependency_import('ink_extensions.bezmisc')
cspsubdiv = from_dependency_import('ink_extensions.cspsubdiv')
cubicsuperpath = from_dependency_import('ink_extensions.cubicsuperpath')
simpletransform = from_dependency_import('ink_extensions.simpletransform')
inkex = from_dependency_import('ink_extensions.inkex')
import bezmisc
import cspsubdiv
import cubicsuperpath
import inkex
import simplepath
from simpletransform import applyTransformToPath, applyTransformToPoint, composeTransform, parseTransform
N_PAGE_WIDTH = 3200 N_PAGE_WIDTH = 3200
N_PAGE_HEIGHT = 800 N_PAGE_HEIGHT = 800
@ -218,7 +222,7 @@ class Map(inkex.Effect):
if (vinfo[2] != 0) and (vinfo[3] != 0): if (vinfo[2] != 0) and (vinfo[3] != 0):
sx = self.docWidth / float(vinfo[2]) sx = self.docWidth / float(vinfo[2])
sy = self.docHeight / float(vinfo[3]) sy = self.docHeight / float(vinfo[3])
self.docTransform = parseTransform('scale({0:f},{1:f})'.format(sx, sy)) self.docTransform = simpletransform.parseTransform('scale({0:f},{1:f})'.format(sx, sy))
def getPathVertices(self, path, node=None, transform=None, find_bbox=False): def getPathVertices(self, path, node=None, transform=None, find_bbox=False):
@ -246,7 +250,7 @@ class Map(inkex.Effect):
return None return None
if transform: if transform:
applyTransformToPath(transform, p) simpletransform.applyTransformToPath(transform, p)
# Now traverse the cubic super path # Now traverse the cubic super path
subpath_list = [] subpath_list = []
@ -298,13 +302,13 @@ class Map(inkex.Effect):
last_point = subpath[0] last_point = subpath[0]
last_point[0] = self.cx + (last_point[0] - self.cx) / math.cos((last_point[1] - self.cy) * steps2rads) last_point[0] = self.cx + (last_point[0] - self.cx) / math.cos((last_point[1] - self.cy) * steps2rads)
if inv_transform is not None: if inv_transform is not None:
applyTransformToPoint(inv_transform, last_point) simpletransform.applyTransformToPoint(inv_transform, last_point)
new_path += ' M {0:f},{1:f}'.format(last_point[0], last_point[1]) new_path += ' M {0:f},{1:f}'.format(last_point[0], last_point[1])
for point in subpath[1:]: for point in subpath[1:]:
x = self.cx + (point[0] - self.cx) / math.cos((point[1] - self.cy) * steps2rads) x = self.cx + (point[0] - self.cx) / math.cos((point[1] - self.cy) * steps2rads)
pt = [x, point[1]] pt = [x, point[1]]
if inv_transform is not None: if inv_transform is not None:
applyTransformToPoint(inv_transform, pt) simpletransform.applyTransformToPoint(inv_transform, pt)
new_path += ' l {0:f},{1:f}'.format(pt[0] - last_point[0], pt[1] - last_point[1]) new_path += ' l {0:f},{1:f}'.format(pt[0] - last_point[0], pt[1] - last_point[1])
last_point = pt last_point = pt
@ -344,7 +348,7 @@ class Map(inkex.Effect):
pass pass
# First apply the current matrix transform to this node's transform # First apply the current matrix transform to this node's transform
mat_new = composeTransform(mat_current, parseTransform(node.get("transform"))) mat_new = simpletransform.composeTransform(mat_current, simpletransform.parseTransform(node.get("transform")))
if node.tag in [inkex.addNS('g', 'svg'), 'g']: if node.tag in [inkex.addNS('g', 'svg'), 'g']:
self.recursivelyTraverseSvg(node, mat_new, v, find_bbox) self.recursivelyTraverseSvg(node, mat_new, v, find_bbox)
@ -375,7 +379,7 @@ class Map(inkex.Effect):
y = float(node.get('y', '0')) y = float(node.get('y', '0'))
# Note: the transform has already been applied # Note: the transform has already been applied
if (x != 0) or (y != 0): if (x != 0) or (y != 0):
mat_new2 = composeTransform(mat_new, parseTransform('translate({0:f},{1:f})'.format(x, y))) mat_new2 = simpletransform.composeTransform(mat_new, simpletransform.parseTransform('translate({0:f},{1:f})'.format(x, y)))
else: else:
mat_new2 = mat_new mat_new2 = mat_new
v = node.get('visibility', v) v = node.get('visibility', v)
@ -604,11 +608,11 @@ class Map(inkex.Effect):
if node_transform is None: if node_transform is None:
return parent_transform return parent_transform
else: else:
tr = parseTransform(node_transform) tr = simpletransform.parseTransform(node_transform)
if parent_transform is None: if parent_transform is None:
return tr return tr
else: else:
return composeTransform(parent_transform, tr) return simpletransform.composeTransform(parent_transform, tr)
else: else:
return self.docTransform return self.docTransform

Wyświetl plik

@ -3,7 +3,6 @@
<_name>EggBot Template</_name> <_name>EggBot Template</_name>
<id>org.inkscape.render.empty_eggbot</id> <id>org.inkscape.render.empty_eggbot</id>
<dependency type="executable" location="extensions">empty_eggbot.py</dependency> <dependency type="executable" location="extensions">empty_eggbot.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<!-- <!--
<param name="layer" type="boolean" _gui-text="Include default layer">true</param> <param name="layer" type="boolean" _gui-text="Include default layer">true</param>

Wyświetl plik

@ -3,42 +3,33 @@
# Adapted from generic template by Tavmjong Bah # Adapted from generic template by Tavmjong Bah
import inkex import inkex
import re
class C(inkex.Effect): class EmptyEggBot(inkex.EffectExtension):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("-w", "--width", action="store", type="int", dest="generic_width", default="1920", help="Custom width")
self.OptionParser.add_option("-z", "--height", action="store", type="int", dest="generic_height", default="1080", help="Custom height")
def effect(self): def __init__(self):
super(EmptyEggBot, self).__init__()
self.arg_parser.add_argument("-w", "--width", type=int, dest="generic_width", default="3200", help="Custom width")
self.arg_parser.add_argument("-z", "--height", type=int, dest="generic_height", default="800", help="Custom height")
width = self.options.generic_width def effect(self):
height = self.options.generic_height
unit = "px"
root = self.document.getroot() width = self.options.generic_width
root.set("id", "SVGRoot") height = self.options.generic_height
root.set("width", str(width) + unit)
root.set("height", str(height) + unit)
root.set("viewBox", "0 0 " + str(width) + " " + str(height) )
namedview = root.find(inkex.addNS('namedview', 'sodipodi'))
if namedview is None:
namedview = inkex.etree.SubElement( root, inkex.addNS('namedview', 'sodipodi') );
namedview.set(inkex.addNS('document-units', 'inkscape'), unit)
# Until units are supported in 'cx', etc.
namedview.set(inkex.addNS('zoom', 'inkscape'), str(512.0/self.uutounit( width, 'px' )) )
namedview.set(inkex.addNS('cx', 'inkscape'), str(self.uutounit( width, 'px' )/2.0 ) )
namedview.set(inkex.addNS('cy', 'inkscape'), str(self.uutounit( height, 'px' )/2.0 ) )
namedview.set( 'pagecolor', "#ffffff" )
namedview.set( 'bordercolor', "#666666" )
namedview.set(inkex.addNS('pageopacity', 'inkscape'), "1.0" )
namedview.set(inkex.addNS('pageshadow', 'inkscape'), "0" )
root = self.document.getroot()
root.set("id", "SVGRoot")
root.set("width", str(width) + 'px')
root.set("height", str(height) + 'px')
root.set("viewBox", "0 0 " + str(width) + " " + str(height) )
c = C() namedview = self.svg.namedview
c.affect() namedview.set(inkex.addNS('document-units', 'inkscape'), 'px')
namedview.set(inkex.addNS('zoom', 'inkscape'), str(512.0 / width) )
namedview.set(inkex.addNS('cx', 'inkscape'), str(width / 2.0))
namedview.set(inkex.addNS('cy', 'inkscape'), str(height / 2.0))
if __name__ == '__main__':
EmptyEggBot().run()

Wyświetl plik

@ -1,91 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>Hershey Text</_name> <name>Hershey Text</name>
<id>command.evilmad.eggbot.hershey</id> <id>org.evilmad.text.hershey-egg</id>
<dependency type="executable" location="extensions">hershey.py</dependency> <dependency type="executable" location="extensions">hershey.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency>
<param name="tab" type="notebook"> <param name="tab" type="notebook">
<page name="render" _gui-text="Render"> <page name="render" gui-text="Render">
<_param indent="1" name="splashTitle1" type="description" appearance="header" xml:space="preserve"> <label indent="1" appearance="header" xml:space="preserve">
Hershey Text Hershey Text
</_param> </label>
<_param indent="2" name="splashTitle1b" type="description" xml:space="preserve">A tool to replace text with stroke fonts <label indent="2" xml:space="preserve">A tool to replace text with stroke fonts
Version 3.0, 2019-06-16 Version 3.0.2, 2019-09-07
</_param> </label>
<param indent="1" name="fontface" type="enum" _gui-text="Font face: "> <param indent="1" name="fontface" type="optiongroup" appearance="combo" gui-text="Font face: ">
<_item value="HersheySans1">Hershey Sans 1-stroke</_item> <option value="HersheySans1">Hershey Sans 1-stroke</option>
<_item value="HersheySansMed">Hershey Sans medium</_item> <option value="HersheySansMed">Hershey Sans medium</option>
<_item value="HersheySerifMed">Hershey Serif medium</_item> <option value="HersheySerifMed">Hershey Serif medium</option>
<_item value="HersheySerifMedItalic">Hershey Serif medium italic</_item> <option value="HersheySerifMedItalic">Hershey Serif medium italic</option>
<_item value="HersheySerifBold">Hershey Serif bold</_item> <option value="HersheySerifBold">Hershey Serif bold</option>
<_item value="HersheySerifBoldItalic">Hershey Serif bold italic</_item> <option value="HersheySerifBoldItalic">Hershey Serif bold italic</option>
<_item value="HersheyScript1">Hershey Script 1-stroke</_item> <option value="HersheyScript1">Hershey Script 1-stroke</option>
<_item value="HersheyScriptMed">Hershey Script medium</_item> <option value="HersheyScriptMed">Hershey Script medium</option>
<option value="HersheyGothEnglish">Hershey Gothic English</option>
<_item value="HersheyGothEnglish">Hershey Gothic English</_item>
<!-- Block below this are derived from fonts licensed under SIL Open Font License --> <!-- Block below this are derived from fonts licensed under SIL Open Font License -->
<_item value="EMSAllure">EMS Allure</_item> <option value="EMSAllure">EMS Allure</option>
<_item value="EMSElfin">EMS Elfin</_item> <option value="EMSElfin">EMS Elfin</option>
<_item value="EMSFelix">EMS Felix</_item> <option value="EMSFelix">EMS Felix</option>
<_item value="EMSNixish">EMS Nixish</_item> <option value="EMSNixish">EMS Nixish</option>
<_item value="EMSNixishItalic">EMS Nixish Italic</_item> <option value="EMSNixishItalic">EMS Nixish Italic</option>
<_item value="EMSOsmotron">EMS Osmotron</_item> <option value="EMSOsmotron">EMS Osmotron</option>
<_item value="EMSReadability">EMS Readability</_item> <option value="EMSReadability">EMS Readability</option>
<_item value="EMSReadabilityItalic">EMS Readability Italic</_item> <option value="EMSReadabilityItalic">EMS Readability Italic</option>
<_item value="EMSTech">EMS Tech</_item> <option value="EMSTech">EMS Tech</option>
<!-- Block above this are derived from fonts licensed under SIL Open Font License --> <!-- Block above this are derived from fonts licensed under SIL Open Font License -->
<_item value="other">Other (given below)</_item> <option value="other">Other (given below)</option>
</param> </param>
<_param name="otherFontDesc" type="description" xml:space="preserve"> <label xml:space="preserve">
Other SVG font name or path (if "Other" selected above): Other SVG font name or path (if "Other" selected above):
</_param> </label>
<param name="otherfont" type="string" indent="2" _gui-text="Name/Path:">HersheySans1</param> <param name="otherfont" type="string" indent="2" gui-text="Name/Path:">HersheySans1</param>
<param name="preserve" indent="4" type="boolean" _gui-text="Preserve original text" >false</param> <param name="preserve" indent="4" type="bool" gui-text="Preserve original text" >false</param>
</page> </page>
<page name="utilities" _gui-text="Utilities"> <page name="utilities" gui-text="Utilities">
<_param name="utilspage" type="description" appearance="header" xml:space="preserve"> <label appearance="header" xml:space="preserve">
Hershey Text Utility Functions Hershey Text Utility Functions
</_param> </label>
<param indent="2" name="action" type="enum" _gui-text="Action: "> <param indent="2" name="action" type="optiongroup" appearance="combo" gui-text="Action: ">
<_item value="sample" >Generate font table</_item> <option value="sample" >Generate font table</option>
<_item value="table" >Generate glyph table in selected font</_item> <option value="table" >Generate glyph table in selected font</option>
</param> </param>
<_param name="utilspage" type="description" xml:space="preserve"> <label xml:space="preserve">
Sample text to use when generating font table:</_param> Sample text to use when generating font table:</label>
<param indent="2" name="text" type="string" _gui-text="Text:"> <param indent="2" name="text" type="string" gui-text="Text:">
The Quick Brown Fox Jumps Over a Lazy Dog</param> The Quick Brown Fox Jumps Over a Lazy Dog</param>
</page> </page>
<page name="help" _gui-text="About"> <page name="help" gui-text="About">
<_param name="aboutpage" type="description" xml:space="preserve"> <label xml:space="preserve">
This extension renders all text (or all selected text) This extension renders all text (or all selected text)
in your document into using specialized "stroke" or in your document into using specialized "stroke" or
"engraving" fonts designed for plotters. "engraving" fonts designed for plotters.
Whereas regular "outline" fonts (e.g., TrueType) work Whereas regular "outline" fonts (e.g., TrueType) work
by filling in the region inside an invisible outline, by filling in the region inside an invisible outline,
@ -94,19 +94,19 @@ or strokes; much like human handwriting.
Engraving fonts are used for creating text paths that Engraving fonts are used for creating text paths that
computer controlled drawing and cutting machines (from computer controlled drawing and cutting machines (from
pen plotters to CNC routers) can efficiently follow. pen plotters to CNC routers) can efficiently follow.
A complete user guide is available to download at: A complete user guide is available to download at:
http://wiki.evilmadscientist.com/hershey http://wiki.evilmadscientist.com/hershey
For extended help, click "Apply" with this tab selected. For extended help, click "Apply" with this tab selected.
</_param> </label>
</page> </page>
<page name="info3" _gui-text="Credits"> <page name="info3" gui-text="Credits">
<_param name="aboutpage3" type="description" xml:space="preserve"> <label xml:space="preserve">
The classic Hershey fonts included are derived from The classic Hershey fonts included are derived from
work by Dr. A. V. Hershey. work by Dr. A. V. Hershey.
@ -117,7 +117,7 @@ Open Font License.
For full credits and license information, please read the For full credits and license information, please read the
credits embedded within the SVG fonts included with this credits embedded within the SVG fonts included with this
distribution. distribution.
</_param> </label>
</page> </page>
</param> </param>
@ -125,7 +125,7 @@ distribution.
<effect needs-live-preview="true"> <effect needs-live-preview="true">
<object-type>all</object-type> <object-type>all</object-type>
<effects-menu> <effects-menu>
<submenu _name="EggBot"/> <submenu _name="EggBot"/>
</effects-menu> </effects-menu>
</effect> </effect>
<script> <script>