|
static void ArxSetUcs_doit(void)
{
Acad::ErrorStatus es = Acad::eOk;
{
AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
AcDbUCSTablePointer pUCSTable(pDb->UCSTableId(), AcDb::kForRead);
if( (es = pUCSTable.openStatus()) != Acad::eOk )
{
acutPrintf(ACRX_T("Fail %s @ Line %d"),
acadErrorStatusText(es), __LINE__);
return;
}
AcDbViewportTablePointer pViewportTable
(pDb->viewportTableId(), AcDb::kForRead);
if((es = pViewportTable.openStatus()) != Acad::eOk)
{
acutPrintf(ACRX_T("Fail %s @ Line %d"),
acadErrorStatusText(es), __LINE__);
return;
}
AcDbObjectId activeViewPortId;
if((es = pViewportTable->getAt
(_T("*Active"),activeViewPortId)) != Acad::eOk)
{
acutPrintf(ACRX_T("Fail %s @ Line %d"),
acadErrorStatusText(es), __LINE__);
return;
}
AcDbViewportTableRecordPointer
pActiveViewportTableRecord
(activeViewPortId, AcDb::kForWrite);
if((es = pActiveViewportTableRecord.openStatus())
!= Acad::eOk)
{
acutPrintf(ACRX_T("Fail %s @ Line %d"),
acadErrorStatusText(es), __LINE__);
return;
}
if( pUCSTable->has(_T("testUCS") ))
{
AcDbObjectId testUCSId;
if( (es = pUCSTable->getAt
(_T("testUCS"),testUCSId) ) != Acad::eOk )
{
acutPrintf(ACRX_T("Fail %s @ Line %d"),
acadErrorStatusText(es), __LINE__);
return;
}
if(!testUCSId.isNull())
{
pActiveViewportTableRecord->setUcs(testUCSId);
}
}
}
if((es = acedVportTableRecords2Vports())
!= Acad::eOk)
{
acutPrintf(ACRX_T("Fail %s @ Line %d"),
acadErrorStatusText(es), __LINE__);
return;
}
} |
|