CMake Errors

All about Windows versions
Hritika
Posts: 23
Joined: Sat Jul 15, 2017 2:59 pm

Re: CMake Errors

Postby Hritika » Sun Jul 16, 2017 12:39 pm

Thank you for your help.It's done.

With Regards
Hritika

Hritika
Posts: 23
Joined: Sat Jul 15, 2017 2:59 pm

Re: CMake Errors

Postby Hritika » Mon Jul 17, 2017 10:58 am

Is it possible to keep the cloudcompare GUI as a backend and understand the functionalities by calling on a new form built on windows c++ form of visual studio?
If yes,Can anyone suggest a way for it, so it doesnot interfere with the CLR environment of visual studio.

daniel
Site Admin
Posts: 3326
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: CMake Errors

Postby daniel » Mon Jul 17, 2017 6:26 pm

Not sure what you are trying to do, but I don't think it's possible to replace Qt by Windows forms of MFCs. They are pretty different systems.
Daniel, CloudCompare admin

Hritika
Posts: 23
Joined: Sat Jul 15, 2017 2:59 pm

Re: CMake Errors

Postby Hritika » Tue Jul 18, 2017 5:39 am

Ok Thank you so much.
If we will use Qt creator and import it as an existing project , I am not able to locate .pro file in it.And the tutorial you suggested for building it in Qt creator doesn't seem to work well.As during building it is directing again to cmake.exe and how to generate is not quite clear.Is there any other way to work with it in qt creator then.Please guide me.
Thank you

les245
Posts: 9
Joined: Mon Jun 12, 2017 11:10 am

Re: CMake Errors

Postby les245 » Thu Sep 21, 2017 2:06 pm

les245 wrote:Thank you very much, that solved the problem. But now, as I try to compile the INSTALL project, I get 3 errors...

What I need to do is get a mesh of a point cloud. I got it using the Delaunay feature in CloudCompare and now I have to automate it, so I thought it would be easy to program it in C++ using a library but I'm completely lost and overtaken. I have never done anything similar (I learned to program in C# but never used many libraries). Could you point me in the right direction or tell me if what I'm trying to do is achievable?

I attached a screenshot of the errors. Thank you very much again.


I'm forced to implement it in C++ now and I'm completely lost.. Now when I compile, it shows me 2 errors and creates a Files in CloudCompare_debug (as shown left in the screenshot).
I'm new to C++ since the only thing I ever learned was C#, so I'm sorry if this is some basic stuff..
I think it shouldn't be that complicated: I only need to load a point cloud, use Delaunay and save it as STL
Attachments
screen.jpg
screen.jpg (226.7 KiB) Viewed 712 times

daniel
Site Admin
Posts: 3326
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: CMake Errors

Postby daniel » Thu Sep 21, 2017 6:15 pm

Hum, hard to tell with only this view.

Are you only 'compiling' the CloudCompare projet or are you trying to run it here? Looking at the error, I would say that compilation is ok, but it fails to run?

If that's the case, then you must actually compile the 'INSTALL' project and then run the installed version of CloudCompare (see the specific section of the BUILD.md file, about Visual Studio).

Otherwise I'll need more information...
Daniel, CloudCompare admin

les245
Posts: 9
Joined: Mon Jun 12, 2017 11:10 am

Re: CMake Errors

Postby les245 » Fri Sep 22, 2017 8:13 am

daniel wrote:Hum, hard to tell with only this view.

Are you only 'compiling' the CloudCompare projet or are you trying to run it here? Looking at the error, I would say that compilation is ok, but it fails to run?

If that's the case, then you must actually compile the 'INSTALL' project and then run the installed version of CloudCompare (see the specific section of the BUILD.md file, about Visual Studio).

Otherwise I'll need more information...


I think it will be easier to explain what I want to achieve because I'm not sure what I'm doing here..

I'm am doing my bachelor thesis in robot simulation and for that, I need to convert some point clouds into STL. This must be programmed so I cant just do every single one of them manually with CloudCompare. I have done it with the command line but now I need it to happen in C++.

