← Inbox

C3D-0133 · READ-ONLY: find the IPF-to-CL dimensions [DIM-READ] done

The IPF-to-centerline annotations are dimensions, not text, so an earlier text scan missed them. Dumps every Dimension in model space with its type, layer, style, measurement, text position and the two extension-line points it measures between, plus the available dimension styles. No changes.

Script file
C3D-0133.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
240s

C# payload

// READ-ONLY. The user's IPF-to-centerline annotations read "26.29" and are DIMENSIONS, not text -
// which is why the MText/DBText/Leader scan found nothing. Dump every Dimension in model space
// with its concrete type, layer, style, measurement and the two points it measures between.
// Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("drawing: " + Db.Filename);

int n = 0;
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    var dim = o as Dimension;
    if (dim == null) continue;
    n++;
    Log("");
    Log("DIM [" + o.Handle + "] " + o.GetType().Name + "  layer=" + dim.Layer);
    try { Log("    measurement " + dim.Measurement.ToString("F4")); } catch (System.Exception ex) { Log("    measurement: " + ex.Message); }
    try { Log("    DimensionText \"" + dim.DimensionText + "\""); } catch { }
    try { Log("    StyleName " + dim.DimensionStyleName); } catch { }
    try { Log("    TextPosition " + String.Format("{0:F3},{1:F3}", dim.TextPosition.X, dim.TextPosition.Y)); } catch { }
    try { Log("    TextRotation " + (dim.TextRotation*180.0/Math.PI).ToString("F2")); } catch { }

    var ad = o as AlignedDimension;
    if (ad != null) {
        Log(String.Format("    XLine1 {0:F3},{1:F3}", ad.XLine1Point.X, ad.XLine1Point.Y));
        Log(String.Format("    XLine2 {0:F3},{1:F3}", ad.XLine2Point.X, ad.XLine2Point.Y));
        Log(String.Format("    DimLine {0:F3},{1:F3}", ad.DimLinePoint.X, ad.DimLinePoint.Y));
    }
    var rd = o as RotatedDimension;
    if (rd != null) {
        Log(String.Format("    XLine1 {0:F3},{1:F3}", rd.XLine1Point.X, rd.XLine1Point.Y));
        Log(String.Format("    XLine2 {0:F3},{1:F3}", rd.XLine2Point.X, rd.XLine2Point.Y));
        Log(String.Format("    rotation {0:F2}", rd.Rotation*180.0/Math.PI));
    }
}
Log("");
Log("dimensions in model space: " + n);

// dimension styles available
var dst = (DimStyleTable)Tx.GetObject(Db.DimStyleTableId, OpenMode.ForRead);
Log("");
Log("=== dimension styles ===");
foreach (ObjectId sid in dst) {
    var s = (DimStyleTableRecord)Tx.GetObject(sid, OpenMode.ForRead);
    Log("  " + s.Name);
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
Message
Executed C3D-0133 (0 entities touched).
Entities
Duration
385 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg

DIM [20B12] AlignedDimension  layer=0
    measurement 24.8288
    DimensionText ""
    StyleName Standard
    TextPosition 2238357.720,1325131.984
    TextRotation 0.00
    XLine1 2238346.673,1325126.319
    XLine2 2238368.766,1325137.649
    DimLine 2238368.766,1325137.649

DIM [20B20] AlignedDimension  layer=0
    measurement 26.2911
    DimensionText ""
    StyleName Standard
    TextPosition 2238239.777,1325248.057
    TextRotation 0.00
    XLine1 2238247.330,1325258.821
    XLine2 2238232.781,1325236.923
    DimLine 2238232.502,1325237.108

dimensions in model space: 2

=== dimension styles ===
  Standard
  Annotative
  carpinteria
  ISO-25
  SURVEY
  DIM 30
  HFB-SITE
  BZI - L80
  DIM 50
  CADdetails-LEADER
  DIM 20
  LEADER-20
  LEADER-30
  LEADER-10
  EZDXF
  GFC_DIM_50

Notes

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

No notes yet.