I want to create a 3D model of Stocking calf by python script, you know it's like a cylinder, the yarn is closed. At first, I want to create a curved yarn element and repeatedly rotate it a circle, but I've not found rotated functions. So then I want to add all nodes on a circle, but the start point and end point don't link togather. The picture is below.
Will be very appreciated for information about this. And happy new year!
Thanks,
guguang
Last edited by guguang on Thu Jan 04, 2018 3:06 am, edited 3 times in total.
It may be an obvious question, but have you repeated the first node? That is, is the last node at the end of the last repeat the same as the very first node? This should make the yarn closed.
Otherwise, would you be able to send either the tg3 file or the script that you used to generate the yarn so that I can try and work out what is happening?
I‘ve tried to repeat the first node at last, but it didn't work. It may be a bug in texgen. I add a simple script below, it should generate a whole circle, but actually it also miss the last part. The TexGen Output in log windows prompted "Trying to add duplicate node: node at 10, 0, 0 not added".
# Create a textile
Textile = CTextile()
# Create a yarn
Yarn = CYarn()
# Add nodes to the yarns to describe the yarn path
Yarn.AddNode(CNode(XYZ(10, 0, 0)))
Yarn.AddNode(CNode(XYZ(5, 8.66, 0)))
Yarn.AddNode(CNode(XYZ(0, 10, 0)))
Yarn.AddNode(CNode(XYZ(-5, 8.66, 0)))
Yarn.AddNode(CNode(XYZ(-10, 0, 0)))
Yarn.AddNode(CNode(XYZ(-5, -8.66, 0)))
Yarn.AddNode(CNode(XYZ(0, -10, 0)))
Yarn.AddNode(CNode(XYZ(5, -8.66, 0)))
Yarn.AddNode(CNode(XYZ(10, 0, 0))) # add the first node
# Set the resolution of the surface mesh created
Yarn.SetResolution(20)
# Add the yarn to the textile
Textile.AddYarn(Yarn)
# Add the textile
AddTextile("knit", Textile)
I'm afraid that I haven't found the cause of this problem yet. There isn't any functionality in TexGen to join two yarns.
The only workaround that I have found at the moment is to use the GUI. I ran your script, selected the last node and used Insert Node in the Outliner window to create an extra node. I selected the new last node, used the y axis arrow to move the point to the correct y location (the Position values are given in the Modeller window). I then selected the inserted node and used the Modeller window to type in the correct Position coordinates. Then select the final node and use the x-axis arrow to move it to the correct position. The bug seems to be in positioning this last point - if you try to type in the x-coordinate it doesn't work.
loop.png (89.12 KiB) Viewed 11815 times
Sorry that's a bit cumbersome but it's the best I can suggest until I have time to try and find the bug.
Hope that helps,
Louise
I've used your method before, the yarn seems like to connect end to end in vision, but the coordinate value of the final node in the modeller window is not the same as the first node. If I tried to edit the last coordinate value to (10, 0, 0) as the first node value, the "TexGen Output" prompted "Trying to replace duplicate node: node at 10, 0, 0 not added" and then failed.
I want to create a tube stocking and then export it to Abaqus to simulate the leg pressure. So the yarn should be consecutive in both vision and physical property. The tube stocking can stretch when it's put on leg.
I'll find if there were any other methods to avoid this bug, and wish your further solution.
Hi Guguang,
If you follow the order specified below then the method should work and in the example attached which was illustrated in the previous email definitely has the same coordinates at the beginning and end of the yarn. You can check this in the tg3 file. Another way I've thought of (and which seems to work) is to save your model and then edit the .tg3 file to give the correct coordinates for the last point. The tg3 file is just a renamed xml file.
It isn't possible in TexGen to create a continuous circular yarn. I think that if you specify your boundary conditions correctly for the matching node sets at either end of the yarn then you should be able to achieve what you're after.