Message 1 of 6
Not applicable
10-01-2019
01:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to read the value out of an attribute called "REV" in a title block called "STAR2" in C#. I then want to assign the value as the definition in my dictionary shown below, and return that to the method that eventually will call this one.
Please see a snippet of my code, the places in bold are the areas I [think I] need to address:
// Gets the attributes from the drawing
public getDWGInfo()
{
// Declarations
int dwgCount = 0;
DocumentCollection docs = Application.DocumentManager;
var dwgDict = new Dictionary<string, string>();
foreach (Document doc in docs)
{
Database acCurDb;
acCurDb = Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// Open the block table for read
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;
if (acBlkTbl.Has("STAR2"))
{
// ##### Get the value of attribute "REV" from "STAR2" & Add to dictionary below?
dwgDict[doc.Name] = ;
dwgCount++;
}
else
{
Application.ShowAlertDialog("The drawing does not have a STAR2 titleblock with a REV attribute, couldn't add to list.");
}
}
}
// ##### Return dwgDict to the method that called it?
}Could you toss me some bones
Solved! Go to Solution.