Hello,
I had a look at the objectArx header files and I saw that there is a AcPointCloud.h file hinting at some Point cloud processing functions.
What I want to do is obtain the point cloud points for specific extents. In essence the points that are located in a bounding box. The function to do that is acdbProcessPointCloudData which requires 4 parameters.
One of the input parameters is the point cloud of course. Is there a way to get the AcDbEntity of the .pcg loaded file, if we assume its only one for simplicity, so I can work with it ?
In AcDbPointcloud.h it is stated that it is the Api for AcDbPointCloud, however I see no class for AcDbPointCloud. Am I missing something ?
Thanks in advance!
I was looking into the class Dictionary since you proposed it.
Certainly I can obtain an AcRxClass so I wanted to ask 2 things if they are possible.
In the case that I have various point clouds in my dwg file how can I get a pointer to each them. I tried iterating through the class dictionary but I am definitely doing something wrong since the ->name() calls are nothing I was expecting to see. So the second question is can i actually get an AcDbEntity* out of the the AcRxClass or acRXObject or I do have to iterate through the block table record?
for (; !pDictItr->done(); pDictItr->next()) { AcRxClass* pRxClass = pDictItr->isA(); AcRxObject* pRxObject = pDictItr->object(); }
Cheers !
Why not iterating the BlockTable? The performance overhead should be relatively small compared with what you will probably do with the point clouds...
In case you need all the point clouds from MODEL_SPACE it's easy like that:
void iteratePointCloudsInModelSpace() { static const AcString className(L"AcDbPointCloud"); AcDbBlockTableRecordPointer pBlockRec(ACDB_MODEL_SPACE,acdbHostApplicationServices()->workingDatabase(),AcDb::kForRead); if (Acad::eOk == pBlockRec.openStatus()) { AcDbBlockTableRecordIterator* it = NULL; if (Acad::eOk == pBlockRec->newIterator(it)) { it->start(); while(!it->done()) { AcDbObjectId entId; it->getEntityId(entId); // open for read should be sufficient in case you like to process point clouds AcDbEntityPointer pEnt(entId,AcDb::kForRead); if (Acad::eOk == pEnt.openStatus()) { if(AcString(pEnt->isA()->name())==className) { // here you go with your point cloud entity } } it->step(); } } delete it; } }
Sorry for the bad formatting...
I don't find anything that's wrong with your code.
My first suspicion was that you accidently call acpcIndexPointCloud asynchronously because the respective parameter defaults to true..., but you do correctly set it to false.
Have you already tried to attach the PCG in another command?
Another workaround could be to attach the point cloud using AutoCAD's "-POINTCLOUDATTACH" command and acedCommand() or sendStringToExecute() API's.