← Inbox

C3D-0322 · 260714 Huckaby R2: read the current OVERHEAD_POWER shape scale done

READ-ONLY. Dumps the OVERHEAD_POWER linetype dash by dash with shape number, shape scale, offset and rotation, plus the LinetypeScale the user set on each power centreline and the drawing LTSCALE.

Script file
C3D-0322.cs
Target
260714 - 285 Huckaby Rd R2.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// READ-ONLY: current OVERHEAD_POWER definition and the entity scales the user set.
Log("drawing: " + Db.Filename);
var ltt = (LinetypeTable)Tx.GetObject(Db.LinetypeTableId, OpenMode.ForRead);
if (ltt.Has("OVERHEAD_POWER")) {
    var r = (LinetypeTableRecord)Tx.GetObject(ltt["OVERHEAD_POWER"], OpenMode.ForRead);
    Log(string.Format("OVERHEAD_POWER dashes={0} patLen={1:F4}", r.NumDashes, r.PatternLength));
    for (int i = 0; i < r.NumDashes; i++) {
        int shp=0; double sc=0; Vector2d off=new Vector2d(); double rot=0; string f="";
        try { shp=r.ShapeNumberAt(i); } catch {}
        try { sc=r.ShapeScaleAt(i); } catch {}
        try { off=r.ShapeOffsetAt(i); } catch {}
        try { rot=r.ShapeRotationAt(i); } catch {}
        try { var s=r.ShapeStyleAt(i); if(!s.IsNull) f=((TextStyleTableRecord)Tx.GetObject(s,OpenMode.ForRead)).FileName; } catch {}
        Log(string.Format("  dash{0} len={1,8:F4} shape={2} scale={3:F4} offset=({4:F3},{5:F3}) rot={6:F1} file={7}",
            i, r.DashLengthAt(i), shp, sc, off.X, off.Y, rot*180/Math.PI, f));
    }
}
Log("");
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
foreach (ObjectId id in ms) {
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null || !ent.Layer.Equals("SS-V-POWER-CL", StringComparison.OrdinalIgnoreCase)) continue;
    var ln = ent as Line;
    Log(string.Format("[{0}] ltscale={1:F4} len={2:F1}", ent.Handle, ent.LinetypeScale, ln!=null?ln.Length:0));
}
Log("LTSCALE=" + Db.Ltscale);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2.dwg
Message
Executed C3D-0322 (0 entities touched).
Entities
Duration
368 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2.dwg
OVERHEAD_POWER dashes=3 patLen=0.7500
  dash0 len=  0.3000 shape=0 scale=1.0000 offset=(0.000,0.000) rot=0.0 file=
  dash1 len= -0.1500 shape=135 scale=0.1500 offset=(-0.150,0.000) rot=0.0 file=ltypeshp.shx
  dash2 len=  0.3000 shape=0 scale=1.0000 offset=(0.000,0.000) rot=0.0 file=

[20C9D] ltscale=0.1000 len=893.0
[20C9E] ltscale=40.0000 len=364.6
[20CA9] ltscale=40.0000 len=1514.6
[20CB1] ltscale=40.0000 len=1569.6
LTSCALE=1

Notes

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

No notes yet.