C3D-0132 · READ-ONLY: existing IPF-to-CL annotations, IPF points, CL polylines [IPF-ANNO-READ] done
Finds the two existing IPF-to-centerline annotations with their entity type, layer, text, height, rotation and leader geometry, plus every IPF point and every centerline polyline, so a new recipe can reproduce the measurement and the exact annotation format. No changes.
C# payload
// READ-ONLY. Find the user's two existing IPF-to-centerline annotations so the new recipe copies
// their exact format: entity type, layer, text, height, rotation, and whether a leader is used.
// Also dumps the IPF points and the centerline polylines so the measurement can be reproduced.
// Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("drawing: " + Db.Filename);
Log("");
Log("=== TEXT / MTEXT / LEADERS (all layers) ===");
foreach (ObjectId id in ms) {
Autodesk.AutoCAD.DatabaseServices.DBObject o;
try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
var mt = o as MText;
var dt = o as DBText;
var ld = o as Leader;
var ml = o as MLeader;
if (mt == null && dt == null && ld == null && ml == null) continue;
if (mt != null)
Log(String.Format("MTEXT [{0}] layer={1} h={2:F2} rot={3:F2} at {4:F2},{5:F2} \"{6}\"",
o.Handle, ent.Layer, mt.TextHeight, mt.Rotation*180.0/Math.PI, mt.Location.X, mt.Location.Y,
mt.Contents));
else if (dt != null)
Log(String.Format("DBTEXT [{0}] layer={1} h={2:F2} rot={3:F2} at {4:F2},{5:F2} \"{6}\"",
o.Handle, ent.Layer, dt.Height, dt.Rotation*180.0/Math.PI, dt.Position.X, dt.Position.Y,
dt.TextString));
else if (ld != null)
Log(String.Format("LEADER [{0}] layer={1} verts={2} start {3:F2},{4:F2} end {5:F2},{6:F2} dimasz={7:F2}",
o.Handle, ent.Layer, ld.NumVertices, ld.VertexAt(0).X, ld.VertexAt(0).Y,
ld.VertexAt(ld.NumVertices-1).X, ld.VertexAt(ld.NumVertices-1).Y, ld.Dimasz));
else
Log(String.Format("MLEADER [{0}] layer={1} \"{2}\"", o.Handle, ent.Layer,
ml.MText != null ? ml.MText.Contents : "<no mtext>"));
}
Log("");
Log("=== IPF POINTS ===");
foreach (ObjectId id in ms) {
var cp = Tx.GetObject(id, OpenMode.ForRead) as CogoPoint;
if (cp == null) continue;
string d = "";
try { d = (cp.RawDescription ?? "").ToUpper(); } catch { }
if (d.IndexOf("IPF") < 0 && d.IndexOf("IPS") < 0 && d.IndexOf("RB") < 0) continue;
Log(String.Format(" pt {0} \"{1}\" {2:F3},{3:F3} layer={4}",
cp.PointNumber, cp.RawDescription, cp.Easting, cp.Northing, cp.Layer));
}
Log("");
Log("=== CENTERLINE POLYLINES ===");
foreach (ObjectId id in ms) {
var pl = Tx.GetObject(id, OpenMode.ForRead) as Polyline;
if (pl == null) continue;
if (pl.Layer.ToUpper().IndexOf("CNTR") < 0 && pl.Layer.ToUpper().IndexOf("-CL") < 0) continue;
Log(String.Format(" [{0}] {1} verts={2} len={3:F2}", pl.Handle, pl.Layer, pl.NumberOfVertices, pl.Length));
for (int i = 0; i < pl.NumberOfVertices; i++) {
var v = pl.GetPoint2dAt(i);
Log(String.Format(" V{0} {1:F3} {2:F3} bulge={3:F6}", i, v.X, v.Y, pl.GetBulgeAt(i)));
}
}
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
=== TEXT / MTEXT / LEADERS (all layers) ===
=== IPF POINTS ===
pt 103 "IPF 1\2 RB" 2238232.781,1325236.923 layer=0
pt 102 "IPF 1\2 RB" 2238191.234,1325128.856 layer=0
pt 101 "IPF 5\8 RB DISTRB" 2238288.113,1325091.887 layer=0
pt 100 "IPF 1\2 RB" 2238346.673,1325126.319 layer=0
=== CENTERLINE POLYLINES ===
[20AD7] SS-V-ROAD-CNTR verts=3 len=187.56
V0 2238231.973 1325302.376 bulge=0.000000
V1 2238219.061 1325270.812 bulge=0.000000
V2 2238164.524 1325127.377 bulge=0.000000
[20AD8] SS-V-ROAD-CNTR verts=8 len=191.85
V0 2238247.330 1325258.821 bulge=0.000000
V1 2238270.194 1325245.339 bulge=0.000000
V2 2238295.376 1325226.308 bulge=0.000000
V3 2238315.715 1325209.306 bulge=0.000000
V4 2238319.806 1325205.157 bulge=0.000000
V5 2238340.228 1325181.083 bulge=0.000000
V6 2238356.693 1325159.592 bulge=0.000000
V7 2238377.480 1325122.216 bulge=0.000000Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.