- UID
- 1
- 积分
- 15887
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
HOW DO I MANIPULATE SUMMARY INFO WITH OBJECTARX? (ACDBDATABASESUMMARYINFO)
See Also: SignPost Contents SignPost Index
Product AUTOCAD Author MCAULEY,CHARLES
Date 26-MAR-99 Document ID 29075
Expiration date Attachments 29075.zip
Keywords ARX; NOD; SUMMARY
Developer Consulting Group technical solution. Autodesk confidential, for ADN members only. Please read the disclaimer
Question
How do I manipulate Summary Information with ObjectARX
(AcDbDatabaseSummaryInfo)?
Answer
Summary Information in an AutoCAD 2000 drawing is stored as an AcDbXrecord in
the Named Objects Dictionary with the key 'DWGPROPS'. ObjectARX 2000 provides a
wrapper class to manipulate this information, namely AcDbDatabaseSummaryInfo.
This class comes with a number of 'query' and 'edit' functions. Please note that
in a new drawing there will be no 'DWGPROPS' key and associated AcDbXrecord
object. If the user executes the '_DWGPROPS' and accepts 'OK' in the presented
dialog, then AutoCAD will create an AcDbXrecord object in the Named Objects
Dictionary with the key 'DWGPROPS'. Classes closely associated with
AcDbDatabaseSummaryInfo are AcDbSummaryInfoManager and AcDbSummaryInfoReactor.
The AcDbSummaryInfoManager class allows for the addition and removal of
AcDbSummaryInfoReactor objects to the AutoCAD session. The
AcDbSummaryInfoReactor class allow the user to respond to
'summaryInfoHasChanged()' events. When executing the '_DWGPROPS' command
('File' menu, select 'Drawing Properties...'), the user is presented with a
tabbed style dialog, familiarize yourself with the various tabs before
considering the code presented below. If you have familiarized with the various
tabs on the 'DWGPROPS' dialog, the member functions of the
AcDbDatabaseSummaryInfo class are pretty straightforward in that they mimic
their dialog counterparts. Prior to executing this code make sure that there is
a drawing file that contains Summary Information.
// The registered command is 'GETSUMMINFO'
// Note: minimal to no error checking
void getSummInfo()
{
// TODO: Implement the command
Acad::ErrorStatus es;
AcDbDatabaseSummaryInfo *pInfo;
AcDbDatabase *pCurDb = NULL;
AcDbDictionary* pDict;
char* info;
char* key;
char* value;
int customQty;
int index;
// You need to make sure that 'acsiobj.arx' is loaded
// this is required. acsiobj.arx is an AutoCAD 2000 arx app
if (!acrxDynamicLinker->loadModule("acsiobj.arx", 0))
{
acutPrintf("\nFailed to load the required SummaryInfo
object.\n");
return;
}
pCurDb = acdbHostApplicationServices()->workingDatabase();
// Get the Named Objects Dictionary
es = pCurDb->getNamedObjectsDictionary(pDict, AcDb::kForRead);
// Is there a "DWGPROPS" key
if(!pDict->has("DWGPROPS"))
{
acutPrintf("\nThis drawing does not contain Summary
Information");
pDict->close();
return;
}
pDict->close();
// Get a pointer to the workingDatabase() summary information
es = acdbGetSummaryInfo(pCurDb, pInfo);
acutPrintf("\nSummary information for this drawing:");
es = pInfo->getTitle(info);
if(info)
{
acutPrintf("\nTitle = %s", info);
}
es = pInfo->getSubject(info);
if(info)
{
acutPrintf("\nSubject matter = %s", info);
}
es = pInfo->getAuthor(info);
if(info)
{
acutPrintf("\nAutor = %s", info);
}
es = pInfo->getKeywords(info);
if(info)
{
acutPrintf("\nKeywords = %s", info);
}
es = pInfo->getComments(info);
if(info)
{
acutPrintf("\nComments = %s", info);
}
es = pInfo->setLastSavedBy("Captain CAD");
es = pInfo->getLastSavedBy(info);
acutPrintf("\nLast saved by = %s", info);
es = pInfo->getHyperlinkBase(info);
if(info)
{
acutPrintf("\nLink Location = %s", info);
}
es = pInfo->setRevisionNumber("1"); // Note: its a string
es = pInfo->getRevisionNumber(info);
acutPrintf("\nRevision number = %s", info);
customQty = pInfo->numCustomInfo();
if(customQty > 0)
{
acutPrintf("\n\nDrawing Custom Summary Information:\n");
acutPrintf("\nKey\t\tValue\n");
for(index = 0; index < customQty; index++)
{
pInfo->getCustomSummaryInfo(index, key, value);
if(key)
{
acutPrintf("\n%s", key);
}
if(value)
{
acutPrintf("\t\t%s", value);
}
acdbFree(key);
acdbFree(value);
}
}
else
{
acutPrintf("\n\nDrawing does not contain any Custom Summary
Information");
}
es = acdbPutSummaryInfo(pInfo);
acdbFree(info);
}
If you open the AcDbXrecord object associated with the key 'DWGPROPS' is a
resbuf structure, there are a number of defined DXF group codes associated with
the representation of Summary Information (layout of the AcDbXrecord). These
codes are as follows:
DXF Code Meaning
1 "DWGPROPS COOKIE" - Do not edit
2 Title - Summary Tab
3 Subject - Summary Tab
4 Author - Summary Tab
6 Comments - Summary Tab
7 Keywords - Summary Tab
8 Last saved by: - Statistics Tab
9 Revision no: - Statistics Tab
300 Name Value - Custom Tab. Thesse are saved as
to strings in the format of "Name=Value"
309
1 (repeated) Hyperlink - Summary Tab
See Also:
Solution 30483: HOW TO EXTRACT THE DRAWING SUMMARY INFO USING LISP
Solution 32968: HOW TO ACCESS DRAWING PROPERTIES THROUGH AUTOMATION
See Also: SignPost Contents SignPost Index |
|