fel88 / DeepNestPort

DeepNest C# Port
MIT License
79 stars 35 forks source link

Compile Boost #1

Closed petrasvestartas closed 6 years ago

petrasvestartas commented 6 years ago

Hi,

I have no experience running .bat files, hence I have a question how to compile minkowski cpp files correctly.

I have downloaded Boost 1.68 version, added to environmental variables. I was using boost before and it works on visual studio.

What I am doing wrong in following procedure?

  1. I open compile.bat using text editor and add path directory like this: cl /Ox /Ob2 /Oi /Ot /Oy- /GL /GF /Gm- /MD /GS- /arch:AVX2 /fp:fast -I <C:\Libs\boost_1_68_0> /LD minkowski.cc

  2. Then run visual studio command prompt (as administrator), navigate to correct directory and type compile. But I get this exception:

_C:\Libs\DeepNestPort-master\DeepNestPort-master\Minkowski>cl /Ox /Ob2 /Oi /Ot /Oy- /GL /GF /Gm- /MD /GS- /arch:AVX2 /fp:fast -I 0<C:\Libs\boost_1_680 1>/LD Access is denied.

I tried adding these directories and they all have the same issue: C:\Libs\boost_1_68_0 C:\Libs\boost_1_68_0\boost C:\Libs\boost_1_68_0\lib64-msvc-14.0

2018-11-12

fel88 commented 6 years ago

Hi,

  1. it seems you wrote wrong path:
    cl /Ox /Ob2 /Oi /Ot /Oy- /GL /GF /Gm- /MD /GS- /arch:AVX2 /fp:fast -I < C:\Libs\boost_1_68_0 > /LD minkowski.cc

    should be

    cl /Ox /Ob2 /Oi /Ot /Oy- /GL /GF /Gm- /MD /GS- /arch:AVX2 /fp:fast -I "C:\Libs\boost_1_68_0"  /LD minkowski.cc

    for example my compile.bat :

    cl /Ox /Ob2 /Oi /Ot /Oy- /GL /GF /Gm- /MD /GS- /arch:AVX2 /fp:fast -I "C:\Users\fel\Downloads\boost_1_62_0\boost_1_62_0" /LD minkowski.cc
  2. You should use 1.62 Boost version
  3. I think, "Access denied" message appears because you tried to execute the command which contains redirection operators ('<', '>'). just fix boost path
petrasvestartas commented 6 years ago

Dear @fel88 ,

Thank you for a reply, after changing to "path" it worked.

Now I will try to run visual studio project.

Do I need to reference generated .dll somehow specially or it can be referenced typically in visual studio project? In visual studio project I do not see .dll referenced , so how compiler know where it is?

reference

fel88 commented 6 years ago

Minkowski.dll is unmanaged dll. Just put minkowski.dll in bin\Debug (or bin\Release) folder after building project. Then you can run DeepNestPort.exe

petrasvestartas commented 6 years ago

Dear @fel88 ,

Thank you it is working and nesting elements.

I would like to ask if I run your software on other computer, would I need to download boost and compile it again, or it would be just enough to have minkowski.dll together with .exe file?

Also maybe it would be possible for you to describe the code structure itself. I am trying to go through methods what happen behind windows form. If I would like to run the whole application with only console application when manually specifying sheets and polygons, would be the best to start understanding your code going through "DeepNestIterate" method?

fel88 commented 6 years ago

Yes, it would be enough to have minkowski.dll together with .exe file. The structure of the code is pretty simple, exactly the same as in the original project:

Set sheets
Set parts
Set settings (gaps, rotations, placement type, etc)
while (!isExitCriterionReached()) {
   DeepNestIterate();
}
Convert results to output format

I'll add sample of console project soon. maybe it helps you.

petrasvestartas commented 6 years ago

I will try to set properties of sheets parts and settings, but if you can show an example of simple console application it would be super nice:)

fel88 commented 6 years ago

Ok, no problem.

petrasvestartas commented 6 years ago

Thank you for console application.

Do you have an example of .xml file of shapes to nest?

What would be the way to type polygons manually by defining their coordinates instead of using .svg file?

For instance if I would like to nest 10 triangles (or other types of polylines) by specifying their coordinates. The pseudo code I imagine:

for(int i = 0 ; i < 10; i++){
  var polygon = new SomePolygonClass();
  polygon.Add(0,0);
  polygon.Add(0,10);
  polygon.Add(10,10);

  sample.AddElementToNest(polygon );
}
fel88 commented 6 years ago
  1. I've added the example of .xml file.
  2. You can run DeenNestConsole.exe with 'sample' argument (DeepNestConsole sample). Look at LoadSampleData method. It is exactly what you want.
petrasvestartas commented 6 years ago

Thank you very much it works very well:)