C3D-0030 · Read SEWER_LINE geometry [SEW-LINES] done
Read-only: every entity on SEWER_LINE with endpoints and length, to place a length label on each.
C# payload
// READ-ONLY: current SEWER_LINE geometry, so a length label can be put on each line.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
int n = 0; double tot = 0;
foreach (ObjectId id in ms)
{
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null || e.Layer != "SEWER_LINE") continue;
var ln = e as Line;
if (ln != null) {
n++; tot += ln.Length;
Log("LINE|" + e.Handle + "|" + ln.StartPoint.X.ToString("F3") + "|" + ln.StartPoint.Y.ToString("F3") +
"|" + ln.EndPoint.X.ToString("F3") + "|" + ln.EndPoint.Y.ToString("F3") + "|" + ln.Length.ToString("F2"));
continue;
}
var pl = e as Polyline;
if (pl != null) {
n++; tot += pl.Length;
Log("PLINE|" + e.Handle + "|verts=" + pl.NumberOfVertices + "|len=" + pl.Length.ToString("F2"));
continue;
}
Log("OTHER|" + e.GetType().Name + "|" + e.Handle);
}
Log("total " + n + " entit(ies), " + tot.ToString("F2") + " ft");
Result
Log
LINE|2E95F|2296651.991|1280058.103|2296651.969|1280046.037|12.07 LINE|2EC86|2296379.845|1279953.525|2296511.251|1279951.450|132.52 LINE|2EC87|2296511.251|1279951.450|2296604.647|1280046.202|133.21 LINE|2EC88|2296549.935|1280052.775|2296604.647|1280046.202|55.14 LINE|2EC89|2296604.647|1280046.202|2296690.956|1280045.901|86.31 LINE|2EC8A|2296690.956|1280045.901|2296714.067|1280025.298|30.97 LINE|2EC8B|2296714.067|1280025.298|2296827.248|1280095.994|133.46 LINE|2EC8C|2296827.248|1280095.994|2296878.692|1280034.217|80.46 LINE|2EC8D|2296878.692|1280034.217|2296980.451|1279912.310|161.58 LINE|2EC8E|2296980.451|1279912.310|2297249.930|1279675.241|359.02 LINE|2EC8F|2297249.930|1279675.241|2297269.034|1279597.724|80.02 LINE|2EC90|2297269.034|1279597.724|2297422.962|1279618.776|155.37 LINE|2EC91|2297422.962|1279618.776|2297424.707|1279599.322|19.54 LINE|2EC92|2296685.187|1280052.355|2296690.956|1280045.901|8.66 total 14 entit(ies), 1448.33 ft
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.