As this is my first post I would like to say Hello to everyone and a big thanks to the developers and users of TexGen
I am trying to write a script to color the individual yarns by yarn orientation, but i cannot figure out how to access the information about the orientation of each yarn. I want to write a loop which iterates through each yarn, obtains the orientation and then changes the color of the yarn appropriately. The code below is how I imagine it could work.
-------------------------------------------------------------------------
# get handle
rw = GetRenderWindow()
tl = GetTextile()
# get number of yarns
n_yarns = tl.GetNumYarns()
# loop
for i in range(n_yarns):
### CODE TO OBTAIN YARN ORIENTATION (0 or 1) ###
# boolean
if "orientation" == 0:
rw.SetYarnColor(i, COLOR(1,0,0)) # red
else:
rw.SetYarnColor(i, COLOR(0,0,1)) # blue
-------------------------------------------------------------------------
By the way, I have noticed that when trying to get the number of layers and yarns of a woven ply (like here http://texgen.sourceforge.net/phpBB3/vi ... tate#p6604) through GetNumLayers() or GetNumYarns() the output is incorrect and only shows the number of layers and yarns for the initial weave. When I inquire as to the type of textile the answer is a weave rather than a" LayeredTextile(Layers:2)" as shown in the GUI. This issue would have an effect on the number of yarns that are supposed to be colored in the script above and I'd like to ask if there is a way to get the right values.
I have attached a model of my two layer ply.
Thanks for the help in advance