C3D-SEGLBLREAD · Find example plan segment label (read-only) done
Locate the '159 13.9%' style label in plan view + its layer/height/rotation as template.
C# payload
// READ-ONLY: find the example segment label in PLAN view (e.g. "159' 13.9%" / "60' DIP / 100' PVC")
// and report its layer, height, rotation, style, position — template for labeling the other segments.
using System;
using Autodesk.AutoCAD.DatabaseServices;
var db = Db;
using (var tr = db.TransactionManager.StartTransaction())
{
var ms = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead);
int n = 0;
foreach (ObjectId id in ms)
{
var e = tr.GetObject(id, OpenMode.ForRead);
string s = null; double x=0,y=0,h=0,rot=0; string layer="", style="";
if (e is DBText t) { s=t.TextString; x=t.Position.X; y=t.Position.Y; h=t.Height; rot=t.Rotation; layer=t.Layer; style=t.TextStyleName; }
else if (e is MText m) { s=m.Text; x=m.Location.X; y=m.Location.Y; h=m.TextHeight; rot=m.Rotation; layer=m.Layer; style=""; }
else continue;
if (string.IsNullOrWhiteSpace(s)) continue;
// plan-view window only (model coords of the outfall)
if (x < 2296700 || x > 2297600 || y < 1279400 || y > 1280300) continue;
if (!(s.Contains("%") || s.Contains("DIP") || s.Contains("PVC"))) continue;
Log($"{e.GetType().Name} [{layer}] ({x:0.0},{y:0.0}) h={h:0.00} rot={rot*180/Math.PI:0.0}deg style='{style}' text='{s.Replace("\n"," ")}' handle={((Autodesk.AutoCAD.DatabaseServices.Entity)e).Handle}");
n++;
}
Log($"matches: {n}");
tr.Commit();
}
Result
Log
matches: 0
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.