← Inbox

C3D-CHECKLTYPE · Check easement/sewer linetypes (read-only) done

Linetype+color for SEWER_LINE, SEWER_EASEMENT, WATER_EASEMENT so the legend sample matches exactly.

Script file
C3D-CHECKLTYPE.cs
Target
active document · model space
Author
claude
Approved
yes · claude (read-only)
Timeout
60s

C# payload

// READ-ONLY: what linetype/color does the actual SEWER_EASEMENT_TEXT / easement geometry use,
// and the SEWER_LINE (outfall sewer), so the legend sample lines match exactly.
using System;
using Autodesk.AutoCAD.DatabaseServices;

var db = Db;
using (var tr = db.TransactionManager.StartTransaction())
{
    var lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);
    foreach (var n in new[]{"SEWER_LINE","SEWER_EASEMENT","SEWER_EASEMENT_TEXT","WATER_EASEMENT"})
    {
        if (!lt.Has(n)) { Log($"{n}: layer does not exist"); continue; }
        var l = (LayerTableRecord)tr.GetObject(lt[n], OpenMode.ForRead);
        var ltbl = (LinetypeTableRecord)tr.GetObject(l.LinetypeObjectId, OpenMode.ForRead);
        Log($"{n}: linetype='{ltbl.Name}' color={l.Color.ColorIndex} lw={l.LineWeight}");
    }
    // any actual geometry entity on SEWER_EASEMENT or SEWER_LINE?
    var ms = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead);
    foreach (ObjectId id in ms)
    {
        var e = tr.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
        if (e == null) continue;
        if (string.Equals(e.Layer,"SEWER_LINE",StringComparison.OrdinalIgnoreCase) || string.Equals(e.Layer,"SEWER_EASEMENT",StringComparison.OrdinalIgnoreCase))
            Log($"  entity on {e.Layer}: {e.GetType().Name} linetype='{e.Linetype}'");
    }
    tr.Commit();
}

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

Log

SEWER_LINE: linetype='Continuous' color=3 lw=ByLineWeightDefault
SEWER_EASEMENT: linetype='Continuous' color=4 lw=ByLineWeightDefault
SEWER_EASEMENT_TEXT: linetype='Continuous' color=7 lw=ByLineWeightDefault
WATER_EASEMENT: linetype='Continuous' color=4 lw=ByLineWeightDefault
  entity on SEWER_LINE: Polyline linetype='ByLayer'

Notes

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

No notes yet.