Hello everyone!
I am opening this discussion because I am having problems exporting .stl files when generating the fabric with python code which is defined in the scripting guide as "the hard way" (i.e. creating the yarns one by one, setting the coordinates of the nodes, defining the cross section etc).
The procedure I usually use to export stl files is: \file\export\ Suraface Mesh\ Vtu/Stl files and it works very well both in Wizard mode and with Python scripts "the easy way", i.e. where you use CTextileWeave2D and weave.swapPosition.
However, when I use more complex Python scripts, I get the following error message when I try to export. "Unable to fill gaps satisfactorily .Error creating surface mesh."
I immediately thought it might be due to yarns interlacing, so I tried correcting the small intersections but the problem persists even if I try to export individual yarns. Then I thought maybe it could be an error in my codes, but the problem is there even when using example codes from the scripting guide.
I would need the stl files for OpenFoam simulations and don't really know how to get them, so any help is appreciated.
Thank you very much!
Problems exporting .stl files
Moderators: Martin, Developers
Re: Problems exporting .stl files
Hi,
Sorry for the slow reply - I've been busy exam marking!
The stl export basically exports the surface mesh (as you see it when you do an x-ray render). The error that you're seeing is from the surface mesh generation and will be to do with the complexity of the model rather than how you created it. If you send a file which gives problems I can see if there's an obvious cause.
The problem with that export is that you just have the geometry and lose any additional information such as volume fraction and orientations.
One of our researchers used OpenFOAM a while ago and used the Abaqus input files generated by TexGen by writing a script which reordered the nodes correctly for OpenFOAM. The simplest thing would be to directly export in the correct order from TexGen and it's been on my to-do list for a while but I haven't got around to doing it yet.
Best wishes,
Louise
Sorry for the slow reply - I've been busy exam marking!
The stl export basically exports the surface mesh (as you see it when you do an x-ray render). The error that you're seeing is from the surface mesh generation and will be to do with the complexity of the model rather than how you created it. If you send a file which gives problems I can see if there's an obvious cause.
The problem with that export is that you just have the geometry and lose any additional information such as volume fraction and orientations.
One of our researchers used OpenFOAM a while ago and used the Abaqus input files generated by TexGen by writing a script which reordered the nodes correctly for OpenFOAM. The simplest thing would be to directly export in the correct order from TexGen and it's been on my to-do list for a while but I haven't got around to doing it yet.
Best wishes,
Louise
Re: Problems exporting .stl files
Hi Louise ,
Don't worry about the late reply, I am even more so. What I was asking you was for a thesis work, and in the end we avoided the problem by using simpler geometries. However, I am now back to work on the subject and would like to try to solve the problem.
Below I attach a problematic script so you can see if there is an obvious cause.
On the other hand, it would be interesting to look into the Abaqus file, can I find the script you mentioned on Github?
Thanks very much
Giovanni
Don't worry about the late reply, I am even more so. What I was asking you was for a thesis work, and in the end we avoided the problem by using simpler geometries. However, I am now back to work on the subject and would like to try to solve the problem.
Below I attach a problematic script so you can see if there is an obvious cause.
On the other hand, it would be interesting to look into the Abaqus file, can I find the script you mentioned on Github?
Thanks very much
Giovanni
Code: Select all
Textile = CTextile()
#Set specification (Density [Yarns/cm] - spacing)
D1=22
D2=20
s1=0.1/D1
s2=0.1/D2
#Warp diameter [m]
d1= 0.00263
#Weft diameter [m]
d2=0.00282
# Create a python list containing 2 Warp yarns
Yarns = [CYarn(), CYarn()]
# Add nodes to the yarns to describe their paths
Yarns[0].AddNode(CNode(XYZ(0, 0, 0)))
Yarns[0].AddNode(CNode(XYZ(0, s2, d1)))
Yarns[0].AddNode(CNode(XYZ(0, 2*s2, 0)))
Yarns[1].AddNode(CNode(XYZ(s1, 0, d1)))
Yarns[1].AddNode(CNode(XYZ(s1, s2, 0)))
Yarns[1].AddNode(CNode(XYZ(s1, 2*s2, d1)))
for Yarn in Yarns:
# Set the interpolation function
Yarn.AssignInterpolation(CInterpolationCubic())
# Assign a constant cross-section all along the yarn of elliptical shape
Yarn.AssignSection(CYarnSectionConstant(CSectionEllipse(1.2*d1, 0.8*d1)))
# Set the resolution of the surface mesh created
Yarn.SetResolution(20)
# Add repeat vectors to the yarn
Yarn.AddRepeat(XYZ(2*s1, 0, 0))
Yarn.AddRepeat(XYZ(0, 2*s2, 0))
# Add the yarn to our textile
Textile.AddYarn(Yarn)
# Create a python list containing 2 Weft yarns
Yarns = [CYarn(), CYarn()]
Yarns[0].AddNode(CNode(XYZ(0, 0, d2)))
Yarns[0].AddNode(CNode(XYZ(s1, 0, 0)))
Yarns[0].AddNode(CNode(XYZ(2*s1, 0, d2)))
Yarns[1].AddNode(CNode(XYZ(0, s2, 0)))
Yarns[1].AddNode(CNode(XYZ(s1, s2, d2)))
Yarns[1].AddNode(CNode(XYZ(2*s1, s2, 0)))
# Loop over all the yarns in the list
for Yarn in Yarns:
# Set the interpolation function
Yarn.AssignInterpolation(CInterpolationCubic())
# Assign a constant cross-section all along the yarn of elliptical shape
Yarn.AssignSection(CYarnSectionConstant(CSectionLenticular(1.2*d2, 0.8*d2)))
# Set the resolution of the surface mesh created
Yarn.SetResolution(20)
# Add repeat vectors to the yarn
Yarn.AddRepeat(XYZ(2*s1, 0, 0))
Yarn.AddRepeat(XYZ(0, 2*s2, 0))
# Add the yarn to our textile
Textile.AddYarn(Yarn)
# Create a domain and assign it to the textile
Textile.AssignDomain(CDomainPlanes(XYZ(-2*s1,-2*s2, -d2/2), XYZ(2*s1, 2*s2 , 1.5*d2)))
# Add the textile with the name "plainWeave_1L"
AddTextile("plainWeave", Textile)
[\code]Re: Problems exporting .stl files
Hi,
I'm afraid that I don't have time to look at your script right now. Are you still wanting to export to OpenFOAM? The scripts that I mentioned aren't on Github I'm afraid.
I came across this software recently https://github.com/binyang424/PolyTex which looks like it has a function to convert a .vtu file exported by TexGen to OpenFoam format. The voxel and volume mesh exports in TexGen will both allow you to export as a .vtu file.
If you try this and have any success I'd be really interested to know. Otherwise, I'll try and take a look at your script when I have time.
Best wishes,
Louise
I'm afraid that I don't have time to look at your script right now. Are you still wanting to export to OpenFOAM? The scripts that I mentioned aren't on Github I'm afraid.
I came across this software recently https://github.com/binyang424/PolyTex which looks like it has a function to convert a .vtu file exported by TexGen to OpenFoam format. The voxel and volume mesh exports in TexGen will both allow you to export as a .vtu file.
If you try this and have any success I'd be really interested to know. Otherwise, I'll try and take a look at your script when I have time.
Best wishes,
Louise
Re: Problems exporting .stl files
Hi Giovanni,
I don't know if you still need to export to OpenFOAM, but the documentation for polytex has now been updated to show how it can be used to export a TexGen file to OpenFOAM. Instructions are here: https://polytex.readthedocs.io/en/lates ... exGen.html
It seems to run, although I haven't tried importing the files produced into OpenFOAM. Also, it seems to crash if the plot option is True.
Best wishes,
Louise
I don't know if you still need to export to OpenFOAM, but the documentation for polytex has now been updated to show how it can be used to export a TexGen file to OpenFOAM. Instructions are here: https://polytex.readthedocs.io/en/lates ... exGen.html
It seems to run, although I haven't tried importing the files produced into OpenFOAM. Also, it seems to crash if the plot option is True.
Best wishes,
Louise