Mesh loads in C#

hi team Karamba,

i am trying to make a mesh load in c#.
i have taken a look at Karamba.GHopper.Loads.SubComponent_MeshLoad (automatically decompiles in visual studio). this is the most vital part of the code i found:

    Mesh3 mesh = destination.Value.Convert(_meshCache, base_length);
    List<Vector3> stresses = unitConversion.toBase(FromGH.Values(list));
    LoadOrientation ld_type = (loadOrientation_[1] ? LoadOrientation.global : (loadOrientation_[2] ? LoadOrientation.proj : LoadOrientation.local));
    MeshLoad meshLoad = new MeshLoadNew(stresses, destination3);
    meshLoad.InitUnitLoads(mesh, ld_type, loadGeneration_, list5, list4, _meshUnitLoadsCache);
    DA.SetData(0, new GH_Load(meshLoad));

i have tried starting as simple as possible in the c# component, in hopes of starting building from there.

var loads = new List<Vector3>();
loads.Add(new Vector3(vec.X, vec.Y, vec.Z));
MeshLoad meshLoad = new MeshLoad(loads, "LCname");
A = meshLoad;

but i already get an error which i have never encountered before when i try to attach a panel or hover over the ā€œAā€ output.

any help would be appreciated.

Hi @Joriss,
here is an example for generating a MeshLoad via C#:
MeshLoad.gh (31.7 KB).
I hope this is useful for you.
– Clemens

1 Like

@cp1 Hi Clemens,

this is exactly what i was looking for! thanks for your effort and the quick response!
might be nice to share this example somewhere on the karamba website too.
there must be other devs trying these things too.