RhinoCommon Intersection.MeshPlane() method Slower in Rhino8

Hello, I am a Rhino Plugin developer.

We are currently upgrading the plugin to Rhino8 version.
The MeshPlane method takes too long to execute.

I’ve also tested the method for inserting a MeshIntersectionCache (see below), but it’s still slow.

Is there any way to improve this part?

Hi @tr1004sm,

Can you provide a model, along with sample source code that we can run here, that exhibits this slowness?

Thanks,

– Dale

There is nothing special about the code
To check the API speed, the code was tested by putting it in a loop.

image

And The file I tested was 3D scan data and had a large number of mesh vertices.
Please understand that we cannot provide samples directly as they are production-applied products. Rhino Object information is provided as follows. (It is expected that the greater the number of mesh vertices, the greater the difference compared to lower versions of Rhino.)

What if you put the creation of the cache outside of your loop. From the little code I can see it looks like you are creating a new cache for every time you perform an intersection.

1 Like

As a result of the test, the speed is similar even if the cache creation is done outside the loop. I also tested the tolerance from 0.1 to 0.0001 and the speed is similar.

Also, is there any way to convert the mesh state to perform intersection? As shown below, the execution speed of the first method of the RhinoCommon method and the execution speed of input 10 planes in the second method are the same.

In my case, the suggestion of Giulio did solve the speed problem. Maybe you should use 1.0e-10 as value for the tolerance ? But it seems to work only if the section plane is parallel to the XY plane.

I could solve that by first transforming the mesh to be aligned with the section plane (planeToPlane transform), and then transforming the resulting polylines back to the original coordinate system. Then I get a similar speed to V7.