|
[code] Acad::ErrorStatus es;
AcDbDatabaseSummaryInfo *pInfo;
AcDbDatabase *pCurDb = NULL;
ACHAR* info;
ACHAR* key;
ACHAR* value;
int customQty;
int index;
pCurDb = acdbHostApplicationServices()->workingDatabase();
// Get a pointer to the workingDatabase()
// summary information
es = acdbGetSummaryInfo(pCurDb, pInfo);
acutPrintf(L"\\nSummary information for this drawing:" );
es = pInfo->getTitle(info);
if (info)
{
acutPrintf(L"\\nTitle = %s" , info);
}
es = pInfo->getSubject(info);
if (info)
{
acutPrintf(L"\\nSubject matter = %s" , info);
}
es = pInfo->getAuthor(info);
if (info)
{
acutPrintf(L"\\nAutor = %s" , info);
}
es = pInfo->getKeywords(info);
if (info)
{
acutPrintf(L"\\nKeywords = %s" , info);
}
es = pInfo->getComments(info);
if (info)
{
acutPrintf(L"\\nComments = %s" , info);
}
es = pInfo->setLastSavedBy(L"Captain CAD" );
es = pInfo->getLastSavedBy(info);
acutPrintf(L"\\nLast saved by = %s" , info);
es = pInfo->getHyperlinkBase(info);
if (info)
{
acutPrintf(L"\\nLink Location = %s" , info);
}
es = pInfo->setRevisionNumber(L"1" );
es = pInfo->getRevisionNumber(info);
acutPrintf(L"\\nRevision number = %s" , info);
customQty = pInfo->numCustomInfo();
if (customQty > 0)
{
acutPrintf(L"\\nCustom Summary Information:\\n" );
acutPrintf(L"\\nKey\\t\\tValue\\n" );
for (index = 0; index < customQty; index++)
{
pInfo->getCustomSummaryInfo(index, key, value);
if (key)
{
acutPrintf(L"\\n%s" , key);
}
if (value)
{
acutPrintf(L"\\t\\t%s" , value);
}
acdbFree(key);
acdbFree(value);
}
}
else
{
acutPrintf(L"\\n\\nDrawing does not contain
any Custom SummaryInformation");
}
es = acdbPutSummaryInfo(pInfo);
acdbFree(info);
pCurDb->saveAs(ACRX_T("D:\\\\Temp\\\\MyTestArx.dwg" ));
To set the properties using COM API, here is a code snippet :
oAcadApp.ActiveDocument.Database.SummaryInfo.LastSavedBy = "Autodesk"
MsgBox(oAcadApp.ActiveDocument.Database.SummaryInfo.LastSavedBy)
oAcadApp.ActiveDocument.SaveAs("D:\\Temp\\MyTest.dwg" )[/code] |
|