How to Check if a Block is Inside a Polyline
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm building an application that needs to run both in interactive AutoCAD and in headless/cloud environments such as the Design Automation API or accoreconsole.exe.
In AutoCAD, users may place blocks inside a polyline, I need to programmatically determine whether a block is completely within a polyline.
Since I can't use built-in methods like SelectWindowPolygon or SelectCrossingPolygon in headless mode, I've tried the following approaches:
1. Bounding Box Method:
I created a bounding box using the minimum and maximum points of the block and checked whether this box is completely inside the polyline. However, in some cases, the bounding box extends beyond the polyline even though the block visually appears to be inside it.
2. Base Point Method:
I checked whether the base point of the block is inside the polyline. But in some cases, the base point is outside, even though the block visually appears inside the polyline.
My Question:
Is there any reliable way to get the actual minimum and maximum points that represent the visible extent of a block? Or are there any other methods/commands that can help determine whether a block is inside a polyline, especially in a headless/cloud environment?
Any suggestions or guidance would be greatly appreciated. Thank you!