Is there any solution to do the following using ezdxf library Input:
- A DXF file.dxf
- List coordinates of a closed polygone (2D) Output:
- All entities (circles, lines hatchs ...) inside (or crossing) this polygone, with propreties (Layer, color ) for each entity
I think the query method can not get entities in a given area. So is there any solution please! Thanks!
I've tried query : https://ezdxf.readthedocs.io/en/stable/tutorials/getting_data.html#tut-getting-data
But did not gives the possibility to filter by coordinates ...
There probably isn't any direct function to do this, but what you could do is:
The solution will probably require you to make a whole if-elif-else tree for every entity type and also study a bit of coordinate geometry. For example, a circle will require you to check if the perpendicular distance of the line from its centre is lesser than or equal to its radius. At the same time, you need to see if the distance of at least one of the ends of the line segment from the centre of the circle is lesser than or equal to its radius.