Message 1 of 4
Fatal error
Not applicable
08-29-2002
12:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is another shot at my last post about pointer problems. This time I
am including the function that is passing the pointer because I think
this is where the real problem is originating. What I'm trying to do is
pass an array of points to my object then that object will ultimately
use those points to set up more points in the object. I can run the
insert function several times without trouble then I will crash.
Sometimes if I unload my program and reload it it will crash after only
running it a few times. Obviously I'm new at this so any help would be
appreciated.
this is my arx command function:
void InsertMyObject()
{
AcDbDatabase *pCurDb;
AcDbObjectId LinId;
Acad::ErrorStatus es;
//get the current database
pCurDb = acdbHostApplicationServices()->workingDatabase();
AcDbObjectId SectionPolyId;
int GsMark;
AcDbPolyline *pPline;
AcGePoint3d Vertex;
//get the object ID of the polyline
es = getObjectAndGsMarker(SectionPolyId, GsMark);
//open the pline for reading
acdbOpenObject(pPline, SectionPolyId, AcDb::kForRead);
// Set up the vertices.
Adesk::UInt32 numVerts = pPline->numVerts();
AcGePoint3d *verts = new AcGePoint3d[(numVerts - 1)];
for (int vertexNumber = 0; vertexNumber < numVerts; vertexNumber++)
{
es = pPline->getPointAt(vertexNumber, Vertex);
verts[vertexNumber] = Vertex;
}
pPline->close(); // Finished with the pline header.
MyDBXObject *pObj;
pObj = new LPLineal;
pObj->SetCrossSection(verts, numVerts);
es = appendToBlockTable(pObj, LinId, ACDB_MODEL_SPACE, pCurDb);
if(es != Acad::eOk)
{
acutPrintf("\nError drawing My object!");
if(pObj)
{
delete pObj;
return;
}
}
pObj->close();
}
this is my dbx object that seems to cause problems:
void MyDBXObject::SetCrossSection(AcGePoint3d*& verts, Adesk::UInt32
numVerts)
{
AcGePoint3d location;
m_numStartSectionVerts = numVerts;
m_StartSectionVerts = verts;
for (int vertexNumber = 0; vertexNumber < numVerts ; vertexNumber++)
{
location = m_StartSectionVerts[vertexNumber];
location.z = 10.00;
}
}
am including the function that is passing the pointer because I think
this is where the real problem is originating. What I'm trying to do is
pass an array of points to my object then that object will ultimately
use those points to set up more points in the object. I can run the
insert function several times without trouble then I will crash.
Sometimes if I unload my program and reload it it will crash after only
running it a few times. Obviously I'm new at this so any help would be
appreciated.
this is my arx command function:
void InsertMyObject()
{
AcDbDatabase *pCurDb;
AcDbObjectId LinId;
Acad::ErrorStatus es;
//get the current database
pCurDb = acdbHostApplicationServices()->workingDatabase();
AcDbObjectId SectionPolyId;
int GsMark;
AcDbPolyline *pPline;
AcGePoint3d Vertex;
//get the object ID of the polyline
es = getObjectAndGsMarker(SectionPolyId, GsMark);
//open the pline for reading
acdbOpenObject(pPline, SectionPolyId, AcDb::kForRead);
// Set up the vertices.
Adesk::UInt32 numVerts = pPline->numVerts();
AcGePoint3d *verts = new AcGePoint3d[(numVerts - 1)];
for (int vertexNumber = 0; vertexNumber < numVerts; vertexNumber++)
{
es = pPline->getPointAt(vertexNumber, Vertex);
verts[vertexNumber] = Vertex;
}
pPline->close(); // Finished with the pline header.
MyDBXObject *pObj;
pObj = new LPLineal;
pObj->SetCrossSection(verts, numVerts);
es = appendToBlockTable(pObj, LinId, ACDB_MODEL_SPACE, pCurDb);
if(es != Acad::eOk)
{
acutPrintf("\nError drawing My object!");
if(pObj)
{
delete pObj;
return;
}
}
pObj->close();
}
this is my dbx object that seems to cause problems:
void MyDBXObject::SetCrossSection(AcGePoint3d*& verts, Adesk::UInt32
numVerts)
{
AcGePoint3d location;
m_numStartSectionVerts = numVerts;
m_StartSectionVerts = verts;
for (int vertexNumber = 0; vertexNumber < numVerts ; vertexNumber++)
{
location = m_StartSectionVerts[vertexNumber];
location.z = 10.00;
}
}