AcDbObjectId DimStyleNameToId(const ACHAR* szName,AcDbDatabase* pDb) { AcDbObjectId id; if( NULL == pDb ) { pDb = acdbHostApplicationServices()->workingDatabase(); } AcDbDimStyleTable* pTbl; pDb->getDimStyleTable(pTbl,AcDb::kForWrite); AcDbDimStyleTableIterator* pIterator = NULL ; pTbl->newIterator(pIterator); for(pIterator->start();!pIterator->done();pIterator->step()) { AcDbDimStyleTableRecord* pR = NULL ; pIterator->getRecord(pR,AcDb::kForWrite); AcString sName ; pR->getName(sName); if( sName == szName ) { id = pR->id(); pR->close(); break;; } pR->close(); } pTbl->close(); return id; } Acad::ErrorStatus SetCurDimStyle(const ACHAR* szName,AcDbDatabase* pDb) { if( NULL == pDb ) { pDb = acdbHostApplicationServices()->workingDatabase(); } AcDbObjectId id = DimStyleNameToId(szName,pDb); if( id.isNull() ) { return eNullObjectId; } return pDb->setDimstyle(id); }