Does anyone know of , or have built something that can loop through a gh script to internalise all nested clusters? Additionally apply password to all of them.
This sounds like something you can sorta do from the top layer, but i think will fall apart when trying to do nested.
Dim newID As Guid = Guid.NewGuid()
Dim record As New GH_UndoRecord(“Cluster Frabbing”)
For Each cluster As GH_Cluster In ClusterFamily()
record.AddAction(New GH_ClusterReferenceAction(cluster))
record.AddAction(New GH_ClusterDocumentIdAction(cluster))
cluster.DocumentId = newID
cluster.m_file.Path = Nothing
cluster.m_file.UpdateToCurrentFile()
Next
RecordUndoEvent(record)
Instances.InvalidateCanvas()
ClusterFamily are all the instances of the same cluster. So you should only need to internalize one. As far as nested clusters, this should be doable too — you can get the Document from a GH_Cluster and loop over its objects in the same way as the top level document.
m_file is a private property, you’re not allowed to access it (except through reflection). What are you attempting to do exactly — internalize the cluster?
This won’t do nested clusters, but maybe you can extrapolate from the code. I’m invoking the private method that is called when you select “Internalize” from the component menu.
Ah beautiful, I examined all the functions available to GH_Cluster, doesnt seem to have ‘internalise’ , or those m_path functions, but i will reverse engineer this script!
Seems its using reflection in your script. That is black magic to me still. Its freaky code.
I wonder if its against the license agreement to post it here