how to create the surface yarns

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
LijunGu
Regular
Posts: 30
Joined: Mon Jun 01, 2020 4:49 am

how to create the surface yarns

Post by LijunGu »

Hello Dr. Louise,

First of all, thank you for your strong support regarding how to get the coordinates of nodes.

There is a simple textile model which include surface yarns. look like:
section.JPG
I have an idea how to setup this textile model. Basically, using Layer to Layer way and add the additional surface yarns.
Scripting looks like:

weave = CTextileLayerToLayer(4, 4, 1, 1, 0.1, 0.5937, 3)
weave.SetWarpRatio( 0)
weave.SetBinderRatio( 1)
weave.SetWarpYarnWidths( 0.8)
weave.SetYYarnWidths( w_weft)
weave.SetBinderYarnWidths( w_warp)
weave.SetupLayers( 3, 4, 3)
weave.SetGapSize( 0 )
weave.SetBinderPosition(0, 0, 0)
...
for i in range(4):
weave.SetXYarnWidths(i, w_warp)
weave.SetXYarnHeights(i, h_warp)
weave.SetXYarnSpacings(i, sy)
for i in range(4):
weave.SetYYarnWidths(i, w_weft)
weave.SetYYarnHeights(i, h_weft)
weave.SetYYarnSpacings(i, sx)
weave.AssignDefaultDomain(False)
AddTextile("test", weave)

# upper yarn
#try 1(failed):
weave.SetBinderPosition(0, 0, 0)
weave.SetBinderPosition(1, 0, 0)
weave.SetBinderPosition(2, 0, 1)
weave.SetBinderPosition(3, 0, 0)
for i in range(4):
weave.SetXYarnWidths(i, w_warp)
weave.SetXYarnHeights(i, h_warp)
weave.SetXYarnSpacings(i, sy)

Due to there is no function like AddYarn according this CTextileLayerToLayer class, so i checked the web: http://texgen.sourceforge.net/api/class ... layer.html
To be honestly, i am not used to check the manual like this, there is not so much explanation.
Anyway I found these below two related commands maybe useful, but it is difficult to use them.
#try 2(failed):
weave.AddXLayers()
#try 3(failed):
weave.AddWarpLayer()

Do you have some ideas regarding this topic?

Have a nice day for all of you!

Best regards!
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: how to create the surface yarns

Post by louisepb »

Hello,

The AddXLayers etc functions are normally used when setting up a 3D weave initially using a script rather than from the user interface. They will add a given number of layers of yarns to the stacks of warp or weft yarns.

You can use the AddYarn function for a textile created using the CTextileLayerToLayer class as it is inherited from CTextile. AddYarn is a CTextile member function. If you look at the diagram at the top of the page you gave a link to you will see the inheritance diagram. If you don't understand this then you probably need to do some reading about object oriented programming and inheritance in order to understand how to use the TexGen classes.

Hope that helps,
Louise
Post Reply