Machine recognizes exported PES

It turns out I wasn't writing as many icons as I should've been.
pull/4/head
Reenforcements 2018-12-04 12:46:12 -05:00
rodzic 52f15ff85c
commit 7647a197ea
18 zmienionych plików z 661 dodań i 205 usunięć

Wyświetl plik

@ -3,10 +3,11 @@
<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$/LOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/LOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PECRender/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/PECRender/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/TestOutput/simple.PES" beforeDir="false" afterPath="$PROJECT_DIR$/TestOutput/simple.PES" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tests/debugPicture.png" beforeDir="false" afterPath="$PROJECT_DIR$/Tests/debugPicture.png" 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>
@ -18,10 +19,10 @@
</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="1543696967218" 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="1543697059353" 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$main.coverage" NAME="main Coverage Results" MODIFIED="1543896611963" 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="1543896674134" 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" />
<SUITE FILE_PATH="coverage/PES_Embroidery$main__1_.coverage" NAME="PESDump Coverage Results" MODIFIED="1543893622615" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/PESDump" />
</component>
<component name="FUSProjectUsageTrigger">
<session id="-1920598427">
@ -39,25 +40,25 @@
<usages-collector id="statistics.vcs.git.usages" />
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="Python" value="35783" />
<entry key="Python" value="40282" />
</counts>
</usages-collector>
<usages-collector id="statistics.js.language.service.starts" />
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="Python" value="28" />
<entry key="Python" value="41" />
<entry key="UML" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="JavaScript-modules-diagram//Users/imaustyn/Documents/MiamiUniversity/ECE 487/Project/PES-Embroidery" value="1" />
<entry key="py" value="28" />
<entry key="py" value="41" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="py" value="35783" />
<entry key="py" value="40282" />
</counts>
</usages-collector>
</session>
@ -67,8 +68,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="196">
<caret line="42" column="44" lean-forward="true" selection-start-line="42" selection-start-column="44" selection-end-line="42" selection-end-column="44" />
<state relative-caret-position="114">
<caret line="47" column="53" lean-forward="true" selection-start-line="47" selection-start-column="53" selection-end-line="47" selection-end-column="53" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
@ -79,69 +80,38 @@
<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="864">
<caret line="204" column="17" lean-forward="true" selection-start-line="204" selection-start-column="17" selection-end-line="204" selection-end-column="29" />
<state relative-caret-position="1061">
<caret line="285" column="23" selection-start-line="285" selection-start-column="17" selection-end-line="285" selection-end-column="23" />
<folding>
<element signature="e#0#23#0" expanded="true" />
<marker date="1543697169310" expanded="true" signature="133:258" ph="..." />
<marker date="1543697169310" expanded="true" signature="435:475" ph="..." />
<marker date="1543697169310" expanded="true" signature="3338:3344" ph="..." />
<marker date="1543895627790" expanded="true" signature="135:325" ph="..." />
<marker date="1543895627790" expanded="true" signature="273:325" ph="..." />
<marker date="1543895627790" expanded="true" signature="502:542" ph="..." />
<marker date="1543895627790" expanded="true" signature="3436:3442" ph="..." />
<marker date="1543895627790" expanded="true" signature="10880:10976" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/PESDump/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="413">
<caret line="85" column="17" lean-forward="true" selection-start-line="85" selection-start-column="17" selection-end-line="85" selection-end-column="17" />
<folding>
<element signature="e#0#15#0" expanded="true" />
<marker date="1543888134994" expanded="true" signature="559:825" 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="3240">
<caret line="317" column="18" selection-start-line="317" selection-start-column="18" selection-end-line="317" selection-end-column="18" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<marker date="1543696307287" expanded="true" signature="143:2224" ph="..." />
<marker date="1543696307287" expanded="true" signature="12671:12676" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<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="246">
<caret line="89" column="30" lean-forward="true" selection-start-line="89" selection-start-column="30" selection-end-line="89" selection-end-column="30" />
<folding>
<element signature="e#0#29#0" expanded="true" />
<marker date="1543625107768" expanded="true" signature="139:2608" ph="..." />
<marker date="1543625107768" expanded="true" signature="497:1537" ph="..." />
<marker date="1543625107768" expanded="true" signature="755:887" ph="..." />
<marker date="1543625107768" expanded="true" signature="1607:2401" ph="..." />
<marker date="1543625107768" expanded="true" signature="2659:2735" ph="..." />
<marker date="1543625107768" expanded="true" signature="2801:2806" ph="..." />
<marker date="1543625107768" expanded="true" signature="2801:4181" ph="..." />
<marker date="1543625107768" expanded="true" signature="3323:3324" ph="..." />
<marker date="1543625107768" expanded="true" signature="3730:3893" ph="..." />
<marker date="1543625107768" expanded="true" signature="3935:4054" ph="..." />
<marker date="1543625107768" expanded="true" signature="4091:4181" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<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="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>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="34" lean-forward="true" selection-start-line="34" selection-end-line="34" />
<state relative-caret-position="255">
<caret line="17" column="105" selection-start-line="17" selection-start-column="105" selection-end-line="17" selection-end-column="105" />
<folding>
<element signature="e#0#10#0" expanded="true" />
</folding>
@ -149,6 +119,15 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/event.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="192">
<caret line="356" selection-start-line="356" selection-end-line="356" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -160,36 +139,36 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>barrier</find>
<find>intersection points for this</find>
<find>intersect</find>
<find>self.b</find>
<find>addPoint</find>
<find>addLine</find>
<find>intersectionPointWithInfLine</find>
<find>invertLine</find>
<find>matchInfLine</find>
<find>invertSlope</find>
<find>moveToIncludePoint</find>
<find>renderPECCommands</find>
<find>lineFallsInValidProjection</find>
<find>makeStitchLevels</find>
<find>TYPE_JUMP</find>
<find>encode</find>
<find>color</find>
<find>1095499788</find>
<find>a0</find>
<find>scale</find>
<find>seeking to</find>
<find>print</find>
<find>Stitch(</find>
<find>endWithinStart</find>
<find>Stitch</find>
<find>&lt;</find>
<find>Beep</find>
<find>0x9</find>
<find>width</find>
<find>size</find>
<find>color</find>
<find>starting at coordin</find>
<find>starting at coordinate</find>
<find>58</find>
<find>colors</find>
<find>Color change</find>
<find>colorIndex</find>
<find>FE</find>
<find>black</find>
<find>color cha</find>
<find>default</find>
<find>ColorChange</find>
<find>getClosest</find>
<find>image</find>
<find>fe</find>
<find>width</find>
<find>label</find>
<find>FF</find>
<find>End st</find>
<find>End</find>
<find>starting stitches at location</find>
<find>thumbnail</find>
<find>getCoordinate</find>
<find>encode</find>
<find>PECColors</find>
</findStrings>
</component>
<component name="Git.Settings">
@ -208,9 +187,10 @@
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
<option value="$PROJECT_DIR$/src/PES_render_utils.py" />
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
<option value="$PROJECT_DIR$/PESDump/main.py" />
<option value="$PROJECT_DIR$/src/main.py" />
<option value="$PROJECT_DIR$/PECRender/main.py" />
<option value="$PROJECT_DIR$/src/PES.py" />
<option value="$PROJECT_DIR$/PECRender/main.py" />
</list>
</option>
</component>
@ -254,12 +234,12 @@
<path>
<item name="PES-Embroidery" type="b2602c69:ProjectViewProjectNode" />
<item name="PES-Embroidery" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="PESDump" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="PES-Embroidery" type="b2602c69:ProjectViewProjectNode" />
<item name="PES-Embroidery" type="462c0819:PsiDirectoryNode" />
<item name="TestOutput" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="PES-Embroidery" type="b2602c69:ProjectViewProjectNode" />
@ -319,6 +299,28 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="PESDump" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="PES-Embroidery" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/PESDump" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/PESDump/main.py" />
<option name="PARAMETERS" value="-i &quot;$PROJECT_DIR$/TestOutput/two.PES&quot;" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="getColors" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="PES-Embroidery" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -355,7 +357,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/zigzag.svg -o ../TestOutput/simpleTry.PES -d" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
@ -390,10 +392,12 @@
<item itemvalue="Python.svgImport" />
<item itemvalue="Python.PECRender-main" />
<item itemvalue="Python.getColors" />
<item itemvalue="Python.PESDump" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.PECRender-main" />
<item itemvalue="Python.PESDump" />
<item itemvalue="Python.getColors" />
<item itemvalue="Python.svgImport" />
</list>
@ -421,7 +425,7 @@
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32941177" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.39251336" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -504,13 +508,6 @@
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/graphics/vertexdomain.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="454" lean-forward="true" selection-start-line="454" selection-end-line="454" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/svgpathtools/bezier.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="387">
@ -546,21 +543,6 @@
</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="765">
<caret line="51" column="23" selection-start-line="51" selection-start-column="23" selection-end-line="51" selection-end-column="23" />
<folding>
<element signature="e#0#13#0" expanded="true" />
<marker date="1543629358921" expanded="true" signature="129:130" ph="..." />
<marker date="1543629358921" expanded="true" signature="129:135" ph="..." />
<marker date="1543629358921" expanded="true" signature="1235:1567" ph="..." />
<marker date="1543629358921" expanded="true" signature="1462:1567" ph="..." />
<marker date="1543629358921" expanded="true" signature="1594:1689" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/pyembroidery/PesReader.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
@ -568,16 +550,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="34" lean-forward="true" selection-start-line="34" selection-end-line="34" />
<folding>
<element signature="e#0#10#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utilities.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
@ -585,33 +557,10 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="864">
<caret line="204" column="17" lean-forward="true" selection-start-line="204" selection-start-column="17" selection-end-line="204" selection-end-column="29" />
<folding>
<element signature="e#0#23#0" expanded="true" />
<marker date="1543697169310" expanded="true" signature="133:258" ph="..." />
<marker date="1543697169310" expanded="true" signature="435:475" ph="..." />
<marker date="1543697169310" expanded="true" signature="3338:3344" 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="196">
<caret line="42" column="44" lean-forward="true" selection-start-line="42" selection-start-column="44" selection-end-line="42" selection-end-column="44" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</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="246">
<caret line="89" column="30" lean-forward="true" selection-start-line="89" selection-start-column="30" selection-end-line="89" selection-end-column="30" />
<state relative-caret-position="-285">
<caret line="82" column="59" selection-start-line="82" selection-start-column="59" selection-end-line="82" selection-end-column="59" />
<folding>
<element signature="e#0#29#0" expanded="true" />
<marker date="1543625107768" expanded="true" signature="139:2608" ph="..." />
@ -629,14 +578,96 @@
</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="390">
<caret line="26" selection-start-line="26" selection-end-line="26" />
<folding>
<element signature="e#0#13#0" expanded="true" />
<marker date="1543629358921" expanded="true" signature="129:130" ph="..." />
<marker date="1543629358921" expanded="true" signature="129:135" ph="..." />
<marker date="1543629358921" expanded="true" signature="1235:1567" ph="..." />
<marker date="1543629358921" expanded="true" signature="1462:1567" ph="..." />
<marker date="1543629358921" expanded="true" signature="1594:1689" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/graphics/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="371" selection-start-line="371" selection-end-line="371" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/graphics/vertexdomain.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="442" selection-start-line="442" selection-end-line="442" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3240">
<caret line="317" column="18" selection-start-line="317" selection-start-column="18" selection-end-line="317" selection-end-column="18" />
<state relative-caret-position="734">
<caret line="320" column="44" lean-forward="true" selection-start-line="320" selection-start-column="44" selection-end-line="320" selection-end-column="44" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<marker date="1543696307287" expanded="true" signature="143:2224" ph="..." />
<marker date="1543696307287" expanded="true" signature="12671:12676" ph="..." />
<marker date="1543699809942" expanded="true" signature="143:2224" ph="..." />
<marker date="1543699809942" expanded="true" signature="12828:12833" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/PESDump/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="413">
<caret line="85" column="17" lean-forward="true" selection-start-line="85" selection-start-column="17" selection-end-line="85" selection-end-column="17" />
<folding>
<element signature="e#0#15#0" expanded="true" />
<marker date="1543888134994" expanded="true" signature="559:825" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/event.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="192">
<caret line="356" selection-start-line="356" selection-end-line="356" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1061">
<caret line="285" column="23" selection-start-line="285" selection-start-column="17" selection-end-line="285" selection-end-column="23" />
<folding>
<element signature="e#0#23#0" expanded="true" />
<marker date="1543895627790" expanded="true" signature="135:325" ph="..." />
<marker date="1543895627790" expanded="true" signature="273:325" ph="..." />
<marker date="1543895627790" expanded="true" signature="502:542" ph="..." />
<marker date="1543895627790" expanded="true" signature="3436:3442" ph="..." />
<marker date="1543895627790" expanded="true" signature="10880:10976" 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="114">
<caret line="47" column="53" lean-forward="true" selection-start-line="47" selection-start-column="53" selection-end-line="47" selection-end-column="53" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="105" selection-start-line="17" selection-start-column="105" selection-end-line="17" selection-end-column="105" />
<folding>
<element signature="e#0#10#0" expanded="true" />
</folding>
</state>
</provider>

132
LOG.md
Wyświetl plik

@ -1,3 +1,135 @@
# 12/3
If I write my PES header with TrueSizer's PEC section, the embroidery machine recognizes it. That means I'm not writing the PEC section correctly. Time for some more reverse engineering.
FINALLY got something to show up. Yesssss. It turns out there's a main icon and then one for each color. I forgot that detail.
# 12/2
Whoops, I was looking at a design that I found and embroidered, and the stitches don't just go from endpoint to endpoint. There are multiple intermediate stitches. I need to fix that in my program too. Wow, there's really too much to do.
# 12/1
Wilcom adds 12116 - 11369 = 747 extra bytes to my file. I think the machine needs the PES section. I tried loading a PEC file and the machine didn't even bother recognizing it. I'll add minimum PES section stuff and see if it helps.
I think it needs a thumbnail. I figured out how their image system works from the documentation I found (it didn't explain it very well, but they literally use one bit per pixel.)
Okay, nope, my machine straight up just doesn't want to recognize it. It's probably related to me missing the PES section?
000000000000000000000000000000000000000000000000
000001110111111101111111011111110111111101111000
000010000000000000000000000000000000000000000100
000100000000000000000011011000000000000000000010
001000000000000000000100000110000000000000000001
001000000000000000001000001110000000000000000001
001000000000000000001000000001000000000000000001
001000000000000000001010011001000000000000000001
001000000000000000001111011101000000000000000001
001000000000000000001111011101000000000000000001
001000000000000000001111011101000000000000000001
001000000000000000001100001101000000000000000001
001000000000000000001110011100100000000000000001
001000000000000000001111011101100000000000000001
001000000000000000001110010110010000000000000001
001000000000000000011011000011010000000000000001
001000000000000000011000000011000000000000000001
001000000000000000111000000011010100000000000001
001000000000000001111000000001110100000000000001
001000000000000001110000000000100010000000000001
001000000000000000110000000000100010000000000001
001000000000000000100000000000110001000000000001
001000000000000101100000000000110001000000000001
001000000000000101100000000000110001000000000001
001000000000000101000000000000110001000000000001
001000000000000101100000000001100001000000000001
001000000000001101110000000001110111000000000001
001000000000111000111000000001110101000000000001
001000000001110000110100000001100001100000000001
001000000001100000011100000011100000110000000001
001000000001100000001100001111100000011000000001
001000000001100000001111011101100001110000000001
001000000001111100001110000101100111000000000001
001000000000001101111111011011110100000000000001
000100000000000001111000000000110000000000000010
000010000000000000000000000000000000000000000100
000001110111111101111111011111110111111101111000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000001110111111101111111011111110111111101111000
000010000000000000000000000000000000000000000100
000100000000000000000000000000000000000000000010
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000011010000000000000000000001
001000000000000000000111011100000000000000000001
001000000000000000000011011100000000000000000001
001000000000000000000011010000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000000000000000000000000000000000001
001000000000000100000000000000000000000000000001
001000000000000101000000000000100011000000000001
001000000000001101100000000000110111000000000001
001000000000111101100000000000110111000000000001
001000000000111101110000000000110111110000000001
001000000000111101111000000000110111110000000001
001000000000111101111000000000110111100000000001
001000000000011101111000000000110110000000000001
001000000000000001111000000000110000000000000001
000100000000000000000000000000000000000000000010
000010000000000000000000000000000000000000000100
000001110111111101111111011111110111111101111000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000001110111111101111111011111110111111101111000
000010000000000000000000000000000000000000000100
000100000000000000000011011000000000000000000010
001000000000000000000111011110000000000000000001
001000000000000000001111011110000000000000000001
001000000000000000001111011111000000000000000001
001000000000000000001111011111000000000000000001
001000000000000000001101000111000000000000000001
001000000000000000001111011111000000000000000001
001000000000000000001110011111000000000000000001
001000000000000000001100000111000000000000000001
001000000000000000001100011111100000000000000001
001000000000000000001111011111100000000000000001
001000000000000000001011000011110000000000000001
001000000000000000011001000001110000000000000001
001000000000000000010000000001110000000000000001
001000000000000000110000000001110100000000000001
001000000000000001110000000000110100000000000001
001000000000000001100000000000110110000000000001
001000000000000001100000000000110110000000000001
001000000000000001100000000000010111000000000001
001000000000000101000000000000010111000000000001
001000000000000101000000000000010111000000000001
001000000000000101000000000000010111000000000001
001000000000000001000000000000110111000000000001
001000000000001000100000000001010110000000000001
001000000000111000011000000001000001000000000001
001000000001000000011100000001000000100000000001
001000000001100000001100000001000000010000000001
001000000001100000001000000011000000001000000001
001000000001000000000111011111000000110000000001
001000000001110000000111011111000011000000000001
001000000000001101001111011011100100000000000001
000100000000000001111000000000110000000000000010
000010000000000000000000000000000000000000000100
000001110111111101111111011111110111111101111000
000000000000000000000000000000000000000000000000
# 11/30

Wyświetl plik

@ -14,10 +14,78 @@ pyglet.gl.glClearColor(0.4,0.4,0.4,1)
#filepath = "/Users/imaustyn/Documents/MiamiUniversity/ECE 487/Project/Understanding2/tux.pes"
#filepath = "/Users/imaustyn/Downloads/Circle embroidery designs/Circle.pes"
filepath = "/Users/imaustyn/Documents/MiamiUniversity/ECE 487/Project/PES-Embroidery/TestOutput/simple.PES"
#filepath = "/Users/imaustyn/Documents/MiamiUniversity/ECE 487/Project/PES-Embroidery/TestOutput/simple.PES"
filepath = "/Users/imaustyn/Documents/MiamiUniversity/ECE 487/Project/PES-Embroidery/TestOutput/simpleTry.PES"
# Global variables
class Global:
colorLookup = [
('None', 26, 10, 148),
('Prussian Blue', 26, 10, 148),
('Blue', 15, 117, 255),
('Teal Green', 0, 147, 76),
('Corn Flower Blue', 186, 189, 254),
('Red', 236, 0, 0),
('Reddish Brown', 228, 153, 90),
('Magenta', 204, 72, 171),
('Light Lilac', 253, 196, 250),
('Lilac', 221, 132, 205),
('Mint Green', 107, 211, 138),
('Deep Gold', 228, 169, 69),
('Orange', 255, 189, 66),
('Yellow', 255, 230, 0),
('Lime Green', 108, 217, 0),
('Brass', 193, 169, 65),
('Silver', 181, 173, 151),
('Russet Brown', 186, 156, 95),
('Cream Brown', 250, 245, 158),
('Pewter', 128, 128, 128),
('Black', 0, 0, 0),
('Ultramarine', 0, 28, 223),
('Royal Purple', 223, 0, 184),
('Dark Gray', 98, 98, 98),
('Dark Brown', 105, 38, 13),
('Deep Rose', 255, 0, 96),
('Light Brown', 191, 130, 0),
('Salmon Pink', 243, 145, 120),
('Vermilion', 255, 104, 5),
('White', 240, 240, 240),
('Violet', 200, 50, 205),
('Seacrest', 176, 191, 155),
('Sky Blue', 101, 191, 235),
('Pumpkin', 255, 186, 4),
('Cream Yellow', 255, 240, 108),
('Khaki', 254, 202, 21),
('Clay Brown', 243, 129, 1),
('Leaf Green', 55, 169, 35),
('Peacock Blue', 35, 70, 95),
('Gray', 166, 166, 149),
('Warm Gray', 206, 191, 166),
('Dark Olive', 150, 170, 2),
('Linen', 255, 227, 198),
('Pink', 255, 153, 215),
('Deep Green', 0, 112, 4),
('Lavender', 237, 204, 251),
('Wisteria Violet', 192, 137, 216),
('Beige', 231, 217, 180),
('Carmine', 233, 14, 134),
('Amber Red', 207, 104, 41),
('Olive Green', 64, 134, 21),
('Dark Fuchsia', 219, 23, 151),
('Tangerine', 255, 167, 4),
('Light Blue', 185, 255, 255),
('Emerald Green', 34, 137, 39),
('Purple', 182, 18, 205),
('Moss Green', 0, 170, 0),
('Flesh Pink', 254, 169, 220),
('Harvest Gold', 254, 213, 16),
('Electric Blue', 0, 151, 223),
('Lemon Yellow', 255, 255, 132),
('Fresh Green', 207, 231, 116),
('Applique Material', 255, 200, 100),
('Applique Position', 255, 200, 200),
('Applique', 255, 200, 200)]
pauseEmbroidery = False
batch = pyglet.graphics.Batch()
x = 0
@ -57,7 +125,14 @@ class Global:
# Skip stuff
cls.label = f.read(20)
print("Label: {}".format(cls.label))
f.read(28)
f.read(14)
# Read thumbnail width and height
thumbWidth = struct.unpack("B", f.read(1))[0]
thumbHeight = struct.unpack("B", f.read(1))[0]
print("Thumbnail dimensions: {} by {}".format(8 * thumbWidth, thumbHeight))
f.read(12)
cls.numberOfColors = struct.unpack("B", f.read(1))[0] + 1
print("Number of colors: {}".format(cls.numberOfColors))
@ -73,8 +148,31 @@ class Global:
# if blank is not (0,0):
# print("nope: {}".format(blank) )
# sys.exit(0)
f.read(8)
width, height = struct.unpack("<HH", f.read(4))
f.read(2)
# Thumbnail offset
thumbOffset = struct.unpack("<H", f.read(2))[0] + 512 + PECOffset
print("Thumbnail starts at byte {}".format(thumbOffset))
# Print thumbnail
lastPosition = f.tell()
f.seek(thumbOffset)
for c in range(0, cls.numberOfColors):
for row in range(0, thumbHeight):
for b in range(0, thumbWidth):
pixels = struct.unpack("B", f.read(1))[0]
for x in range(0, 8):
if ((0x80 >> (7-x)) & pixels) > 0:
c = "1"
else:
c = "0"
sys.stdout.write(c)
sys.stdout.write("\n")
f.seek(lastPosition)
f.read(4)
width, height = struct.unpack("<hh", f.read(4))
f.read(8)
print("Width and height of design: {}, {}".format(width, height))
print("Starting stitches at location: {}".format(f.tell()))
@ -97,12 +195,12 @@ class Global:
(Global.testColors[Global.colorIndex])[2])
# Get the starting point
while True:
Global.x = Global.getCoordinate(f)
Global.y = -Global.getCoordinate(f)
#while True:
Global.x = Global.getCoordinate(f)
Global.y = -Global.getCoordinate(f)
if Global.x != 0 or Global.y != 0:
break
#if Global.x != 0 or Global.y != 0:
# break
print("Starting at coordinates: ({}, {})".format(Global.x, Global.y))
@ -119,11 +217,13 @@ class Global:
if len(peek) is 0 or peek is None:
return "End"
if peek == 0xFF:
peekByte = struct.unpack("B", peek)[0]
if (0xFF & peekByte) == 0xFF:
print("End stitches")
return "End"
peekByte = struct.unpack("B", peek)[0]
print("Peek byte: {:02x}".format(peekByte))
if (peekByte & 0x80) > 0:
# Double length
c = struct.unpack(">H", Global.readBytes(f, 2))[0]
@ -171,10 +271,10 @@ class Global:
for i in range(0,stepBy):
x = cls.getCoordinate(f)
if x is None:
if x is None or isinstance(x, str):
continue
y = -cls.getCoordinate(f)
if y is None:
if y is None or isinstance(y, str):
continue
if x is "End" or y is "End":
@ -182,9 +282,9 @@ class Global:
print("({},{})".format(x,y))
cls.addLine(Global.x, Global.y, Global.x + x, Global.y + y,
(Global.testColors[Global.colorIndex])[0],
(Global.testColors[Global.colorIndex])[1],
(Global.testColors[Global.colorIndex])[2])
(Global.colorLookup[Global.colors[Global.colorIndex]])[1],
(Global.colorLookup[Global.colors[Global.colorIndex]])[2],
(Global.colorLookup[Global.colors[Global.colorIndex]])[3])

