Wykres commitów

117 Commity (d4a79b8a5e33003bf22b47d105699fb749652483)

Autor SHA1 Wiadomość Data
Lex Neva 247855cb57 start auto-fill at end of previous patch 2016-11-06 19:19:22 -05:00
Lex Neva 7e685222af add underlay option to auto-fill 2016-11-06 17:04:31 -05:00
Lex Neva e48a0f6556 pick closest starting point 2016-11-06 14:07:48 -05:00
Lex Neva b16f7de2fc WIP 2016-11-04 20:31:13 -04:00
Lex Neva 318da3bb18 WIP 2016-11-03 22:49:59 -04:00
Lex Neva 2d34bed8ad split out fill algorithm into a function 2016-11-03 21:21:55 -04:00
Lex Neva 841e9196ba major refactor
Split into classes for Fill, Stroke, and SatinColumn.  Renamed params to be
the same across XML attributes and OptionParser.  Added distinct stitch length
params for satin underlay.  Renamed "satin underlay" to "contour underlay" and
split out "center walk underlay" and "zigzag underlay".

The code is ten times more readable, parameters make more sense, and everything
is specified by the user in millimeters.  Basically, everything is way better.
2016-11-02 23:20:31 -04:00
Lex Neva 9249a3ae77 pep8 fixes 2016-10-29 13:28:37 -04:00
Lex Neva 579ef18b56 remove obselete stitch order option 2016-10-28 22:12:03 -04:00
Lex Neva 14ec80d012 switch to millimeters and make pixels_per_millimeter an option 2016-10-28 22:10:54 -04:00
Lex Neva b63abea797 remove unnecessary imports 2016-10-28 21:52:48 -04:00
Lex Neva 46482bfd5e tidy 2016-10-27 22:35:47 -04:00
Lex Neva ae49143c3a studly caps to underscores (pep8) 2016-10-27 22:32:49 -04:00
Lex Neva f2bb136c75 inline reverseTuple 2016-10-27 22:31:59 -04:00
Lex Neva 752b34b4ea get rid of shapelyLineSegmentToPyTuple 2016-10-27 22:29:44 -04:00
Lex Neva 65cb5bf875 simplify polygon sorting 2016-10-27 22:09:59 -04:00
Lex Neva 696e3802ba remove hatching option 2016-10-27 21:59:46 -04:00
Lex Neva 90e4cc2c8c big refactor to untangle embroidery from stitch generation 2016-10-26 15:04:15 -04:00
Lex Neva 7cb1b27a67 remove PatchList class and use a simple List 2016-10-26 13:40:00 -04:00
Lex Neva a1cd95b2c8 remove sortorder bits 2016-10-26 13:20:27 -04:00
Lex Neva a7ef582025 be sure to visit selected nodes in the right order 2016-10-26 13:13:27 -04:00
Lex Neva f81a70766f get rid of traveling salesman stuff
The algorithm was terrible.  In general, it seems to work a lot better to just
have the human choose what order things are stitched in than to try to
do it automatically.
2016-10-24 21:55:01 -04:00
Lex Neva 35d5077ca7 remove unused row_spacing_px option from EmbroideryObject 2016-10-24 21:28:19 -04:00
Lex Neva b06783a557 get rid of preamble code and feature
The code was poorly implemented and unclear.  I haven't ever had a need for
preamble.  I think my machine (brother SE400) might do it automatically.
2016-10-24 21:25:12 -04:00
Lex Neva 80c874ab3a remove unused functions 2016-10-24 21:07:24 -04:00
Lex Neva c40ae3cec3 tidy up Patch 2016-10-24 20:54:21 -04:00
Lex Neva afcd2d020a refactor satin a bit 2016-10-24 20:51:43 -04:00
Lex Neva de2cd9a30d proper zigzag underlay 2016-10-20 22:27:48 -04:00
Lex Neva 36085676c8 add center walk and zigzag underlay for satin
the code's a total hack, but it gets the job done
2016-10-19 21:43:23 -04:00
Lex Neva b70e0e7fa8 stuff 2016-10-19 20:47:30 -04:00
Lex Neva 6a23fe868b protect from foot-shooting by printing to stdout 2016-05-16 22:16:36 -04:00
Lex Neva 4f5a719899 bugfixes 2016-05-16 22:08:50 -04:00
Lex Neva 0e18512947 add pull compensation for satin columns 2016-05-14 15:19:50 -04:00
Lex Neva 75cd530302 align rows properly even for rotated regions, also fix float inaccuracy 2016-04-28 12:07:19 -04:00
Lex Neva 55166bdedd a bunch of features and fixes
* added "flip" option for fills to start stitching in upper left rather than right
  * line up rows in abutting fills properly
  * handle intersect_with_grating intersection result that is a line or single point (skip row)
  * skip endpoint marker tags in SVG files (subtags look like paths)
  * dashed stroke indicates running stitch (<=0.5 width still works but is deprecated)
  * in running stitches, add a stitch at apex of sharp corners
