Compare/Diff RhinoObjects


#1

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…


#2

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


(Menno Deij - van Rijswijk) #3

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


(Msgatrong) #4

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


#5

CompareGeometry is working in V6.


(Msgatrong) #6

Thanks you very much Dan, but i use V5


#7

This might be a reason to upgrade.