Message 1 of 9
How to use AcDbEvalGraph::getAllNodes()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone
I'm working with AcDbEvalGraph, my task is get and print number of node in a graph.
I maked a function as below, that can successully build and load into AutoCAD. But when I run it, I faced an error.
In debug mode, VS said: "A breakpoint instruction (__debugbreak() statement or a similar call) was executed in acad.exe"
Why that error occurs? Did I have any misstake?
void test() {
Acad::ErrorStatus es;
AcDbObjectId objId;
ads_name name; ads_point p;
if (acedEntSel(_T("\nSelect block reference: "), name, p) != RTNORM)
return;
acdbGetObjectId(objId, name);
AcDbBlockReference* pBlkRef;
es = acdbOpenObject(pBlkRef, objId, AcDb::kForRead, false);
if (es != Acad::eOk) return;
AcDbDynBlockReference dynBlk(objId);
AcDbBlockTableRecordPointer pBTR(dynBlk.dynamicBlockTableRecord(), AcDb::kForRead);
if (pBTR.openStatus() != Acad::eOk) return;
// Open Dictionary of Block Table Record
objId = pBTR->extensionDictionary();
AcDbDictionary* pDic;
es = acdbOpenObject(pDic, objId, AcDb::kForWrite, false);
if (es != Acad::eOk) return;
// Open EvalGraph
es = pDic->getAt(_T("ACAD_ENHANCEDBLOCK"), objId);
if (es != Acad::eOk) return;
AcDbEvalGraph* graph;
es = acdbOpenObject(graph, objId, AcDb::kForWrite, false);
if (es != Acad::eOk) return;
// Get length of NodeIdArray
AcDbEvalNodeIdArray nodes;
es = graph->getAllNodes(nodes);
if (es != Acad::eOk) return;
acutPrintf(_T("\nLength: %d", nodes.length()));
}
I'm using AutoCAD 2023.
Visual Studio 2022 with CPP project is not generated by ObjectARX Wizard.