length of yarn

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
guguang
Posts: 8
Joined: Wed Nov 01, 2017 2:12 am

length of yarn

Post by guguang »

Hi,
I'm new of texgen, now I use python script to generate weft knit, and I will want to export the model to abaqus to analyse it's pressure condition. So I want to know how I can get the concrete Interpolation function (Bezier Spline or Natural Cubic Spline) that to calculate the length of yarn by curvilinear integral. And can I specify the Interpolation function in python script? I'd appreciate if you could show me an example.

Thanks,
guguang
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: length of yarn

Post by louisepb »

Hi Guguang,

Welcome to the forum!
I have a student who is modelling knitted fabrics at the moment so would be interested to hear about your work.

You can change the interpolation function used for a yarn using something like

Code: Select all

Yarn.AssignInterpolation(CInterpolationCubic())
and inserting whichever interpolation function you want to use.

The Yarn.GetRawYarnLength() function will give you the length of one repeat of the yarn. This uses the length of the slave node sections so the higher the resolution you have specified for your yarn (ie the higher the number of slave nodes) the more accurate the length will be.

Hope that helps,
Louise
guguang
Posts: 8
Joined: Wed Nov 01, 2017 2:12 am

Re: length of yarn

Post by guguang »

Hi louisepb,

I'm so appreciate that your reply is so fast! This forum is very good as you know there is litter reference about texgen on the internet. I'm very happy to share my work with your student, and he/she can send me a private letter to get my email.

I've used the Yarn.GetRawYarnLength() function, yes it worked. I have read the "Scripting Guide" before, but I didn't find this function in the guide, I hope there is such a "scripting reference manual" for us newers to refer to any function in the texgen.

About the interpolation function, if I want to use a custom interpolation, do I need to write a function like "CInterpolationCubic()" as a parameter for "AssignInterpolation()"?

Thanks for your help,
guguang
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: length of yarn

Post by louisepb »

Hi Guguang,

I am in the process of writing a scripting guide but it is progressing slowly as I don't get much time to do it. Hopefully it won't be too long before an initial version is released.

The interpolation classes available within TexGen are CInterpolationBezier, CInterpolationLinear and CInterpolationCubic which all use CInterpolation as a base function. You could create your own function using the CInterpolation base class and use this in the AssignInterpolation call which takes a CInterpolation derived object as its parameter. Information about these is in the API reference here: http://texgen.sourceforge.net/api/names ... x_gen.html

Hope that helps,
Louise
guguang
Posts: 8
Joined: Wed Nov 01, 2017 2:12 am

Re: length of yarn

Post by guguang »

Hi louisepb,

Hope to read your scripting guide to learn more about texgen!

I'm reading the API reference and will try to do something with the CInterpolation base class.

Thank you for your help and hard work.

Thanks,
guguang
Post Reply