C3D-0431 · Dump SS_BLOCK_11X17 attribute tags + values (read-only) error
Read-only: list SS_BLOCK* defs + attdef tags, dump every inserted ref attribute tag=value across all spaces.
C# payload
using System;
using System.Text;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.ApplicationServices;
public class Script
{
public string Run(DrawingContext ctx)
{
var db = ctx.Db;
var sb = new StringBuilder();
using (var tr = db.TransactionManager.StartTransaction())
{
var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
// 1) does a block DEFINITION named SS_BLOCK_11X17 exist?
sb.AppendLine("=== BLOCK DEFS containing 'BLOCK_11X17' or 'BLOCK_17X11' ===");
foreach (ObjectId btrId in bt)
{
var btr = (BlockTableRecord)tr.GetObject(btrId, OpenMode.ForRead);
string n = btr.Name;
if (n.IndexOf("BLOCK_11X17", StringComparison.OrdinalIgnoreCase) >= 0 ||
n.IndexOf("BLOCK_17X11", StringComparison.OrdinalIgnoreCase) >= 0 ||
n.IndexOf("SS_BLOCK", StringComparison.OrdinalIgnoreCase) >= 0)
{
sb.AppendLine("DEF: '" + n + "' layout=" + btr.IsLayout + " hasAttDef=" + btr.HasAttributeDefinitions);
foreach (ObjectId eid in btr)
{
var ent = tr.GetObject(eid, OpenMode.ForRead) as Entity;
if (ent is AttributeDefinition ad)
sb.AppendLine(" ATTDEF tag='" + ad.Tag + "' prompt='" + ad.Prompt + "' default='" + ad.TextString + "'");
}
}
}
// 2) find INSERTED references across model + all paper spaces, dump attribute values
sb.AppendLine();
sb.AppendLine("=== INSERTED REFERENCES (all spaces) ===");
foreach (ObjectId btrId in bt)
{
var space = (BlockTableRecord)tr.GetObject(btrId, OpenMode.ForRead);
foreach (ObjectId eid in space)
{
var br = tr.GetObject(eid, OpenMode.ForRead) as BlockReference;
if (br == null) continue;
var bd = (BlockTableRecord)tr.GetObject(br.BlockTableRecord, OpenMode.ForRead);
string bn = bd.Name;
if (bn.IndexOf("SS_BLOCK", StringComparison.OrdinalIgnoreCase) < 0) continue;
sb.AppendLine("REF of '" + bn + "' in space '" + space.Name + "' pos=" + br.Position.ToString());
foreach (ObjectId arId in br.AttributeCollection)
{
var ar = tr.GetObject(arId, OpenMode.ForRead) as AttributeReference;
if (ar != null)
sb.AppendLine(" ATT tag='" + ar.Tag + "' value='" + ar.TextString + "'");
}
}
}
tr.Commit();
}
return sb.ToString();
}
}
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.