C3D-0179 · Land lot markers: L.L. 3 west, L.L. 4 east [LL-MARKERS-2] done
Places two double-circle land lot markers straddling the LAND_LOT_LINE at its midpoint, offset 25 feet each side - L.L. 3 west, L.L. 4 east - with circle radii following the drawing existing symbols and text at the 4.0 annotation height. Idempotent and verifies the result.
C# payload
// Two land lot markers straddling the land lot line: L.L. 3 west, L.L. 4 east.
//
// The line is 2FA8F on layer LAND_LOT_LINE, running due north-south at a constant
// X = 2296402.372 from Y 1279678.207 to 1280597.609 (919.40 ft). Constant X means WEST is the
// smaller X and EAST the larger, so the markers sit at X -/+ an offset either side of it.
//
// Marker form copied from the drawing's existing double-circle symbols (PDF2_E IPF-SET and
// SS-0-FRAME both use a concentric pair r=0.938 / r=1.271): two circles plus "L.L." over the
// number, centred. Scaled up here so it reads at the land-lot line's scale.
//
// Placed at the line's MIDPOINT height, offset 25 ft to each side.
// Idempotent: bails if an L.L. marker already exists on the target layer.
const string LAYER = "LAND_LOT_LINE";
const double R_IN = 9.38; // 10x the existing symbol, to match the 4.0-height annotation scale
const double R_OUT = 12.71;
const double TXT_H = 4.0; // same height as the APPROXIMATE LAND LOT LINE annotation
const double OFFSET = 25.0; // how far either side of the line
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
Log("drawing: " + Db.Filename);
EnsureLayer(LAYER, 7);
// find the land lot line by handle, and fall back to the layer if it moved
Line ll = null;
foreach (ObjectId id in ms) {
var o = Tx.GetObject(id, OpenMode.ForRead);
if (o.Handle.ToString() == "2FA8F") { ll = o as Line; break; }
}
if (ll == null) {
foreach (ObjectId id in ms) {
var l = Tx.GetObject(id, OpenMode.ForRead) as Line;
if (l != null && l.Layer == LAYER) { ll = l; break; }
}
}
if (ll == null) { Log("ABORT: land lot line not found"); return; }
Log(String.Format("land lot line [{0}] {1:F3},{2:F3} -> {3:F3},{4:F3} len={5:F2}",
ll.Handle, ll.StartPoint.X, ll.StartPoint.Y, ll.EndPoint.X, ll.EndPoint.Y, ll.Length));
// idempotency
foreach (ObjectId id in ms) {
var t = Tx.GetObject(id, OpenMode.ForRead) as MText;
if (t != null && !t.IsErased && t.Layer == LAYER && t.Contents.IndexOf("L.L.") >= 0) {
Log("an L.L. marker already exists on " + LAYER + " - nothing to do");
return;
}
}
// midpoint of the line, and the perpendicular direction
double mx = (ll.StartPoint.X + ll.EndPoint.X) / 2.0;
double my = (ll.StartPoint.Y + ll.EndPoint.Y) / 2.0;
double dx = ll.EndPoint.X - ll.StartPoint.X, dy = ll.EndPoint.Y - ll.StartPoint.Y;
double len = Math.Sqrt(dx*dx + dy*dy);
double px = -dy/len, py = dx/len; // unit perpendicular
if (px < 0) { px = -px; py = -py; } // make +perp point EAST (increasing X)
Action<double,double,string> marker = (cx, cy, label) => {
var c1 = new Circle(new Point3d(cx, cy, 0), Vector3d.ZAxis, R_IN);
c1.Layer = LAYER; ms.AppendEntity(c1); Tx.AddNewlyCreatedDBObject(c1, true);
var c2 = new Circle(new Point3d(cx, cy, 0), Vector3d.ZAxis, R_OUT);
c2.Layer = LAYER; ms.AppendEntity(c2); Tx.AddNewlyCreatedDBObject(c2, true);
var t = new MText {
Location = new Point3d(cx, cy, 0),
Contents = @"L.L.\P" + label,
TextHeight = TXT_H,
Attachment = AttachmentPoint.MiddleCenter,
};
t.Layer = LAYER;
ms.AppendEntity(t); Tx.AddNewlyCreatedDBObject(t, true);
Log(String.Format(" L.L. {0} at {1:F3},{2:F3} circles r={3:F2}/{4:F2}", label, cx, cy, R_IN, R_OUT));
};
marker(mx - px*OFFSET, my - py*OFFSET, "3"); // WEST side
marker(mx + px*OFFSET, my + py*OFFSET, "4"); // EAST side
// verify
int circles = 0, texts = 0;
foreach (ObjectId id in ms) {
var o = Tx.GetObject(id, OpenMode.ForRead);
var e = o as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null || e.IsErased || e.Layer != LAYER) continue;
if (o is Circle) circles++;
var t = o as MText;
if (t != null && t.Contents.IndexOf("L.L.") >= 0) texts++;
}
Log("");
Log("on " + LAYER + ": " + circles + " circles, " + texts + " L.L. labels (verified)");
Ed.Regen();
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-C-Store Sewer As-Built.dwg land lot line [2FA8F] 2296402.372,1280597.609 -> 2296402.372,1279678.207 len=919.40 L.L. 3 at 2296377.372,1280137.908 circles r=9.38/12.71 L.L. 4 at 2296427.372,1280137.908 circles r=9.38/12.71 on LAND_LOT_LINE: 4 circles, 2 L.L. labels (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.