← Inbox

C3D-0007 · Read control symbol blocks + tie layers [CTRL-BLOCKS] done

Read-only: block definitions that could be control-point symbols, all user block names, control/tie layers, and text styles - so the tie-line recipe uses real names instead of assumed ones.

Script file
C3D-0007.cs
Target
260612 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// READ-ONLY: block definitions that could serve as control-point symbols, and the layers/text
// styles a tie line would use. Reads what EXISTS - no assumptions about names.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);

Log("=== candidate control / monument symbol blocks ===");
var keys = new string[] { "CTRL","CONTROL","MON","BENCH","BM","IPF","IPS","IRON","PIN","TRIANG",
                          "USGS","AZIMUTH","FLIGHT","CC","POINT","MARK","TIE","STA","PK","DRILL","HUB" };
foreach (ObjectId id in bt)
{
    var d = (BlockTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    if (d.IsLayout) continue;
    var n = d.Name.ToUpper();
    if (n.StartsWith("*") || n.StartsWith("A$C")) continue;
    bool hit = false;
    foreach (var k in keys) if (n.Contains(k)) { hit = true; break; }
    if (!hit) continue;
    int ents = 0; var kinds = new Dictionary<string,int>();
    foreach (ObjectId cid in d) { ents++;
        var e = Tx.GetObject(cid, OpenMode.ForRead);
        var t = e.GetType().Name; kinds[t] = kinds.ContainsKey(t) ? kinds[t]+1 : 1; }
    var parts = new List<string>();
    foreach (var kv in kinds) parts.Add(kv.Value + " " + kv.Key);
    Log("  '" + d.Name + "'  refs=" + d.GetBlockReferenceIds(true,true).Count +
        "  entities=" + ents + "  [" + string.Join(", ", parts) + "]");
}

Log("=== ALL user block names (for anything the keyword scan missed) ===");
var all = new List<string>();
foreach (ObjectId id in bt)
{
    var d = (BlockTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    if (d.IsLayout) continue;
    var n = d.Name;
    if (n.StartsWith("*") || n.StartsWith("A$C") || n.StartsWith("_")) continue;
    all.Add(n);
}
all.Sort();
Log("  (" + all.Count + ") " + string.Join(" | ", all));

Log("=== V-CTRL* / tie-ish layers ===");
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
foreach (ObjectId id in lt)
{
    var l = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    var n = l.Name.ToUpper();
    if (!(n.Contains("CTRL") || n.Contains("CONTROL") || n.Contains("TIE") || n.Contains("MON")))
        continue;
    Log("  '" + l.Name + "' colour=" + l.Color.ColorIndex + " off=" + l.IsOff + " frozen=" + l.IsFrozen);
}

Log("=== text styles ===");
var tst = (TextStyleTable)Tx.GetObject(Db.TextStyleTableId, OpenMode.ForRead);
foreach (ObjectId id in tst)
{
    var ts = (TextStyleTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    if (ts.Name.Length == 0) continue;
    Log("  '" + ts.Name + "' font='" + ts.FileName + "' height=" + ts.TextSize.ToString("F3"));
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS BOUNDARY.dwg
Message
Executed C3D-0007 (0 entities touched).
Entities
Duration
755 ms
Civil 3D
25.0.0.0

Log

=== candidate control / monument symbol blocks ===
  'AeccTickLine'  refs=0  entities=1  [1 Line]
  'AeccTickCircle'  refs=0  entities=1  [1 Circle]
  'AeccTickTriangle'  refs=0  entities=2  [2 Polyline]
  'AeccArrow'  refs=0  entities=1  [1 Leader]
  'Drill Hole'  refs=0  entities=3  [1 BlockReference, 2 Circle]
  'STA'  refs=2  entities=2  [1 Polyline, 1 Circle]
  'Station Mark'  refs=0  entities=4  [3 Line, 1 Circle]
  'Benchmark'  refs=0  entities=5  [2 Line, 1 Circle, 2 Polyline]
  'Iron Pin'  refs=0  entities=2  [2 Circle]
  '_CrowsFoot-Start'  refs=0  entities=3  [2 Arc, 1 Circle]
  'Marker Pnt'  refs=0  entities=3  [1 Circle, 2 Polyline]
  'AeccSectionMark'  refs=0  entities=2  [1 Hatch, 1 Circle]
  'AeccSectionPntr'  refs=0  entities=1  [1 Hatch]
  'HighPoint'  refs=0  entities=3  [1 Hatch, 2 Polyline]
  'LowPoint'  refs=0  entities=3  [1 Hatch, 2 Polyline]
  'AeccArwClosedFilled'  refs=0  entities=1  [1 Solid]
  'As Built - DEV3896 East Lake Pkwy C-Store - Water & Sewer'  refs=0  entities=11909  [1 RasterImage, 857 Hatch, 56 Solid, 200 MText, 10358 Polyline, 287 Arc, 107 Circle, 23 Ellipse, 20 Spline]
=== ALL user block names (for anything the keyword scan missed) ===
  (85) 11x17 COVER SHEET SS | 145624724635_Symbols CAD Block_Wheel chair symbol | 3136 | 4b489b62-e834-4762-a085-7954ec19726a | 4b489b62-e834-4762-a085-7954ec19726a_3 | AeccArrow | AeccArwClosedFilled | AeccSectionMark | AeccSectionPntr | AeccTickCircle | AeccTickLine | AeccTickTriangle | ARROW | As Built - DEV3896 East Lake Pkwy C-Store - Water & Sewer | Benchmark | BOULDER | bound | Catch Basin | CG-T30 | CLOSEOUT | Drainage MH | Drill Hole | e2d441ea-1ff1-48e7-ba14-35cae9d44af1 | e2d441ea-1ff1-48e7-ba14-35cae9d44af1_3 | EX-TREE1 | EX-TREE2 | EX-TREE3 | EX-TREE4 | EX-TREE5 | EX-TREE6 | EX-TREE8 | Existing Hyd | Flared End Section - Plan | Flared End Section - Profile | FullSuperLeftDownEmpty | FullSuperLeftUpEmpty | FullSuperRightDownEmpty | FullSuperRightUpEmpty | Gas Valve | Guy Pole | HBCMW | HBPCW | HighPoint | Hydrant-Elevation | Iron Pin | LowPoint | Marker Pnt | PRESSUREPARTERRORBLOCK | Proposed Hyd | SCALE50 | Sewer Manhole | Shrub 2 | Single Pole Sign | SP0 | SP10 | SP11 | SP12 | SP13 | SP14 | SP4 | SP5 | SP6 | SP7 | SP8 | SP9 | SS_BLOCK_11X17 | SS_BLOCK_11X17 (1) | SS_BLOCK_11X17 (2) | SS_BLOCK_11X17 (3) | SS_LEGEND | STA | Station Mark | Storm Manhole | SuperLeftDownEmpty | SuperLeftUpEmpty | SuperRightDownEmpty | SuperRightUpEmpty | Test Pit | Tree 6 | Tree-Deciduous | Tree-Evergreen | Utility Pole | Water Shutoff | Water Valve | Well
=== V-CTRL* / tie-ish layers ===
  'V-CTRL-LINE-DIRC' colour=6 off=False frozen=False
  'V-CTRL-LINE-NETW' colour=11 off=False frozen=False
  'V-CTRL-LINE-SHOT' colour=45 off=False frozen=False
  'V-CTRL-TRAV' colour=150 off=False frozen=False
  'V-CTRL-TRAV-ERRO' colour=92 off=False frozen=False
  'V-CTRL-NODE-KNOW' colour=92 off=False frozen=False
  'V-CTRL-NODE-UNKN' colour=1 off=False frozen=False
  'V-CTRL-NODE-SHOT' colour=11 off=False frozen=False
  'V-CTRL-HCPT' colour=150 off=False frozen=False
  'V-CTRL-VCPT' colour=150 off=False frozen=False
  'V-CTRL-BMRK' colour=150 off=False frozen=False
  'HORIZONTAL_AND_VERTICAL_CONTROL_POINT' colour=7 off=False frozen=False
  'HORIZONTAL_AND_VERTICAL_CONTROL_TEXT' colour=7 off=False frozen=False
=== text styles ===
  'Standard' font='simplex.shx' height=0.000
  'Annotative' font='' height=0.000
  'SHR' font='SIMPLEX' height=0.750
  'S4' font='simplex' height=0.056
  'L120' font='simplex.shx' height=12.000
  'ROMAND' font='romand.shx' height=0.125
  'SIMPLEX' font='romanc.shx' height=3.200
  'CBL' font='ROMANS' height=0.023
  'DIM' font='ic-dim.shx' height=0.000
  'NEWSTYLE5' font='ic-dim.shx' height=0.000
  'BLOCK$0$DIM' font='ic-dim.shx' height=0.000
  'L100' font='simplex' height=5.000
  'ARIAL' font='swissb.ttf' height=0.000
  'L30' font='simplex.shx' height=3.000
  'L60' font='simplex.shx' height=3.000
  'L20' font='simplex.shx' height=2.000
  'anno-0.08' font='times.ttf' height=0.080
  'LABELS' font='times.ttf' height=0.000
  'ARCH-1' font='arch-1.shx' height=0.000
  'BP' font='BKANT.TTF' height=0.000
  'L50' font='simplex' height=1.000
  'CADdetails-DIMENSIONS' font='ARIALN.TTF' height=2.380
  'UTILITY' font='romans.shx' height=0.000
  'ARCHSING' font='archsing' height=0.000
  'ARCHCHIS' font='archchis' height=0.000
  'linetype' font='simplex.shx' height=0.000
  'OpenSans' font='OpenSans-Regular.ttf' height=0.000
  'OpenSansCondensed-Light' font='OpenSansCondensed-Light.ttf' height=0.000
  'Verdana' font='verdana.ttf' height=0.000
  'TITLE20' font='BKANT.TTF' height=0.079
  'GF_050' font='arial.ttf' height=0.197
  'HL-HD' font='j:\LIBRARY\FONTS\bold.shx' height=0.020
  'PDF Arial Narrow Italic' font='ARIALNI.TTF' height=0.000
  'PDF ArialMT' font='arial.ttf' height=0.000
  'PDF Arial Narrow' font='ARIALN.TTF' height=0.000
  'PDF Century Gothic' font='GOTHIC.TTF' height=0.000
  'PDF BankGothicBT-Light' font='arial.ttf' height=0.000
  'PDF Arial-BoldMT' font='arial.ttf' height=0.000
  'ROMANC' font='romanc.shx' height=3.000

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.