2016-04-27 23:21:17 -04:00
Lex Neva ffea1d2bc1 fix: stitches appearing outside fill in case of very short rows 2016-02-28 14:02:57 -05:00
Lex Neva 43b16936be don't embroider stuff set to invisible (layers, groups, paths, etc) 2016-02-25 17:23:16 -05:00
Lex Neva 3c3591c78b embroider everything if nothing is selected 2016-02-25 17:17:41 -05:00
Lex Neva 8f3b03ff6d add option to preserve absolute object stacking order 2016-02-25 17:11:03 -05:00
Lex Neva 25a70ba148 rework satin_column to properly handle segments that are less than the zigzag length 2016-02-23 22:24:36 -05:00
Lex Neva b054de3735 sort line segments to better pick contiguous fill regions 2016-02-23 22:23:58 -05:00
Lex Neva 53598b3508 multiple-stagger stitches in fills
Instead of staggering stitches like this:

--*--*--*-
*--*--*--*

stagger like this:

---*-----------*-----------
------*-----------*--------
---------*-----------*-----
------------*-----------*--
---*-----------*-----------

This ends up looking much prettier on the fabric.  The number of staggers
is configurable; a value of 2 would behave like the previous commit.
2016-02-23 22:23:10 -05:00
Lex Neva d1cd63eecd get rid of randomness in fills
Previously, each row in a fill region was offset by a random amount.  This
looks better than not offsetting at all (which will create visible columns of
stitches), but humans are very good at finding patterns in randomness.  The
result is that fill regions look weird.

This commit instead carefully orders the stitches in fill regions such that
each row's stitches are offset by half of max_stitch_length from the previous.

There are also a couple of other miscellaneous fixes and features in here --
sorry about that.
2016-02-18 21:43:16 -05:00
Lex Neva 13dcbf8846 clean up satin column code and clarify error messages 2016-01-30 23:01:45 -05:00
Lex Neva 8c40bd95e0 add variable satin feature
Variable satin does zigzag stitches between two arbitrary paths.  This lets you do satin stitching of variable width and angles, which is useful for filling smaller regions where tatami filling doesn't make sense.  It's also good for doing satin around corners, because it doesn't leave the outer part of the corner sparsely-stitched.

To use variable satin, create an object containing two paths in inkscape.  Each path should have the same number of vertices.  Zigzag satin will be drawn between the two paths such that a stitch always aligns with each corresponding pair of vertices.  This lets you control the way the stitches are angled by subdividing the paths appropriately.  Tip: you can add a vertex to a path by double-clicking the place on the path where you want the new vertex.

