Giter Site home page Giter Site logo

svgnest's People

Contributors

bmtm avatar dergenaue avatar dustmason avatar gaetancollaud avatar jack000 avatar johnrees avatar jonnor avatar olilej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svgnest's Issues

Can run demo at local?

run_svgnest com

When run demo at svgnest.com, All are fine.

run_local
Download src and extract it into a local directory and run the demo again.
Progress bar is disappeared. nothing was happened.

Can i add fixed polygons to the base/bin?

Hey,

I've been testing your software and it's amazing. Congratulations!

I have a question regarding de base/bin where the other elements are placed. Is there any way to add a polygon which has to be fixed and not traslated/rotated by the algorithm and will have no pieces inside it placed once the algoritm finishes?

I mean for example a base which is some kind of material which has stains and we dont want to place pieces onto.

I've been thinking if i can nest a svg inside the svg where all the other pieces are and mark it as the bin. Would it be possible?

Thank you very much in advice!

Slightly deformed shapes

After nesting few elements (files attached) 2 shapes "S" and "W" letter was slightly different from original.
Why this happened?

The second thing is, space in svgnest configuration was set to 10 (or 12 don't remember) - svg was was set to mm in inkscape. And after nesting the space is around 3,5mm.

clipboard01

zale.zip

CSV file nesting?

As I see this nesting program is able to nest only imported geometry as SVG shapes.

It will be very useful to be able to nest geometry from CSV files where the elements are defined as dimension values, like in the bellow example:


500, 200, 5
230, 120, 3
120, 320, 2


Where the first column is always the grain orientation, and the last one is the quantity of parts/shape to be nested.

lasercut optimisation

Great work !.
I suggest an optimisation which could be added as an option.

If two edges are coincident and one lies enirely within the length of the other, then eliminate the shorter edge.

This will optimise out the duplication of cuts in a way that does not chop an edge into a number of shorter cuts - which frequently generates bumps in a physically cut result. Further types of reuction could be looked at as well but the direction and order of each cut is an ordering problem within the SVG and a tricky one to calculate.

Skip Nesting on Defect Regions

Hi Jack

First of all i thank you for the wonderful project. Being in material optimization job, I know how difficult to work with nesting. This SVGnest does impressive job.

I request you to consider this enhancement in higher priority - "Skipping the nesting in the defect regions of sheet/bin". It is a must need feature when you think about automated nesting coz not every sheet/bin will be a defect free solids.

I guess as discussed in an another thread, "Treat pieces inside the bin as locked" will be a better solution.

Attached samples for your reference
samplenest

Thanks
Nadum Sing

Using with QtWebKit

Hi, I try to load SVGNest in a QWebView and have an issue :

TypeError: undefined is not an object (evaluating 'element.getAttribute')

Have you any solution ?

Thanks.

Preserve fill and stroke color

I was trying to use this to process some Ponoko files, which have colored strokes and fills to represent etched/cut line intensities and etched area intensities respectively. Unfortunately, SVGNest removes fill and stroke colors after processing.

I also had some issues with Deepnest.io, but both tools seem great; just not for my use case.

SVG from Kabeja

Hi.

I am trying to load shapes generated with Kabeja. Unfortunately many of them does not appear correct. If I first simplify in Inkscape it works. However simplify is not good, further Id like if it could load for nest directly.

I have attached a few simple examples og SVG. the rendering problem has nothing to do with SVGNEST.

testSVG.zip

Multi page placement

Hi,
What if I have more pieces that I can fit onto one sheet? Could it place the pieces onto multiple sheets?

SVG nest and orientations (0 or 180) or (90 or 270)

Example.zip
Interesting stuff this SVGnest.

I also commented in #15. That was about grain-direction in wood. I repeat my comments here:

In metal sheet industry the requirements are somewhat more complex compared to the wood-grain issue.
Metal sheet proces is as follows: Sheet metal is cut (lasered or punched) Next step is bending on a press brake. For the press-brake it is important that the grain (molecular structure) is in the same direction for all identical parts in the nest. That is a prerequisition to have a consistent bend during the complete batch. In most cases it does not matter if grain is along or perpendicular to bending axis.
Now back to nesting and rotations: Commercial nesting software often has an option to select allowable rotations of a part. Most of the time this is set per part to (0 or 180) or to (90 or 270). This will ensure grain directions for identical parts to be the same. However it does not always produce the best material utilisation. It can be the case that a part (which is set to 0 or 180) will fit better if it were set to (90 or 270) and would result in a better utilisation.
I've not seen commercial nesting software that does provide the option per part: try (0 or 180) and try (90 or 270)
Sadly SVGnest does not provide this option either.
However, having taken a look at Jacks code there is a routine that places parts with the help of a genetic algorithm (GA). I think it is in this section that a code change should be made to accomodate the (0 or 180) or (90 or 270) rules. However I'm totally not into GA. Is there anyone who can help to get this done?

I have included a sample. Start with the "example.svg". Set part distance:10 and enable "explore concave areas". This wil result in a nest like "result.svg" (You might wonder where the 3 indentations in the bin are for: These are the reserved areas where the lasercutter places its clamps to move the metal sheet under the laserbeam) The goal would be to let have the same colored parts the same orientation.

Hopefully someone will be helpfull.

i tested your software

it is great, i enjoyed your software. thanks for sharing.i think how we can make better in optimization. any way thanks very much

Paths Seem to be broken apart.

I'm trying to pack my shapes for a bookshelf using SVGNest. I've been successful using it in the past for other projects. But it seems to think my path is a bunch of smaller paths for the curved shapes.

My workflow was Fusion 360 -> DXF -> Inkscape.

Here is a pastebin with my SVG: Bookmark.svg

Option to save every nested Sheet as separate SVG file.

Hi, I just discovered this project and I have some feature requests.

Will be practical to be able to save every nested Sheet as a separate SVG file, instead to save only one file containing all the nested sheets like it is right now. I tested the online demo. Maybe an option when are multiple sheets to download all SVG files as a ZIP file will do the trick.

"Performs similarly to commercial software"... which one?

There's probably more than one application that can do packing, which one are you benchmarking against? (because this is a bit like saying "our toothpaste is 30% better than the next leadin brand"... there's no true information there =D)

