VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use Bulk Operations for Region comparison such as Boolean Method and Bulk operation for Coordinates

0 REPLIES 0
Reply
Message 1 of 1
jalal.mousa
251 Views, 0 Replies

Use Bulk Operations for Region comparison such as Boolean Method and Bulk operation for Coordinates

 

Public Sub ArrayRectangular

Dim RegionRoom As Variant
Dim RegionTile As Variant
Public numberOfRows As Long
Public NumberofColumns As Long
Public numberOfLevels As Long
Public distanceBwtnRows As Double
Public distanceBwtnColumns As Double
Public distanceBwtnLevels As Double
Public TileTo(0) As AcadEntity
Public Repeatearray As Integer


retObj = TileTo(0).ArrayRectangular(numberOfRows, NumberofColumns, numberOfLevels, distanceBwtnRows, distanceBwtnColumns, distanceBwtnLevels)
RegionTile = MyDWG.ModelSpace.AddRegion(retObj)

'Dim size of object based on Array Size
ReDim RetObjResize(0 To Repeatearray * numberOfRows * NumberofColumns - 1)
Dim ArrayN As Long
Dim X As Long
x = 1
For ArrayN = 1 To Repeatearray
' set Region to match poly object
RegionRoom = MyDWG.ModelSpace.AddRegion(RoomTo) 'Type: 3DSolid, Region
'Perform Boolean Method
RegionRoom(0).Boolean acIntersection, RegionTile(i)

Set RetObjResize(x) = MyDWG.ModelSpace.item(MyDWG.ModelSpace.Count - 1)
x = x + 1
Next

Dim i As Long
   iCut = 1
For i = 0 To RegionCount - 1
                Set obj = RetObjResize(i)
If TypeOf obj Is AcadRegion Then
                                    Call PartsRequired(obj, Objarea)
                        
                        End If

Next
end sub

 

Attached partial code that first create array then perform intersection between 2 Region to find common points between 2 objects, then later i will loop through results to get coordinates

 

the code works perfectly, but my problem is that when Array =>5,000 going through loop become extremely slow

is there a way to do bulk operations instead of looping through each to perform Bollean method and looping through result to get coordinates ?

 

 

 

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report