C3D-0039 · READ-ONLY: isolate the stranded sewer easement label [SSE-LABEL-FAR2] done
Measures every Civil label on the sewer/prop/easement layers against its parent feature and reports only those more than 60 ft away, with parent handle/type, distance and style. Isolates the label that points way out from the drawing. No changes.
C# payload
// READ-ONLY. Which sewer-easement label is stranded far from the thing it labels?
//
// The previous dump was too long to read. This one measures each Civil label's distance from its
// PARENT feature and prints ONLY the outliers (> 60 ft), so the one "pointing way out here" is
// isolated. Also reports whether the label carries a dragged-state offset, because a label whose
// anchor is its parent will snap back when you try to drag it. No changes.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
int n = 0, far = 0;
foreach (ObjectId id in ms) {
var lbl = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Label;
if (lbl == null) continue;
var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)lbl;
string lay = ent.Layer;
if (!(lay.StartsWith("SS-") || lay.StartsWith("C-PROP") || lay.Contains("SEWER") || lay.Contains("EASEMENT"))) continue;
n++;
Point3d loc;
try { loc = lbl.LabelLocation; } catch { continue; }
// where is the parent?
Point3d anchor = loc; string ptype = "?"; string phandle = "?";
double d = -1.0;
try {
var par = Tx.GetObject(lbl.FeatureId, OpenMode.ForRead);
ptype = par.GetType().Name;
phandle = par.Handle.ToString();
var pent = par as Autodesk.AutoCAD.DatabaseServices.Entity;
if (pent != null) {
var e = pent.GeometricExtents;
anchor = new Point3d((e.MinPoint.X + e.MaxPoint.X) / 2.0,
(e.MinPoint.Y + e.MaxPoint.Y) / 2.0, 0.0);
d = Math.Sqrt(Math.Pow(loc.X - anchor.X, 2) + Math.Pow(loc.Y - anchor.Y, 2));
}
} catch { }
if (d < 60.0) continue; // sitting on its parent - not the problem
far++;
Log("");
Log(String.Format("STRANDED [{0}] {1} layer={2}", ent.ObjectId.Handle, lbl.GetType().Name, lay));
Log(String.Format(" label at {0:F2},{1:F2}", loc.X, loc.Y));
Log(String.Format(" parent [{0}] {1} centre {2:F2},{3:F2} DISTANCE {4:F1} ft", phandle, ptype, anchor.X, anchor.Y, d));
try { Log(" style " + lbl.StyleName); } catch { }
try { Log(" visible " + ent.Visible); } catch { }
}
Log("");
Log("civil labels on sewer/prop/easement layers: " + n + " stranded (>60ft from parent): " + far);
Result
Log
STRANDED [2E1ED] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296403.18,1280241.14 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 337.8 ft style Bearing over Distance visible True STRANDED [2E1EE] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296385.99,1280166.83 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 301.6 ft style Bearing over Distance visible True STRANDED [2E1EF] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296420.33,1279890.92 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 235.5 ft style Delta over Length and Radius visible True STRANDED [2E1F0] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296384.56,1279805.29 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 311.0 ft style Delta over Length and Radius visible True STRANDED [2E1F1] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296411.15,1279702.95 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 364.9 ft style Delta over Length and Radius visible True STRANDED [2E1F2] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296527.95,1279727.44 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 285.5 ft style Delta over Length and Radius visible True STRANDED [2E1F3] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296683.06,1279953.22 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 64.4 ft style Bearing over Distance visible True STRANDED [2E1F4] ParcelSegmentLabel layer=C-PROP-LINE-TEXT label at 2296683.12,1280255.16 parent [2E1EB] ParcelSegment centre 2296632.46,1279993.09 DISTANCE 266.9 ft style Bearing over Distance visible True STRANDED [2EE59] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296443.67,1279967.52 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 244.8 ft style Standard.Tag.2 visible True STRANDED [2EE5A] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296538.79,1280000.75 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 146.3 ft style Standard.Tag.2 visible True STRANDED [2EE5B] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296552.87,1280037.31 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 135.0 ft style Standard.Tag.2 visible True STRANDED [2EE5C] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296535.04,1280054.57 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 156.6 ft style Standard.Tag.2 visible True STRANDED [2EE5D] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296571.64,1280065.28 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 126.4 ft style Standard.Tag.2 visible True STRANDED [2EE5E] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296651.57,1280060.99 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 61.6 ft style Standard.Tag.2 visible True STRANDED [2EE60] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296773.03,1280079.81 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 113.0 ft style Standard.Tag.2 visible True STRANDED [2EE61] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296860.31,1280079.73 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 189.1 ft style Standard.Tag.2 visible True STRANDED [2EE62] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296941.09,1279982.87 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 257.5 ft style Standard.Tag.2 visible True STRANDED [2EE63] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296996.85,1279950.62 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 317.4 ft style Standard.Tag.2 visible True STRANDED [2EE64] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296980.45,1279912.31 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 311.0 ft style Standard.Tag.2 visible True STRANDED [2EE65] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296965.52,1279887.78 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 305.8 ft style Standard.Tag.2 visible True STRANDED [2EE66] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296918.05,1279963.66 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 237.6 ft style Standard.Tag.2 visible True STRANDED [2EE67] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296845.63,1280050.48 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 166.0 ft style Standard.Tag.2 visible True STRANDED [2EE68] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296768.29,1280041.48 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 89.4 ft style Standard.Tag.2 visible True STRANDED [2EE6C] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296564.17,1279983.76 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 123.4 ft style Standard.Tag.2 visible True STRANDED [2EEDB] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297123.55,1279799.74 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 92.7 ft style Standard.Tag.3 visible True STRANDED [2EEDC] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297267.74,1279644.76 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 125.6 ft style Standard.Tag.3 visible True STRANDED [2EEDD] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297354.05,1279619.45 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 201.1 ft style Standard.Tag.3 visible True STRANDED [2EEDE] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297432.87,1279620.14 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 265.0 ft style Standard.Tag.3 visible True STRANDED [2EEDF] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297347.85,1279598.41 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 211.3 ft style Standard.Tag.3 visible True STRANDED [2EEE0] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297251.22,1279628.20 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 133.3 ft style Standard.Tag.3 visible True STRANDED [2EEE1] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2297106.83,1279787.81 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 102.8 ft style Standard.Tag.3 visible True STRANDED [2EEE2] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296980.45,1279912.31 parent [2EED9] ParcelSegment centre 2297203.45,1279752.69 DISTANCE 274.2 ft style Standard.Tag.3 visible True STRANDED [2EEFD] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296428.19,1279937.76 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 266.4 ft style Standard.Tag.2 visible True STRANDED [2EEFE] ParcelSegmentLabel layer=SEWER_EASEMENT_TEXT label at 2296378.97,1279946.31 parent [2EE56] ParcelSegment centre 2296684.89,1280009.17 DISTANCE 312.3 ft style Standard.Tag.2 visible True civil labels on sewer/prop/easement layers: 37 stranded (>60ft from parent): 34
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.