Works fine for me,
Using a SelectCrossingWindow and change each entity to red.
[CommandMethod("PaperSpaceCrossingWindow")]
public void PaperSpaceCrossingWindow()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction trx = db.TransactionManager.StartTransaction())
{
BlockTable blocktable = trx.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord currentSpace = trx.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord;
if (currentSpace.ObjectId == blocktable[BlockTableRecord.ModelSpace])
{
Application.ShowAlertDialog("Use a paer space layout");
return;
}
//// Note using db.Extmin & db.Extmax uses extents of model space not current space extents
PromptSelectionResult psr = ed.SelectCrossingWindow(db.Extmin, db.Extmax);
ed.WriteMessage("\n" + db.Extmin.ToString() + " " + db.Extmax.ToString());
foreach (ObjectId objId in psr.Value.GetObjectIds())
{
Entity ent = (Entity)trx.GetObject(objId, OpenMode.ForWrite);
ent.ColorIndex = 1;
}
trx.Commit();
}
}
In pic below the circles are drawn in ModelSpace and the rest are in paperspace(rectangle is the viewport)