← Inbox

C3D-0670 · 261009: main viewport scale back to 1:50 after the trim [C3D-FIX1009C] done

Trimming the viewport height kept the view height, so the scale drifted to ~1:62. Sets CustomScale back to 1:50 (0.02) and re-asserts the view center on 11X17 and 11X17 DEMO.

Script file
C3D-0670.cs
Target
261009 - 510 Covington Cove.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

var ld=(DBDictionary)Tx.GetObject(Db.LayoutDictionaryId,OpenMode.ForRead);
foreach(DBDictionaryEntry de in ld){ var lo=(Layout)Tx.GetObject(de.Value,OpenMode.ForRead); if(lo.LayoutName!="11X17"&&lo.LayoutName!="11X17 DEMO") continue;
 var btr=(BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId,OpenMode.ForRead);
 foreach(ObjectId id in btr){ var v=Tx.GetObject(id,OpenMode.ForRead) as Viewport; if(v==null||v.Number==1||Math.Abs(v.ViewCenter.X-2276418.03)>1) continue;
  v.UpgradeOpen(); bool lk=v.Locked; v.Locked=false; double s0=v.CustomScale;
  v.CustomScale=0.02; v.ViewCenter=new Point2d(2276418.03,1456204.70); v.Locked=lk;
  Log("  "+lo.LayoutName+" vp "+v.Handle+": scale 1:"+(1/s0).ToString("F2")+" -> 1:"+(1/v.CustomScale).ToString("F2")+" viewHeight="+v.ViewHeight.ToString("F2")+" center="+v.ViewCenter.X.ToString("F2")+","+v.ViewCenter.Y.ToString("F2")+" paper h="+v.Height.ToString("F3")); } }
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261009 - 510 Covington Cove, Byron, GA 31008, USA\261009 - 510 Covington Cove.dwg
Message
Executed C3D-0670 (0 entities touched).
Entities
—
Duration
667 ms
Civil 3D
25.0.0.0

Log

  11X17 vp 1FDA0: scale 1:61.76 -> 1:50.00 viewHeight=662.77 center=2276418.03,1456204.70 paper h=13.255
  11X17 DEMO vp 21697: scale 1:61.76 -> 1:50.00 viewHeight=662.77 center=2276418.03,1456204.70 paper h=13.255

Notes

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

No notes yet.