← Inbox

C3D-LW-TBC · Linework: back of curb done

Draws 7 back-of-curb polylines on SS-ROAD-TBC from 184 TBC-family points, 60ft break threshold (chosen by testing 25/40/60/80/120).

Script file
C3D-LW-TBC.cs
Target
SS_BLOCK_22X17 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// Back-of-curb linework -> SS-ROAD-TBC.
// 184 TBC-family points chained nearest-neighbour from the outermost point, breaking a run when
// the next-nearest point is more than 60ft away. That threshold was chosen by testing 25/40/60/
// 80/120ft: 60 gives 7 runs using 182 of 184 points with only 2 runs under 30ft. Tighter
// fragments real curb, wider merges separate curbs into one polyline.
// Regular Polyline, never Polyline3d (cookbook 11). Host owns Tx; host regens after commit.
const string LAYER = "SS-ROAD-TBC";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 3);

    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296725.56, 1280274.02), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296737.01, 1280271.15), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296743.82, 1280264.95), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296748.26, 1280252.73), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296746.81, 1280248.86), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296742.13, 1280245.67), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296790.3, 1280252.25), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296790.34, 1280252.37), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296791.26, 1280258.04), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296792.5, 1280261.07), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296792.8, 1280261.69), 0, 0, 0);
        pl.AddVertexAt(11, new Point2d(2296795.65, 1280265.77), 0, 0, 0);
        pl.AddVertexAt(12, new Point2d(2296797.93, 1280267.97), 0, 0, 0);
        pl.AddVertexAt(13, new Point2d(2296800.58, 1280270.02), 0, 0, 0);
        pl.AddVertexAt(14, new Point2d(2296806.21, 1280272.51), 0, 0, 0);
        pl.AddVertexAt(15, new Point2d(2296806.52, 1280272.48), 0, 0, 0);
        pl.AddVertexAt(16, new Point2d(2296814.9, 1280274.57), 0, 0, 0);
        pl.AddVertexAt(17, new Point2d(2296814.96, 1280274.55), 0, 0, 0);
        pl.AddVertexAt(18, new Point2d(2296816.39, 1280275.0), 0, 0, 0);
        pl.AddVertexAt(19, new Point2d(2296816.5, 1280274.91), 0, 0, 0);
        pl.AddVertexAt(20, new Point2d(2296802.06, 1280240.29), 0, 0, 0);
        pl.AddVertexAt(21, new Point2d(2296802.11, 1280240.22), 0, 0, 0);
        pl.AddVertexAt(22, new Point2d(2296797.9, 1280241.58), 0, 0, 0);
        pl.AddVertexAt(23, new Point2d(2296793.3, 1280244.25), 0, 0, 0);
        pl.AddVertexAt(24, new Point2d(2296793.28, 1280244.33), 0, 0, 0);
        pl.AddVertexAt(25, new Point2d(2296791.58, 1280246.63), 0, 0, 0);
        pl.AddVertexAt(26, new Point2d(2296817.1, 1280237.1), 0, 0, 0);
        pl.AddVertexAt(27, new Point2d(2296817.11, 1280237.03), 0, 0, 0);
        pl.AddVertexAt(28, new Point2d(2296817.09, 1280214.91), 0, 0, 0);
        pl.AddVertexAt(29, new Point2d(2296817.0, 1280198.59), 0, 0, 0);
        pl.AddVertexAt(30, new Point2d(2296816.97, 1280184.92), 0, 0, 0);
        pl.AddVertexAt(31, new Point2d(2296816.83, 1280166.31), 0, 0, 0);
        pl.AddVertexAt(32, new Point2d(2296816.86, 1280166.23), 0, 0, 0);
        pl.AddVertexAt(33, new Point2d(2296806.46, 1280166.26), 0, 0, 0);
        pl.AddVertexAt(34, new Point2d(2296802.75, 1280166.15), 0, 0, 0);
        pl.AddVertexAt(35, new Point2d(2296802.24, 1280166.1), 0, 0, 0);
        pl.AddVertexAt(36, new Point2d(2296801.81, 1280166.08), 0, 0, 0);
        pl.AddVertexAt(37, new Point2d(2296801.05, 1280165.71), 0, 0, 0);
        pl.AddVertexAt(38, new Point2d(2296800.19, 1280165.35), 0, 0, 0);
        pl.AddVertexAt(39, new Point2d(2296799.66, 1280164.65), 0, 0, 0);
        pl.AddVertexAt(40, new Point2d(2296799.39, 1280163.78), 0, 0, 0);
        pl.AddVertexAt(41, new Point2d(2296799.41, 1280163.71), 0, 0, 0);
        pl.AddVertexAt(42, new Point2d(2296799.3, 1280162.84), 0, 0, 0);
        pl.AddVertexAt(43, new Point2d(2296799.36, 1280162.66), 0, 0, 0);
        pl.AddVertexAt(44, new Point2d(2296799.11, 1280154.65), 0, 0, 0);
        pl.AddVertexAt(45, new Point2d(2296799.08, 1280154.55), 0, 0, 0);
        pl.AddVertexAt(46, new Point2d(2296799.0, 1280154.54), 0, 0, 0);
        pl.AddVertexAt(47, new Point2d(2296776.75, 1280154.82), 0, 0, 0);
        pl.AddVertexAt(48, new Point2d(2296776.67, 1280151.84), 0, 0, 0);
        pl.AddVertexAt(49, new Point2d(2296776.69, 1280151.76), 0, 0, 0);
        pl.AddVertexAt(50, new Point2d(2296776.66, 1280151.7), 0, 0, 0);
        pl.AddVertexAt(51, new Point2d(2296761.66, 1280154.93), 0, 0, 0);
        pl.AddVertexAt(52, new Point2d(2296761.57, 1280154.84), 0, 0, 0);
        pl.AddVertexAt(53, new Point2d(2296759.32, 1280153.62), 0, 0, 0);
        pl.AddVertexAt(54, new Point2d(2296759.26, 1280153.4), 0, 0, 0);
        pl.AddVertexAt(55, new Point2d(2296758.52, 1280151.75), 0, 0, 0);
        pl.AddVertexAt(56, new Point2d(2296758.56, 1280151.68), 0, 0, 0);
        pl.AddVertexAt(57, new Point2d(2296758.83, 1280146.64), 0, 0, 0);
        pl.AddVertexAt(58, new Point2d(2296758.83, 1280146.4), 0, 0, 0);
        pl.AddVertexAt(59, new Point2d(2296759.23, 1280145.18), 0, 0, 0);
        pl.AddVertexAt(60, new Point2d(2296759.3, 1280145.1), 0, 0, 0);
        pl.AddVertexAt(61, new Point2d(2296761.2, 1280144.15), 0, 0, 0);
        pl.AddVertexAt(62, new Point2d(2296761.2, 1280144.09), 0, 0, 0);
        pl.AddVertexAt(63, new Point2d(2296762.92, 1280144.62), 0, 0, 0);
        pl.AddVertexAt(64, new Point2d(2296762.95, 1280144.64), 0, 0, 0);
        pl.AddVertexAt(65, new Point2d(2296765.5, 1280120.09), 0, 0, 0);
        pl.AddVertexAt(66, new Point2d(2296765.24, 1280119.69), 0, 0, 0);
        pl.AddVertexAt(67, new Point2d(2296787.3, 1280133.17), 0, 0, 0);
        pl.AddVertexAt(68, new Point2d(2296787.63, 1280133.24), 0, 0, 0);
        pl.AddVertexAt(69, new Point2d(2296737.44, 1280136.47), 0, 0, 0);
        pl.AddVertexAt(70, new Point2d(2296734.99, 1280136.45), 0, 0, 0);
        pl.AddVertexAt(71, new Point2d(2296734.65, 1280148.2), 0, 0, 0);
        pl.AddVertexAt(72, new Point2d(2296735.96, 1280150.46), 0, 0, 0);
        pl.AddVertexAt(73, new Point2d(2296737.49, 1280148.36), 0, 0, 0);
        pl.AddVertexAt(74, new Point2d(2296747.74, 1280099.76), 0, 0, 0);
        pl.AddVertexAt(75, new Point2d(2296745.18, 1280082.39), 0, 0, 0);
        pl.AddVertexAt(76, new Point2d(2296745.1, 1280082.35), 0, 0, 0);
        pl.AddVertexAt(77, new Point2d(2296715.57, 1280082.51), 0, 0, 0);
        pl.AddVertexAt(78, new Point2d(2296691.92, 1280077.44), 0, 0, 0);
        pl.AddVertexAt(79, new Point2d(2296691.63, 1280060.39), 0, 0, 0);
        pl.AddVertexAt(80, new Point2d(2296693.28, 1280058.71), 0, 0, 0);
        pl.AddVertexAt(81, new Point2d(2296694.65, 1280058.97), 0, 0, 0);
        pl.AddVertexAt(82, new Point2d(2296695.68, 1280059.56), 0, 0, 0);
        pl.AddVertexAt(83, new Point2d(2296698.41, 1280038.01), 0, 0, 0);
        pl.AddVertexAt(84, new Point2d(2296698.45, 1280037.89), 0, 0, 0);
        pl.AddVertexAt(85, new Point2d(2296698.55, 1280037.93), 0, 0, 0);
        pl.AddVertexAt(86, new Point2d(2296689.46, 1280037.23), 0, 0, 0);
        pl.AddVertexAt(87, new Point2d(2296688.62, 1280036.82), 0, 0, 0);
        pl.AddVertexAt(88, new Point2d(2296686.3, 1280035.65), 0, 0, 0);
        pl.AddVertexAt(89, new Point2d(2296685.69, 1280034.91), 0, 0, 0);
        pl.AddVertexAt(90, new Point2d(2296684.6, 1280032.42), 0, 0, 0);
        pl.AddVertexAt(91, new Point2d(2296684.55, 1280032.4), 0, 0, 0);
        pl.AddVertexAt(92, new Point2d(2296683.75, 1280021.51), 0, 0, 0);
        pl.AddVertexAt(93, new Point2d(2296683.83, 1280021.42), 0, 0, 0);
        pl.AddVertexAt(94, new Point2d(2296720.27, 1280058.54), 0, 0, 0);
        pl.Elevation = 729.53;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 1: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296480.01, 1279993.48), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296485.66, 1279990.19), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296490.19, 1279994.12), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296490.28, 1280009.87), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296479.87, 1280009.68), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296509.58, 1280009.91), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296526.79, 1280009.91), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296552.82, 1280009.06), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296552.89, 1280009.9), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296557.78, 1280009.95), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296557.79, 1280009.01), 0, 0, 0);
        pl.AddVertexAt(11, new Point2d(2296557.87, 1280014.02), 0, 0, 0);
        pl.AddVertexAt(12, new Point2d(2296557.55, 1279995.0), 0, 0, 0);
        pl.AddVertexAt(13, new Point2d(2296554.91, 1279991.13), 0, 0, 0);
        pl.AddVertexAt(14, new Point2d(2296552.55, 1279995.27), 0, 0, 0);
        pl.AddVertexAt(15, new Point2d(2296576.99, 1279960.46), 0, 0, 0);
        pl.AddVertexAt(16, new Point2d(2296584.61, 1279960.44), 0, 0, 0);
        pl.AddVertexAt(17, new Point2d(2296587.67, 1279960.73), 0, 0, 0);
        pl.AddVertexAt(18, new Point2d(2296594.69, 1279963.62), 0, 0, 0);
        pl.AddVertexAt(19, new Point2d(2296599.65, 1279968.6), 0, 0, 0);
        pl.AddVertexAt(20, new Point2d(2296601.75, 1279973.64), 0, 0, 0);
        pl.AddVertexAt(21, new Point2d(2296602.15, 1279994.07), 0, 0, 0);
        pl.AddVertexAt(22, new Point2d(2296606.77, 1280023.0), 0, 0, 0);
        pl.AddVertexAt(23, new Point2d(2296607.05, 1280034.86), 0, 0, 0);
        pl.AddVertexAt(24, new Point2d(2296604.66, 1280037.33), 0, 0, 0);
        pl.AddVertexAt(25, new Point2d(2296602.38, 1280034.9), 0, 0, 0);
        pl.AddVertexAt(26, new Point2d(2296615.49, 1280062.16), 0, 0, 0);
        pl.AddVertexAt(27, new Point2d(2296614.2, 1280063.16), 0, 0, 0);
        pl.AddVertexAt(28, new Point2d(2296617.11, 1280062.39), 0, 0, 0);
        pl.AddVertexAt(29, new Point2d(2296617.73, 1280063.13), 0, 0, 0);
        pl.AddVertexAt(30, new Point2d(2296617.63, 1280068.68), 0, 0, 0);
        pl.AddVertexAt(31, new Point2d(2296617.82, 1280077.63), 0, 0, 0);
        pl.AddVertexAt(32, new Point2d(2296596.61, 1280068.29), 0, 0, 0);
        pl.AddVertexAt(33, new Point2d(2296591.99, 1280072.37), 0, 0, 0);
        pl.AddVertexAt(34, new Point2d(2296590.22, 1280077.63), 0, 0, 0);
        pl.AddVertexAt(35, new Point2d(2296562.3, 1280056.16), 0, 0, 0);
        pl.Elevation = 730.01;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 2: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296562.15, 1280126.98), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296562.12, 1280135.01), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296590.56, 1280136.58), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296595.08, 1280136.55), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296590.59, 1280131.47), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296595.15, 1280147.52), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296590.71, 1280148.44), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296592.56, 1280151.8), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296562.25, 1280195.59), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296562.18, 1280197.26), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296561.7, 1280198.67), 0, 0, 0);
        pl.AddVertexAt(11, new Point2d(2296557.85, 1280200.47), 0, 0, 0);
        pl.AddVertexAt(12, new Point2d(2296576.48, 1280230.34), 0, 0, 0);
        pl.AddVertexAt(13, new Point2d(2296580.22, 1280227.74), 0, 0, 0);
        pl.AddVertexAt(14, new Point2d(2296583.8, 1280229.12), 0, 0, 0);
        pl.AddVertexAt(15, new Point2d(2296584.54, 1280231.41), 0, 0, 0);
        pl.AddVertexAt(16, new Point2d(2296584.57, 1280245.39), 0, 0, 0);
        pl.AddVertexAt(17, new Point2d(2296584.61, 1280245.84), 0, 0, 0);
        pl.AddVertexAt(18, new Point2d(2296576.47, 1280245.81), 0, 0, 0);
        pl.AddVertexAt(19, new Point2d(2296558.5, 1280275.96), 0, 0, 0);
        pl.AddVertexAt(20, new Point2d(2296554.44, 1280323.42), 0, 0, 0);
        pl.AddVertexAt(21, new Point2d(2296554.79, 1280326.43), 0, 0, 0);
        pl.Elevation = 731.59;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 3: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296363.42, 1279929.09), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296372.02, 1279950.41), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296374.61, 1279955.02), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296379.07, 1279958.65), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296387.02, 1279960.81), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296394.86, 1279961.82), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296395.16, 1279993.98), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296392.63, 1279995.13), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296384.27, 1280000.92), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296373.9, 1280013.66), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296415.75, 1280009.0), 0, 0, 0);
        pl.AddVertexAt(11, new Point2d(2296415.68, 1279992.09), 0, 0, 0);
        pl.Elevation = 748.30;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 4: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296795.75, 1280320.9), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296795.69, 1280323.8), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296808.17, 1280323.86), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296808.03, 1280320.84), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296866.71, 1280321.77), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296866.67, 1280324.82), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296900.69, 1280325.75), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296901.7, 1280325.86), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296901.47, 1280322.79), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296900.83, 1280322.76), 0, 0, 0);
        pl.Elevation = 731.91;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 5: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296965.01, 1280327.59), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296964.74, 1280330.58), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296972.76, 1280331.13), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296973.23, 1280328.13), 0, 0, 0);
        pl.Elevation = 727.49;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 6: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296456.54, 1280327.77), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296454.33, 1280325.94), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296456.33, 1280324.64), 0, 0, 0);
        pl.Elevation = 741.44;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 7: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }

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 == LAYER && e is Polyline) { n++; tot += ((Polyline)e).Length; }
}
Log("SS-ROAD-TBC now holds " + n + " polyline(s), " + tot.ToString("F0") + " ft total (verified)");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\SS_BLOCK_22X17.dwg
Message
Executed C3D-LW-TBC (0 entities touched).
Entities
Duration
328 ms
Civil 3D
25.0.0.0

Log

  run 1: 95 verts, 728.6 ft
  run 2: 36 verts, 414.0 ft
  run 3: 22 verts, 287.9 ft
  run 4: 12 verts, 170.7 ft
  run 5: 10 verts, 118.9 ft
  run 6: 4 verts, 14.1 ft
  run 7: 3 verts, 5.3 ft
SS-ROAD-TBC now holds 7 polyline(s), 1739 ft total (verified)

Notes

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

No notes yet.