Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,4 @@ venv.bak/
# mypy
.mypy_cache/

.idea/
inkscape-unicorn.iml
inkscape-unicorn.ipr
inkscape-unicorn.iws

*.pyc
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Disclaimer
===========================================
I am not responsible for any damanage or harm that may have caused by this extension, do so at your own risk

* Modified by: [Spencer Schumann](https://github.com/spencerschumann)
* Modified by: [Brian Ho](http://github.com/kawateihikaru)
* Original Author: [Marty McGuire](http://github.com/martymcguire)

Credits
=======

* Spencer Schumann renamed this extension from `unicorn` to `timsav_gcode` and fixed some stroke color handling problems
* Brian Ho modified this extension to generate compatible g-code for TimSav (Robotini GRBL)
* Marty McGuire pulled this all together into an Inkscape extension.
* [Inkscape](http://www.inkscape.org/) is an awesome open source vector graphics app.
Expand All @@ -31,7 +33,7 @@ Typical locations include:
* Linux - `/usr/share/inkscape/extensions`
* Windows - `C:\Program Files\Inkscape\share\extensions`

you should have 2 files directly under the extensions folder (unicorn.inx, unicorn.py) and the unicorn folder as well.
you should have 2 files directly under the extensions folder (timsav_gcode.inx, timsave_gcode.py) and the timsav_gcode folder as well.

Usage
=====
Expand Down
4 changes: 2 additions & 2 deletions unicorn.inx → timsav_gcode.inx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<_name>TimSav G-Code Output</_name>
<id>com.timsav.gcode</id>
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
<dependency type="executable" location="extensions">unicorn.py</dependency>
<dependency type="executable" location="extensions">timsav_gcode.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="tab" type="notebook">
<page name="plotter_setup" _gui-text="Setup">
Expand All @@ -27,6 +27,6 @@
<dataloss>true</dataloss>
</output>
<script>
<command reldir="extensions" interpreter="python">unicorn.py</command>
<command reldir="extensions" interpreter="python">timsav_gcode.py</command>
</script>
</inkscape-extension>
4 changes: 2 additions & 2 deletions unicorn.py → timsav_gcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
import inkex
from unicorn.context import GCodeContext
from unicorn.svg_parser import SvgParser
from timsav_gcode.context import GCodeContext
from timsav_gcode.svg_parser import SvgParser


class TimSavGCodeGenerator(inkex.Effect):
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions unicorn/entities.py → timsav_gcode/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Circle(Entity):
def __init__(self):
self.center = None
self.radius = None
self.cutStyle = None
self.cut_style = None

def __str__(self):
return "Circle at [%.2f,%.2f], radius %.2f" % (self.center[0], self.center[1], self.radius)
Expand All @@ -39,7 +39,7 @@ def get_gcode(self, context):

context.codes.append("(" + str(self) + ")")
context.go_to_point(start[0], start[1])
context.start(self.cutStyle)
context.start(self.cut_style)
context.codes.append(arc_code)
context.stop()
context.codes.append("")
Expand Down
8 changes: 4 additions & 4 deletions unicorn/svg_parser.py → timsav_gcode/svg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from inkex import Path, bezier, CubicSuperPath
from inkex.transforms import Transform
from lxml import etree
from unicorn import entities
from timsav_gcode import entities


def parse_length_with_units(string):
Expand Down Expand Up @@ -88,15 +88,15 @@ def get_gcode(self, context):
class SvgPath(entities.PolyLine):
def __init__(self):
super().__init__()
self.cutStyle = 1
self.cut_style = 1

def load(self, node, trans):
a = node.get('style').split(";")
d = dict(s.split(':') for s in a)
if d['stroke'] == "#ff0000":
self.cutStyle = 2
self.cut_style = 2
elif d['stroke'] == "#0000ff":
self.cutStyle = 3
self.cut_style = 3
else:
pass

Expand Down
File renamed without changes.