以下示例中的代码创建一个迭代器,用于遍历线型表中的符号表记录。它获取每条记录,将其打开以供读取,获取线型名称,关闭记录,然后打印线型名称。最后,程序删除迭代器。 void iterateLinetypes() { AcDbLinetypeTable *pLinetypeTbl; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pLinetypeTbl, AcDb::kForRead); // Create a new iterator that starts at table // beginning and skips deleted. // AcDbLinetypeTableIterator *pLtIterator; pLinetypeTbl->newIterator(pLtIterator); // Walk the table, getting every table record and // printing the linetype name. // AcDbLinetypeTableRecord *pLtTableRcd; char *pLtName; for (; !pLtIterator->done(); pLtIterator->step()) { pLtIterator->getRecord(pLtTableRcd, AcDb::kForRead); pLtTableRcd->getName(pLtName); pLtTableRcd->close(); acutPrintf("\nLinetype name is: %s", pLtName); free(pLtName); } delete pLtIterator; pLinetypeTbl->close(); } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:21
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.