Using Karamba Meshing tool in C#

Hi,
I am currently working on a project where I use Karamba through its C# API.
Is there a way to call the meshing tool of Karamba “Mesh Breps” through a C# function?
I have the impression that the logic is directly implemented in the SolveInstance of the component, hence not accessible from outside.

Thank you very much for your answer.
Guillaume

Hi @guillaume_caussarieu,
thanks for your hint! Yes, you are right. In Karamba3D 1.3.3 the mesher-UI and the solution procedure are still contained in one place.
I will change that in version 2.0.0. and add a separate static class which contains the mesher logic. Please have a look at https://github.com/karamba3d/K3D_NightlyBuilds. I think it will be there by mid next week.
– Clemens

Hi Clemens,
Great! I will download the latest version next week then.
Thanks a lot!

Guillaume

Hi @guillaume_caussarieu

I am looking for the same thing but do not manage to find it in the latest NighltyBuild, did you manage to use the brep to mesh in c# and where did you find it?

@karamba3d which method would you propose to create a brep to karamba mesh3 in c#?

Thanks!

Lukas

Hi @lfuhrimann,
the K3D mesher can be envoked via
Karamba.GHopper.Utilities.MeshBreps.solve:

/// meshes a list of breps such that their vertices coincide on common edges. The minimum mesh-size is hard-coded to 5mm. This is due to tolerance checks and will be removed in future.
/// list of breps to be meshed
/// points to be added to the mesh as vertices if their distance from the breps is not too large
/// characteristic length of the resulting face edges
/// case 0: No Point Reduction (check Cull Mode),
/// case 1: Point Reduction is set to ‘Leave One’; Culling Points at distance < 0.5 * Mesh Resolution
/// case 2: Point Reduction is set to ‘Average’; Culling Points at distance < 0.5 * Mesh Resolution
/// Edges are refined with: Math.Round(refineEdgeResFactor, 2) x Mesh Resolution
/// Vertices closer than cullDist get removed
/// tolerance *0.1 = tolerance for delauney triangulation
/// must be between 0 and 1; smoothes the mesh
/// number of steps for smoothing the mesh
/// warning encountered during mesh generation
/// information regarding the meshing process
/// resulting meshes
public static void solve(List inputBrep, List inclusionPoints, double mResolution, int m_mode, double refineEdgeResFactor, double cullDist, double tolerance, double smooth, int steps, out string warning, out string info, out List remappedMeshes)

Use “Mesh3 mesh3 = mesh.Convert() from ‘Karamba.GHopper.Geometry’” to convert a Rhino Mesh to Mesh3.
– Clemens

1 Like