section shape

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
JordT
Posts: 3
Joined: Wed Jul 11, 2012 4:13 pm

section shape

Post by JordT »

Hello,

I would like to know if it is possible to model a section of a yarn by means of a equation with phyton. I imagine that TexGen only accepts the python scrips that generates when one uses the menus in the software.

Thank you for your answer.

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

Re: section shape

Post by louisepb »

Hi Jordi,

There is a polygon section available in TexGen. You can only use this from a Python script. The api documentation is here: http://texgen.sourceforge.net/api/class ... lygon.html Basically you need to send it a list of points which you could generate using your equation.

Hope that helps,
Louise
JordT
Posts: 3
Joined: Wed Jul 11, 2012 4:13 pm

Re: section shape

Post by JordT »

Hello dear Louise,

Thank you for your fast reply.

I will read all in this link.

Best regards.

Jordi Trias
JordT
Posts: 3
Joined: Wed Jul 11, 2012 4:13 pm

Re: section shape

Post by JordT »

Hello Louise,

Sorry for bothering you again. I have seen in the link that you gave me that it's possible to create "SectionMeshTriangulate.h", "SectionMeshRectangular.h" and "SectionMeshRectangleSection.h". But what about if I want a polygon with let's say 10 vertixes, is it possible to do that?

Thank you.

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

Re: section shape

Post by louisepb »

Hi Jordi,

The functions that you mention are those that are used to create 2D meshes for the Sections. The functions which you can use to create the section shapes are CSectionEllipse, CSectionPowerEllipse, CSectionRectangle, CSectionLenticular, CSectionHybrid and CSectionPolygon. These can all be created from the user interface with the exception of CSectionPolygon. With the polygon section you simply send it a list of as many points as you want around the edge of the polygon (note that these are specified as 2D sections with the origin at the centre). It must be a closed shape so for your 10 vertices you will need to send 11 points.

Try reading here:
A C Long and L P Brown. Composite reinforcements for optimum performance: Modelling the geometry of textile reinforcements for composites: TexGen, edited by P Boisse, Woodhead Publishing Ltd, 2011, ISBN: 978-1-84569-965-9. http://www.woodheadpublishing.com/en/bo ... ookID=2233. An electronic copy of the chapter is available here: https://woodhead.metapress.com/content/ ... online.com

or here:
http://etheses.nottingham.ac.uk/303/1/thesis-final.pdf

to get a good understanding of the modelling theory.

Best regards,

Louise
JordiMJ
Posts: 2
Joined: Thu Apr 11, 2013 1:59 pm

Re: section shape

Post by JordiMJ »

Hi Louise,

I need your help. I tried to define a polygonal section for a yarn, but i had some problems. I tried to define it with the following command:

section = CSectionPolygon(XY(0,0) &(1,1)(-1,1)(-1,-1)(1,-1),0)

and Texgen sent me a type error that said "'tuple' object is not callable", and I don't know why the programm sent this error. Can you help me?

Thanks for all

Jordi
JordiMJ
Posts: 2
Joined: Thu Apr 11, 2013 1:59 pm

Re: section shape

Post by JordiMJ »

Hello Louise,

I'm Jordi again, and I would ask if you have some examples of the polygon section writen in Python, because the examples in the Texgen web are writen in C++, and I don't know about C++.

Thanks for all

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

Re: section shape

Post by louisepb »

Hi Jordi,

Here is a short script which creates a yarn with a polygon section. Just add as many points as you need to the Points array and use it as the input for the CSectionPolygon.

Code: Select all

Textile = CTextile()
yarn = CYarn()
yarn.AddNode(CNode(XYZ(0, 0, 0)))
yarn.AddNode(CNode(XYZ(10, 0, 0)))
# Set the interpolation function
yarn.AssignInterpolation(CInterpolationCubic())
# Assign a constant cross-section along the yarn using a set of polygon points
Points = [XY(0.5,0),XY(0,0.5),XY(-0.5,0),XY(0,-0.5)]
yarn.AssignSection(CYarnSectionConstant(CSectionPolygon(Points)))
Textile.AddYarn(yarn)
AddTextile("PolygonSection", Textile)
Best regards,

Louise
Post Reply