Back to the compiler. I was thinking (and maybe I'm wrong) that following the instructions for the compilation, I would get some project where I could program my converter using the functions available in Cloud Compare. But I find myself completely lost.

What I'm trying to do is to write a code that opens a point cloud, does the Delaunay reconstruction and saves it as a STL-File as ASCII. I have done this manually in Cloud Compare and it works just fine. Now I need a small code that does the work.

Thank you so much for your help

daniel
Site Admin
Posts: 3326
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: CMake Errors

Postby daniel » Fri Sep 29, 2017 8:02 am

Sorry for the delay.

Actually to do what you want, you would "simply" have to use the main libraries of the project (CC_CORE_LIB, CC_DB_LIB and CC_IO_LIB).

However you'll need to compile CC_CORE_LIB with CGAL (which adds a little bit to the complexity) and you'll need some good command in C++ to use all the components together (even if there's only a few lines of code).

So you were probably right to try to simply patch CloudCompare directly... but once again, you'll need to compile it first (you juste need to setup Qt and CGAL as dependencies via CMake). And then edit the command line code... in C++ ;)
Daniel, CloudCompare admin

les245
Posts: 9
Joined: Mon Jun 12, 2017 11:10 am

Re: CMake Errors

Postby les245 » Thu Oct 05, 2017 3:14 pm

Thank you so much for your reply!

I don't even know how I did it, but I got it to work (I think)

Now I'm struggling with the Commands in C++ (as you said, its not that simple)

I'm finding it hard to undestand, since I'm new to C++ and I can't find any other example code (besides the one included in CloudCompare) that uses this Library.

I think it should be something simitar to this but I don't comprehend how AsciiFilter::loadFile and STLFilter::saveToASCIIFile works.

Code: Select all

#include <stdlib.h>
#include <iostream>
#include <STLFilter.h>
#include <Delaunay2dMesh.h>
#include <qstring.h>
#include <AsciiFilter.h>
#include <ccMesh.h>




static ccHObject::Container clouds;
static ccMesh* mesh;

using namespace std;

int main(int argc, char* argv) {

   QString directory_test("F:\\Mesh.xyz");
   //ccHObject::Container clouds;

   FileIOFilter::LoadParameters parameters;
   AsciiFilter::loadFile(directory_test, clouds, parameters);
   
   double s_meshMaxEdgeLength = 15.0;
   bool updateNormals = true;
   CC_TRIANGULATION_TYPES type;

   for (size_t i = 0; i < clouds.size(); ++i)
   {
      ccHObject* ent = clouds[i];
      assert(ent->isKindOf(CC_TYPES::POINT_CLOUD));

      //compute mesh
      ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(ent);
      ccMesh* mesh = ccMesh::Triangulate(cloud,
         type,
         updateNormals,
         static_cast<PointCoordinateType>(s_meshMaxEdgeLength),
         2 //XY plane by default
         );

   }
   FILE* thefile = fopen("Mesh_Test.stl", "wb");
   QWidget *parentWidget = (QWidget *)0;

   STLFilter::saveToASCIIFile(mesh,thefile,*parentWidget);

   return EXIT_SUCCESS;
}


But maybe this isn't even close to be working.. I'm pretty lost I think..

Do you have any idea, how I could actually get this to work? My deadline is in 2 Weeks and I don't think I can get it to work..

Thank you so much for your help!

daniel
Site Admin
Posts: 3326
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: CMake Errors

Postby daniel » Fri Oct 06, 2017 7:24 am

Well, you are not that far, but you are indeed missing the required C++ knowledge. I won't have time to explain everything but here is how you could write it:

Code: Select all

#include <stdlib.h>
#include <iostream>
#include <STLFilter.h>
#include <Delaunay2dMesh.h>
#include <qstring.h>
#include <AsciiFilter.h>
#include <ccMesh.h>

using namespace std;

int main(int argc, char* argv)
{
  //if you want to use Qt, you have to instantiate a Qt application first
  QApplication app;

   QString directory_test("F:\\Mesh.xyz");
  ccHObject::Container clouds;
   FileIOFilter::LoadParameters parameters;
   //you have to instantiate the AsciiFilter before using it (loadFile is not a static function)
   //(another way is to use FileIOFilter::LoadFromFile which is static)
   if (AsciiFilter().loadFile(directory_test, clouds, parameters) != CC_FERR_NO_ERROR)
   {
     return EXIT_FAILURE;
   }
   
   double meshMaxEdgeLength = 15.0;
   bool updateNormals = true;
   CC_TRIANGULATION_TYPES type = DELAUNAY_2D_AXIS_ALIGNED; //you have to chose the triangulation type here!

   for (size_t i = 0; i < clouds.size(); ++i)
   {
      ccHObject* ent = clouds[i];
      assert(ent->isKindOf(CC_TYPES::POINT_CLOUD));

      //compute mesh
      ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(ent);
      ccMesh* mesh = ccMesh::Triangulate(cloud,
         type,
         updateNormals,
         static_cast<PointCoordinateType>(meshMaxEdgeLength),
         2 //XY plane by default
         );
         
      if (!mesh)
      {
        //failed to triangulate the point cloud
        continue;
      }

     FILE* thefile = fopen(QString("Mesh_%1_Test.stl").arg(i), "wb"); //you need one file per cloud
     if (!theFile)
     {
       //failed to open the file for writing
        continue;
    }

     //Same thing for the STLFilter, you have to insantiate it before using it
     //And you don't have access to 'saveToASCIIFile' (it's protected). You can either change the code so as to make it 'public'
     //or directly change the default state of 'binaryMode' in saveToFile.
     STLFilter().saveToASCIIFile(mesh, thefile, *parentWidget);
   
     //don't forget to close the file
     fclose(thefile);
   
     //don't forget to clean the memory
     delete mesh;

   } //the loop should end here (and not before saving the file)

   return EXIT_SUCCESS;
}


And if you managed to compile CloudCompare, then it may be better (and easier) to create or modify an existing entry in the command line tool (see for instance 'CommandDelaunayTri' in ccCommandLineCommands.h - it's doing exactly what you are trying to do here, apart that the loading and saving steps are handled in a generic way by the command line mechanism).
Daniel, CloudCompare admin


Return to “Windows related topics”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest