Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Trying to Delete selected Extrusions

$
0
0

@dylanbahnan wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles