<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 PyGeM
Tutorial 2
Step1:  Now we have to load the iges file on which we will perform the FFD. Since it is an iges we use the IgesHandler() class. The parse method extract the control points (or poles) coordinate of the NURBS surfaces that represent each face of the iges geometry without touching the topology.
Step2:  We can now use the show method to visualize the iges geometry. It basically load the file and shows its geometry. It is different from the plot method since
Step3:  Sometimes the write method can fail. In fact, in write function we perform some operations like 
- linking edges into a single wire; 
- trimming the surface with the wire.
Often, a CAD file has its own tolerance and some entities that seems to be, for instance, linked actually are not.
The linking and trimming operations can be hard for the software to be performed, especially when the starting CAD has not been made for analysis but for design purposes.
Thus, for non trivial geometries it could be necessary to increase the tolerance.
For the cylinder this is not the case, but we can increse the tolerance as well and write a, indeed almost equal, result.
<ASSISTANT_TASK:>
Python Code:
import pygem as pg
params = pg.params.FFDParameters()
params.read_parameters(filename='../tests/test_datasets/parameters_test_ffd_iges.prm')
Explanation: PyGeM
Tutorial 2: Free Form Deformation on a cylinder in iges file format
In this tutorial we will show the typical workflow. In particular we are going to parse the parameters file for the FFD, read an iges file of a cylinder, perform the FFD and write the results on a new iges file. We also provide the example of the show function which is not present in tutorial 1.
First of all we just import pygem package and we read a parameters file.
End of explanation
iges_handler = pg.igeshandler.IgesHandler()
mesh_points = iges_handler.parse('../tests/test_datasets/test_pipe.iges')
Explanation: Now we have to load the iges file on which we will perform the FFD. Since it is an iges we use the IgesHandler() class. The parse method extract the control points (or poles) coordinate of the NURBS surfaces that represent each face of the iges geometry without touching the topology.
End of explanation
free_form = pg.freeform.FFD(params, mesh_points)
free_form.perform()
new_mesh_points = free_form.modified_mesh_points
iges_handler.write(new_mesh_points, 'test_pipe_mod.iges')
Explanation: We can now use the show method to visualize the iges geometry. It basically load the file and shows its geometry. It is different from the plot method since:
- it shows directly the geometry and not its triangulation
- it can not save the picture in a png file (it shows only)
Here you can see the result of 
iges_handler.show('../tests/test_datasets/test_pipe.iges')
For some "backend" issues we can show only one shape for session. Be careful when you try to show many geometries in the same script.
Finally we can actually perform the FFD with the freeform module and then we can write the modified iges file with the new control points (or poles).
End of explanation
iges_handler.write(new_mesh_points, 'test_pipe_mod.iges', 1e-3)
Explanation: Sometimes the write method can fail. In fact, in write function we perform some operations like 
- linking edges into a single wire; 
- trimming the surface with the wire.
Often, a CAD file has its own tolerance and some entities that seems to be, for instance, linked actually are not.
The linking and trimming operations can be hard for the software to be performed, especially when the starting CAD has not been made for analysis but for design purposes.
Thus, for non trivial geometries it could be necessary to increase the tolerance.
For the cylinder this is not the case, but we can increse the tolerance as well and write a, indeed almost equal, result.
End of explanation
<END_TASK>