← Inbox

C3D-MHOLSYM4 · Place manhole symbols at 10ft radius (14 pts) done

13 outfall (blue open circle, r=10ft) + 1 bolted (gray filled donut, #7013). Sized for 1"=100' scale (~0.2in on paper). Legend not touched, user handling separately.

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

C# payload

// Place manhole symbols at SSMH points 7000-7013 + a legend block.
// #7013 = SSMH bolted (gray filled, donut) on SEWER_MANHOLE_EXISTING.
// #7000-7012 = Outfall SSMH (blue open circle) on SEWER_MANHOLE.
// Uses the AMBIENT Tx/ModelSpace globals throughout — no separate transactions (that was the bug:
// mixing a locally-opened transaction with the AddMText helper, which uses the plugin's own Tx).
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Colors;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;

const double R = 10.0; // circle radius, feet — 10ft / 100 scale = ~0.2" on paper
int bolted = 0, outfall = 0;

EnsureLayer("SEWER_MANHOLE", 5);
EnsureLayer("SEWER_MANHOLE_EXISTING", 8);
EnsureLayer("LEGEND", 7);

void PlaceCircle(Point3d center, string layer, short colorIdx)
{
    var circ = new Circle(center, Vector3d.ZAxis, R);
    circ.Layer = layer;
    circ.Color = Color.FromColorIndex(ColorMethod.ByAci, colorIdx);
    ModelSpace.AppendEntity(circ);
    Tx.AddNewlyCreatedDBObject(circ, true);
}

void PlaceDonut(Point3d center, string layer, short colorIdx)
{
    var donut = new Polyline();
    donut.AddVertexAt(0, new Point2d(center.X - R, center.Y), 1.0, R, R);
    donut.AddVertexAt(1, new Point2d(center.X + R, center.Y), 1.0, R, R);
    donut.Closed = true;
    donut.Layer = layer;
    donut.Color = Color.FromColorIndex(ColorMethod.ByAci, colorIdx);
    ModelSpace.AppendEntity(donut);
    Tx.AddNewlyCreatedDBObject(donut, true);
}

var cdoc = CivilDocument.GetCivilDocument(Db);
foreach (ObjectId id in cdoc.CogoPoints)
{
    var cp = Tx.GetObject(id, OpenMode.ForRead) as CogoPoint;
    if (cp == null) continue;
    int n = (int)cp.PointNumber;
    if (n < 7000 || n > 7013) continue;

    var center = new Point3d(cp.Easting, cp.Northing, 0);
    if (n == 7013)
    {
        PlaceCircle(center, "SEWER_MANHOLE_EXISTING", 8);
        PlaceDonut(center, "SEWER_MANHOLE_EXISTING", 8);
        bolted++;
    }
    else
    {
        PlaceCircle(center, "SEWER_MANHOLE", 5);
        outfall++;
    }
}
Log($"placed manhole symbols: outfall(blue open)={outfall}, bolted(gray filled)={bolted}");
Log("DONE. Legend not touched — user is fixing it directly.");

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-MHOLSYM4 (0 entities touched).
Entities
Duration
312 ms
Civil 3D
25.0.0.0

Log

placed manhole symbols: outfall(blue open)=13, bolted(gray filled)=1
DONE. Legend not touched — user is fixing it directly.

Notes

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

No notes yet.