How could I rename blocks without re-defining the whole shebang (content, attributes, origin,…) with Human or Elefront’s Define Block component ?
It seems like quite some heavylifting for such a mundane task…
How could I rename blocks without re-defining the whole shebang (content, attributes, origin,…) with Human or Elefront’s Define Block component ?
It seems like quite some heavylifting for such a mundane task…
changeBlockDefinitionName.gh (7.7 KB)
private void RunScript(string from, string to, bool OK, ref object A)
{
if(!OK)
return;
var idef = RhinoDocument.InstanceDefinitions.Find(from);
if(idef == null)
return;
RhinoDocument.InstanceDefinitions.Modify(idef, to, idef.Description, true);
}
Holy smokes ! It works ! Thank you so much Keyu !
I was trying to hack my way out with Anemone, but without much success :
From your image, that’s probably not the correct way to use Anemone
As I said, it’s a hack : I just tried to make it output Old name / New name values one after the other for the Sasquatch component to process them.
There was a problem with the timing…
Hi @gankeyu ,
Could you add a boolean trigger that will output “True / False” , but only once all the blocks have been renamed ?
I need to refresh my definition when the blocks have changed names, but I can’t seem to find a mechanism that will trigger this refresh at the proper time…
Perhaps if you allow a list access, then the whole list is processed before sending something to the output, which then triggers a refresh.
EDIT : OK, I gave it a shot, and it worked
Three blocks.3dm (63.1 KB)
Block renamer.gh (5.1 KB)