← Inbox

C3D-0442 · Copy 3 parcel curve label styles into 260711 [C3D-0441] error

Side-open SS_BLOCK_11X17.dwg; WblockClone parcel CURVE label styles DELTA OFF, Delta over Length and Radius, Standard into 260711 - 281 Maranatha Trail.dwg.

Script file
C3D-0442.cs
Target
260711 - 281 Maranatha Trail.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload


string path = @"C:\Users\sanja\OneDrive\_SurveyDisco\SS_BLOCK_11X17.dwg";
var want = new System.Collections.Generic.HashSet<string>(StringComparer.OrdinalIgnoreCase){"DELTA OFF","Delta over Length and Radius","Standard"};
using (var sideDb = new Database(false, true)) {
    sideDb.ReadDwgFile(path, System.IO.FileShare.Read, true, null);
    var ids = new ObjectIdCollection();
    using (var stx = sideDb.TransactionManager.StartTransaction()) {
        var cd = Autodesk.Civil.ApplicationServices.CivilDocument.GetCivilDocument(sideDb);
        foreach (ObjectId sid in cd.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
            var s=(Autodesk.Civil.DatabaseServices.Styles.LabelStyle)stx.GetObject(sid,OpenMode.ForRead);
            if (want.Contains(s.Name)) { ids.Add(sid); Log("queued: "+s.Name); }
        }
        stx.Commit();
    }
    if (ids.Count>0) {
        var map = new IdMapping();
        Db.WblockCloneObjects(ids, CivilDoc.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles.ObjectId, map, DuplicateRecordCloning.Replace, false);
        Log("cloned "+ids.Count+" curve label styles into current dwg");
    } else Log("NONE FOUND");
}
Ed.Regen();

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\260711 - 281 Maranatha Trail R2.dwg
Message
Compile error: (17,99): error CS1061: 'LabelStyleCollection' does not contain a definition for 'ObjectId' and no accessible extension method 'ObjectId' accepting a first argument of type 'LabelStyleCollection' could be found (are you missing a using directive or an assembly reference?)
Entities
Duration
334 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.