C3D-0019 · Tie line 378 to HC07-06 (150ft, arrow at origin) [TIE-378-150] done
Redraws the 378 -> HC07-06 control tie as a 150ft stub with the arrowhead at the ORIGIN end. Label carries the true computed distance of 9725.42 ft. Erases the previous 120ft version.
C# payload
// Control tie: point 378 (SSMH A6) -> point 675 (HC07-06). REDRAWN at 150ft with the
// ARROWHEAD AT THE ORIGIN end per the user (the first attempt put it at the control end and
// used a 120ft stub).
//
// Leader vertices run CONTROL-end -> ORIGIN so the arrowhead lands on the origin.
// Bearing/distance computed from the surveyed coordinates; the tie is stubbed (true tie is
// 9725ft and would run far off the sheet) but the label carries the REAL distance.
//
// S43d 30' 29"E 9725.42 TO CC HC07-06
//
// Erases the previous 120ft tie first so they do not stack.
// Host owns Tx; host regens after commit.
const string LLAYER = "V-CTRL-LINE-SHOT", TLAYER = "V-CTRL-TEXT";
const double H = 4.0;
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LLAYER, 45);
EnsureLayer(TLAYER, 7);
int erased = 0;
foreach (ObjectId id in ms)
{
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null) continue;
if (e.Layer != LLAYER && e.Layer != TLAYER) continue;
if (!(e is Leader) && !(e is MText)) continue;
var mt0 = e as MText;
if (mt0 != null && !(mt0.Contents ?? "").Contains("TO CC")) continue;
var w = (Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id, OpenMode.ForWrite);
w.Erase(); erased++;
}
Log("erased " + erased + " previous tie entit(ies)");
var ld = new Leader();
ld.AppendVertex(new Point3d(2296930.517, 1279987.202, 0.0)); // control end - tail
ld.AppendVertex(new Point3d(2296827.248, 1280095.994, 0.0)); // origin end - ARROWHEAD
ld.HasArrowHead = true;
ld.Layer = LLAYER;
ms.AppendEntity(ld);
Tx.AddNewlyCreatedDBObject(ld, true);
var mt = new MText {
Location = new Point3d(2296878.882, 1280041.598, 0.0),
Contents = @"S43\U+00B0 30' 29""E 9725.42 TO CC HC07-06",
TextHeight = H,
Rotation = -0.811437,
Attachment = AttachmentPoint.BottomCenter,
};
mt.Layer = TLAYER;
ms.AppendEntity(mt);
Tx.AddNewlyCreatedDBObject(mt, true);
Log("tie 378 -> HC07-06: 150 ft stub, arrowhead at the ORIGIN, true distance 9725.42 ft");
Log(" " + mt.Contents);
Result
Log
erased 1 previous tie entit(ies) tie 378 -> HC07-06: 150 ft stub, arrowhead at the ORIGIN, true distance 9725.42 ft S43\U+00B0 30' 29"E 9725.42 TO CC HC07-06
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.