Message 1 of 5
can't delete regions

Not applicable
01-23-2006
07:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I make some regions then create other regions that I use for boolean subtracting so I can make holes in the primary region then I take that region and make a solid out of it.
I cannot delete the hole region once I have use it to punch a hole in the primary region because it does not exist anymore.
So then I even tried this method which I do not like because I have to loop through everything.
Public Sub deleteRegions()
Dim i As Long
Dim modelSpaceObject As AcadObject
Dim objectcount As Long
objectcount = ThisDrawing.ModelSpace.count
For i = 0 To objectcount - 1
On Error Resume Next
Set modelSpaceObject = ThisDrawing.ModelSpace(i)
If modelSpaceObject.ObjectName = "AcDbRegion" Then
modelSpaceObject.Delete
End If
Next
End Sub
This will pick up the regions and act like it deletes them, but they are still there.
Once you subtract 1 region from another the "hole region" does not exist. but looping through all the modelspace objects you find it again, and delete it but it is still there. I even tried setting it to visible=false or truecolor = color.black (my UDT) and it goes through and does nothing.
Does anyone know how to go around this??
I cannot delete the hole region once I have use it to punch a hole in the primary region because it does not exist anymore.
So then I even tried this method which I do not like because I have to loop through everything.
Public Sub deleteRegions()
Dim i As Long
Dim modelSpaceObject As AcadObject
Dim objectcount As Long
objectcount = ThisDrawing.ModelSpace.count
For i = 0 To objectcount - 1
On Error Resume Next
Set modelSpaceObject = ThisDrawing.ModelSpace(i)
If modelSpaceObject.ObjectName = "AcDbRegion" Then
modelSpaceObject.Delete
End If
Next
End Sub
This will pick up the regions and act like it deletes them, but they are still there.
Once you subtract 1 region from another the "hole region" does not exist. but looping through all the modelspace objects you find it again, and delete it but it is still there. I even tried setting it to visible=false or truecolor = color.black (my UDT) and it goes through and does nothing.
Does anyone know how to go around this??