Message 1 of 4
I can save my custom entity but I cannot open

Not applicable
08-08-2002
08:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I cannot open my entity in autocad. I am getting an exception error (Null
Pointer ?) 0xC0000005 right after the open command. If someone can help me
with this, it would be greatly appreciated!
//*******************************************
** Retrieve entity data into drawing when opening. **
*************************************************************************/
Acad::ErrorStatus PSIHollowcore::dwgInFields(AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es;
// Call dwgInFields from AcDbEntity
if ((es = AcDbEntity::dwgInFields(pFiler)) != Acad::eOk) {
return es;
}
// Read version number.
Adesk::UInt16 version;
pFiler->readItem(&version);
if (version > VERSION_PSIHOLLOWCORE)
return Acad::eMakeMeProxy;
// Read the data members.
switch (version)
{
case (1):
int nShape, nBoundary;
pFiler->readItem(&nShape);
pFiler->readItem(&nBoundary);
pFiler->readItem(&m_dLength);
pFiler->readItem(&m_dWidth);
pFiler->readItem(&m_dThickness);
AcGePoint3d temp;
for(int i = 0; i < nShape; i++)
{
pFiler->readItem(&temp);
m_ptsShape.append(temp);
}
for(i = 0; i < nBoundary; i++)
{
pFiler->readItem(&temp);
m_ptsBoundary.append(temp);
}
break;
}
return pFiler->filerStatus();
}
/*************************************************************************
** Save entity object to dwg when saving. **
*************************************************************************/
Acad::ErrorStatus PSIHollowcore::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
// Call dwgOutFields from AcDbEntity
if ((es = AcDbEntity::dwgOutFields(pFiler)) != Acad::eOk) {
return es;
}
// Write version number.
pFiler->writeItem((Adesk::UInt16) VERSION_PSIHOLLOWCORE);
pFiler->writeItem(m_dLength);
pFiler->writeItem(m_dWidth);
pFiler->writeItem(m_dThickness);
int nShape = m_ptsShape.length();
int nBoundary = m_ptsBoundary.length();
pFiler->writeItem((Adesk::UInt16) nShape);
pFiler->writeItem((Adesk::UInt16) nBoundary);
for(int i = 0; i < nShape; i++)
{
pFiler->writeItem(m_ptsShape);
}
for(i = 0; i < nBoundary; i++)
{
pFiler->writeItem(m_ptsBoundary);
}
return pFiler->filerStatus();
}
//*******************************************
m_ptsShape, and m_ptsBoundary are both AcGePoint3dArray objects. Any ideas?
Mike B
Pointer ?) 0xC0000005 right after the open command. If someone can help me
with this, it would be greatly appreciated!
//*******************************************
** Retrieve entity data into drawing when opening. **
*************************************************************************/
Acad::ErrorStatus PSIHollowcore::dwgInFields(AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es;
// Call dwgInFields from AcDbEntity
if ((es = AcDbEntity::dwgInFields(pFiler)) != Acad::eOk) {
return es;
}
// Read version number.
Adesk::UInt16 version;
pFiler->readItem(&version);
if (version > VERSION_PSIHOLLOWCORE)
return Acad::eMakeMeProxy;
// Read the data members.
switch (version)
{
case (1):
int nShape, nBoundary;
pFiler->readItem(&nShape);
pFiler->readItem(&nBoundary);
pFiler->readItem(&m_dLength);
pFiler->readItem(&m_dWidth);
pFiler->readItem(&m_dThickness);
AcGePoint3d temp;
for(int i = 0; i < nShape; i++)
{
pFiler->readItem(&temp);
m_ptsShape.append(temp);
}
for(i = 0; i < nBoundary; i++)
{
pFiler->readItem(&temp);
m_ptsBoundary.append(temp);
}
break;
}
return pFiler->filerStatus();
}
/*************************************************************************
** Save entity object to dwg when saving. **
*************************************************************************/
Acad::ErrorStatus PSIHollowcore::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
// Call dwgOutFields from AcDbEntity
if ((es = AcDbEntity::dwgOutFields(pFiler)) != Acad::eOk) {
return es;
}
// Write version number.
pFiler->writeItem((Adesk::UInt16) VERSION_PSIHOLLOWCORE);
pFiler->writeItem(m_dLength);
pFiler->writeItem(m_dWidth);
pFiler->writeItem(m_dThickness);
int nShape = m_ptsShape.length();
int nBoundary = m_ptsBoundary.length();
pFiler->writeItem((Adesk::UInt16) nShape);
pFiler->writeItem((Adesk::UInt16) nBoundary);
for(int i = 0; i < nShape; i++)
{
pFiler->writeItem(m_ptsShape);
}
for(i = 0; i < nBoundary; i++)
{
pFiler->writeItem(m_ptsBoundary);
}
return pFiler->filerStatus();
}
//*******************************************
m_ptsShape, and m_ptsBoundary are both AcGePoint3dArray objects. Any ideas?
Mike B