87
PESDump/main.py 100644
Wyświetl plik

@ -0,0 +1,87 @@
import argparse
import struct
parser = argparse.ArgumentParser(description="Converts an SVG file into a PES embroidery file.")
parser.add_argument("-i", dest="inputFile", type=str, action='store', required=True)
args = parser.parse_args()
def read(file, amount, format):
bytes = file.read(amount)
if len(bytes) is not amount:
return None
return (struct.unpack(format, bytes), bytes)
def printW(string, raw):
raw = bytearray(raw)
print("{} {}".format(string, " ".join(format(x, "02x") for x in raw) ))
def assertContinue(f):
h1 = f.read(2)
h2 = f.read(2)
h1 = struct.unpack("<H", h1)[0]
h2 = struct.unpack("<H", h2)[0]
if h1 != 0xFFFF or h2 != 0:
raise Exception("Didn't get continue bytes.")
else:
print("Got continue block: {} {}".format(h1, h2))
with open(args.inputFile, "r") as f:
b = f.read(8)
print("PES Header: {}".format(b))
b = f.read(4)
print("PEC offset: {}".format( struct.unpack("<I", b)[0] ))
b = f.read(2)
print("Hoop size: {}".format(struct.unpack("<H", b)[0]))
b = f.read(2)
print("Use existing design area: {}".format(struct.unpack("<H", b)[0]))
b = f.read(2)
print("CSewSeg block count: {}".format(struct.unpack("<H", b)[0]))
print("")
assertContinue(f)
b = f.read(2)
l = struct.unpack("<H", b)[0]
print("Header string length: {}".format( l ))
print("Header string: {}".format( f.read(l) ))
for y in range(0,2):
b = f.read(2)
print("Top: {}".format(struct.unpack("<H", b)[0]))
b = f.read(2)
print("Left: {}".format(struct.unpack("<H", b)[0]))
b = f.read(2)
print("Right: {}".format(struct.unpack("<H", b)[0]))
b = f.read(2)
print("Bottom: {}".format(struct.unpack("<H", b)[0]))
for y in range(0, 6):
b = f.read(4)
print("Matrix: {}".format(struct.unpack("<f", b)[0]))
b = f.read(2)
print("Typically 1: {}".format(struct.unpack("<H", b)[0]))
b = f.read(2)
print("CSewSeg X?: {}".format(struct.unpack("<h", b)[0]))
b = f.read(2)
print("CSewSeg Y?: {}".format(struct.unpack("<h", b)[0]))
b = f.read(2)
print("CSewSeg width: {}".format(struct.unpack("<h", b)[0]))
b = f.read(2)
print("CSewSeg height: {}".format(struct.unpack("<h", b)[0]))
b = f.read(8)
print("Eight zeros: {}".format(b))
b = f.read(2)
print("CSewSeg block count: {}".format(struct.unpack("<H", b)[0]))

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

