Author Topic: ArxDbg classes  (Read 1684 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6963
  • AKA Daniel
ArxDbg classes
« on: February 23, 2009, 12:20:34 PM »

Anyone use any of the classes in the ArxDbg? Some of them are pretty slick, like ArxDbgRbList, ArxDbgSelSet and the prompt classes.
I have pulled the classes I like and have made a library, sure does make things simpler

Code: [Select]
static void ArxLib_doit(void)
  {
    //ArxDbg class to prompt for a double
    ArxDbgUiPrDouble dbl(_T("Enter a tolerance"),NULL, ArxDbgUiPrDouble::kAny);
    if(dbl.go() != ArxDbgUiPrBase::kOk)
      return;
    double val = dbl.value();

    //ArxDbgRbList frees the resbuf
    ArxDbgRbList filter(acutBuildList(RTDXF0,ACRX_T("LINE"),RTNONE));
    CString addPrompt = ACRX_T("\nSelect Lines: ");
    CString remPrompt = ACRX_T("\nRemove Lines: ");

    //ArxDbgSelSet frees the set
    ArxDbgSelSet set;
    if(set.userSelect(addPrompt,remPrompt,filter) != ArxDbgSelSet::kSelected)
      return;
    AcDbObjectIdArray ids
    set.asArray(ids);

    for(int i = 0; i < ids.length(); i++)
    {
      AcDbLinePointer ptr(ids[i],AcDb::kForRead);
      if(ptr.openStatus() != Acad::eOk)
        continue;

      if(ptr->startPoint().distanceTo(ptr->endPoint()) < val)
      {
        ptr->upgradeOpen();
        acutPrintf(_T("\nErased %ld"),(long)(AcDbStub*)ptr->objectId());
        ptr->erase();
      }
    }
  }