hi,
the set guides just define the guide, but you have to create them before.
I've create this more generic example. From this, you should be able to create the guide from the spline.
import c4d
from c4d import gui
# Welcome to the world of Python
# Main function
def main():
# Creates the guides
guideCnt = 10
segmentPerGuide = 4
pointsPerGuide = segmentPerGuide +1
guides = c4d.modules.hair.HairGuides(guideCnt, segmentPerGuide)
if guides is None:
raise ValueError("coudln't create the guides")
x = 0
xspace = 10
yspace = 10
# set the points position of the guides.
for guideIndex in range(guideCnt):
# space each guide
x += xspace
for spid in range(pointsPerGuide):
# Calculate the vertical position of each point
pPos = c4d.Vector (x, yspace * spid, 0 )
# get the index of that point in the global guide array
pIndex = guideIndex * pointsPerGuide + spid
# Sets the point
guides.SetPoint( pIndex, pPos )
# Creates the Hair Object
hairObj = c4d.BaseObject(c4d.Ohair)
# Sets the previously created guide to this hair object.
hairObj.SetGuides(guides, False)
# Inserts the hairObject in the document
doc.InsertObject(hairObj, None, None)
# Inserts an update event in the stack
c4d.EventAdd()
# Execute main()
if __name__=='__main__':
main()
after looking the result you need a bit more information about the command.
the convert spline to hair is using the function UniformToNatural to convert bezier curves.
It also take into account any hair tag that could change the render look of the spline.
Cheers,
Manuel