Thank you for your reply, actually my purpose is define a customed entity which contains multi-AcDb3dSolid.
FYI:
I have verified that AcDb3dSolid's copyFrom() actually copies the the underlying solid.
I have tried use a pointer to a solid, but the issue is: during the "_copyclip" command excute on my customed entity, It's AcDb3dSolid-s
data member seems lose data, for me, it's solid area becomes 0.
///////////////////////////////////////////////////////////////////////////////////////////////////////////
see output:
dwgOut solid area 600.0000
dwgIn solid area 600.0000
dwgOut solid area 600.0000
dwgIn solid area 0.0000
dwgOut solid area 0.0000
///////////////////////////////////////////////////////////////////////////////////////////////////////////
code clip as below (now regardless the memory manage):
class DLLIMPEXP MyEntity : public AcDbEntity
{
public:
ACRX_DECLARE_MEMBERS(MyEntity) ;
protected:
static Adesk::UInt32 kCurrentVersionNumber ;
public:
MyEntity () ;
virtual ~MyEntity () ;
virtual Acad::ErrorStatus dwgOutFields (AcDbDwgFiler *pFiler) const ;
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler *pFiler) ;
virtual Acad::ErrorStatus transformBy(const AcGeMatrix3d& xform);
virtual Adesk::Boolean worldDraw (AcGiWorldDraw *mode) ;
public:
AcDbLine ll;
AcArray
solids;
} ;
Acad::ErrorStatus MyEntity::dwgOutFields (AcDbDwgFiler *pFiler) const
{
assertReadEnabled () ;
Acad::ErrorStatus es =AcDbEntity::dwgOutFields (pFiler) ;
if ( es != Acad::eOk ) return (es) ;
if ( (es =pFiler->writeUInt32 (MyEntity::kCurrentVersionNumber)) != Acad::eOk ) return (es) ;
ll.dwgOutFields(pFiler);
es = pFiler->writeUInt32(solids.length());
for (int i = 0; i < solids.length(); i++)
{
es = solids.at(i)->dwgOutFields(pFiler);
double a;solids.at(i)->getArea(a); acutPrintf(_T("\n dwgOut solid area %.4f"), a);
}
return (pFiler->filerStatus ()) ;
}
Acad::ErrorStatus MyEntity::dwgInFields (AcDbDwgFiler *pFiler)
{
assertWriteEnabled () ;
Acad::ErrorStatus es =AcDbEntity::dwgInFields (pFiler) ;
if ( es != Acad::eOk ) return (es) ;
Adesk::UInt32 version =0 ;
if ( (es =pFiler->readUInt32 (&version)) != Acad::eOk ) return (es) ;
if ( version > MyEntity::kCurrentVersionNumber ) return (Acad::eMakeMeProxy) ;
ll.dwgInFields(pFiler);
solids.removeAll();
Adesk::UInt32 n = 0;
es = pFiler->readUInt32(&n);
for (int i = 0; i < n; i++)
{
AcDb3dSolid* e = new AcDb3dSolid();
e->dwgInFields(pFiler);
solids.append(e);
double a;solids.at(i)->getArea(a); acutPrintf(_T("\n dwgIn solid area %.4f"), a);
}
return (pFiler->filerStatus ()) ;
}
//-----------------------------------------------------------------------------
//----- AcDbEntity protocols
Adesk::Boolean MyEntity::worldDraw (AcGiWorldDraw *mode)
{
assertReadEnabled () ;
return ll.worldDraw(mode);
}
Acad::ErrorStatus MyEntity::transformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
return ll.transformBy(xform);
}
//test command function
void test5()
{
MyEntity* pEnt = new MyEntity();
pEnt->ll.setStartPoint(AcGePoint3d(100, 100, 0));
pEnt->ll.setEndPoint(AcGePoint3d(500, 500, 0));
AcDb3dSolid* sod1 = new AcDb3dSolid();
sod1->createBox(10, 10, 10);
pEnt->solids.append(sod1);
appendEnt(pEnt);
}