Mercurial > repos > greg > icqsol_translate_shape
comparison icqsol_translate_shape.py @ 2:415160ef2f85 draft
Uploaded
author | greg |
---|---|
date | Sat, 05 Dec 2015 10:31:14 -0500 |
parents | 0e26a1b31cac |
children | cd4bb1f942ce |
comparison
equal
deleted
inserted
replaced
1:b18f4c1c852d | 2:415160ef2f85 |
---|---|
21 # Get the format of the input - either vtk or ply. | 21 # 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) | 22 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() | 23 tmp_dir = icqsol_utils.get_temp_dir() |
24 | 24 |
25 # Instantiate a ShapeManager for loading the input. | 25 # Instantiate a ShapeManager for loading the input. |
26 if input_format == 'vtk': | 26 if input_format == icqsol_utils.VTK: |
27 shape_mgr = ShapeManager(file_format=input_format, vtk_dataset_type=args.input_dataset_type) | 27 shape_mgr = ShapeManager(file_format=input_format, vtk_dataset_type=args.input_dataset_type) |
28 else: | 28 else: |
29 shape_mgr = ShapeManager(file_format=input_format) | 29 shape_mgr = ShapeManager(file_format=input_format) |
30 | 30 |
31 # Get the vtk polydata from the input dataset. | 31 # Get the vtk polydata from the input dataset. |
33 | 33 |
34 # Translate (in place operation). | 34 # Translate (in place operation). |
35 displ = (args.displacement_x, args.displacement_y, args.displacement_z) | 35 displ = (args.displacement_x, args.displacement_y, args.displacement_z) |
36 shape_mgr.translateVtkPolyData(vtk_poly_data, displ=displ) | 36 shape_mgr.translateVtkPolyData(vtk_poly_data, displ=displ) |
37 | 37 |
38 # Save the output. | |
38 output_format, output_file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) | 39 output_format, output_file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) |
39 tmp_dir = icqsol_utils.get_temp_dir() | 40 tmp_dir = icqsol_utils.get_temp_dir() |
40 tmp_output_path = icqsol_utils.get_temporary_file_path(tmp_dir, 'vtk') | 41 tmp_output_path = icqsol_utils.get_temporary_file_path(tmp_dir, icqsol_utils.VTK) |
41 shape_mgr.saveVtkPolyData(vtk_poly_data, file_name=tmp_output_path, file_type=output_file_type) | 42 shape_mgr.saveVtkPolyData(vtk_poly_data, file_name=tmp_output_path, file_type=output_file_type) |
42 shutil.move(tmp_output_path, args.output) | 43 shutil.move(tmp_output_path, args.output) |