Separate the packing algorithm out from the UI and SVG dependency so it can be used independently

The geometry part of this code depends on plain polygon objects which are lists of {x: y:} points and some worker threads that call the clipper library and a genetic algorithm.

The other half of this code decodes the SVG shapes, organizes them into inner and outer contours, and then linearizes the edges.

It would be very useful if this system were broken into two completely disconnected parts with a simple API between them (that just took the polygons and returned the transformations), because then I could use it for packing other shapes that might be generated within my own javascript UI.

Nesting messed up when input with the output of the demo

I've tried to use the output of the demo as an input, because was having difficulty in using my test profiles. I noticed that when demo has been run with 0 spacing, the subsequent nesting performed on it gives some white filled shapes placed outside the bin, and many shapes wildly overlap.
If the demo is run with 0.5 spacing, using this output gives a fine result.
cattura

Use lowest position of centre of gravity to position the elements

line 185 placementworker.js

            // choose placement that results in the smallest bounding box
    // could use convex hull instead, but it can create oddly shaped nests (triangles or long slivers) which are not optimal for real-world use
    // todo: generalize gravity direction

Consider placing according to the lowest position of centre of gravity, as suggested in this paper:

"Algorithm for 2D irregular-shaped nesting problem based on the NFP algorithm and lowest-gravity-center principle"
LIU Hu-yao, HE Yuan-jun [2005]

If you translated each of your polygons so that its centre of gravity was at the origin (and the rotations were around this point), then this final scan of displaced points (allpoints and shiftvector stuff) would be unnecessary as you would merely need to find the lowest point of finalNfp.

Locked pieces

There are times in a job where there are pieces that are required to be in certain locations - due to grain or wood imperfections, etc. After these pieces are located in their manually approved locations it would be desirable to nest remaining pieces. Sometimes it is as simple as the 'primary' pieces are paying for the job and need to be in the best parts of the material, and then the remainder of the material can be used to nest pieces of 'secondary' value.

Note: this is NOT a duplicate request to the 'piece orientation' request - but obviously I'd mark the primary pieces by location and orientation.

Implementation thought: When the initial nesting container is selected and the process triggered, anything already within the container boundaries is treated as locked both positionally and with regard to orientation. Nesting resumes from there?

Error when running demo in Chrome OSX

Clicking on the Demo button using Chrome version 49.0.2623.0 canary (64-bit) under OSX only gives an error in the bottom of the app window.

TypeError: Cannot read property 'length' of undefined

Troubles about creating hulls

Hello,
I've translated the functions in geometryutil.js into C# for a course project. The problem is that sometimes the polygonHull function may lose several parts in the process. I've been captured that overlapping points with the one on the upper half of A and the other is in the lower cause the problem. Still, there are lots of problems cases I cannot handle.
I wonder if there is another feasible and reliable mean to create the hull of the parts?
thx in advance

DOMException: Failed to construct 'Worker': Script at '

i can run demo on the web site http://svgnest.com/.
however it reports errors when i download the file and run on the chrome version 60.
the error is shown in follow:
Any guidance would be appreciated. thank you

image

