I can save my custom entity but I cannot open

I can save my custom entity but I cannot open

Anonymous
Not applicable
264 Views
3 Replies
Message 1 of 4

I can save my custom entity but I cannot open

Anonymous
Not applicable
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
0 Likes
265 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I changed the order of some events in the dwgOutFields

int nShape = m_ptsShape.length();
int nBoundary = m_ptsBoundary.length();
pFiler->writeItem((Adesk::UInt16) nShape);
pFiler->writeItem((Adesk::UInt16) nBoundary);
pFiler->writeItem(m_dLength);
pFiler->writeItem(m_dWidth);
pFiler->writeItem(m_dThickness);

This still does not work.
Any ideas?
0 Likes
Message 3 of 4

Anonymous
Not applicable
hi, Guy!no one will bother to told you any word that really
values, unless you pay to AutoDesk!
you are lucky enough that I 've got lots and lots of experience of
customize entity, so if you do trust me, send your
code and I'll examine it. Think about it, I am the one
who really wanna help you.
0 Likes
Message 4 of 4

Anonymous
Not applicable
to kittywwxx@sina.com
0 Likes