Compare/Diff RhinoObjects

I’m trying to write a tool that would compare two versions of a Rhino model by identifying which objects have been addded, deleted, and modified. Determining the added and deleted elements seems trivial, as I can use the Ids to identify objects that are new or missing. Determining the objects that are modified seems trickier.

Are there any built-in function(s) of the RhinoCommon SDK which can be used to identify if two RhinoObjects are equal to one another or not? Meaning they have the same geometry, attributes, etc…

There is the CompareGeometry method, but it’s not currently hooked up in Python. It does work in Rhinoscript. I’m not sure about the RhinoCommon SDK, but this might possibly be a clue to help you figure this out.

Dan

Most of the basic geometry classes and structs in RhinoCommon have an EpsilonEquals<T>(T other, double tolerance) method that can compare whether two objects are “the same” within a specified tolerance (i.e. epsilon).

You should use these methods with a tolerance up to, let’s say, 1e-8 to 1e-12, because of floating point accuracy, see http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems

Hello Dan,
Do you know a rhino script to compare two models ?
Thank you very much
Gatrong

CompareGeometry is working in V6.

Thanks you very much Dan, but i use V5

This might be a reason to upgrade.

1 Like