Uncaught DOMException: Failed to construct 'Worker': Script at 'file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/util/eval.js' cannot be accessed from origin 'null'.
at Parallel._spawnWorker (file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/util/parallel.js:167:12)
at Parallel._spawnMapWorker (file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/util/parallel.js:217:24)
at Parallel.p._spawnMapWorker (file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/svgnest.js:351:47)
at file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/util/parallel.js:265:10
at Operation.then (file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/util/parallel.js:51:5)
at Parallel.map (file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/util/parallel.js:263:18)
at SvgNest.launchWorkers (file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/svgnest.js:354:6)
at file:///C:/Users/Administrator/Desktop/fdm%20scheduling/SVGnest-master/SVGnest-master/svgnest.js:235:25
Parallel._spawnWorker @ parallel.js:167
Parallel._spawnMapWorker @ parallel.js:217
p._spawnMapWorker @ svgnest.js:351
(anonymous) @ parallel.js:265
Operation.then @ parallel.js:51
Parallel.map @ parallel.js:263
SvgNest.launchWorkers @ svgnest.js:354
(anonymous) @ svgnest.js:235

Download SVG Error!

Not able to download the final nested SVG. I tried to download svg after the demo nesting is finished. Got the below error on opening it.

This page contains the following errors:

error on line 1 at column 617: Attribute version redefined
Below is a rendering of the page up to the first error.

Chrome V54

Type error

When I uploaded the svg file:

An error is occurred.
TypeError: unable to get property "getAttribute" of undefined or null reference.

Has the file any error?

Will you give any samples in the demo project?

incorrect nesting

Hello,

when nesting attached SVG file with default-settings the"wrong placed " elements will not be recognized.

even increasing space between parts and curve tolerance shows "wrong placed" elements.

any ideas ( is the input svg not correct )?

thx in advance

Francois

nest_test3.svg.zip

svgnesting_fail

Nesting takes too long and nothing happens

Hello,

I make drawings on CorelDraw. I save them in SVG, open them in inkscape, ungroup everything, convert to path and save again.

Even so SVGnest does not generate a solution in a reasonable time.

Here the last SVG file I tried: https://goo.gl/86TEHx

In commercial software the nesting was conclued in less than 10 seconds.
Printscreen: https://goo.gl/qxHMMg

SVGnest is running now for more than 20 minutes and nothing happen. Windows Task Manager show me 99% CPU usage.
Printscreen: https://goo.gl/15L1eV

I'm trying with these configurations options: https://goo.gl/UVRZew

Dxf nesting

Mm i dont know how its hard, but you must add DXF nestin mean cad nestin. This is to be good for me :)

quick questions

for nesting for vinyl cutters / printers do options exist to?

nest within grid? where nested svgs are nested only horizontal or vertical?

keep svgs as graphics. assuming we are trying to nest svg of git hub logo, apple logo, ubuntu logo, and facebook logo, and each is made from multiple paths and groups can nesting be set to keep artwork the same ? in other words nest using the outer bbox or size?

thanks!!!

Doesn't ever stop

It doesn't seem to ever stop. I've had this running all day! 😄

Every now and then it will reshuffle, but it's always been at 66%. (This is using the demo SVG)

screen shot 2016-01-22 at 17 33 45

Plans for command line version or GPU acceleration?

I was wondering if there were any plans for a local command-line base version of this software. As the code seems to involve a lot of floating-point math, I think it would benefit from a CUDA implementation / GPU acceleration, which isn't currently possible with the Javascript base. Obviously, a local version would come before such optimization, but I was wondering if there were any plans to go in this direction.

Labels for svg 'pieces'

If cutting some items, even if they are drawn out, some might be very similar. It would be nice to attach a label to each piece (possibly a number, with an optional text field - think 20 to 30 characters or so).

This 'legend' could be separate from the parts, but would need to be associated with each part both before and after optimization, so the parts can be identified for use later.

Sorry if this is to wordy. This should be a long term enhancement, not something I expect could be quickly done.

Thanks for your consideration.

Enhancement suggestion: Required orientation

I would like to suggest allowing some parts to be marked to have a 'grain' direction, as well as the stock piece.

This would allow cutting, say plywood, so the grain is going in the 'correct' direction for the part.

This is important in woodworking to keep the grain right, but also in patterned stock of any kind (wall paper for example).

Thank you for the consideration.

fill holes

Hello,

Is that possible that the code fills the holes, for example an "O" characters inside?
I have some ideas for acceleration if you like it. For example using angles that pre-caclulated on polygons etc, to obtain the likely possible best rotation to fit to the cutout etc.

Can't solve trivial problem.

I'm not sure if I drew it correctly, but this input:

image

Produces this output after 700 iterations:

image

Forcing rotations to 1 thus decreasing incorrect combinations, and you can see there is one triangle left to be solved yet.

I attach here the svg zipped:

test1.svg.zip

Server-side Nesting?

I'd like to take a shot at helping to abstract the algorithmic code from the DOM-dependent code so nests can be ran on a server /lambdas. Would also help keep things modular.

Any guidance would be appreciated, what would be your interest level?

Not allowing parts to be rotated at all

I think this tool would be great for figuring out efficient cutting for fabric as well, however with some fabric it is essential that none of the parts get rotated at all due to the fabric structure.
Setting "Part Rotations" to 0 or 1 still caused the parts to be rotated, I would suggest an option to not rotate any parts.

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.