MatchMeshEdge through scripting or Grasshopper 3D components

Hi all,
I am aiming to close a mesh which due to some previous surface modifications (added approximated patch by blending two separate objects) has a number of small gaps at both ends. A closed mesh is required for the subsequent conversion into a solid SubD geometry and modifications in Grasshopper.

I did try to analyse previous topics/attempts regarding _MatchMeshEdge and came across the following:

  1. MatchMeshEdge C# Component - Grasshopper - I cannot access the file there;
  2. MatchMeshEdge - seems like a request for future work/Beta releases

Could you please advise me on how I can replicate the existing manual _MatchMeshEdge Rhino command in Grasshopper 3D (avoiding to bake the geometry and scripting a customised command via the MacroEditor )
Any GhPython and c# scripting solutions are also welcome.

Rhino 5 file and STL data of the depicted model above are attached here:
MatchMeshEdge_discourse_request_25_10_2020.3dm (10.6 MB) MatchMeshEdge_discourse_request_25_10_2020.stl (4.6 MB)

The gaps are very tiny and manually I am able to close the mesh surface using the following _MatchMeshEdge parameters:

I have access to the most up-to-date Rhino v6 and Rhino Beta versions.

I look forward to receiving your help/advice.
Thank you,

So as I understand the _MatchMeshEdge is not scriptable or accessible with Grasshopper?

Thank you,

Hi Ilja,

It looks like scripting it works:

import rhinoscriptsyntax as rs
import Grasshopper
import Rhino

rhdoc = Rhino.RhinoDoc.ActiveDoc
rhdoc.Views.RedrawEnabled = False

rh_mesh = rhdoc.Objects.AddMesh(mesh)
current = rhdoc.Objects.Find(rh_mesh).RuntimeSerialNumber

# Select the mesh at the end of the command, when it is preselected the options are not available
command = """_MatchMeshEdge _DistanceToAdjust 0.1 _RatchetMode=_On _SelId {} _EnterEnd""".format(str(rh_mesh))

new_obj = rhdoc.Objects.AllObjectsSince(current)

if len(new_obj) > 0:
    mesh_out = new_obj[0].Geometry.Duplicate()
    mesh_out = None

for m in new_obj:

rhdoc.Views.RedrawEnabled = True

in a GHPython component, where mesh is a GH mesh input, and mesh_out the output when successful.

Technically this is equivalent to baking, running a macro, and deleting the temporary baked geometries, but it’s all automated so I guess it’s not really an issue. You could also parametrize the DistanceToAdjust parameter by adding an input to the GHPython component and feeding that to the command through .format().

2020-11-24_DI-110943_MatchMeshEdge (4.0 KB)

1 Like

Hi Pierre,

Is it still on the wishlist to be added to the sdk, for example accessible through Python?

1 Like

I also support this request :+1:

This is still in the pile:, although at a low priority.