Selecting Splines by Display Colour


Hi all,

I imported an illustrator file using CV-Artsmart and I got around 7500 splines with the Use Colour option activated in the Basic tab and a Display Colour assigned to each one.

How can I tell Cinema to select splines that share the same Display colour?

Since there are so many splines I need to find an automatic way of doing this.

Thanks in advance!


import c4d

def iterateHierarchy(obj, doc, colorToMatch):
    while obj:
        if obj[c4d.ID_BASEOBJECT_COLOR] == colorToMatch and isinstance(obj, c4d.SplineObject):
                doc.SetActiveObject(obj, c4d.SELECTION_ADD)
        iterateHierarchy(obj.GetDown(), doc, colorToMatch)
        obj = obj.GetNext()
def main():
    obj = op
    if not obj: return
    color = obj[c4d.ID_BASEOBJECT_COLOR]
    iterateHierarchy(doc.GetFirstObject(), doc, color)
if __name__=='__main__':

It will select all splines that have the same color than the object you currently select.


I’ll try it right away, thank you so much!!


It works perfect! Thanks again!! :bowdown:


This is so cool man…!!! It even works with Polygon Objects with a minor change… Thanks.


Yes of course, just remove “and isinstance(obj, c4d.SplineObject)” and it will select all kind of objects. :slight_smile:


Very generous gr4ph0s, so great to see such help from the community.