Joining Meshes became super slow in recent V6 builds : (

Hi @Pascal,

Not sure what changed in Rhino recently, but joining meshes became super slow and seriously gets in the way of our workflow where this is something we have to do very often.

Joining 100K+ pieces together in V5 or earlier versions of V6 is really just a blink of an eye fast, and now in latest V6 Rhino freezes for a good minute.
Please see attached sample file to compare, if you have access to V5 or earlier V6 builds… Hope this can get fixed!

EDIT: working with Version 6 SR16
(6.16.19150.22171, 5/30/2019)

thank you,

–Jarek

Join_Mesh_Test_100K.zip (9.8 MB)

@tim, can you look at this?

Yep, a minute in 6.16… a second or so in V5.

I added https://mcneel.myjetbrains.com/youtrack/issue/RH-53066, currently for Tim. Checking on 6.15…

-Pascal

1 Like

This happened as a result of the fix for https://mcneel.myjetbrains.com/youtrack/issue/RH-52761. I can check for ngons prior to the join and call the old code if there aren’t any.

Tim

Thanks Tim- I believe here there is mostly no Ngons… But are you saying that if there are Ngons, the code will be very slow and there is no way around it?

PS. Hope V6 still can get this fixed : )

–jarek

@Jarek - do you recall what Rhino 6 SR was “fast?” We don’t believe the fix made by @tim is the cause of the slowness.

Also, what is the purpose of the massive disjoint mesh?

– Dale

Slow in 6.10…
Slow in 6.4…

@tim - in 6.4 the if the option in Join is set not to join disjoint meshes, it is extra slow, but not as slow as 6.16 in my test - it does finish. ~4 minutes plus, here.

-Pascal

hi @dale,

I’d say SR13 and before for sure (well, it used to be slow again for a while due to poor handling of legacy materials, but @johnc made fixes for that…) So for a while it was good, but this slowness is quite recent, but not ‘just happened’. Sorry I can’t be more precise. It definitely worked in V6 well for a long time (since we switched to V6 last year).

Most of the work we do has to do with models that are orginally imported from other software (SKP, Revit) and Rhino is used to clean them up and built upon that/detail them further etc. These most often come imported as meshes, and very heavy scenes. Disorganized. Messy. Sometimes super slow since meshes don’t come joined. In order to be able to operate on these, we would use various combinations of join/splitdisjointmesh/extract mesh faces/ etc. Back and forth - since Rhino works super fast on big joined meshes. So we heavily rely on this being fast.

@pascal - I just saw your note - 6.10 might have been pre-JohnC fix. We switched to Rhino 6 around SR9 and helped to iron out a couple of issues, slow mesh joining was one of them, but it was due to some weird material buildup… I would say 6.11 to 6.13 was OK?

thanks,

–jarek

@Jarek - this quick and dirty script will join a bunch of meshes without all the bother of the Join command.

import scriptcontext
import Rhino

def FastJoinMesh():
    
    # Pick some meshes
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select meshes to join")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Mesh
    go.GetMultiple(1, 0)
    if go.CommandResult() != Rhino.Commands.Result.Success: 
        return
    
    # Make a list of mesh geometry
    meshes = []
    for objref in go.Objects():
        meshes.append(objref.Mesh())
    
    # Join 'em up
    new_mesh = Rhino.Geometry.Mesh()
    new_mesh.Append(meshes)
    
    # Add new mesh to doc
    scriptcontext.doc.Objects.Add(new_mesh)
    
    # Delete the selected meshes
    for objref in go.Objects():
        scriptcontext.doc.Objects.Delete(objref.ObjectId, False)
        
FastJoinMesh()

– Dale

Nice, thanks. Why can’t the join command be as fast :slight_smile: Or have some options like “I_don’t_care_about_Ngons_Only_Speed” ?

I tried RhinoScript:

    	Dim m : m = Rhino.GetObjects()
    	Call Rhino.JoinMeshes(m, True)

but it is as slow as the command. Unfortunately we have bunch of in house tools relying on the RhinoScript version : /

–j

@Jarek - the Join command can probably be a faster for your case. Code was added to Join to deal with disjoint meshes (e.g. the JoinDisjointMeshes=No/Yes command line option). This is where the root of the slowness comes from. I think @tim has a few idea on how to speed this up a bit.

I can also make a quick tune up to RhinoScript too.

– Dale

That would be great…

I did not see that… 90% of the time we would need it on YES (that’s how it is right now). The slowdown is noticeable only on 20,000+ meshes (I know this sounds crazy, but try importing architects files from SKP or Revit - one bush that comes as separate faces could be 100,000+…). Rhino deals exceptionally well with these heavy files to make them usable or workable, but we heavily rely on the mesh joining being fast. Looking forward to what @tim can cook up. Thank you for helping with making this better !

–jarek

2 Likes

The _Join with meshes is back to being quite fast in the latest build. @Tim, thank you for the fix! (@Dale, this affects the RhinoScript JoinMesh which also works well now).

–jarek

This issue (Rhino.JoinMeshes is slow RH-53070) is fixed in the latest Service Release Candidate

1 Like