C3D-INSP2403G · Layer states + SS-BOUNDARY_CYAN outline (read-only) done
Boundary layer on/frozen/plot flags, saved layer states, and SS-BOUNDARY_CYAN line endpoints (the live hero outline) to learn the per-sheet visibility switch and mirror it for lot 10.
C# payload
// READ-ONLY: how is per-sheet SS-boundary visibility controlled?
// (1) all layers whose name contains SS-BOUNDARY or BOUNDARY: on/off, frozen, color, lineweight, plottable
// (2) layer states saved in the drawing (LayerStates manager) — names + which layers each toggles
// (3) the SS-BOUNDARY_CYAN linework endpoints (the live hero) so I know the exact lot outline to mirror
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
var db = Db;
// (1) hero layer states
using (var tr = db.TransactionManager.StartTransaction())
{
var lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);
Log("BOUNDARY-RELATED LAYERS:");
foreach (ObjectId id in lt)
{
var l = (LayerTableRecord)tr.GetObject(id, OpenMode.ForRead);
if (l.Name.IndexOf("BOUNDARY", StringComparison.OrdinalIgnoreCase) < 0) continue;
Log($" {l.Name}: off={l.IsOff} frozen={l.IsFrozen} plot={l.IsPlottable} color={l.Color.ColorIndex} lw={l.LineWeight}");
}
tr.Commit();
}
// (2) saved layer states
using (var tr = db.TransactionManager.StartTransaction())
{
var lm = db.LayerStateManager;
var names = new List<string>();
// LayerStates enumerated via GetLayerStateNames-ish; use the reflectionless API:
try {
foreach (var n in lm.GetLayerStateNames(false, false).Cast<string>()) names.Add(n);
} catch (System.Exception ex) { Log($" layerstate note: {ex.Message}"); }
Log($"SAVED LAYER STATES ({names.Count}): {(names.Count==0?"<none>":string.Join(", ", names))}");
tr.Commit();
}
// (3) SS-BOUNDARY_CYAN geometry — the live hero outline (endpoints)
using (var tr = db.TransactionManager.StartTransaction())
{
var ms = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead);
Log("SS-BOUNDARY_CYAN geometry (the live hero outline):");
foreach (ObjectId id in ms)
{
var ent = tr.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null || !string.Equals(ent.Layer, "SS-BOUNDARY_CYAN", StringComparison.OrdinalIgnoreCase)) continue;
if (ent is Line ln)
Log($" Line ({ln.StartPoint.X:0.0},{ln.StartPoint.Y:0.0}) -> ({ln.EndPoint.X:0.0},{ln.EndPoint.Y:0.0}) len={ln.Length:0.0}");
else if (ent is Arc a)
Log($" Arc center=({a.Center.X:0.0},{a.Center.Y:0.0}) r={a.Radius:0.0} from={a.StartAngle*180/Math.PI:0.0} to={a.EndAngle*180/Math.PI:0.0}");
else Log($" {ent.GetType().Name}");
}
tr.Commit();
}
Result
Log
BOUNDARY-RELATED LAYERS: BOUNDARY: off=False frozen=False plot=True color=3 lw=LineWeight050 BOUNDARY_PTS: off=False frozen=False plot=True color=7 lw=LineWeight025 BOUNDARY_FRAME: off=False frozen=False plot=True color=210 lw=LineWeight025 SS-BOUNDARY_CYAN: off=False frozen=False plot=True color=4 lw=LineWeight050 SS-BOUNDARY_RED: off=False frozen=True plot=True color=1 lw=LineWeight050 SS-BOUNDARY_R3: off=False frozen=True plot=True color=6 lw=ByLineWeightDefault SAVED LAYER STATES (0): <none> SS-BOUNDARY_CYAN geometry (the live hero outline): Line (2359457.4,1425521.0) -> (2359298.0,1425651.9) len=206.3 Line (2359542.9,1425805.8) -> (2359598.2,1425793.5) len=56.7 Line (2359298.0,1425651.9) -> (2359375.3,1425745.9) len=121.7 Arc center=(2359508.2,1425638.3) r=171.0 from=78.3 to=141.0 Line (2359598.2,1425793.5) -> (2359559.0,1425603.2) len=195.1 Line (2359559.0,1425603.2) -> (2359457.4,1425521.0) len=131.2
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.