Selecting Splines by Display Colour

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  11 November 2017
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!
M.
 
  11 November 2017

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)
† ††
† † c4d.EventAdd()
if __name__=='__main__':
† † main()

It will select all splines that have the same color than the object you currently select.
__________________
http://graphos.xyz/
https://github.com/gr4ph0s

Last edited by gr4ph0s : 11 November 2017 at 10:00 AM.
 
  11 November 2017
I'll try it right away, thank you so much!!
 
  11 November 2017
It works perfect! Thanks again!!†
 
  11 November 2017
This is so cool man....!!! It even works with Polygon Objects with a minor change.... Thanks.
__________________
Lex de PrieŽlle | Studio Lex

Last edited by Lex1968 : 11 November 2017 at 07:35 AM.
 
  11 November 2017
Yes of course, just remove "and isinstance(obj, c4d.SplineObject)" and it will select all kind of objects.
__________________
http://graphos.xyz/
https://github.com/gr4ph0s
 
  11 November 2017
Very generous gr4ph0s, so great to see such help from the community.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:00 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.