BIN
TestOutput/two.PES 100644

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 3.9 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 4.3 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.1 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.4 KiB

Wyświetl plik

@ -1,18 +1,21 @@
from struct import pack
from svgpathtools import Line
from svgpathtools import *
import math
def encodeU8(num):
return pack("<B", num)
return pack("<B", int(num))
def encodeU16(num):
return pack("<H", num)
return pack("<H", int(num))
def encodeS16(num):
return pack("<h", num)
return pack("<h", int(num))
def encodeU32(num):
return pack("<I", num)
return pack("<I", int(num))
def encodeFloat(num):
return pack("<f", num)
'''
The EmbroideryDesign class is used to build
@ -30,7 +33,8 @@ The PES object and all the objects that follow it
are for easy encoding to the PES format.
'''
class PES:
colors = [('Prussian Blue', 26, 10, 148),
colors = [('None', 0,0,0),
('Prussian Blue', 26, 10, 148),
('Blue', 15, 117, 255),
('Teal Green', 0, 147, 76),
('Corn Flower Blue', 186, 189, 254),
@ -115,11 +119,12 @@ class PES:
cls.colors[closest][2],
cls.colors[closest][3])
def __init__(self, PEC):
def __init__(self, PEC, shape):
self.magic = "#PES"
self.version = "0001"
self.sections = []
self.PEC = PEC
self.shape = shape
def encode(self):
b = bytearray()
@ -127,10 +132,80 @@ class PES:
b.extend(self.version)
# Save a spot for the PEC offset that we will
# change later to the actual offset
pecOffsetLocation = len(b)
b.extend([0x0C, 0x00, 0x00, 0x00])
b.extend(encodeU16(1))
b.extend(encodeU16(1))
# Number of sew segment blocks
b.extend(encodeU16(1))
b.extend([0xFF, 0xFF, 0x00, 0x00])
# CEmbOne section
b.extend(encodeU16(7))
b.extend("CEmbOne")
# Standard block geometry
left, right, bottom, top = self.shape.bbox()
b.extend(encodeS16(left))
b.extend(encodeS16(top))
b.extend(encodeS16(right))
b.extend(encodeS16(bottom))
b.extend(encodeS16(left))
b.extend(encodeS16(top))
b.extend(encodeS16(right))
b.extend(encodeS16(bottom))
b.extend(encodeFloat(1.0))
b.extend(encodeFloat(0.0))
b.extend(encodeFloat(0.0))
b.extend(encodeFloat(1.0))
b.extend(encodeFloat(0.0))
b.extend(encodeFloat(0.0))
# Nobody knows what this value is but it's usually 1
b.extend(encodeU16(1))
# Coordinate translation?
b.extend(encodeS16(0))
b.extend(encodeS16(0))
# Width/height
b.extend(encodeS16(self.PEC.size.real))
b.extend(encodeS16(self.PEC.size.imag))
# Eight zeros for whatever reason
b.extend([0,0,0,0,0,0,0,0])
# CSewSeg block count (1)
b.extend(encodeU16(1))
# Means that more blocks follow.
b.extend([0xFF, 0xFF, 0x00, 0x00])
# CSewSeg
b.extend(encodeU16(7))
b.extend("CSewSeg")
# Encode stitch list
b.extend(encodeU16(0))
b.extend(encodeU16(1))
b.extend(encodeU16(2))
Stitch(toPoint=(10+10j)).encodeForCSewSeg(b)
Stitch(toPoint=(30 + 30j)).encodeForCSewSeg(b)
# Encode color list
b.extend(encodeU16(1))
b.extend(encodeU16(0))
b.extend(encodeU16(5))
# No more blocks follow
b.extend([0x00, 0x00, 0x00, 0x00])
pecOffset = len(b)
self.PEC.encode(b)
b[pecOffsetLocation:pecOffsetLocation+4] = encodeU32(pecOffset)
# Old code for the PES section
# that I decided to try excluding.
# # Assume 100mm x 100mm hoop size
@ -152,17 +227,22 @@ class PES:
return b
class PEC:
def __init__(self, label, colors, commands):
self.label = "default"
def __init__(self, label, colors, commands, size):
self.label = label
self.colors = colors
self.size = size
# Commands include stitches, jumps, and color changes
self.commands = commands
self.thumbnailWidth = 6
self.thumbnailHeight = 38
def encode(self, b):
# The label is always 19 bytes
# "LA:" + name + spaces to make it 19 bytes total + carriage return
pecStart = len(b)
b.extend("LA:" + self.label[:16].ljust(16))
b.extend("\r")
# Lots of values that aren't understood but probably have to be there.
@ -174,8 +254,8 @@ class PEC:
b.extend([0xFF])
# Thumbnail width and height
b.extend([6])
b.extend([38])
b.extend([self.thumbnailWidth])
b.extend([self.thumbnailHeight])
b.extend([0x20, 0x20, 0x20, 0x20, 0x64, 0x20, 0x00, 0x20, 0x00, 0x20, 0x20, 0x20])
@ -187,7 +267,7 @@ class PEC:
b.extend([c[0] & 0xFF])
# Palette section padding?
b.extend([0x20] * (462 - len(self.colors) ))
b.extend([0x20] * (462 - (len(self.colors) - 1) ))
# Second section of PEC header
@ -195,18 +275,19 @@ class PEC:
# Offset to image thumbnail relative to the beginning of the second section
# Set to zero for now because we don't know how many stitches we have yet.
thumbnailMarker = len(b)
b.extend([0x00, 0x00])
b.extend([0x31, 0x00])
b.extend([0xF0, 0xFF])
b.extend([0x00, 0x31])
b.extend([0xFF, 0xF0])
# Width and height
# TEMP values
b.extend([0x0A, 0x0A])
b.extend([0x0A, 0x0A])
print("Width: {} Height: {}".format(self.size.real, self.size.imag))
b.extend(encodeS16(self.size.real))
b.extend(encodeS16(self.size.imag))
b.extend([0x01, 0xE0])
b.extend([0x01, 0xB0])
b.extend([0xE0, 0x01])
b.extend([0xB0, 0x01])
b.extend([0x00] * 4)
@ -214,8 +295,17 @@ class PEC:
command.encode(b)
# End of stitch list
b.extend([0xFF])
b.extend([0xFF, 0, 0, 0, 0])
# Write the thumbnails
thumbStart = len(b)
for i in range(0, 2):
for x in range(0, len(self.colors)):
for r in range(0, self.thumbnailHeight):
for p in range(0, self.thumbnailWidth):
b.extend([0x81])
b[thumbnailMarker:thumbnailMarker+2] = encodeU16(thumbStart - 512 - pecStart)
@ -259,16 +349,23 @@ class Stitch:
def encode(self, b):
self.encodePoint(self.point - Stitch.lastPoint, b)
Stitch.lastPoint = self.point
Stitch.lastPoint = complex( int(round(self.point.real)), int(round(self.point.imag)))
def encodePoint(self, point, b):
self.encodeCoordinate(point.real, b)
self.encodeCoordinate(point.imag, b)
def encodeCoordinate(self, coordinate, b):
total = self.type + (int(coordinate) & 0xFFF)
if coordinate > 2047 or coordinate < -2047:
raise Exception("Coordinate movement too big: {}".format(coordinate))
total = self.type + ( int(round(coordinate)) & 0xFFF )
b.extend([ ((total & 0xFF00) >> 8), total & 0xFF])
def encodeForCSewSeg(self, b):
b.extend(encodeS16(self.point.real))
b.extend(encodeS16(self.point.imag))
def length(self):
return self.line.length()
@ -280,10 +377,11 @@ class ColorChange:
TYPE_COLOR_CHANGE_left = 0xFE
TYPE_COLOR_CHANGE_right = 0xB0
def __init__(self, colorIndex):
def __init__(self, colorIndex, indexInColorList):
self.colorIndex = colorIndex
self.indexInColorList = indexInColorList
def encode(self, b):
b.extend([ ColorChange.TYPE_COLOR_CHANGE_left ])
b.extend([ ColorChange.TYPE_COLOR_CHANGE_right ])
b.extend([ self.colorIndex & 0xFF ])
b.extend([ self.indexInColorList & 0xFF ])

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -26,7 +26,7 @@ paths, attributes = svg
if paths is None:
sys.exit(0)
threadWidth = 0.5
threadWidth = 3
# Enumerate the shapes in the SVG to find where stitches should go.
levelGroups = []
@ -48,11 +48,14 @@ for i, shape in enumerate(paths):
# Make the stitches into a continuous set of commands
PECCommands = createStitchRoutine(levelGroups, fillColors=fillColors, threadWidth=threadWidth)
# Render the PEC commands
renderPECCommands(PECCommands)
left, right, bottom, top = shape.bbox()
pec = PEC(label="pec1", colors=PECColors, commands=PECCommands)
pes = PES(PEC=pec)
pec = PEC(label="simple", colors=PECColors, commands=PECCommands, size=complex(right - left, top - bottom))
# Render the PEC commands
renderPEC(pec)
pes = PES(PEC=pec, shape=shape)
encodedPES = pes.encode()
with open(args.outputFile, "w") as f:

Wyświetl plik

@ -301,12 +301,14 @@ def createStitchRoutine(levelGroups, fillColors, threadWidth=2):
fillColor = fillColors[i]
colorData = PES.getClosestColor(fillColor)
colorChange = ColorChange(colorIndex=colorData[0])
allStitches.append(colorChange)
# First color is automatically set.
if i != 0:
colorChange = ColorChange(colorIndex=colorData[0], indexInColorList=i )
allStitches.append(colorChange)
for singleLineGroup in shapeLineGroup:
# Was the last command a stitch?
if isinstance(allStitches[-1], Stitch):
if len(allStitches) > 0 and isinstance(allStitches[-1], Stitch):
lastStitch = allStitches[-1]
# Is the distance greater than the minimum?
if pointWithinPoint(lastStitch.point, singleLineGroup[0].start, maxDist) is not True:
@ -324,12 +326,15 @@ def createStitchRoutine(levelGroups, fillColors, threadWidth=2):
print("Created {} stitches.".format(len(allStitches)))
return allStitches
def renderPECCommands(PECCommands):
def renderPEC(pec):
PECCommands = pec.commands
colors = pec.colors
GenericRenderer.globalRenderer.clearAll()
lastPoint = (0+0j)
currentColor = ("None", 0,0,0)
currentColor = colors[0][1:]
jumps = []
for command in PECCommands:
if isinstance(command, Stitch):
@ -342,7 +347,7 @@ def renderPECCommands(PECCommands):
lastPoint = command.point
if isinstance(command, ColorChange):
currentColor = PES.colors[command.colorIndex]
currentColor = colors[command.indexInColorList][1:]
# Render all the jumps on top
for jump in jumps:

Plik binarny nie jest wyświetlany.