ELEFRONT : "List Block Document" loses option on file opening

As I am working on a block management tool, I use “List Block Document” as the primary component in my definition.
The first thing I need to do is to weed out blocks possibly coming from attached files, and therefore I use the “Full name” component which allows me to filter block names containing “.3dm” which is part of the full name (which contains the attached file name).

The problem is that this option is not sticky, and is lost everytime I close the file !

1 Like

Does it work to use Metahoppers’ Expire Object? Although I have found that usually the whole Grasshopper script takes a big performance hit.

But keep us updated on a solution, I think we are basically trying to solve the same problem (handling linked blocks of blocks in GH in some bearable way).

Hi Armin, “Expire” won’t help !
It looks like the default for this component is to have the “Full Name” option unchecked.

I think the solution is to write a C# script that lists all the blocks in the current “Session” with the full name.
Then it is easy to filter those who are from attached files.
The other way around (like it is now) is a PITA.

The problem is that I’m making a tool with a Human UI interface.
I can’t ask the poor souls in the office to lift the hood and go mess with component options each time they use my tool.

Hi,
in C# this would be a way:
this example is using linq, you need to put reference the namespace if you copy the code in another component.

  A = Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Select(b => b.Name).ToList();
    if(update)
      Component.ExpireSolution(true);
    Component.Message = "GetBlockNames";

File:
20210525_GetBlockNames.gh (5.0 KB)
You could filter the blocks in that step, but that is something for the linq cracks here.
EDIT:
without LINQ and filtered:

var filtered = new List<string>();
    var names = Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions;
    for (int i = 0; i < names.Count; i++)
    {
      if(!names[i].Name.Contains(".3dm"))
        filtered.Add(names[i].Name);
    }
    A = filtered;

    if(update)
      Component.ExpireSolution(true);
    Component.Message = "GetBlockNames";
1 Like

I hear you. I am in a similar situation. I am the one who builds the tool, but others have to use it. Human UI has been a bit too much work to implement and make look good so other workarounds had to do. If there was just a proper version of RCP that actually looked/worked well and supported more types that would solve like 90% of issues. Sadly its stuck in V0.1 since day 1.

Well, It took me a while, but I’m kind of used to it now and I feel it’s a great tool.
It’s like the Gremlins, there are just a few things you should never do with Human UI.
I mostly miss more feature for data tables, but that’s probably because my project is centered on…data tables.

The one from Zelda ?

What is Zelda?

Oh, I see you don’t have young kids :wink:
Link is the name of the main character.

The first one seems to work fine, but yields nulls :

error message on that one…

Not sure, are these nulls deleted blocks?
maybe anexing .GetList(true) here:
Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.GetList(true)
gets rid of the error?

I don’t know, I compared to the Elefront component, and there seems to be no block missing.
Right now, I’m struggling with the input.
If I plug a panel with “True” , the component seems to refresh all the time and the whole definition is frozen (needed to crash Rhino).

yes, that is what it is doing.
Is the elfront component constantly updating?

No, it only refreshes at the opening of the definition, or when I use Metahopper to Expire it.
There is also an option to refresh the list if you right-click on the component center, but since I’m making an interface, I don’t use this.

I don’t understand the problem then, with hte panel.
You can just don’t use this part,no?Or expire it with the button.

Yep, indeed.
I thought it would not run at all if it didn’t have a “True” input, but it does.
Thanks Baris ! This solves my problem.

1 Like

Yeah, maybe I need to give Human UI another chance and do a little base setup. I usually just have quite a few buttons, toggles and mostly dropdowns for options, plus some basic outputs so far.

For the new project I will need some data table kind of stuff as well.

I will also give Baris’ solution with the C# a go. Do you mind sharing the solution you ended up using that was working fine?

I used the first C# component, plus a Match text component.