I am trying to develop a plugin for grasshopper to interact with an FEM-Software.
So basically I’m deconstructing geometry(mesh, polyline, points) and store the retrieved data (point coordinates, coordinates of mesh vertices) in the database of the other Programm.
I already wrote some components to make this possible but now I am facing some problems:
I have a component (comp1) which deconstructs a mesh and converts the data so that I can use it.
Another component (comp2) does the same for a Polyline. But the component should check if the points of the polyline already exist in comp1 and send the not existing ones to comp1 where I integrate them in the mesh (if they are close to the mesh).
comp1 and comp2 are not connected through wires and have different inputs.
To solve this my idea is to create a „shared data container component“ where every other component has wireless access and can store or retrieve data! The stored data type would then be an 3 or 4 dimensional object array.
Is something even possible or should I look for another way?
You can, of course, use static class to store global variables.
However, the problem here is, the order of calculation is not guaranteed. What would happen if your polyline component runs before the mesh component? I would recommend to have one final collector component which registers AfterSolveInstance to check everything.
Just pack all the data, then ship it to a single component where the calculation will happen. For starters, I do not suggest you add new structural logic to the GH environment. Look at “Mesh face” – it does not know about the mesh it’s in, but it performs all the logic and ships the “face” to the “Construct mesh”.