|
Acad::ErrorStatus entity_custum::create_3d()
>
> {
>
> Acad::ErrorStatus es = Acad::eOk;
>
> int i=0;
>
>
>
> AcGePoint3dArray vertices;
>
>
>
> AcDbVoidPtrArray lines;
>
> AcDbVoidPtrArray regions;
>
>
>
> vertices.append (m_ptStartRight);
>
> vertices.append (m_ptStartLeft);
>
> vertices.append (m_ptEndLeft);
>
> vertices.append (m_ptEndRight);
>
>
>
> AcDb3dPolyline polyLine (AcDb::k3dSimplePoly, vertices,
> Adesk::kTrue);
>
>
>
> if ((es = polyLine.explode(lines)) != Acad::eOk)
>
> {
>
> for (i = 0; i < lines.length(); i++)
>
> delete (AcRxObject*)lines;
>
>
>
> for (i = 0; i < regions.length(); i++)
>
> delete (AcRxObject*)regions;
>
>
>
> return es;
>
> }
>
>
>
> if ((es = AcDbRegion::createFromCurves(lines, regions)) != Acad::eOk)
>
> {
>
> for (i = 0; i < lines.length(); i++)
>
> delete (AcRxObject*)lines;
>
>
>
> for (i = 0; i < regions.length(); i++)
>
> delete (AcRxObject*)regions;
>
>
>
> return es;
>
> }
>
>
>
> assert(regions.length() == 1);
>
> AcDbRegion* regionMap = AcDbRegion::cast((AcRxObject*)regions[0]);
>
> assert(regionMap != NULL);
>
>
>
> if ((es = m_Solid .extrude (regionMap, 10, 0.0)) != Acad::eOk)
>
> {
>
> for (i = 0; i < lines.length(); i++)
>
> delete (AcRxObject*)lines;
>
>
>
> for (i = 0; i < regions.length(); i++)
>
> delete (AcRxObject*)regions;
>
>
>
> return es;
>
> }
>
>
>
> return es;
>
> }
>
>
>
> I draw this solid in the viewportDraw function of the custom entity:
>
>
>
> AcGeMatrix3d mat;
>
> getEcs(mat);
>
>
>
> create_3d ();
>
>
>
> DrawData->geometry().pushModelTransform(mat);
>
> DrawData->geometry().draw(&m_Solid);
>
> DrawData->geometry().popModelTransform();
>
>
>
> Autocad draws succefully the solid, but when I move the mouse across of
the
> solid Autocad gives out a irreversible error (scandr.cpp line
> 773:eAtMaxReaders) .
>
> This error no occur if I build the solid by createBox function:
>
>
>
> AcGeMatrix3d mat;
>
> getEcs(mat);
>
>
>
> m_Solid.createBox (1,1,1);
>
>
>
> DrawData->geometry().pushModelTransform(mat);
>
> DrawData->geometry().draw(&m_Solid);
>
> DrawData->geometry().popModelTransform(); |
|