- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using a SelectCrossingWindow to select entities close to a given point. But I got a curious bug if I have Model space zoomed out.
If the zoom level is not too great my method to find the entities works fine. But if I zoom model space out so everything is tiny and run my command I get multiple result in my selection set that I did not expect.
How should I modify my SelectCrossingWindow Pt1 and Pt2 values to account for the level of zoom in the current model space view?
My current extension method that does the selection for me:
public static IEnumerable<BlockReference> GetBlocksConnectedToPolylineAtEndpoint(this Database database, Point3d polylinePoint, bool isStartPoint) { ThrowForNoTransaction(database); // Define crossing window dimensions. Point3d botLeft; Point3d topRight; if (isStartPoint) { botLeft = new Point3d(polylinePoint.X - 1, polylinePoint.Y - 1, 0); topRight = new Point3d(polylinePoint.X + 5.9, polylinePoint.Y + 1, 0); } else { botLeft = new Point3d(polylinePoint.X - 5.9, polylinePoint.Y - 1, 0); topRight = new Point3d(polylinePoint.X + 1, polylinePoint.Y + 1, 0); } var selectWindowResult = ActiveDocument.Editor.SelectCrossingWindow(botLeft, topRight); if (selectWindowResult.Status == PromptStatus.OK) { var selectionSet = selectWindowResult.Value; Debug.WriteLine($"DB_Extensions::GetBlocksConnectedToPolylineAtPoint identified {selectionSet.Count} related blocks"); return selectionSet.GetObjectIds() .Where(oId => oId.ObjectClass.IsDerivedFrom(AutocadRxClassTypes.RX_BlockReferenceType)) .Select(oId => (BlockReference)oId.GetObject(OpenMode.ForRead)) .Where(br => BlockLibraryManager.Current.IsBlockLibraryBlock(br)); } return Enumerable.Empty<BlockReference>(); }
Solved! Go to Solution.
Link copied