betterway-tinyman / packer

3D Bin Packing with multiple Wrappers (Boxes)
BSD 3-Clause "New" or "Revised" License
123 stars 51 forks source link

Can't get it to work #4

Closed deadeye636 closed 7 years ago

deadeye636 commented 7 years ago

Hi @samchon I am trying to implement for an test application but iam unable to get your example to work.

iam not a ts or c++ dev. perhaps you could help me in understanding how your application is working. if i get it work i want to create a linux shell application wich will read a file with the data and output it to a file.

thank you.

samchon commented 7 years ago

I'm on vacation. I will help you at next week.

samchon commented 7 years ago

You've to install NodeJS and 3D-Bin-Packing

- Installing 3D Bin Packing: npm install -g 3d-bin-packing

First, make a JavaScript file (I named it packer.js) and write the below code:

var fs = require("fs");
var samchon = require("samchon-framework");
var library = samchon.library;

var pack = require("3d-bin-packing");

function main(inputPath, outputPath)
{
    var input_str = fs.readFileSync(inputPath, "utf8");
    var input_xml = new library.XML(input_str);

    var packer = new pack.PackerForm();
    packer.construct(input_xml);

    var result = packer.optimize();
    var output_str = result.toXML().toString();
    fs.writeFileSync(outputPath, output_str, "utf8");
}
main(process.argv[2], process.argv[3]);

Call the packer.js via node, with two parameters, input and output files.

node packer input.xml output.xml
deadeye636 commented 7 years ago

Hi @samchon ,

thank you for the example. got it working now and it looks realy great.

is there perhaps some explation for?

samchon commented 7 years ago

@deadeye636 Well, which explanation do you want?

deadeye636 commented 7 years ago

mhh nice there is missing some word. iam trying to understand what is the best for the gaParameters.

iam trying to get the lowest count for the bins. but at the moment iam getting 2x small bins but 1x middle bin would be better.

thanks