Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
After searching in forum I found code that extracts data from attribute block
but I need to modify the excel output result as DATAEXTRACTION command
List<object[]> rooms = new List<object[]>(); using (var tr = db.TransactionManager.StartTransaction()) { foreach (SelectedObject so in psr.Value) { BlockReference bref = (BlockReference)tr.GetObject(so.ObjectId, OpenMode.ForRead); //populate array with attribute data Autodesk.AutoCAD.DatabaseServices.AttributeCollection attcoll = bref.AttributeCollection; object[] info = new object[4]; foreach (ObjectId id in attcoll) { AttributeReference atref = (AttributeReference)tr.GetObject(id, OpenMode.ForRead); if (atref.Tag=="QUANTITY") { info[0] = atref.TextString; } if (atref.Tag=="MATERIAL") { info[1] = atref.TextString; } if (atref.Tag=="STANDARD") { info[2] = atref.TextString; } if (!rooms.Contains(info)) { rooms.Add(info); } } } tr.Commit(); }
the excel output
I need the result to be something like this
Solved! Go to Solution.