Display Structural2DElementMesh in Grasshopper



I am struggling to display a Structural2DElementMesh in Grasshopper from the following stream:
The results are shown correctly in the online viewer (see screenshot).

In Grasshopper I receive the correct meshes, but it seems that there are no results attached to it.
I attached a sample Grasshopper script. The data structure looks fine though.
Note: I created one SpeckleMesh for each quad element, because I needed to attach results to individual elements instead of nodes.

Maybe someone can point me in the right direction?


EDIT: changed to a smaller model :wink:


Hi @tlmn,

FYI shear utilisation works well at least:

Regarding the other values that you struggle to display, this happens because the result output is a list of Rhino Dictionaries (which as you’ve noticed are actually empty).
I think I could help you to figure out what’s wrong if you share the part of the definition that is situated before sending the meshes (i.e. how you attached values to your meshes) - you can simply internalize the necessary values instead of sharing the whole script that generated those values.


Hi @pauldotnet,
I haven´t tried to attach any other results than shear utilization for now… :wink:
Did you get it to work with Grasshopper as well?


I created another example with some more results:

I still can´t access any results in Grasshopper:

I assume i am doing something wrong here? :wink:

The code used to create the results:

SpeckleMesh speckleMesh = new SpeckleMesh { Type = “Mesh”, Vertices = vertices, Faces = faces };

            Dictionary<string, Object> results = new Dictionary<string, object>();
            addResult(quad.vx, "vx", results);
            addResult(quad.vy, "vy", results);
            addResult(quad.nx, "nx", results);
            addResult(quad.ny, "ny", results);
            addResult(quad.nxy, "nxy", results);
            addResult(quad.epsilonX, "epsilon_x", results);
            addResult(quad.epsilonY, "epsilon_y", results);
            addResult(quad.epsilonZ, "epsilon_z", results);
            addResult(quad.crackWidthX, "crack_width_x", results);
            addResult(quad.crackWidthY, "crack_width_y", results);
            addResult(quad.crackWidthZ, "crack_width_z", results);
            addResult(quad.eta, "shear_utilization", results);

            Dictionary<string, Object> structural2DElementResults = new Dictionary<string, object>();
            Structural2DElementResult structural2DElementResult = new Structural2DElementResult { Type = "Structural2DElementResult", Value = results };

            structural2DElementResults.Add("8001", structural2DElementResult);

            Structural2DElementMesh structural2DElementeMesh = new Structural2DElementMesh
                Type = "Mesh/Structural2DElementMesh",
                baseMesh = speckleMesh,
                ElementType = Structural2DElementType.Generic,
                Result = structural2DElementResults

    private static void addResult(double result, string resultType, Dictionary<string, Object> results)
        List<double> r = new List<double>();
        results.Add(resultType, result);


Hello @tlmn! I think you can simplify a bit your code.

var speckleMesh = new SpeckleMesh { Vertices = vertices, Faces = faces };
speckleMesh.properties = new Dictionary<string,object>(); // to make sure it's initialised

var myResultDict = new Dictionary<string,double>();

myResultDict["epsilon_x"] = etc;
myResultDict["epsilon_y"] = etc;
myResultDict["epsilon_z"] = etc;

speckleMesh.properties["8001"] = myResultDict; // "8001" is a weird  key name, but i assume it's something you need

PS: creating a mesh from each quad is very inefficient… but let’s leave that for now :slight_smile:


Hey @dimitrie,
8001 is one of my load cases, so i thought a good key for my result dictionary… :wink:

Setting my results as custom properties works now also with Grasshopper! Thanks!

What´s the reason to use Structural2DElementResult then?

P.S. I wanted results per quad (not per node), which meant, I had to create a mesh for each quad. I already noticed that it´s “quiet” inefficient… :wink: Any other suggestions?


@mishaelnuh might be able to shed more light on Structural2DElementResult, i’m at a loss. It’s used to get stuff out of GSA, afaik, so it might be tailored for that. There were some compromises involved :smiley:

@mishaelnuh also elegantly dealt with extracting results both per face and per vertex (needed to colour things in the browser).

@mishaelnuh also is now back to school doing cooler things, unfortunately

Off the top of my head, i would do this, to keep things in one mesh:

  • add each quad’s vertexes in one mesh’s vertex array, duplicating the common ones
  • add the faces array based on the above
  • add results_x_per_face prop, with your results per quad, as you’re doing now --> nice results in gh
  • add, as well, results_x_per_vertex, which would just be the value from above times x, where x is 3 or 4 (triangle/quad) --> shows nicely in the online viewer

Even though there’s duplicate info, just keeping things inside arrays like this would make life much snappier…


Hi @tlmn,

As @dimitrie said, I’m busy with uni (although if I’m doing cooler things is debatable), but I think I can point out some tips which may point you in the right direction!

Firstly, Dictionaries and Lists sometimes do not get deserialized properly in GH using the components. A way to resolve this is to skip the conversion step so as to keep the object in its original form. You can do this by right clicking the Receiver component and making sure ‘Deserialise objects’ is not checked.

Secondly, accessing the dictionaries requires some finagling unfortunately. Never managed to have time to implement this before I went back to school (maybe some time in the distant future as a procrastination technique).

I’ve included a GH definition which demos contouring a mesh with results from GSA. You’ll definitely have to change it for your results, but hopefully it’ll shed some light into the problem! The stream is stored on the Hestia server and should be public.

GH File