kopia lustrzana https://github.com/Reenforcements/PES-Embroidery
Snapshot before I redo things
Some things need to be redone to accommodate when to jump from one region to another. I'm going to try a levelization approach.pull/4/head
rodzic
c8ef18ff01
commit
7395eaef44
|
@ -3,6 +3,9 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="0b5af789-e47c-4138-bdb9-8fa765481e1e" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/PES.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/PES.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/PES_render_utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/PES_render_utils.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/svgFunctions.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/svgFunctions.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
|
@ -13,7 +16,7 @@
|
|||
</component>
|
||||
<component name="CoverageDataManager">
|
||||
<SUITE FILE_PATH="coverage/PES_Embroidery$svgImport.coverage" NAME="svgImport Coverage Results" MODIFIED="1541478220694" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src/learning" />
|
||||
<SUITE FILE_PATH="coverage/PES_Embroidery$main.coverage" NAME="main Coverage Results" MODIFIED="1543516545424" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src" />
|
||||
<SUITE FILE_PATH="coverage/PES_Embroidery$main.coverage" NAME="main Coverage Results" MODIFIED="1543537614896" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src" />
|
||||
<SUITE FILE_PATH="coverage/PES_Embroidery$PECRender_main.coverage" NAME="PECRender-main Coverage Results" MODIFIED="1542987287831" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/PECRender" />
|
||||
<SUITE FILE_PATH="coverage/PES_Embroidery$getColors.coverage" NAME="getColors Coverage Results" MODIFIED="1542917684965" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Colors" />
|
||||
<SUITE FILE_PATH="coverage/PES_Embroidery$main__1_.coverage" NAME="PECRender-main Coverage Results" MODIFIED="1542509072203" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/PECRender" />
|
||||
|
@ -22,19 +25,19 @@
|
|||
<session id="-1920598427">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="9" />
|
||||
<entry key="project.closed" value="10" />
|
||||
<entry key="project.open.time.2" value="1" />
|
||||
<entry key="project.open.time.5" value="1" />
|
||||
<entry key="project.open.time.6" value="5" />
|
||||
<entry key="project.open.time.7" value="1" />
|
||||
<entry key="project.open.time.7" value="2" />
|
||||
<entry key="project.open.time.8" value="2" />
|
||||
<entry key="project.opened" value="10" />
|
||||
<entry key="project.opened" value="11" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.vcs.git.usages" />
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="Python" value="26468" />
|
||||
<entry key="Python" value="28441" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.js.language.service.starts" />
|
||||
|
@ -52,7 +55,7 @@
|
|||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="py" value="26468" />
|
||||
<entry key="py" value="28441" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
|
@ -62,8 +65,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="46">
|
||||
<caret line="25" column="17" selection-start-line="25" selection-start-column="17" selection-end-line="25" selection-end-column="17" />
|
||||
<state relative-caret-position="360">
|
||||
<caret line="33" column="32" selection-start-line="33" selection-start-column="32" selection-end-line="33" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -71,27 +74,29 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/PES.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="210">
|
||||
<caret line="235" selection-start-line="235" selection-end-line="235" />
|
||||
<folding>
|
||||
<element signature="e#0#23#0" expanded="true" />
|
||||
<marker date="1542986842340" expanded="true" signature="133:210" ph="..." />
|
||||
<marker date="1542986842340" expanded="true" signature="387:427" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="210">
|
||||
<caret line="183" column="24" lean-forward="true" selection-start-line="183" selection-start-column="24" selection-end-line="183" selection-end-column="24" />
|
||||
<state relative-caret-position="1728">
|
||||
<caret line="226" column="39" selection-start-line="226" selection-start-column="39" selection-end-line="226" selection-end-column="39" />
|
||||
<folding>
|
||||
<element signature="e#0#19#0" expanded="true" />
|
||||
<marker date="1543537504159" expanded="true" signature="10070:10075" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/PES.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1425">
|
||||
<caret line="97" column="20" selection-start-line="97" selection-start-column="20" selection-end-line="97" selection-end-column="20" />
|
||||
<folding>
|
||||
<element signature="e#0#23#0" expanded="true" />
|
||||
<marker date="1543520578420" expanded="true" signature="133:210" ph="..." />
|
||||
<marker date="1543520578420" expanded="true" signature="387:427" ph="..." />
|
||||
<marker date="1543520578420" expanded="true" signature="3290:3296" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -100,8 +105,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="675">
|
||||
<caret line="71" selection-start-line="71" selection-end-line="71" />
|
||||
<state relative-caret-position="270">
|
||||
<caret line="18" column="27" lean-forward="true" selection-start-line="18" selection-start-column="27" selection-end-line="18" selection-end-column="27" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1542995051340" expanded="true" signature="112:1695" ph="..." />
|
||||
|
@ -119,8 +124,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/utilities.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" selection-start-line="11" selection-end-line="11" />
|
||||
<state relative-caret-position="15">
|
||||
<caret line="1" column="14" selection-start-line="1" selection-start-column="14" selection-end-line="1" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -128,14 +133,15 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_render_utils.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-68">
|
||||
<caret line="13" column="48" selection-start-line="13" selection-start-column="48" selection-end-line="13" selection-end-column="48" />
|
||||
<state relative-caret-position="615">
|
||||
<caret line="42" column="20" selection-start-line="42" selection-start-column="20" selection-end-line="42" selection-end-column="20" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
<marker date="1542996800150" expanded="true" signature="129:130" ph="..." />
|
||||
<marker date="1542996800150" expanded="true" signature="129:135" ph="..." />
|
||||
<marker date="1542996800150" expanded="true" signature="1233:1441" ph="..." />
|
||||
<marker date="1542996800150" expanded="true" signature="1468:1563" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="129:130" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="129:135" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="1233:1565" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="1460:1565" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="1592:1687" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -152,16 +158,6 @@
|
|||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>color</find>
|
||||
<find>color change</find>
|
||||
<find>Color change</find>
|
||||
<find>png</find>
|
||||
<find>width</find>
|
||||
<find>getCoordinate</find>
|
||||
<find>sdfsd</find>
|
||||
<find>getBoxDiagonalLength</find>
|
||||
<find>to_svg</find>
|
||||
<find>to_svg_Line</find>
|
||||
<find>svgpathtools</find>
|
||||
<find>invert</find>
|
||||
<find>intersectionPath</find>
|
||||
|
@ -174,7 +170,6 @@
|
|||
<find>Ultramarine</find>
|
||||
<find>makeStitchLines</find>
|
||||
<find>loadVectorGraphic</find>
|
||||
<find>getClosestColor</find>
|
||||
<find>getStartAndEndPointsOfLineInBox</find>
|
||||
<find>x_for_y</find>
|
||||
<find>invertSlope</find>
|
||||
|
@ -182,6 +177,17 @@
|
|||
<find>[</find>
|
||||
<find>addPoint</find>
|
||||
<find>Stitch</find>
|
||||
<find>index</find>
|
||||
<find>type(</find>
|
||||
<find>enumerate</find>
|
||||
<find>renderPECCommands</find>
|
||||
<find>endWithinStart</find>
|
||||
<find>colorIndex</find>
|
||||
<find>type</find>
|
||||
<find>getColorOfPathAtIndex</find>
|
||||
<find>closest</find>
|
||||
<find>ColorChange</find>
|
||||
<find>getClosestColor</find>
|
||||
</findStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
|
@ -198,10 +204,10 @@
|
|||
<option value="$PROJECT_DIR$/src/utilities.py" />
|
||||
<option value="$PROJECT_DIR$/PECRender/main.py" />
|
||||
<option value="$PROJECT_DIR$/Colors/getColors.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES.py" />
|
||||
<option value="$PROJECT_DIR$/src/main.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES_render_utils.py" />
|
||||
<option value="$PROJECT_DIR$/src/main.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES.py" />
|
||||
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
|
||||
</list>
|
||||
</option>
|
||||
|
@ -225,7 +231,6 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -256,6 +261,7 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -341,7 +347,7 @@
|
|||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/main.py" />
|
||||
<option name="PARAMETERS" value="-i ../Tests/zigzag.svg -o ../TestOutput/simple.PES -d" />
|
||||
<option name="PARAMETERS" value="-i ../Tests/simplePath.svg -o ../TestOutput/simple.PES -d" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
|
@ -402,7 +408,7 @@
|
|||
<frame x="0" y="23" width="1680" height="1027" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.13858365" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.13980465" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
|
@ -532,53 +538,45 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1425">
|
||||
<caret line="97" column="20" selection-start-line="97" selection-start-column="20" selection-end-line="97" selection-end-column="20" />
|
||||
<folding>
|
||||
<element signature="e#0#23#0" expanded="true" />
|
||||
<marker date="1543520578420" expanded="true" signature="133:210" ph="..." />
|
||||
<marker date="1543520578420" expanded="true" signature="387:427" ph="..." />
|
||||
<marker date="1543520578420" expanded="true" signature="3290:3296" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/utilities.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" selection-start-line="11" selection-end-line="11" />
|
||||
<state relative-caret-position="15">
|
||||
<caret line="1" column="14" selection-start-line="1" selection-start-column="14" selection-end-line="1" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_render_utils.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-68">
|
||||
<caret line="13" column="48" selection-start-line="13" selection-start-column="48" selection-end-line="13" selection-end-column="48" />
|
||||
<state relative-caret-position="615">
|
||||
<caret line="42" column="20" selection-start-line="42" selection-start-column="20" selection-end-line="42" selection-end-column="20" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
<marker date="1542996800150" expanded="true" signature="129:130" ph="..." />
|
||||
<marker date="1542996800150" expanded="true" signature="129:135" ph="..." />
|
||||
<marker date="1542996800150" expanded="true" signature="1233:1441" ph="..." />
|
||||
<marker date="1542996800150" expanded="true" signature="1468:1563" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="46">
|
||||
<caret line="25" column="17" selection-start-line="25" selection-start-column="17" selection-end-line="25" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="210">
|
||||
<caret line="235" selection-start-line="235" selection-end-line="235" />
|
||||
<folding>
|
||||
<element signature="e#0#23#0" expanded="true" />
|
||||
<marker date="1542986842340" expanded="true" signature="133:210" ph="..." />
|
||||
<marker date="1542986842340" expanded="true" signature="387:427" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="129:130" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="129:135" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="1233:1565" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="1460:1565" ph="..." />
|
||||
<marker date="1543517886574" expanded="true" signature="1592:1687" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="675">
|
||||
<caret line="71" selection-start-line="71" selection-end-line="71" />
|
||||
<state relative-caret-position="270">
|
||||
<caret line="18" column="27" lean-forward="true" selection-start-line="18" selection-start-column="27" selection-end-line="18" selection-end-column="27" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1542995051340" expanded="true" signature="112:1695" ph="..." />
|
||||
|
@ -592,12 +590,23 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="360">
|
||||
<caret line="33" column="32" selection-start-line="33" selection-start-column="32" selection-end-line="33" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="210">
|
||||
<caret line="183" column="24" lean-forward="true" selection-start-line="183" selection-start-column="24" selection-end-line="183" selection-end-column="24" />
|
||||
<state relative-caret-position="1728">
|
||||
<caret line="226" column="39" selection-start-line="226" selection-start-column="39" selection-end-line="226" selection-end-column="39" />
|
||||
<folding>
|
||||
<element signature="e#0#19#0" expanded="true" />
|
||||
<marker date="1543537504159" expanded="true" signature="10070:10075" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
|
11
src/PES.py
11
src/PES.py
|
@ -235,7 +235,7 @@ class CSewSeg:
|
|||
None
|
||||
|
||||
class Stitch:
|
||||
TYPE_ERROR = 0
|
||||
TYPE_SHORT = 0x00
|
||||
TYPE_LONG = 0x8000
|
||||
TYPE_JUMP = 0x9000
|
||||
TYPE_TRIM = 0xA000
|
||||
|
@ -243,14 +243,15 @@ class Stitch:
|
|||
# Initialize a new stitch from the previous location
|
||||
# to the new location.
|
||||
def __init__(self, line):
|
||||
assert(type(line) is Line)
|
||||
assert(isinstance(line, Line))
|
||||
|
||||
self.line = line
|
||||
|
||||
self.type = Stitch.TYPE_LONG
|
||||
if self.line.length() < 63.0:
|
||||
self.type = Stitch.TYPE_SHORT
|
||||
else:
|
||||
self.type = Stitch.TYPE_LONG
|
||||
|
||||
self.previous = line.start
|
||||
self.new = line.end
|
||||
|
||||
def encode(self, b):
|
||||
None
|
||||
|
|
BIN
src/PES.pyc
BIN
src/PES.pyc
Plik binarny nie jest wyświetlany.
|
@ -39,6 +39,10 @@ class GenericRenderer:
|
|||
('c3B', (r, g, b))
|
||||
)
|
||||
|
||||
def clearAll(self):
|
||||
self.lineBatch = pyglet.graphics.Batch()
|
||||
self.pointBatch = pyglet.graphics.Batch()
|
||||
|
||||
def updateDisplay(self, s):
|
||||
self.window.clear()
|
||||
self.lineBatch.draw()
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -28,17 +28,24 @@ if paths is None:
|
|||
|
||||
# Enumerate the shapes in the SVG to find where stitches should go.
|
||||
basicLines = []
|
||||
fillColors = []
|
||||
for i, shape in enumerate(paths):
|
||||
fillColor = getColorOfPathAtIndex(attributes,i)
|
||||
fillColors.append(fillColor)
|
||||
|
||||
print("Doing shape {} with fill color {}".format(shape, fillColor))
|
||||
print("Closest color: {}".format( PES.getClosestColor(fillColor) ))
|
||||
|
||||
# Fill color here is only for debugging.
|
||||
s = makeStitchLines(shape, fillColor, debug=args.debug)
|
||||
# Append the stitches as their own array so we can separate by colors
|
||||
basicLines.append(s)
|
||||
|
||||
# Make the stitches into a continuous set of commands
|
||||
PECCommands = createStitchRoutine(basicLines)
|
||||
PECCommands = createStitchRoutine(basicLines, fillColors=fillColors, threadWidth=2)
|
||||
|
||||
# Render the PEC commands
|
||||
renderPECCommands(PECCommands)
|
||||
|
||||
pes = PES(PECCommands=PECCommands)
|
||||
pes.encode()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import svgpathtools
|
||||
from PES_Emb_mathutils import *
|
||||
from PES_render_utils import *
|
||||
from PES import Stitch
|
||||
from PES import *
|
||||
import re
|
||||
import numpy
|
||||
|
||||
|
@ -177,7 +177,7 @@ def endWithinStart(l1, l2, dist):
|
|||
|
||||
# Take all the stitches we created and actually make
|
||||
# a continuous set of commands for the machine to follow.
|
||||
def createStitchRoutine(basicLines, threadWidth=2):
|
||||
def createStitchRoutine(basicLines, fillColors, threadWidth=2):
|
||||
|
||||
maxDist = math.sqrt(2 * math.pow(threadWidth,2))
|
||||
|
||||
|
@ -215,10 +215,47 @@ def createStitchRoutine(basicLines, threadWidth=2):
|
|||
newGroup = [ungroupedLine]
|
||||
lineGroups.append(newGroup)
|
||||
|
||||
# Connect the groups together with jump stitches
|
||||
# Add color change, convert lines to stitches and add jump commands
|
||||
allStitches = []
|
||||
|
||||
for i, shapeLineGroup in enumerate(shapeLineGroups):
|
||||
# Create the color change command.
|
||||
fillColor = fillColors[i]
|
||||
colorData = PES.getClosestColor(fillColor)
|
||||
|
||||
colorChange = ColorChange(colorIndex=colorData[0])
|
||||
allStitches.append(colorChange)
|
||||
|
||||
for singleLineGroup in shapeLineGroup:
|
||||
# Was the last command a stitch?
|
||||
if isinstance(allStitches[-1], Stitch):
|
||||
lastStitch = allStitches[-1]
|
||||
# Is the distance greater than the minimum?
|
||||
if endWithinStart(lastStitch.line, singleLineGroup[0], maxDist) is not True:
|
||||
# Jump to the location of this shape.
|
||||
jump = Stitch( line=Line(start=lastStitch.line.end, end=singleLineGroup[0].start) )
|
||||
jump.type = Stitch.TYPE_JUMP
|
||||
allStitches.append(jump)
|
||||
|
||||
for singleLine in singleLineGroup:
|
||||
# Do I really need to do two stitches per stitch or just one?
|
||||
# Maybe I can add different modes for this.
|
||||
s = Stitch(singleLine)
|
||||
allStitches.append(s)
|
||||
|
||||
print("Created {} stitches.".format(len(allStitches)))
|
||||
return allStitches
|
||||
|
||||
def renderPECCommands(PECCommands):
|
||||
GenericRenderer.globalRenderer.clearAll()
|
||||
|
||||
currentColor = ("None", 0,0,0)
|
||||
for command in PECCommands:
|
||||
if isinstance(command, Stitch):
|
||||
if command.type is Stitch.TYPE_JUMP:
|
||||
GenericRenderer.globalRenderer.addLine(command.line, 255, 255, 255)
|
||||
else:
|
||||
# Regular stitch
|
||||
GenericRenderer.globalRenderer.addLine(command.line, currentColor[1], currentColor[2], currentColor[3])
|
||||
if isinstance(command, ColorChange):
|
||||
currentColor = PES.colors[command.colorIndex]
|
||||
|
|
Plik binarny nie jest wyświetlany.
Ładowanie…
Reference in New Issue