Hi Jose,
As you are probably aware, the Database.UpdateExt() method only seems to update the Extmin and Extmax properties for model space.
I have two suggestions.
1. If you switch to another layout (e.g. the Model tab) and then back to the paper space layout, the Database.Pextmin and
Database.Pextmax properties will be updated correctly. So in C# you could do something like this:
db.TileMode = !db.TileMode;
db.TileMode = !db.TileMode;
2. Below is a C# helper method that I created to update Pextmin and Pextmax for the currently selected paper space layout tab.
public static void UpdatePSpaceExts() {
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
// Check current layout is a paper space layout.
if (db.TileMode == true) {
return;
}
using (Transaction tr = db.TransactionManager.StartTransaction()) {
// Current paper space BlockTableRecord.
BlockTableRecord btr = tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord;
// Current paper space Layout.
Layout layout = tr.GetObject(btr.LayoutId, OpenMode.ForRead) as Layout;
// Main paper space area Viewport ObjectId.
// # Note: First ObjectId from GetViewports() is the main paper space area Viewport ObjectId.
ObjectId mainPSpaceVportId = layout.GetViewports()[0];
// Create Extents3d based on BlockTableRecord entities.
// # Note: Exclude main paper space viewport ObjectId.
Extents3d extents = new Extents3d();
foreach (ObjectId id in btr) {
if (id != mainPSpaceVportId) {
Entity ent = tr.GetObject(id, OpenMode.ForRead) as Entity;
if (ent != null) {
extents.AddExtents(ent.GeometricExtents);
}
}
}
// Create Extents3d based on paper space layout limits.
Extents3d limits = new Extents3d(
new Point3d(layout.Limits.MinPoint.X, layout.Limits.MinPoint.Y, 0),
new Point3d(layout.Limits.MaxPoint.X, layout.Limits.MaxPoint.Y, 0));
extents.AddExtents(limits);
// Update Pextmin and Pextmax.
db.Pextmin = extents.MinPoint;
db.Pextmax = extents.MaxPoint;
tr.Commit();
}
}
Hope this helps.
Art