Git Product home page Git Product logo

Comments (6)

golanlevin avatar golanlevin commented on May 29, 2024 1

Hi @tatyanade, could you please test this out so that we can close this issue.

from pembroider.

LingDong- avatar LingDong- commented on May 29, 2024

Hi @golanlevin , I think the request totally make sense. Won't be too easy to add, but definitely doable.

Currently each polyline is associated with a cullGroup, which is how I make sure the same shape doesn't cull with its own strokes. So theoretically I can pass this info to TSP too.

But may I suggest another interface that I think gives users more clarity and control:

E.optimize() can be called multiple times. Each time it is called, the polylines that are currently on the canvas are optimized. Then, they're marked as "solidified" and future calls to TSP will treat them as a whole. So users will insert E.optimize() between what they regard as different "object"s.

What do you think?

from pembroider.

golanlevin avatar golanlevin commented on May 29, 2024

Hi @LingDong- , this is an interesting proposal. What if there were a beginOptimize() and endOptimize() call, which runs a TSP exclusively on the stitches that were added in between those functions?

from pembroider.

LingDong- avatar LingDong- commented on May 29, 2024

good idea 👍

from pembroider.

LingDong- avatar LingDong- commented on May 29, 2024

beginOptimize() and endOptimize() were added in this commit: 946609f

Sorry forgot to update here. Usage is:

import processing.embroider.*;

void setup(){
  size(1000,500);
  PEmbroiderGraphics E = new PEmbroiderGraphics(this);
  
  E.fill(0);
  E.hatchSpacing(20);

  // these shapes will be optimized individually
  E.beginOptimize();
  E.rect(10,10,300,300);
  E.endOptimize();
  
  E.beginOptimize();
  E.rect(50,50,300,300);
  E.endOptimize();
  
  // these shapes will interleave
  E.beginOptimize();
  E.rect(510,10,300,300);
  E.rect(550,50,300,300);
  E.endOptimize();
  

  E.visualize(true,true,true);
  
}

from pembroider.

tatyanade avatar tatyanade commented on May 29, 2024

Wanted to say that this as a feature makes a lot of sense, have had some failed embroideries where issues arose on one specific shape/object but since the embroidery was jumping around multiple shapes I had to re-embroider all of the ones that had been started and not finished instead of just being able to redo the one with an issue.

Here are some tests I ran;

the code from above
PEmbroider_stitch_vs_object_TSP

PEmbroider_stitch_vs_object_TSP

and then a new one w text

text is a weird one to watch be embroidered since it doesn't write left to right and skips around letters and words which is counter intuitive to watch, especially with cursive since you'd expect it to be one line but! It does do the individual text segment individually.

PEmbroider_stitch_vs_object_TSP_text

PEmbroider_stitch_vs_object_TSP_text

This does cause iterating on code to be slower since it takes longer to visualize - when optimize is at the bottom and its you can comment it out till you're ready to write the file but now you'd have to comment out all the begin/ends which might get tedious without a helper function, especially if you have a lot of individual shapes that you want to retain the order of.

In the example code you @LingDong- put above, would optimize by itself need to be called and the end of the file or would that be redundant since all the shapes being embroidered have had optimize called already?

from pembroider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.