Trying to Delete selected Extrusions

Hi, I’m sure this is a very basic question but I can’t seem to figure it out. I’m trying to modify an existing script to delete the extrusions from groups after it’s converted them from blocks (I’m using Dale Fugiers Script). At the moment it will convert the blocks to groups but then it deletes everything. Any help is appreciated. Here’s what I’ve got.

  ' Local variables
  Dim arrBlocks, strBlock, arrObjects(), nBound, strObject, arrExtrusions
 
  ' Get blocks to explode
  arrBlocks = Rhino.GetObjects("Select blocks to convert", 4096, True, True)
  If IsNull(arrBlocks) Then Exit Sub

  
 
  ' Explode the blocks    
  For Each strBlock In arrBlocks  
    ' Reset our array of objects
    ReDim arrObjects(-1)  
    ' Explode the block
    Call BlockExplode(strBlock, arrObjects)
    ' See if any objects were added to our array
    On Error Resume Next
    nBound = UBound(arrObjects)
    If (Err.Number = 0) Then
      ' Group the objects
      Call Rhino.AddObjectsToGroup(arrObjects, Rhino.AddGroup())
    End If

    'Defines arrExtrusions'
    arrExtrusions = Rhino.ObjectsByType(1073741824, True)

    For Each arrExtrusions In arrBlocks 
      'Deletes Extrusions'
      Call Rhino.DeleteObjects(Rhino.ObjectsByType(1073741824, True))
    Next

  Next
End Sub
  • Thanks

Hi @dylanbahnan,

See if this is what you are looking for.

ConvertBlockToGroup.rvb (3.0 KB)

– Dale