diff options
| author | Lex Neva <github@lexneva.name> | 2016-11-07 20:55:12 -0500 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2016-11-07 20:55:12 -0500 |
| commit | a180cd7b16cba2f6c5154e8ba4b9ca9f85e3d1dd (patch) | |
| tree | 1236ad7bd7b0b26bc028adc6586d67fff9780042 /embroider.py | |
| parent | 45336a18dcd0cbf1880fcc65263159efba1c4461 (diff) | |
don't do auto-fill for regions with holes
Diffstat (limited to 'embroider.py')
| -rw-r--r-- | embroider.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/embroider.py b/embroider.py index 706cc774..f5411818 100644 --- a/embroider.py +++ b/embroider.py @@ -501,6 +501,10 @@ class AutoFill(Fill): def fill_underlay_max_stitch_length(self): return self.get_float_param("fill_underlay_max_stitch_length_mm" or self.max_stitch_length) + def validate(self): + if len(self.shape.boundary) > 1: + self.fatal("auto-fill: object %s cannot be auto-filled because it has one or more holes. Please disable auto-fill for this object or break it into separate objects without holes." % self.node.get('id')) + def is_same_run(self, segment1, segment2): if shgeo.Point(segment1[0]).distance(shgeo.Point(segment2[0])) > self.max_stitch_length: return False @@ -540,7 +544,7 @@ class AutoFill(Fill): distance = self.perimeter_distance(p1, p2) stitches = abs(int(distance / self.running_stitch_length)) - direction = distance / abs(distance) + direction = math.copysign(1.0, distance) stitch = self.running_stitch_length * direction for i in xrange(stitches): @@ -592,6 +596,7 @@ class AutoFill(Fill): def to_patches(self, last_patch): print >> dbg, "autofill" + self.validate() patches = [] |
