Filter block by name

Hi guys, i am trying to select tree blocks within a disturbance area, add an X block on top of the tree block and finally create an spreadsheet with the trees to be removed. I have a close polyline create in cad which i am able to select and create a polygon geometry in Dynamo.I am having trouble filtering the tree blocks. I am using the All Objects of Type to filter the selection to select all blocks only but how can i just create a selection of only the tree blocks.

Try this.

GetBlockRefsByNameInBndBox.dyn (22.6 KB)

Thank you Keith the script is pointing me to the right direction. I am having an anomaly with the bounding box. It is selecting a block that is outside the boundary. I was also trying by selecting the object in the layer and then creating the geometry from the object and the result was also wrong, just one item got selected. I am not sure was the problem.

Hi @csanchez

Assuming your polygon is planar. Use Polygon.ContainmentTest node to see if the point is inside or outside the polygon. Above example bounding box what @keith.sowinski showed works for 4 side polygon.

Thank you Kulkul, I tried your approach but I am getting a Null result from the test. The original object is a close polyline from cad.TreeRemovalByLOD2.dyn (24.5 KB) Drawing1.dwg (885.9 KB)

@csanchez Since you have polycurve you can create polygon by exploding polycurve or use custom node from springs package called Polygon.ContainmentTest+. It has ability to consider both polycurve and polygon.

1 Like

Thank you Kulkul the solution works very well.