Tipo166 Posted September 27, 2008 Posted September 27, 2008 Hello All, Using the following code it iterates through all objects in model space not just region objects (as desired). Can someone take a look and tell me what I'm missing? For Each Region In ThisDrawing.ModelSpace Region.Highlight True 'Check to see if Region has xdata if not continue Region.getxdata "AppName", xdataType, xdataValue If VarType(xdataValue) = vbEmpty Then GoTo nextreg: Else If xdataValue(1) = xdataStr Then Region.Boolean acSubtraction, FrameRegion(0) '*************subtract frame footprint from Usable Region.Highlight False Exit For End If End If nextreg: Region.Highlight False Next Region thanks guys, happy friday! Quote
borgunit Posted September 29, 2008 Posted September 29, 2008 The word Region is just a variable name and not the object type. You would either need to create a selection set of only Region objects or as you iterate through each Object (what you have named Region), check its object name ie If Region.objectname = "AcDbRegion" then "DO you operation here" End If Quote
Tipo166 Posted December 3, 2008 Author Posted December 3, 2008 This is what I ended up with: Public Function Regions_Collection() As Collection Dim ent As AcadEntity Dim RegionX As AcadRegion Dim RegionsCollection As New Collection Set Regions_Collection = RegionsCollection On Error Resume Next For Each ent In ThisDrawing.ModelSpace If ent.ObjectName = "AcDbRegion" Then Set RegionX = ent 'add the entity(region) to the regions collection RegionsCollection.Add ent Else End If Next ent End Function thanks for all the help with everything else! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.