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
  1 Week Ago
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.
 
  1 Week Ago

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.
__________________
Available for job:
http://graphos.xyz/
https://github.com/gr4ph0s

Last edited by gr4ph0s : 6 Days Ago at 10:00 AM.
 
  1 Week Ago
I'll try it right away, thank you so much!!
 
  1 Week Ago
It works perfect! Thanks again!!†
 
  6 Days Ago
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 : 6 Days Ago at 07:35 AM.
 
  6 Days Ago
Yes of course, just remove "and isinstance(obj, c4d.SplineObject)" and it will select all kind of objects.
__________________
Available for job:
http://graphos.xyz/
https://github.com/gr4ph0s
 
  4 Days Ago
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 05:18 PM.


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