Comparing files

I have not done any testing but it is easy enough to tag objects in a file - this could also be done to an imported file as it comes in, but maybe one tag is enough.

Simple example

import rhinoscriptsyntax as rs


def tag_objects():
    
    file = rs.DocumentName()

    if not file:return

    tagString = file.split(".")[0]
    
    ids = rs.AllObjects()
    
    if not ids: return
    
    for id in ids:
        rs.SetUserText(id, 'FileTag', tagString)
        
tag_objects()

Here is a thing to select these once the dups have been hidden’

import rhinoscriptsyntax as rs

def sel_tag_objects():
    
    file = rs.DocumentName()

    if not file:return

    tagString = file.split(".")[0]
    
    ids = rs.NormalObjects()
    
    if not ids: return
    rs.UnselectAllObjects()
    rs.EnableRedraw(False)
    for id in ids:
        
        if rs.SetUserText(id, 'FileTag', tagString):
            rs.SelectObject(id)
    rs.EnableRedraw(True)
        
sel_tag_objects()

and, I suppose there ought to be one to clear all the tags…

import rhinoscriptsyntax as rs

def clear_tag_objects():
    

    ids = rs.AllObjects()
    
    if not ids: return

    for id in ids:
        rs.SetUserText(id, 'FileTag', "")

clear_tag_objects()

-Pascal

4 Likes