How can compare different of objects?

I have 2 objects. Object 2 is mirrored of object 1.
How can compare different of them?

Hello,

Do you know exactly how they are mirrored? If so then can you mirror one of them and take the Boolean difference?

Hello - what do you want to compare, exactly - 3d shape? How identical should they be in order to be ‘the same’? Same bounding box? Same surface area? Same surface structure? Same color? etc etc. In short, what are you looking for exactly?

-Pascal

I want to find a difference between them so that when comparing, returns the false value

Hello - compare bounding boxes is probably the simplest here.

-Pascal

i created bounding boxes but how compare them with python script

Hello - here is a simple example:

import rhinoscriptsyntax as rs
import scriptcontext as sc

def compare_bounding_boxes(id1, id2):
    tol = sc.doc.ModelAbsoluteTolerance
    bb1 = rs.BoundingBox(id1)
    bb2 = rs.BoundingBox(id2)
    #In rhinoscriptsyntax, BoundingBox returns the corner points
    # compare the coner points of the boxes
    # if any pair are farther apart than some tolerance
    # consider the boxes to be different    
    for i in range(8):
        if bb1[i].DistanceTo(bb2[i])> tol:
            return False
    return True

id1 = rs.GetObject()
id2 = rs.GetObject()

if id1 and id2:
    same = compare_bounding_boxes(id1, id2)
    print same
    
    

-Pascal

1 Like

thank you! i try it

This Ok! Thank you very much

Compare it to itself is true but compare it to copy it then false

Hello - yes, that’s why I asked up above what exactly you mean by the same… what you care about makes a difference in how you ask if they are the same. This can be a fairly complicated problem - if the objects are oriented differently they will have different bounding boxes except in special cases, so that is not, as it turns out, a useful test for a copy. If you are checking surfaces, you may want to compare area, number of trims, underlying surface structure, etc etc.

-Pascal

I use the area to filter them out. They have the same area. how to compare 1 vs copy 1 is True, 2 with 1 is False.

How to compare number of trím or underlying surface structure with code?

Help me. Please!