Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8548

GH/VBScript - Replace Block Definition while keeping Instances?

$
0
0

@RIL wrote:

Q: Is it possible to keep Block Instances while updating (replacing) the Block Definition, and then re-reference the Instances back to the (updated/replaced) Block Definition again?

In the code snippet below I'd like to pick up the instances, replace the definition, and re-reference the (existing) Instances, if any, back to the replaced Block Definition :

Current GH/VBScript does not allow delete while there are instances, so I would need to "disconnect" the instances before delete. But is such a trick possible, or do I have to re-create any existing Block Instances from scratch?

Dim Block_tmp As Rhino.DocObjects.InstanceDefinition

'//BLOCK DEF EXIST?
block_tmp = rh.InstanceDefinitions.Find(BlockName, True)
If Block_tmp IsNot Nothing Then
    '// REPLACE EXISTING BLOCK DEF (?)
    rh.InstanceDefinitions.Delete(Block_tmp.Index, False, False) '//False=Keep references, False=Not Quiet
End If

// Rolf

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8548

Trending Articles