Exporting .dat and .odb files in Texgen

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
lianges777
Regular
Posts: 10
Joined: Tue Apr 07, 2009 3:49 pm

Exporting .dat and .odb files in Texgen

Post by lianges777 »

Hello
I am doing a research internship about textile composites and I have to stimulate 2D weave textile composites using Texgen and Abaqus. I managed to import the geometry and mesh generated by Texgen and solved it using Abaqus solver. In order to better appreciate the yarns deformation, I would like now to export the .dat and .odb files generated by abaqus into a .tg3 file. I tried copying dry fabric simulation example script:
from TexGen.Abaqus import *

# Define a linear transformation
tension = CLinearTransformation()
# Add a scale in the X direction
tension.Scale(1.1)

# Create an instance of the TextileDeformerAbaqus class
deformer = TextileDeformerAbaqus()
# Add the tensile deformation step
deformer.AddDeformationStep(tension)

# Read in a TexGen model
ReadFromXML('weave2D.tg3')
textile = GetTextile()

# This is where all the work is done, note this may take a long time to run
deformer.DeformTextile(textile)

# Save the result back to a new TexGen model
SaveToXML('weave2D-tensioned.tg3')


Unfortunately, whan I run this script in Texgen, I have this error message:
<1> execfile(r"C:\Temp\Angie\texabaqus.py")
Traceback (most recent call last):
File "gui", line 1, in <module>
File "C:\Temp\Angie\texabaqus.py", line 1, in <module>
from TexGen.Abaqus import *
ImportError: No module named Abaqus


As for the version of Texgen installed on my computer, I have got the version texgen-bundle-3.3.0.exe.

Thank you very much
Angie
joncrookston
Expert User
Posts: 27
Joined: Wed Apr 11, 2007 4:03 pm
Location: Nottingham, UK

Post by joncrookston »

Hi,

If you look in the site-packages directory of your python installation (something like C:\Program Files\Python24\Lib\site-packages) is there a directory called TexGen containing a file named Abaqus.py? If not, maybe there is a portion of the installation process which has not worked correctly. If this file is there, can you open a python command line and type:

Code: Select all

from TexGen.Abaqus import *
without getting an error?

Let us know how you get on with this; it should help the diagnosis.

Where are you working, out of interest?

Cheers,
Jon.
lianges777
Regular
Posts: 10
Joined: Tue Apr 07, 2009 3:49 pm

Post by lianges777 »

Hi,
I checked in the directory C:\Program Files\Python24\Lib\site-packages\Texgen and there is no file named Abaqus.py
I will try desinstalling the software and reinstalling it again

I am working in the Madrid Institue for Advanced Studies (IMDEA in spanish) and I have to simulate 2D woven material using Texgen.

Thank you very much
Angie
eayzdg
Posts: 1
Joined: Sat Feb 21, 2009 6:09 pm

Post by eayzdg »

i had a similar problem, if reinstalling the bundle doesnt work, uninstall texgen and install activepython2.5 and then install the non-bundle version of texgen.
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

Reviving old thread:

I'm having an identical problem to lianges777: I don't have Abaqus.py in directory C:\Program Files\Python 2.7\Lib\site-packages

I originally installed Python after installing TexGen. Upon reading this thread and checking the above directory, I uninstalled TexGen 3.4.1 and reinstalled it (bundle version). That did not succeed in creating Abaqus.py correctly. Then I tried to follow the advice in this thread with the non-bundle version. The non-bundle version does not run (Installer Integrity Check. I keep getting the error even after following NSIS advice).

Is there a way I can manually add Abaqus.py to the Python site-packages directory?

I just tried copy/pasting Abaqus.py from "C:\Program Files\TexGen\Python\libxtra\TexGen\" to "C:\Program Files\Python 2.7\Lib\site-packages\TexGen\", but running the command "from TexGen.Abaqus import *" from the Python 2.7 (both GUI and CL) still returns the original error:

Traceback (most recent call last):
File "stdin", line 1, in <module>
from TexGen.Abaqus import *
ImportError: No module named Abaqus

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

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi David,

I suspect that your problem is to do with the fact that TexGen is built with Python 2.5. The functions which you call from your Python scripts are all generated by SWIG which wraps the original C++ functions so that they can be called from Python scripts.

You need to install Python 2.5 and ensure that the TexGen site-packages directory contains Abaqus.py.

If you install the bundled version it should put Abaqus.py into the ProgramFiles/TexGen/Python/libxtra/TexGen directory. If you still have Python27 in your path it may still look for the file there rather than in the TexGen directory.

I hope that helps. Let me know how you get on.

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

Hello again,

I think I've successfully solved the original problem. I completely uninstalled Python and TexGen, deleting any residual files. Then reinstalled Python. Restarted. Reinstalled TexGen. Now running "from TexGen.Abaqus import *" works fine. Excellent; thank you for your help.

The new problem is thus: I'm trying to follow your scripting documentation examples.
Taking the Sheared Weave (Example 4) python script and creating a MyTextile.tg3 file from it using TexGen.
I then run another script from your documentation to mesh the MyTextile.tg3 file, creating a file called mesh.vtk.
I can load mesh.vtk properly in ParaView :)
Then taking the final code in the documentation (ABAQUS Dry Fabric Simulation) and running that script in Abaqus CAE. (Note: the same happens using the Geometry Solver code, as well)

If I try to run this file in Abaqus I get the following error:
AbaqusError.JPG
AbaqusError.JPG (30.21 KiB) Viewed 11025 times
Any ideas what's going wrong here? My fear is that Abaqus 6.10-1 is trying to use a newer version of Python, and doesn't like python25.dll, but expects, perhaps python27.dll or somesuch.

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

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi David,

Yes, you're right - Abaqus 6.10 uses Python 2.6.2. I have just this week built a 32-bit version on TexGen with Python 2.6.6 ( the current Windows release ) and this seems to work fine calling TexGen functions from within Abaqus 6.10. You could try building TexGen yourself using Python 2.6. Failing that I may make the next TexGen release with Python 2.6 but I'm not entirely sure when that will be yet.

Louise
Post Reply