ObjectARX

Reply
Active Member
Posts: 9
Registered: ‎03-04-2010
Message 1 of 11 (370 Views)

Generate large amounts of AcDbText, then AutoCAD show fatal error

370 Views, 10 Replies
03-25-2012 08:31 PM

when I create three million AcDbText and add them to model space, in this process, AutoCAD show fatal error warning, then AutoCAD collapse.

 

why?, what can i do for this?

Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 2 of 11 (357 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-26-2012 12:24 AM in reply to: zero111

put your code here. It can be your bug.

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Active Member
Posts: 9
Registered: ‎03-04-2010
Message 3 of 11 (348 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-26-2012 03:03 AM in reply to: zero111

BOOL AddToModelSpace(AcDbEntity *pEnt)
{
 if(pEnt == NULL)
    return FALSE;

 AcDbBlockTable *pTable = NULL;
 Acad::ErrorStatus es = acdbHostApplicationServices()->workingDatabase()->getBlockTable(pTable, AcDb::kForRead);
 
 AcDbBlockTableRecord *pRecd = NULL;
 es = pTable->getAt(ACDB_MODEL_SPACE, pRecd, AcDb::kForWrite);
 es = pRecd->appendAcDbEntity(pEnt);
 
 pTable->close();
 pRecd->close();
 pEnt->close();

 return TRUE;
}

 

 

void cmdTest()
{

   for(long m=0L; m<1500L; m++){
       for(long j=0L; j<2000L; j++){

          AcDbText *pText = new AcDbText(AcGePoint3d(m*100,j*100,0), _T("abc")); 

          pText->setColorIndex(1);  

          if(AddToModelSpace(pText)==FALSE){
            if(pText != NULL)
               delete pText;
         }
     }
  }

}

Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 4 of 11 (343 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-26-2012 04:12 AM in reply to: zero111

your code works fine, BUT...

when it was done 86%, I got a message, that I have not enough memory to complete task.

So, I think that your computer is not good enough for this task such as my :smileyhappy: 

 

PS: I didn't got a fatal error at all

 

AcApDocument * pDoc = acDocManager->mdiActiveDocument();
acDocManager->lockDocument(pDoc);
acedSetStatusBarProgressMeter(_T("Press ESC to abort: "), 0, 1500);
for(long m=0L; m<1500L; m++)
{
   for(long j=0L; j<2000L; j++)
   {
      AcDbText *pText = new AcDbText(AcGePoint3d(m*100,j*100,0), _T("abc")); 
      pText->setColorIndex(1);  

      if(AddToModelSpace(pText)==FALSE)
      {
          if(pText != NULL)
            delete pText;
      }
   }
   acedSetStatusBarProgressMeterPos( m );
   if(acad_abortCycle(_T("\nINFO: aborted...")) == 1)
      break;
}
acedRestoreStatusBar();
acDocManager->unlockDocument(pDoc);

 

int acad_abortCycle(const ACHAR * abortString)
{
   int res = 0;
   CWinApp *app = acedGetAcadWinApp();
   CWnd *wnd = app->GetMainWnd ();
   MSG msg; 
   while (:: PeekMessage (&msg, wnd->m_hWnd, 0, 0, PM_NOREMOVE)) 
   { 
      if (!app->PumpMessage()) 
      { 
         :: PostQuitMessage(0); 
            break; 
      } 
   } 
   LONG lIdle = 0;
   while (app->OnIdle (lIdle++));

   res = acedUsrBrk();
   if(res == 1 && abortString != NULL) acutPrintf(abortString);
   return res;
}

 

 

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Active Member
Posts: 9
Registered: ‎03-04-2010
Message 5 of 11 (329 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-26-2012 06:55 PM in reply to: zero111

How much capacity in your computer memory?

Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 6 of 11 (322 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-27-2012 12:01 AM in reply to: zero111

2GB.

But free memory, that can be used is little more then 1.2GB (Windows, antivirus, e.t.c eat 800MB)

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
*Expert Elite*
Alfred.NESWADBA
Posts: 8,474
Registered: ‎06-29-2007
Message 7 of 11 (319 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-27-2012 01:45 AM in reply to: zero111

Hi,

 

try to turn off UNDO-recording, that will save a lot of memory as AutoCAD does not need to save every single add-task.

_UNDO _AUTO _OFF

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Member
Posts: 9
Registered: ‎03-04-2010
Message 8 of 11 (315 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-27-2012 02:17 AM in reply to: Alfred.NESWADBA

when it was done 59%, I got a fatal error message .

if I stop at 58%, then all AcDbText are created in  model space, But if click "ZOOM" or "REGEN" in command line, AutoCAD show fatal error and collapse.  It looks like refresh graphics display make it.

Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 9 of 11 (309 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-27-2012 04:32 AM in reply to: zero111

did you test this in pure autocad? if no, try to unload everything additional (arx-files, lisp and so on) and leave just pure acad, like after installation. I didn't get fatal error. It was a messagebox with Ok|Cancel buttons for aborting the task. So, the problem can be in other arx file :smileyhappy:, if it has, db  reactor, for example.

And what about Alfred's advice? It will reduce the memory usage.

 

PS: try to do the same with, for example, points or lines (to check is this text bug or just lack of memory)

PS: if it was a pure autocad, may be it's time to reinstall it :smileyhappy:

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Active Member
Posts: 9
Registered: ‎03-04-2010
Message 10 of 11 (294 Views)

Re: Generate large amounts of AcDbText, then AutoCAD show fatal error

03-28-2012 03:12 AM in reply to: Nick1983

in pure autocad, it outputs more AcDbText, but cmmand "zoom" and "regen" still lead to error or enough memory .

turn off UNDO-recording, not solve the problem.

points or lines has no problem.

 

It looks like  lack of memory, I'm not sure.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community