diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..01ee7a8
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "terminal.integrated.cwd": "${workspaceFolder}"
+}
\ No newline at end of file
diff --git a/embroidery/embroidery/Embroidery.css b/embroidery/embroidery/Embroidery.css
new file mode 100644
index 0000000..e56272f
--- /dev/null
+++ b/embroidery/embroidery/Embroidery.css
@@ -0,0 +1,3 @@
+.background {
+ background-color: blueviolet;
+}
diff --git a/embroidery/embroidery/Embroidery.jsx b/embroidery/embroidery/Embroidery.jsx
new file mode 100644
index 0000000..e1e9431
--- /dev/null
+++ b/embroidery/embroidery/Embroidery.jsx
@@ -0,0 +1,31 @@
+import React from "react";
+
+import "./TemplateAction.css";
+
+export default class Embroidery extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ flag: true,
+ };
+ }
+ backendMethod() {
+ fetch("/runBackendMethod", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ method: "templateActionMethod", // The method to run
+ actionID: this.props.action.id,
+ }),
+ })
+ .then((res) => res.json())
+ .then((asdf) => {
+ console.log(asdf);
+ });
+ }
+ render() {
+ return
Content goes here!
;
+ }
+}
diff --git a/embroidery/embroidery/Embroidery.py b/embroidery/embroidery/Embroidery.py
new file mode 100644
index 0000000..7e184f0
--- /dev/null
+++ b/embroidery/embroidery/Embroidery.py
@@ -0,0 +1,29 @@
+from app.planager.workflow.Action import Action
+
+CONFIG = {
+ "displayName": "Embroidery",
+ "inports": {
+ "templateInput": {
+ "displayName": "TemplateAction",
+ "description": "TemplateAction",
+ }
+ },
+ "outports": {
+ "templateOutput": {
+ "displayName": "TemplateAction",
+ "description": "TemplateAction",
+ }
+ },
+}
+
+
+class Embroidery(Action):
+ def __init__(self):
+ Action.__init__(self, CONFIG)
+
+ def main(self):
+ """The main loop; this is what runs when the action is run."""
+ print("main loop")
+
+ def templateActionMethod(self, options):
+ print("template method")
diff --git a/embryoid.py b/embryoid.py
new file mode 100644
index 0000000..2278a85
--- /dev/null
+++ b/embryoid.py
@@ -0,0 +1,56 @@
+from rich import print
+from pyembroidery import *
+from svgpathtools import svg2paths, wsvg
+import numpy as np
+
+
+OUTPUT_PES = "pes_tests/"
+OUTPUT_SVG = "svg_tests/"
+
+
+class Embryoid:
+ def __init__(self):
+ self.pattern = EmbPattern()
+
+ def save_svg(self, fname=OUTPUT_SVG + "design.svg"):
+ write_svg(self.pattern, fname)
+
+ def save_pes(self, fname=OUTPUT_PES + "design.pes"):
+ write_pes(self.pattern, fname)
+
+ def add_stitch_block(self, block):
+ self.pattern.add_block(block)
+
+ def parse_svg(self, fname):
+ paths, attributes = svg2paths(fname)
+ print(attributes)
+ for path in paths:
+ block = []
+ for segment in path._segments:
+ block.append((segment.start.real, segment.start.imag))
+ block.append((path._segments[0].start.real, path._segments[0].start.imag))
+ self.pattern.add_block(block, "teal")
+
+
+def solid_block(x_len=100, y_len=100, num_stitches=20):
+ stitches = []
+ stitches_y_coords = np.linspace(0, y_len, num_stitches)
+ for stitch_y in stitches_y_coords:
+ stitches.append((0, stitch_y))
+ stitches.append((x_len, stitch_y))
+
+ return stitches
+
+
+def parse():
+ e = Embryoid()
+ e.parse_svg("star.svg")
+ e.save_svg("star_test.svg")
+ e.save_pes("result.pes")
+
+
+if __name__ == "__main__":
+ e = Embryoid()
+ e.add_stitch_block(solid_block())
+ e.save_svg("block_test.svg")
+ e.save_pes("block_test.pes")
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..5882d0c
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,15 @@
+black==22.1.0
+click==8.0.3
+colorama==0.4.4
+commonmark==0.9.1
+mypy-extensions==0.4.3
+numpy==1.22.2
+pathspec==0.9.0
+platformdirs==2.5.0
+pyembroidery==1.4.33
+Pygments==2.11.2
+rich==11.2.0
+scipy==1.8.0
+svgpathtools==1.4.4
+svgwrite==1.4.1
+tomli==2.0.1
diff --git a/tests_input/star.svg b/tests_input/star.svg
new file mode 100644
index 0000000..e24fb0e
--- /dev/null
+++ b/tests_input/star.svg
@@ -0,0 +1,60 @@
+
+
+
+
diff --git a/tests_input/test_pattern.svg b/tests_input/test_pattern.svg
new file mode 100644
index 0000000..5d8709c
--- /dev/null
+++ b/tests_input/test_pattern.svg
@@ -0,0 +1,57 @@
+
+
+
+
diff --git a/tests_pes/block_test.pes b/tests_pes/block_test.pes
new file mode 100644
index 0000000..a6c2a0c
Binary files /dev/null and b/tests_pes/block_test.pes differ
diff --git a/tests_pes/star.pes b/tests_pes/star.pes
new file mode 100644
index 0000000..1e2211c
Binary files /dev/null and b/tests_pes/star.pes differ
diff --git a/tests_svg/block_test.svg b/tests_svg/block_test.svg
new file mode 100644
index 0000000..88398b5
--- /dev/null
+++ b/tests_svg/block_test.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/tests_svg/result.svg b/tests_svg/result.svg
new file mode 100644
index 0000000..3ccdde1
--- /dev/null
+++ b/tests_svg/result.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/tests_svg/star_test.svg b/tests_svg/star_test.svg
new file mode 100644
index 0000000..af12f64
--- /dev/null
+++ b/tests_svg/star_test.svg
@@ -0,0 +1 @@
+
\ No newline at end of file