Difference between revisions of "Scripting Examples"
From TexGen
Jump to navigationJump to searchLine 3: | Line 3: | ||
=== Geometry Solver === | === Geometry Solver === | ||
− | The theory behind the geometry solver is described in a paper submitted to "The First World Conference on 3D Fabrics and Their Applications" held in Manchester on the 10-11th of April 2008 titled " | + | The theory behind the geometry solver is described in a paper submitted to "The First World Conference on 3D Fabrics and Their Applications" held in Manchester on the 10-11th of April 2008 titled "Prediction of textile geometry using strain energy minimisation". A longer more detailed version of this will shortly be submitted as a journal paper. |
+ | |||
+ | <pre> | ||
+ | # Read in a textile | ||
+ | ReadFromXML('800s4.tg3') | ||
+ | Textile = GetTextile() | ||
+ | |||
+ | # Create an instance of the geometry solver | ||
+ | Solver = CGeometrySolver() | ||
+ | |||
+ | # Set some parameters | ||
+ | Solver.SetContactStiffness(1e6) | ||
+ | Solver.SetDisabledStiffness(1e-6) | ||
+ | Solver.SetSeed(1.0) | ||
+ | # Create the system of equations to be solved | ||
+ | Solver.CreateSystem(Textile) | ||
+ | # Solve the system | ||
+ | Solver.SolveSystem() | ||
+ | # Save the result to a VTK file for viewing purposes | ||
+ | Solver.SaveToVTK("GeomSolve") | ||
+ | # Deform the textile | ||
+ | Solver.DeformTextile() | ||
+ | # Save the result back to a TG3 file | ||
+ | SaveToXML('Def-800s4.tg3') | ||
+ | </pre> |
Revision as of 08:48, 15 May 2008
This page contains a number of example scripts which show off some of the more advanced classes used to achieve specific tasks within TexGen.
Geometry Solver
The theory behind the geometry solver is described in a paper submitted to "The First World Conference on 3D Fabrics and Their Applications" held in Manchester on the 10-11th of April 2008 titled "Prediction of textile geometry using strain energy minimisation". A longer more detailed version of this will shortly be submitted as a journal paper.
# Read in a textile ReadFromXML('800s4.tg3') Textile = GetTextile() # Create an instance of the geometry solver Solver = CGeometrySolver() # Set some parameters Solver.SetContactStiffness(1e6) Solver.SetDisabledStiffness(1e-6) Solver.SetSeed(1.0) # Create the system of equations to be solved Solver.CreateSystem(Textile) # Solve the system Solver.SolveSystem() # Save the result to a VTK file for viewing purposes Solver.SaveToVTK("GeomSolve") # Deform the textile Solver.DeformTextile() # Save the result back to a TG3 file SaveToXML('Def-800s4.tg3')