ObjectARX

ObjectARX

Reply
Distinguished Mentor
owenwengerd
Posts: 628
Registered: ‎08-06-2002
Message 11 of 24 (390 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-26-2012 09:15 PM in reply to: xeri0n

I think you are confused by the abstract class declaration. The fact that its members are pure virtual does not mean you can't call them. You should be able to call IAcPcDataBuffer::size() to get the number of points in the buffer each time your IAcPcPointProcessor::filter() and IAcPcPointProcessor:: processPoints() functions are called.

--
Owen Wengerd
ManuSoft
Contributor
xeri0n
Posts: 19
Registered: ‎11-21-2011
Message 12 of 24 (385 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-26-2012 09:39 PM in reply to: owenwengerd

What I tried to do was

 

Acad::ErrorStatus err = acdbProcessPointCloudData(pEntity, boundingBox, 100, ptProc);
IAcPcDataBuffer* buf = ptProc->buffer();
DWORD size = buf->size();

This resulted in a runtime error. 

I tried what you mentioned and put in the finished() as well as the processPoints() 

DWORD size = this->buffer()->size();

and was OK. 

 

In the finished() function it was 0 size array but in every processPoints() function call there was 1 million Pts which makes sense. 

This makes things a bit more clear now. The buffer is allocated and deallocated after iteration so accessing the buffer as I did (when the call has ended) is not possible as its deallocated already. What helped me understand is that in the finished() function the array was 0 size. Pretty much if I want to do anything with the points I need to keep/store them somewhere else and do that in the processPoints().

 

Thank you for you help ! 

 

Distinguished Mentor
owenwengerd
Posts: 628
Registered: ‎08-06-2002
Message 13 of 24 (382 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-26-2012 10:06 PM in reply to: xeri0n

I'm not sure why you are accessing the data in the finished() function. That function is for you to signal to the processor that you are finished processing. Also, you should never dereference the data pointer without first checking that it isn't NULL.

--
Owen Wengerd
ManuSoft
Contributor
xeri0n
Posts: 19
Registered: ‎11-21-2011
Message 14 of 24 (378 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-26-2012 10:10 PM in reply to: owenwengerd

No reason really ! 

I was just trying to understand what was going on with the buffer.

Contributor
xeri0n
Posts: 19
Registered: ‎11-21-2011
Message 15 of 24 (372 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-27-2012 07:37 AM in reply to: xeri0n

Hm one more question if I may.

 

I actually set a proper query and I see something weird I think.

Just to confirm some things before going on here is some info for my point cloud entity from Acad

 

AcDbExtents boundBox;
pEntity->getGeomExtents(boundBox);

// min Value {x=704669.92000000004 y=5751465.0200000005 z=115.55000000000000 }
// max value {x=704680.00000000000 y=5755356.0000000000 z=160.00000000000000 }

 So I set as my search

 

// set bounding box for query
AcGePoint3d ptmin(704669.0, 5755340.0, 0);
AcGePoint3d ptmax(704680.0, 5755356.0, 160);
const AcDbExtents boundingBox( ptmin, ptmax);

 

The returned buffer size was 175108 which makes sense for a converted LAS file.

 

When I access the points by

AcPcPointFloat* pt = this->buffer()->floatPoints();

the all are like this

0x0000000040940040 {m_x=-11470.385 m_y=1847.1350 m_z=-41.020000 ...}

 

This is definitely not in the extents that I am queryin for. Any idea ? Am i doing something wrong ?

Distinguished Mentor
owenwengerd
Posts: 628
Registered: ‎08-06-2002
Message 16 of 24 (365 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-27-2012 08:31 AM in reply to: xeri0n

It looks like you are assuming the points are in float format. Call nativeDbl() first to check the format, or call floatPoint() instead to get individual points if you want them in float format.

--
Owen Wengerd
ManuSoft
Contributor
xeri0n
Posts: 19
Registered: ‎11-21-2011
Message 17 of 24 (362 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-27-2012 08:46 AM in reply to: owenwengerd

This time I actually had tested that :smileyhappy:

 

The this->buffer()->doublePoints(); was returning NULL and this is what the documentation says while also the nativeDbl is false.

Both calls to floatPoint and doublePoint return the exact same coordinates ! 

Distinguished Mentor
owenwengerd
Posts: 628
Registered: ‎08-06-2002
Message 18 of 24 (360 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-27-2012 08:49 AM in reply to: xeri0n

Did you notice the comments for the offset() and entityTransform() functions?

--
Owen Wengerd
ManuSoft
Contributor
xeri0n
Posts: 19
Registered: ‎11-21-2011
Message 19 of 24 (357 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-27-2012 09:11 AM in reply to: owenwengerd

Mhm I did not apply that transformation ...

I just tried it though and it seems that the matrix is just identity though so no difference.

 

AcPcPointFloat* pt = this->buffer()->floatPoints();
AcGeMatrix3d trans;
bool b = this->buffer()->entityTransform(trans);
AcGePoint3d tmpDBPoint(pt->m_x,pt->m_y,pt->m_z);
tmpDBPoint.transformBy(trans);

 I am sure that there is no offset by the way just to rule out that one as well.

Contributor
xeri0n
Posts: 19
Registered: ‎11-21-2011
Message 20 of 24 (353 Views)

Re: Accessing point cloud entity loaded from a .pcg file

04-27-2012 09:18 AM in reply to: xeri0n

Mhm lets just forget my last statement.

Seems like the point cloud engine is doing something and there is an offset even if my insertion point is (0,0,0).

 

Cheers ! 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.