kopia lustrzana https://github.com/evil-mad/EggBot
Merge pull request #175 from evil-mad/Inkscape_v1
Prep work for merging current Inkscape driver -- with Inkscape v1 support -- into Masterpull/176/head
commit
bfa9559bd5
|
@ -4,7 +4,6 @@
|
|||
<id>command.evilmadscientist.eggbot.rev280b1</id>
|
||||
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
|
||||
<dependency type="executable" location="extensions">eggbot.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="tab" type="notebook">
|
||||
|
||||
<page name="splash" _gui-text="Plot">
|
||||
|
@ -172,9 +171,9 @@ selected number, which can be up to 100.
|
|||
<_param name="instructions_general" type="description"
|
||||
xml:space="preserve">
|
||||
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:
|
||||
* "Cancel" function does not work while plotting.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<_name>Preset hatch for fills</_name>
|
||||
<id>command.evilmadscience.hatch.eggbot</id>
|
||||
<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">
|
||||
This extension applies a set of eggbot-friendly
|
||||
default presets to the live path effect called
|
||||
|
|
|
@ -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
|
||||
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):
|
||||
def __init__(self):
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
<_name>Reorder Paths for Speed</_name>
|
||||
<id>command.evilmadscientist.eggbot.reorder</id>
|
||||
<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"
|
||||
appearance="header">EggBot Plot Optimization Tool</_param>
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Stretch</_name>
|
||||
<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">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">
|
||||
This extension will horizontally stretch your drawing. The
|
||||
|
|
|
@ -19,13 +19,17 @@
|
|||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
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_HEIGHT = 800
|
||||
|
@ -218,7 +222,7 @@ class Map(inkex.Effect):
|
|||
if (vinfo[2] != 0) and (vinfo[3] != 0):
|
||||
sx = self.docWidth / float(vinfo[2])
|
||||
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):
|
||||
|
||||
|
@ -246,7 +250,7 @@ class Map(inkex.Effect):
|
|||
return None
|
||||
|
||||
if transform:
|
||||
applyTransformToPath(transform, p)
|
||||
simpletransform.applyTransformToPath(transform, p)
|
||||
|
||||
# Now traverse the cubic super path
|
||||
subpath_list = []
|
||||
|
@ -298,13 +302,13 @@ class Map(inkex.Effect):
|
|||
last_point = subpath[0]
|
||||
last_point[0] = self.cx + (last_point[0] - self.cx) / math.cos((last_point[1] - self.cy) * steps2rads)
|
||||
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])
|
||||
for point in subpath[1:]:
|
||||
x = self.cx + (point[0] - self.cx) / math.cos((point[1] - self.cy) * steps2rads)
|
||||
pt = [x, point[1]]
|
||||
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])
|
||||
last_point = pt
|
||||
|
||||
|
@ -344,7 +348,7 @@ class Map(inkex.Effect):
|
|||
pass
|
||||
|
||||
# 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']:
|
||||
self.recursivelyTraverseSvg(node, mat_new, v, find_bbox)
|
||||
|
@ -375,7 +379,7 @@ class Map(inkex.Effect):
|
|||
y = float(node.get('y', '0'))
|
||||
# Note: the transform has already been applied
|
||||
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:
|
||||
mat_new2 = mat_new
|
||||
v = node.get('visibility', v)
|
||||
|
@ -604,11 +608,11 @@ class Map(inkex.Effect):
|
|||
if node_transform is None:
|
||||
return parent_transform
|
||||
else:
|
||||
tr = parseTransform(node_transform)
|
||||
tr = simpletransform.parseTransform(node_transform)
|
||||
if parent_transform is None:
|
||||
return tr
|
||||
else:
|
||||
return composeTransform(parent_transform, tr)
|
||||
return simpletransform.composeTransform(parent_transform, tr)
|
||||
else:
|
||||
return self.docTransform
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<_name>EggBot Template</_name>
|
||||
<id>org.inkscape.render.empty_eggbot</id>
|
||||
<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>
|
||||
|
|
|
@ -3,42 +3,33 @@
|
|||
# Adapted from generic template by Tavmjong Bah
|
||||
|
||||
import inkex
|
||||
import re
|
||||
|
||||
class C(inkex.Effect):
|
||||
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")
|
||||
class EmptyEggBot(inkex.EffectExtension):
|
||||
|
||||
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
|
||||
height = self.options.generic_height
|
||||
unit = "px"
|
||||
def effect(self):
|
||||
|
||||
root = self.document.getroot()
|
||||
root.set("id", "SVGRoot")
|
||||
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" )
|
||||
width = self.options.generic_width
|
||||
height = self.options.generic_height
|
||||
|
||||
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()
|
||||
c.affect()
|
||||
namedview = self.svg.namedview
|
||||
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()
|
||||
|
|
|
@ -1,91 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Hershey Text</_name>
|
||||
<id>command.evilmad.eggbot.hershey</id>
|
||||
<name>Hershey Text</name>
|
||||
<id>org.evilmad.text.hershey-egg</id>
|
||||
|
||||
<dependency type="executable" location="extensions">hershey.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
|
||||
<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
|
||||
</_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: ">
|
||||
<_item value="HersheySans1">Hershey Sans 1-stroke</_item>
|
||||
<_item value="HersheySansMed">Hershey Sans medium</_item>
|
||||
<param indent="1" name="fontface" type="optiongroup" appearance="combo" gui-text="Font face: ">
|
||||
<option value="HersheySans1">Hershey Sans 1-stroke</option>
|
||||
<option value="HersheySansMed">Hershey Sans medium</option>
|
||||
|
||||
<_item value="HersheySerifMed">Hershey Serif medium</_item>
|
||||
<_item value="HersheySerifMedItalic">Hershey Serif medium italic</_item>
|
||||
<option value="HersheySerifMed">Hershey Serif medium</option>
|
||||
<option value="HersheySerifMedItalic">Hershey Serif medium italic</option>
|
||||
|
||||
<_item value="HersheySerifBold">Hershey Serif bold</_item>
|
||||
<_item value="HersheySerifBoldItalic">Hershey Serif bold italic</_item>
|
||||
<option value="HersheySerifBold">Hershey Serif bold</option>
|
||||
<option value="HersheySerifBoldItalic">Hershey Serif bold italic</option>
|
||||
|
||||
<_item value="HersheyScript1">Hershey Script 1-stroke</_item>
|
||||
<_item value="HersheyScriptMed">Hershey Script medium</_item>
|
||||
<option value="HersheyScript1">Hershey Script 1-stroke</option>
|
||||
<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 -->
|
||||
<_item value="EMSAllure">EMS Allure</_item>
|
||||
<option value="EMSAllure">EMS Allure</option>
|
||||
|
||||
<_item value="EMSElfin">EMS Elfin</_item>
|
||||
<_item value="EMSFelix">EMS Felix</_item>
|
||||
<option value="EMSElfin">EMS Elfin</option>
|
||||
<option value="EMSFelix">EMS Felix</option>
|
||||
|
||||
<_item value="EMSNixish">EMS Nixish</_item>
|
||||
<_item value="EMSNixishItalic">EMS Nixish Italic</_item>
|
||||
<option value="EMSNixish">EMS Nixish</option>
|
||||
<option value="EMSNixishItalic">EMS Nixish Italic</option>
|
||||
|
||||
<_item value="EMSOsmotron">EMS Osmotron</_item>
|
||||
<_item value="EMSReadability">EMS Readability</_item>
|
||||
<_item value="EMSReadabilityItalic">EMS Readability Italic</_item>
|
||||
<_item value="EMSTech">EMS Tech</_item>
|
||||
<option value="EMSOsmotron">EMS Osmotron</option>
|
||||
<option value="EMSReadability">EMS Readability</option>
|
||||
<option value="EMSReadabilityItalic">EMS Readability Italic</option>
|
||||
<option value="EMSTech">EMS Tech</option>
|
||||
<!-- 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 name="otherFontDesc" type="description" xml:space="preserve">
|
||||
<label xml:space="preserve">
|
||||
Other SVG font name or path (if "Other" selected above):
|
||||
</_param>
|
||||
<param name="otherfont" type="string" indent="2" _gui-text="Name/Path:">HersheySans1</param>
|
||||
</label>
|
||||
<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 name="utilities" _gui-text="Utilities">
|
||||
<_param name="utilspage" type="description" appearance="header" xml:space="preserve">
|
||||
<page name="utilities" gui-text="Utilities">
|
||||
<label appearance="header" xml:space="preserve">
|
||||
Hershey Text Utility Functions
|
||||
</_param>
|
||||
</label>
|
||||
|
||||
<param indent="2" name="action" type="enum" _gui-text="Action: ">
|
||||
<_item value="sample" >Generate font table</_item>
|
||||
<_item value="table" >Generate glyph table in selected font</_item>
|
||||
<param indent="2" name="action" type="optiongroup" appearance="combo" gui-text="Action: ">
|
||||
<option value="sample" >Generate font table</option>
|
||||
<option value="table" >Generate glyph table in selected font</option>
|
||||
</param>
|
||||
|
||||
<_param name="utilspage" type="description" xml:space="preserve">
|
||||
<label xml:space="preserve">
|
||||
|
||||
Sample text to use when generating font table:</_param>
|
||||
<param indent="2" name="text" type="string" _gui-text="Text:">
|
||||
Sample text to use when generating font table:</label>
|
||||
<param indent="2" name="text" type="string" gui-text="Text:">
|
||||
The Quick Brown Fox Jumps Over a Lazy Dog</param>
|
||||
|
||||
</page>
|
||||
|
||||
|
||||
<page name="help" _gui-text="About">
|
||||
<_param name="aboutpage" type="description" xml:space="preserve">
|
||||
<page name="help" gui-text="About">
|
||||
<label xml:space="preserve">
|
||||
This extension renders all text (or all selected text)
|
||||
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
|
||||
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
|
||||
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:
|
||||
http://wiki.evilmadscientist.com/hershey
|
||||
|
||||
|
||||
For extended help, click "Apply" with this tab selected.
|
||||
|
||||
</_param>
|
||||
</label>
|
||||
</page>
|
||||
|
||||
|
||||
<page name="info3" _gui-text="Credits">
|
||||
<_param name="aboutpage3" type="description" xml:space="preserve">
|
||||
<page name="info3" gui-text="Credits">
|
||||
<label xml:space="preserve">
|
||||
The classic Hershey fonts included are derived from
|
||||
work by Dr. A. V. Hershey.
|
||||
|
||||
|
@ -117,7 +117,7 @@ Open Font License.
|
|||
For full credits and license information, please read the
|
||||
credits embedded within the SVG fonts included with this
|
||||
distribution.
|
||||
</_param>
|
||||
</label>
|
||||
|
||||
</page>
|
||||
</param>
|
||||
|
@ -125,7 +125,7 @@ distribution.
|
|||
<effect needs-live-preview="true">
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="EggBot"/>
|
||||
<submenu _name="EggBot"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
Ładowanie…
Reference in New Issue