A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
loop through each HairGuide and get its length using Python
Posted: 17 November 2020 11:13 AM   [ Ignore ]  
Avatar
Total Posts:  22
Joined  2018-02-21

I’m trying to get rid of all hair guides with zero length, and it seems to be impossible without selecting it manually.
So, I ended up with a script to get the guides, but I’m stuck without being able to get the length of each guide individually.

This is what I’ve got so far:

import c4d

def main
():  
    
hair doc.GetActiveObject()
    
guides hair.GetGuides()
    
gcount guides.GetCount()
    for 
index in xrange(0gcount):
        print 
guides[index][c4d.HAIRSTYLE_LENGTH]
        
    c4d
.EventAdd()

if 
__name__=='__main__':
    
main() 

Obviously this is just a guess:

guides[index][c4d.HAIRSTYLE_LENGTH] 

how can I achieve my goal?

Profile
 
 
Posted: 17 November 2020 04:25 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Studio Sixty Four,

For anything Python, please use the Maxon Developer Forum:
https://plugincafe.maxon.net

My best wishes

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 17 November 2020 08:58 PM   [ Ignore ]   [ # 2 ]  
Avatar
Total Posts:  22
Joined  2018-02-21

Thank you Dr. Sassi, I’ll do that.
Regarding to my problem with hair, which has directed me to Python, maybe it’s something you could suggest a different approach if possible.
But to keep things organized, I’ll create a new topic to be more specific.

Thanks

Daniel Sian

Profile
 
 
Posted: 17 November 2020 09:38 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Daniel Sian,

If it doesn’t need to be Python, then things get so much easier:

Please have a look here
https://help.maxon.net/r23/en-us/Default.htm#html/TOOLHAIRSELECTION-MDATA_MAINGROUP.html#HAIR_SELECTION_SELECT

You can select Hairs with a length of Zero manually.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 17 November 2020 10:09 PM   [ Ignore ]   [ # 4 ]  
Avatar
Total Posts:  22
Joined  2018-02-21

Hey Dr. Sassi, you are a master.

This is exactly the solution for my problem.

Thank you!

Profile
 
 
Posted: 17 November 2020 10:26 PM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

You’re very welcome, Daniel Sian; thanks for taking the time.

My best wishes

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile