C3D-TBCREDRAW2 · Redraw TBC curb polylines done
Erases any leftover Spline/Polyline3d on SS-V-ROAD-CURB then redraws the 33 straight-chord TBC curb polylines from surveyed points. Same script structure as the two successful runs today (C3D-TBCFIX, C3D-TBCRESTORE) - matches DrawingContext/ScriptRunner contract exactly, no transaction wrapping.
C# payload
// Erase the 33 squiggly splines (and any leftover Polyline3d) I drew on SS-V-ROAD-CURB, then redraw
// the back-of-curb linework the original way: straight-chord 3D polylines through the surveyed TBC
// points. Only Spline/Polyline3d entities are touched - none existed on this layer before my runs;
// the pre-existing Lines/Polylines/FeatureLines/dimensions/hatch/wipeout are left alone.
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
const string LAYER = "SS-V-ROAD-CURB";
// 1) erase my Spline + Polyline3d entities on the layer
var toErase = new List<ObjectId>();
foreach (ObjectId id in ModelSpace)
{
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null || ent.Layer != LAYER) continue;
if (ent is Spline || ent is Polyline3d) toErase.Add(id);
}
foreach (var id in toErase)
{
var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id, OpenMode.ForWrite);
ent.Erase();
}
Log($"Erased {toErase.Count} Spline/Polyline3d entities on '{LAYER}'.");
// 2) redraw straight-chord 3D polylines
var chains = new List<List<(double e,double n,double z,int pn)>> {
new List<(double,double,double,int)> { (2428141.27,1064465.53,419.67,100), (2428155.49,1064483.51,419.62,101), (2428140.24,1064495.49,419.42,102), (2428120.84,1064510.89,419.21,103), (2428135.26,1064529.86,418.86,106) },
new List<(double,double,double,int)> { (2428098.86,1064560.50,418.40,110), (2428091.49,1064551.49,418.69,111), (2428079.18,1064561.72,418.58,112), (2428085.57,1064577.81,418.24,113) },
new List<(double,double,double,int)> { (2427895.79,1064547.77,416.46,121), (2427882.98,1064542.33,416.12,122), (2427874.91,1064538.07,416.07,123), (2427867.87,1064532.18,416.07,124), (2427861.73,1064525.29,416.09,125), (2427858.35,1064519.93,416.01,126), (2427856.27,1064513.03,415.95,127), (2427855.39,1064505.01,416.00,128) },
new List<(double,double,double,int)> { (2427983.53,1064712.47,414.40,194), (2428020.90,1064724.69,414.42,197), (2428008.08,1064735.69,413.91,198), (2428006.69,1064736.85,413.94,199), (2428006.52,1064737.65,413.95,200), (2428007.29,1064738.85,413.92,201), (2428015.32,1064741.53,413.97,202), (2428016.97,1064742.06,413.66,203) },
new List<(double,double,double,int)> { (2428023.77,1064744.33,414.12,205), (2428026.93,1064744.86,414.11,206) },
new List<(double,double,double,int)> { (2428041.49,1064735.59,414.34,221), (2428044.86,1064725.90,414.46,222) },
new List<(double,double,double,int)> { (2428065.81,1064742.28,414.90,228), (2428064.90,1064745.65,414.86,229), (2428065.02,1064749.50,414.83,230), (2428065.79,1064752.96,414.82,231), (2428068.06,1064756.47,414.82,232), (2428071.04,1064759.09,414.88,233), (2428074.01,1064760.75,414.94,234), (2428076.77,1064761.61,414.49,235) },
new List<(double,double,double,int)> { (2428083.96,1064764.03,414.93,238), (2428085.24,1064764.34,414.99,239), (2428086.49,1064764.16,415.00,240), (2428087.99,1064763.12,415.05,241), (2428101.83,1064751.20,415.39,244), (2428127.60,1064759.62,415.48,246), (2428138.78,1064763.40,415.48,248), (2428169.43,1064773.43,415.42,249) },
new List<(double,double,double,int)> { (2428059.46,1064777.83,414.48,260), (2428077.72,1064783.77,414.69,262), (2428079.13,1064784.56,414.72,263), (2428080.09,1064786.08,414.64,264), (2428084.09,1064804.57,414.28,265), (2428109.64,1064812.98,414.08,267), (2428109.64,1064812.99,414.09,268) },
new List<(double,double,double,int)> { (2428152.42,1064827.01,413.63,281), (2428152.06,1064835.18,413.32,282) },
new List<(double,double,double,int)> { (2428107.41,1064820.85,413.68,283), (2428078.81,1064811.77,413.91,284), (2428083.07,1064828.08,414.26,285), (2428083.33,1064829.62,414.24,286), (2428082.77,1064830.79,414.30,287), (2428081.48,1064830.77,414.33,288), (2428078.49,1064829.76,414.27,289), (2428061.11,1064824.00,413.96,290) },
new List<(double,double,double,int)> { (2428052.68,1064821.24,414.30,293), (2428032.28,1064814.49,414.27,294), (2428005.85,1064805.69,414.13,302), (2428001.48,1064804.29,413.63,303) },
new List<(double,double,double,int)> { (2427994.88,1064802.03,413.88,307), (2427993.63,1064801.33,413.88,308), (2427992.50,1064798.88,413.80,309), (2427988.27,1064781.44,413.36,311), (2427960.05,1064772.15,413.19,312) },
new List<(double,double,double,int)> { (2427993.49,1064774.78,413.38,314), (2427991.78,1064758.28,413.90,315), (2427991.59,1064756.71,413.97,316), (2427991.96,1064756.00,413.95,317), (2427993.03,1064755.76,413.97,318), (2428008.34,1064760.94,414.10,320), (2428010.92,1064761.89,413.71,321) },
new List<(double,double,double,int)> { (2428017.25,1064763.88,414.12,324), (2428040.34,1064771.62,414.33,326) },
new List<(double,double,double,int)> { (2427983.14,1064820.25,414.09,327), (2427997.98,1064825.25,414.38,328), (2428002.16,1064828.13,414.58,329), (2428005.99,1064834.33,414.76,330), (2428006.28,1064841.54,414.89,331), (2428029.67,1064852.22,414.39,332), (2428032.62,1064846.16,414.63,333), (2428039.63,1064841.75,414.87,334), (2428047.46,1064841.69,414.99,335), (2428050.31,1064842.41,414.66,336), (2428055.03,1064844.02,414.55,337), (2428057.14,1064844.58,414.88,338), (2428063.74,1064846.84,414.85,339), (2428064.85,1064847.62,414.85,340), (2428064.48,1064848.86,414.82,341) },
new List<(double,double,double,int)> { (2427933.18,1064803.66,413.70,394), (2427929.40,1064801.64,413.58,395), (2427926.51,1064799.26,413.50,396), (2427924.60,1064795.15,413.43,397), (2427922.03,1064786.80,413.26,398), (2427921.24,1064783.71,413.15,399), (2427919.51,1064779.37,413.08,400), (2427916.02,1064774.30,412.93,401), (2427910.85,1064769.24,412.79,402), (2427905.40,1064765.83,412.76,403), (2427898.75,1064762.73,412.80,404), (2427910.69,1064736.98,412.49,406), (2427917.61,1064737.48,412.54,407), (2427923.57,1064736.35,412.81,408), (2427928.00,1064733.99,412.97,409), (2427931.55,1064731.19,413.19,410), (2427932.71,1064730.11,412.90,411) },
new List<(double,double,double,int)> { (2427885.49,1064728.61,412.44,425), (2427874.24,1064754.19,412.31,427), (2427849.69,1064745.92,412.18,428), (2427844.26,1064745.94,412.12,429), (2427841.50,1064745.22,412.12,430), (2427837.64,1064741.72,412.26,432), (2427860.95,1064720.25,412.19,434), (2427854.50,1064716.22,412.26,435), (2427851.46,1064715.28,412.32,436), (2427844.83,1064714.61,412.25,438), (2427813.34,1064704.03,412.86,451), (2427802.47,1064729.82,412.92,453), (2427791.46,1064726.06,413.04,456), (2427783.52,1064723.99,413.13,457), (2427777.48,1064723.66,413.27,458), (2427773.15,1064724.37,413.24,459), (2427764.13,1064728.77,413.43,460), (2427758.45,1064735.04,413.66,461), (2427733.10,1064718.22,413.85,464) },
new List<(double,double,double,int)> { (2427753.24,1064651.18,413.08,465), (2427780.03,1064659.69,412.98,467), (2427787.70,1064664.28,413.87,468), (2427797.62,1064698.52,413.07,470), (2427789.95,1064695.15,413.11,471), (2427783.77,1064690.42,413.23,472), (2427778.67,1064681.78,413.23,473), (2427777.46,1064677.38,413.11,474), (2427777.43,1064670.38,413.03,475), (2427778.32,1064665.46,412.95,476) },
new List<(double,double,double,int)> { (2427796.19,1064605.18,412.55,482), (2427796.17,1064605.18,412.55,483), (2427798.73,1064601.18,412.49,484), (2427799.74,1064598.08,412.38,485), (2427800.70,1064590.29,412.69,486), (2427769.79,1064596.39,412.49,490), (2427770.25,1064591.32,412.53,491), (2427770.94,1064588.50,412.49,492), (2427773.52,1064583.78,412.59,493), (2427779.11,1064565.44,412.80,494), (2427805.76,1064573.24,412.88,496) },
new List<(double,double,double,int)> { (2427876.57,1064539.16,416.07,503), (2427867.90,1064532.23,416.03,504), (2427860.55,1064523.95,415.99,505), (2427857.36,1064517.44,415.94,506), (2427855.64,1064507.72,415.95,507), (2427855.00,1064502.96,415.88,508), (2427854.52,1064502.02,415.83,509), (2427853.03,1064500.45,415.84,510), (2427851.16,1064499.40,415.88,511), (2427850.03,1064498.57,415.98,512), (2427849.21,1064496.93,416.09,513), (2427849.13,1064496.55,416.11,514), (2427849.11,1064496.55,416.08,515), (2427850.70,1064492.44,416.00,516), (2427852.97,1064488.66,416.27,517), (2427842.62,1064476.15,415.89,518), (2427822.18,1064481.61,414.73,519), (2427831.31,1064450.69,416.00,520), (2427818.16,1064452.41,415.55,521), (2427797.69,1064430.91,414.43,522) },
new List<(double,double,double,int)> { (2427889.22,1064480.15,418.02,527), (2427890.95,1064477.90,418.39,528), (2427907.97,1064487.12,418.84,529), (2427911.09,1064483.94,418.84,530), (2427942.07,1064493.58,419.19,533), (2427958.24,1064506.78,418.60,534), (2427950.76,1064484.57,418.91,537) },
new List<(double,double,double,int)> { (2427915.77,1064450.71,418.30,538), (2427915.51,1064452.78,418.39,539), (2427916.55,1064454.87,418.40,540), (2427920.20,1064458.12,418.47,541), (2427924.49,1064460.12,418.56,542), (2427930.16,1064460.38,418.66,543), (2427935.30,1064458.59,418.65,544), (2427938.94,1064455.92,418.63,545), (2427942.84,1064453.12,418.61,546) },
new List<(double,double,double,int)> { (2427976.43,1064514.09,418.48,551), (2428007.14,1064526.21,418.35,552), (2428007.62,1064525.27,418.33,553), (2427988.67,1064501.05,418.69,554), (2427968.73,1064475.51,418.80,555), (2427965.81,1064470.84,418.93,556), (2427972.31,1064465.24,418.91,557), (2427974.16,1064464.00,418.87,558), (2427976.56,1064463.77,418.85,559), (2427978.25,1064464.94,418.90,560), (2427978.49,1064468.62,419.02,561), (2427976.67,1064469.87,418.96,562) },
new List<(double,double,double,int)> { (2428009.98,1064526.05,418.49,565), (2428009.48,1064527.10,418.48,566), (2428025.49,1064522.64,418.65,567), (2428026.65,1064522.70,418.63,568), (2428027.54,1064523.31,418.62,569), (2428024.03,1064532.77,418.54,570), (2428039.86,1064538.86,418.61,571), (2428043.72,1064543.55,418.45,572), (2428042.53,1064542.71,418.41,573), (2428040.25,1064542.89,418.44,574), (2428038.34,1064544.48,418.45,575), (2428035.35,1064551.88,418.37,576), (2428035.52,1064553.81,418.40,577), (2428037.37,1064555.65,418.42,578), (2428039.80,1064556.01,418.44,579), (2428046.67,1064556.72,418.49,580), (2428047.89,1064556.45,418.50,581), (2428048.70,1064555.81,418.48,582), (2428049.88,1064554.47,418.46,583), (2428049.99,1064552.26,418.49,584), (2428049.16,1064550.27,418.48,585), (2428058.41,1064522.83,418.89,611) },
new List<(double,double,double,int)> { (2427999.30,1064444.49,418.99,661), (2427997.92,1064445.52,418.82,662), (2428006.19,1064456.57,419.04,663), (2428025.46,1064481.28,418.93,665), (2428042.37,1064502.49,419.08,669) },
new List<(double,double,double,int)> { (2427981.34,1064423.05,418.66,671), (2428004.64,1064404.77,418.63,672), (2428006.53,1064402.80,418.70,673), (2428007.25,1064401.13,418.74,674), (2428006.87,1064399.52,418.74,675) },
new List<(double,double,double,int)> { (2428045.95,1064370.83,417.72,676), (2428037.04,1064378.01,418.02,677), (2428034.75,1064380.08,418.17,678), (2428033.73,1064381.34,418.22,679), (2428033.41,1064382.78,418.29,680), (2428034.01,1064383.75,418.28,681), (2428035.71,1064385.70,418.29,682), (2428037.47,1064386.96,418.34,683), (2428039.85,1064387.63,418.37,684), (2428043.48,1064387.80,418.47,685), (2428047.58,1064387.08,418.71,686), (2428050.93,1064385.72,418.98,687), (2428058.59,1064379.68,419.31,690), (2428068.04,1064371.91,419.91,691) },
new List<(double,double,double,int)> { (2428104.89,1064444.99,419.60,703), (2428117.93,1064435.58,419.72,704), (2428104.95,1064444.99,419.60,708), (2428105.56,1064448.93,419.64,709), (2428108.29,1064452.01,419.59,710), (2428123.35,1064442.77,419.73,711) },
new List<(double,double,double,int)> { (2428111.61,1064367.07,429.12,728), (2428131.32,1064394.00,428.95,729), (2428148.34,1064415.98,428.88,730), (2428161.91,1064432.73,428.74,731), (2428165.52,1064438.04,428.60,732), (2428168.62,1064446.22,428.32,733), (2428169.77,1064452.57,428.24,734) },
new List<(double,double,double,int)> { (2428196.65,1064492.69,427.97,739), (2428201.08,1064491.60,428.07,741), (2428205.59,1064491.67,428.17,742), (2428211.89,1064492.98,428.38,743), (2428217.72,1064495.91,428.69,744), (2428221.37,1064498.72,428.90,745) },
new List<(double,double,double,int)> { (2428301.11,1064567.16,428.81,754), (2428283.49,1064553.21,428.68,755), (2428261.70,1064535.39,428.85,756), (2428243.13,1064519.11,428.66,757), (2428221.85,1064499.40,428.83,758) },
new List<(double,double,double,int)> { (2427809.34,1064557.12,396.48,772), (2427813.07,1064537.84,396.57,773), (2427781.98,1064553.13,396.28,775), (2427785.05,1064531.87,396.44,777), (2427813.64,1064526.61,396.48,779), (2427812.91,1064504.53,396.64,780), (2427813.45,1064498.98,396.97,781), (2427815.07,1064491.34,397.47,782), (2427818.09,1064484.51,397.77,783), (2427824.72,1064479.71,398.32,784), (2427835.15,1064475.87,398.85,785), (2427844.48,1064476.41,399.41,786), (2427849.56,1064480.51,399.60,787), (2427849.67,1064480.51,399.62,788), (2427851.59,1064485.27,399.56,789), (2427852.74,1064488.51,399.69,790) },
};
EnsureLayer(LAYER);
int drawn = 0, ptsUsed = 0;
foreach (var chain in chains)
{
var pl = new Polyline3d(Poly3dType.SimplePoly,
new Point3dCollection(chain.Select(p => new Point3d(p.e, p.n, p.z)).ToArray()), false);
pl.Layer = LAYER;
ModelSpace.AppendEntity(pl);
Tx.AddNewlyCreatedDBObject(pl, true);
drawn++;
ptsUsed += chain.Count;
}
Log($"Drew {drawn} straight-chord 3D polylines from {ptsUsed} TBC points on layer '{LAYER}'.");
Result
Log
Erased 0 Spline/Polyline3d entities on 'SS-V-ROAD-CURB'. Drew 33 straight-chord 3D polylines from 286 TBC points on layer 'SS-V-ROAD-CURB'.
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.