← Inbox

C3D-BOLTEDFIX · Redefine SSMH_BOLTED as a plain circle done

Remove the donut geometry from the SSMH_BOLTED block, replace with a simple gray circle. All existing inserts update automatically (block redefinition).

Script file
C3D-BOLTEDFIX.cs
Target
SS_Outfall_260612_SHEET.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Redefine SSMH_BOLTED as a plain circle (gray) — remove the donut, keep it simple.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Colors;

const double R = 5.0;
const string BLK_BOLTED = "SSMH_BOLTED";

var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForWrite);
if (!bt.Has(BLK_BOLTED)) { Log($"block '{BLK_BOLTED}' not found"); return; }

var btr = (BlockTableRecord)Tx.GetObject(bt[BLK_BOLTED], OpenMode.ForWrite);

// erase everything currently in the block definition
var toErase = new System.Collections.Generic.List<ObjectId>();
foreach (ObjectId id in btr) toErase.Add(id);
foreach (var id in toErase)
{
    var e = (Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id, OpenMode.ForWrite);
    e.Erase();
}

// plain circle, gray
var c = new Circle(Point3d.Origin, Vector3d.ZAxis, R);
c.Color = Color.FromColorIndex(ColorMethod.ByAci, 8);
btr.AppendEntity(c);
Tx.AddNewlyCreatedDBObject(c, true);

Log($"SSMH_BOLTED redefined as a plain circle (r={R}, gray). All existing inserts update automatically.");

Result

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

Log

SSMH_BOLTED redefined as a plain circle (r=5, gray). All existing inserts update automatically.

Notes

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

No notes yet.