- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wrote an arx command under CAD2012 to trace the boundaries just like what the "bpoly" command do: pick a point inside polylines, then get a bpoly. Everytime I load the arx file, the first pick is fine, the boundaries created smoothly, but after 3 or 4 picks, it crashes, always...
The warning is "Fatal error: Unhandled Access Violation Reading 0x... ". So it seems that the acedTraceBoundary function returns an array that can not be released...
I am just using the acdbVoidPtrarray& as in the help file to get the returned entities then append them into the modelspace,
static void MyGroupTest1 ()
{
AcGePoint3d seedPt;
//AcAxDocLock docLock;
acedGetPoint(NULL, _T("\nSelect a point inside the rectangle: "),asDblArray(seedPt));
AcDbVoidPtrArray Boundaries;
bool detectIslands = Adesk::kTrue;
if (acedTraceBoundary(seedPt, detectIslands, Boundaries) == Acad::eOk)
{
AcDbBlockTableRecordPointer pCurSpace(acdbCurDwg()->currentSpaceId(), AcDb::kForWrite);
if (pCurSpace.openStatus() == Acad::eOk)
{
for (int i = 0; i < Boundaries.length(); i++)
{
AcDbEntity *pEnt = static_cast<AcDbEntity *>(Boundaries[i]);
pCurSpace->appendAcDbEntity(pEnt);
pEnt->close();
}
}
pCurSpace->close();
}
}
it's quite simple, but not working.
The platform is CAD 2012 x32 and x64 on windows 7 with Visual studio 2010. Someone said it works fine on his cad2014 x64 edtion when I sent it to him, quite weird... I don't know the reason. Is anyone facing the same problem?
Solved! Go to Solution.