Example #1
0
	//-------------------------------------------------------------------------------------------
	// 
	//  功能: 遍历线型表中的所有记录,获得并打印线型名
	//                 
	//
	//  作者:Qin H.X.
	//
	// 日期:200709
	//
	//  历史:无
	//
	//----------------------------------------------------------------------------------------------
	// - CGDCH03.IterateLinetype command (do not rename)
	static void CGDCH03IterateLinetype(void)
	{
		// 获取线型表
		AcDbLinetypeTable *pLinetypeTbl;
		acdbHostApplicationServices()->workingDatabase()
			->getSymbolTable(pLinetypeTbl, AcDb::kForRead);

		// 创建线性表的遍历器
		AcDbLinetypeTableIterator *pLtIterator;
		pLinetypeTbl->newIterator(pLtIterator);

		// 遍历线性表,输出每个线性表记录的名称
		AcDbLinetypeTableRecord *pLtTableRcd;
		const TCHAR *pLtName;
		for (; !pLtIterator->done(); pLtIterator->step()) {
			pLtIterator->getRecord(pLtTableRcd, AcDb::kForRead);
			pLtTableRcd->getName(pLtName);
			pLtTableRcd->close();
			acutPrintf(_T("\n线型名称:  %s"), pLtName);
		}
		// 删除线性表遍历器并关闭线性表
		delete pLtIterator;
		pLinetypeTbl->close();

	}
Example #2
0
// Opens the linetype table and iterates through all the
// entries printing the name of each linetype.
// 
// THE FOLLOWING CODE APPEARS IN THE SDK DOCUMENT.
//
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;
    const char *pLtName;
    for (; !pLtIterator->done(); pLtIterator->step()) {
        pLtIterator->getRecord(pLtTableRcd, AcDb::kForRead);
        pLtTableRcd->getName(pLtName);
        pLtTableRcd->close();
        acutPrintf("\nLinetype name is:  %s", pLtName);
    }
    delete pLtIterator;
    pLinetypeTbl->close();
}