Be careful when going around corners, especially sharp ones.  The number of stitches is based on the zigzag spacing parameter measured around the _longer_ of the two beziers in each segment.  Around corners, even if the outside angle is sharp, you may want to make the inside angle slightly rounded to avoid having a bunch of stitches all land at exactly the same point, which could poke a hole in your fabric.
2016-01-20 03:04:43 -05:00
Lex Neva acd9db29d3 fix up whitespace error 2016-01-18 22:22:48 -05:00
Lex Neva de87bd71eb augment the TSP algorithm by being greedier
The greedy algorithm can be fairly effective, and it's not particularly
expensive to calculate given the relatively small number of patches in
any given set.  Instead of doing a greedy algorithm starting from the
furthest point from the centroid (what's the theory there...?), just
find greedy paths from all possible starting points and pick the best.
This gets us pretty close to optimal right out of the gate.
2016-01-18 22:22:37 -05:00
Lex Neva 67125cdc0b fix gnarly bug in hill-climbing resulting in hill-falling
try_swap occasionally made very bad swaps that increased the overall cost.
If asked to swap neighboring patches, the calculations were completely wrong.
2016-01-18 22:16:23 -05:00
Lex Neva e2fd415664 fix bug that allowed a patch to be discontiguous 2016-01-18 20:51:31 -05:00
Lex Neva 67aec77ec5 rewrite intersect_region_with_grating to resolve TODO 2016-01-18 20:25:46 -05:00
Lex Neva 48d957860e convert tabs to spaces 2016-01-18 18:31:10 -05:00
Lex Neva 521be47402 really fix "preserve order"
My previous fix didn't really do the job.  It took patches in Z-order, but runs of patches of the same color were fed into the TSP algorithm and it could embroider them in whatever order it chose.  This resulted in underlays for my fill regions being embroidered AFTER the fill.

Now, the "preserve order" option has been changed to "preserve layers".  Patches on different layers are gauranteed to be stitched in layer order.  Patches of the same color within the same layer can be stitched in any order as chosen by the TSP algorithm.
2016-01-18 18:18:30 -05:00
Lex Neva 3e3d540089 major revamp
* properly process transform parameters (ungrouping no longer necessary!)
  * handle satin on beziers properly
    * previously beziers were stroked as straight line segments that included control points
  * allow overriding parameters on individual paths by adding extra svg params
    * embroider_angle, embroider_stitch_length, embroider_zigzag_spacing, embroider_row_spacing, etc
    * set using "Edit XML"
  * default to 10 pixels per millimeter
  * properly write CSV files in millimeters (was dividing by 10)
  * always translate pattern to origin to fit in hoop
  * add "running stitch length" for < 0.5 stroke width)
  * don't traceback if no paths were selected
  * add "repeats" option for stroke (satin/running stitch) to go back and forth over the line
    * good for a double line of center-line underlay below satin
2016-01-08 22:56:10 -05:00
Lex Neva 142f0a5681 make 'preserve stacking order' actually work 2016-01-06 10:44:05 -05:00
Lex Neva 2a31088cb8 set to 10 pixels per mm for embroidermodder CSV output 2016-01-06 10:43:51 -05:00
Bas Wijnen e7bf0753b5 allow specifying orientation 2015-12-15 01:09:25 -05:00
Bas Wijnen 284e6e4d21 Make it work well for Franklin
Add Franklin G-Code target as output.
Fix issue that filled area was treated as one patch per stitch.
Don't autodetect orientation; let the user choose by orienting the object.
Remove empty stitches.
Base generated inkscape path on output from file.
Allow maximum stitch length of 10 cm.
Save debug output in /tmp.
Disable almost all debugging.
Let hatching connect the segments.
2015-11-11 00:17:45 -05:00
Stefan Siegl 65d037d335 Fix preamble generation for very short patches 2015-01-03 03:00:02 +01:00
Stefan Siegl 160b08062c Improve zigzag path around stroke + sep. spacing config
Don't use path nodes as stich points, just use the stroke as a
guide for the zigzag stich
2015-01-02 23:48:33 +01:00
Stefan Siegl 1689309c6e Optionally auto-generate preambles 2015-01-02 14:30:33 +01:00
Stefan Siegl 60199fffe0 Filter out duplicate stitches 2014-12-29 23:34:37 +01:00
Stefan Siegl 35e5c09c99 Allow to collapse (jump) stitches 2014-12-29 22:38:22 +01:00
Stefan Siegl e80f5f4003 Allow to hatch filled paths 2014-12-29 13:54:14 +01:00
Stefan Siegl 9480ec1ed7 Correctly close polygons with multiple sub-paths 2014-12-29 12:44:38 +01:00
Stefan Siegl 4aef2789a2 Add Embroidermodder 2 CSV export 2014-12-27 17:30:54 +01:00
Stefan Siegl ea07ab6f10 Handle closed paths 2014-12-26 23:26:06 +01:00
Stefan Siegl 47449d22cb Initial import of upstream code
Embroidery output extension for Inkscape;
downloaded from http://www.jonh.net/~jonh/inkscape-embroidery/
on 2014-12-26 19:38 CET

Copyright 2010 by Jon Howell, licensed under GPLv3.
2014-12-26 23:15:48 +01:00