← Inbox

C3D-0142 · Wider letter spacing + R/W dims onto ROAD-RW-TEXT [ROAD-LABELS-3] done

Redraws the curved Camellia Cir label with letter spacing widened from 0.62 to 0.95 times text height, since a curve crowds glyphs on the inside of the arc, and moves the IPF-to-centreline R/W dimensions onto ROAD-RW-TEXT. Records that SdskCurvedText cannot be created from a ticket: no managed wrapper and no registered .NET command produces one.

Script file
C3D-0142.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// Road labels: wider letter spacing on the curve, and the R/W dimensions moved to ROAD-RW-TEXT.
//
// TEXT-ALONG-CURVE - SETTLED, do not re-litigate: the proper entity is SdskCurvedText (DXF
// SDSK_CURVEDTEXT, app SDSK). It IS registered in this session but has NO managed .NET wrapper in
// any loaded assembly, and NO registered .NET command creates one (scanned every CommandMethod in
// every loaded assembly: only Map's MAPTEXT2ANN/MAPMTEXT2ANN/MAPLABEL2ANN matched, which convert
// existing text to annotation). Express Tools ARCTEXT/AcDbArcAlignedText is not registered here
// either. So a ticket CANNOT create curved text natively - one MText per character is the method.
//
// Letter spacing widened from 0.62*H to 0.95*H: on a curve the glyphs crowd together on the inside
// of the arc, so nominal advance is too tight.
const string LAYER = "ROAD_TEXT";
const string RW_LAYER = "ROAD-RW-TEXT";
const double H = 3.2;

var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 7);
EnsureLayer(RW_LAYER, 7);

// clear the previous label pass
int erased = 0;
var doomed = new List<ObjectId>();
foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e != null && !e.IsErased && e.Layer == LAYER) doomed.Add(id);
}
foreach (ObjectId id in doomed) { Tx.GetObject(id, OpenMode.ForWrite).Erase(); erased++; }
Log("erased " + erased + " previous ROAD_TEXT entities");

    {
        var mt = new MText { Location = new Point3d(2238197.8526, 1325215.0327, 0.0), Contents = @"SWEETBRIAR LN (50' R/W)",
            TextHeight = H, Rotation = -5.075729, Attachment = AttachmentPoint.MiddleCenter };
        mt.Layer = LAYER;
        ms.AppendEntity(mt); Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  SWEETBRIAR LN (50' R/W)");
    }
    {
        int n = 0;
        { var c = new MText { Location = new Point3d(2238299.9022, 1325222.5244, 0.0), Contents = @"C",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238302.2346, 1325220.5747, 0.0), Contents = @"A",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238304.5670, 1325218.6249, 0.0), Contents = @"M",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238306.8994, 1325216.6752, 0.0), Contents = @"E",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238309.2318, 1325214.7255, 0.0), Contents = @"L",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238311.5643, 1325212.7757, 0.0), Contents = @"L",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238313.8967, 1325210.8260, 0.0), Contents = @"I",
              TextHeight = H, Rotation = -0.696269, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238316.1854, 1325208.8289, 0.0), Contents = @"A",
              TextHeight = H, Rotation = -0.792437, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238320.4033, 1325204.4529, 0.0), Contents = @"C",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238322.3699, 1325202.1346, 0.0), Contents = @"I",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238324.3364, 1325199.8164, 0.0), Contents = @"R",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238328.2696, 1325195.1799, 0.0), Contents = @"(",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238330.2361, 1325192.8617, 0.0), Contents = @"5",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238332.2027, 1325190.5435, 0.0), Contents = @"0",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238334.1692, 1325188.2252, 0.0), Contents = @"'",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238338.1024, 1325183.5887, 0.0), Contents = @"R",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238340.0689, 1325181.2705, 0.0), Contents = @"/",
              TextHeight = H, Rotation = -0.867289, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238341.9273, 1325178.8650, 0.0), Contents = @"W",
              TextHeight = H, Rotation = -0.917049, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        { var c = new MText { Location = new Point3d(2238343.7761, 1325176.4518, 0.0), Contents = @")",
              TextHeight = H, Rotation = -0.917049, Attachment = AttachmentPoint.MiddleCenter };
          c.Layer = LAYER; ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true); n++; }
        Log("  CAMELLIA CIR (50' R/W) as " + n + " characters, spacing " + (H*0.95).ToString("F2"));
    }

// the IPF->centreline R/W dimensions belong on ROAD-RW-TEXT
int moved = 0;
foreach (ObjectId id in ms) {
    var ad = Tx.GetObject(id, OpenMode.ForRead) as AlignedDimension;
    if (ad == null || ad.IsErased) continue;
    if (ad.Layer == RW_LAYER) continue;
    var w = (AlignedDimension)Tx.GetObject(id, OpenMode.ForWrite);
    string was = w.Layer;
    w.Layer = RW_LAYER;
    moved++;
    Log(String.Format("  dim [{0}] {1:F2}  {2} -> {3}", w.Handle, w.Measurement, was, RW_LAYER));
}
Log("dimensions moved: " + moved);

int nText = 0, nDim = 0;
foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e == null || e.IsErased) continue;
    if (e.Layer == LAYER) nText++;
    if (e.Layer == RW_LAYER && e is AlignedDimension) nDim++;
}
Log("ROAD_TEXT: " + nText + " entities   ROAD-RW-TEXT: " + nDim + " dimensions (verified)");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
Message
Executed C3D-0142 (0 entities touched).
Entities
Duration
510 ms
Civil 3D
25.0.0.0

Log

erased 20 previous ROAD_TEXT entities
  SWEETBRIAR LN (50' R/W)
  CAMELLIA CIR (50' R/W) as 19 characters, spacing 3.04
  dim [20B12] 24.83  0 -> ROAD-RW-TEXT
  dim [20B20] 26.29  0 -> ROAD-RW-TEXT
  dim [20BDE] 24.44  0 -> ROAD-RW-TEXT
  dim [20BDF] 92.84  0 -> ROAD-RW-TEXT
dimensions moved: 4
ROAD_TEXT: 20 entities   ROAD-RW-TEXT: 4 dimensions (verified)

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.