3d Solid Custom Entity

3d Solid Custom Entity

Anonymous
Not applicable
466 Views
1 Reply
Message 1 of 2

3d Solid Custom Entity

Anonymous
Not applicable
I derived a class from "AcDb3dSolid" to create a 3D Plate. It is working fine to create the plate. I used following code to create the Plate in worldDraw().

AcDb3dSolid* pPlate = new AcDb3dSolid();
pPlate->createBox(m_Length, m_Width, m_Thickness);
pPlate->transformBy(Ecs);
mode->geometry().draw(pPlate);

But I am not able to get BRep object of this Entity?
Please see the code I used:
AcDbEntity* pEnt = NULL;
Acad::ErrorStatus es = Acad::eOk;
es = acdbOpenObject((AcDbEntity* &)pEnt, PlateEntityId, AcDb::kForWrite);

AcBr::ErrorStatus returnValue;
AcBrBrep* pBrep = new AcBrBrep();
returnValue = pBrep->set((const AcDbEntity&)*pEnt);

after execution of the last statement
returnValue = eNullObjectPointer

I am not able find the problem. Please suggest to get it done.
0 Likes
467 Views
1 Reply
Reply (1)
Message 2 of 2

krishnamurthy.kalvai
Explorer
Explorer
To gain access to the brep, here is an example from the brep sample from the SDK (look in utils\brep). It uses a subent path type in the set() method. Perhaps you can try doing the same.

AcDbFullSubentPath subPath(kNullSubent);
acadReturnValue = selectEntity(subType, subPath);
if (acadReturnValue != Acad::eOk) {
acutPrintf("\n Error in selectEntity: %d", acadReturnValue);
return (AcBr::ErrorStatus)acadReturnValue;
}

// Call the appropriate subentity constructor
switch (subType) {
case AcDb::kNullSubentType:
pEnt = new AcBrBrep();
break;
case AcDb::kFaceSubentType:
pEnt = new AcBrFace();
break;
case AcDb::kEdgeSubentType:
pEnt = new AcBrEdge();
break;
default:
acutPrintf("\n selectEntityByType: unsupported subentity type: %d\n", subType);
returnValue = (AcBr::ErrorStatus)Acad::eWrongSubentityType;
return returnValue;
}
if (pEnt == NULL) {
acutPrintf("\n selectEntityByType: unable to allocate memory\n");
returnValue = (AcBr::ErrorStatus)Acad::eOutOfMemory;
return returnValue;
}

returnValue = pEnt->set(subPath);
0 Likes