CAD如何删除指定区域里的多边形、直线等
CAD如何删除指定区域里的多边形、直线等。已知围成区域的一组坐标,比如多边形,已知多边形的每个点的坐标,删除多边内的所有线段或多边形。
[解决办法]
'圈围区域点坐标数组
Dim P(8) As Double
P(0) = -100: P(1) = 300: P(2) = 0
P(3) = 75: P(4) = -100: P(5) = 0
P(6) = 500: P(7) = 300: P(8) = 0
Dim SS As AcadSelectionSet, E As AcadEntity, Ft(4) As Integer, Fd(4) As Variant
'定义选择集过滤器为"多段线","优化多段线"和"直线"
Ft(0) = -4: Fd(0) = "<or"
Ft(1) = 0: Fd(1) = "POLYLINE"
Ft(2) = 0: Fd(2) = "LWPOLYLINE"
Ft(3) = 0: Fd(3) = "LINE"
Ft(4) = -4: Fd(4) = "or>"
'创建选择集
Set SS = ThisDrawing.SelectionSets.Add("SS")
'按指定区域的对象类型圈选
SS.SelectByPolygon acSelectionSetWindowPolygon, P, Ft, Fd
'删除被选择的对象
For Each E In SS
E.Delete
Next
'删除用过的选择集
SS.Delete