comparison icqsol_translate_shape.py @ 7:cd4bb1f942ce draft

Uploaded
author greg
date Mon, 11 Jan 2016 09:45:14 -0500
parents 415160ef2f85
children
comparison
equal deleted inserted replaced
6:ff5b00e03acf 7:cd4bb1f942ce
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 import argparse 2 import argparse
3 import shutil 3 import shutil
4 4
5 import icqsol_utils 5 import icqsol_utils
6 from icqsol.shapes.icqShapeManager import ShapeManager
7 6
8 # Parse Command Line. 7 # Parse Command Line.
9 parser = argparse.ArgumentParser() 8 parser = argparse.ArgumentParser()
10 parser.add_argument('--input', dest='input', help='Shape dataset selected from history') 9 parser.add_argument('--input', dest='input', help='Shape dataset selected from history')
11 parser.add_argument('--input_file_format_and_type', dest='input_file_format_and_type', help='Input file format and type') 10 parser.add_argument('--input_file_format_and_type', dest='input_file_format_and_type', help='Input file format and type')
21 # Get the format of the input - either vtk or ply. 20 # Get the format of the input - either vtk or ply.
22 input_format, input_file_type = icqsol_utils.get_format_and_type(args.input_file_format_and_type) 21 input_format, input_file_type = icqsol_utils.get_format_and_type(args.input_file_format_and_type)
23 tmp_dir = icqsol_utils.get_temp_dir() 22 tmp_dir = icqsol_utils.get_temp_dir()
24 23
25 # Instantiate a ShapeManager for loading the input. 24 # Instantiate a ShapeManager for loading the input.
26 if input_format == icqsol_utils.VTK: 25 shape_mgr = icqsol_utils.get_shape_manager(input_format, args.input_dataset_type)
27 shape_mgr = ShapeManager(file_format=input_format, vtk_dataset_type=args.input_dataset_type)
28 else:
29 shape_mgr = ShapeManager(file_format=input_format)
30 26
31 # Get the vtk polydata from the input dataset. 27 # Get the vtk polydata from the input dataset.
32 vtk_poly_data = shape_mgr.loadAsVtkPolyData(args.input) 28 vtk_poly_data = shape_mgr.loadAsVtkPolyData(args.input)
33 29
34 # Translate (in place operation). 30 # Translate (in place operation).