comparison icqsol_create_shape.py @ 8:eda67f807e5c draft

Uploaded
author greg
date Mon, 11 Jan 2016 09:07:20 -0500
parents e683e75d905d
children
comparison
equal deleted inserted replaced
7:8df65e37d12a 8:eda67f807e5c
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('--create_process', dest='create_process', help='Shape creation process (create or clone)') 9 parser.add_argument('--create_process', dest='create_process', help='Shape creation process (create or clone)')
11 parser.add_argument('--shape_input', dest='shape_input', default=None, help='Shape file if create_process is clone') 10 parser.add_argument('--shape_input', dest='shape_input', default=None, help='Shape file if create_process is clone')
42 format, file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) 41 format, file_type = icqsol_utils.get_format_and_type(args.output_vtk_type)
43 tmp_dir = icqsol_utils.get_temp_dir() 42 tmp_dir = icqsol_utils.get_temp_dir()
44 cloning = True if args.create_process == 'clone' else False 43 cloning = True if args.create_process == 'clone' else False
45 44
46 # TODO: fix this to handle inputPLY files for cloning, but producing VTK POLYDATA. 45 # TODO: fix this to handle inputPLY files for cloning, but producing VTK POLYDATA.
47 shape_mgr = ShapeManager(file_format=format, vtk_dataset_type=icqsol_utils.POLYDATA) 46 shape_mgr = icqsol_utils.get_shape_manager(format, icqsol_utils.POLYDATA)
48 47
49 if cloning: 48 if cloning:
50 # We're cloning an existing shape selected from the history. 49 # We're cloning an existing shape selected from the history.
51 tmp_input_path = icqsol_utils.get_input_file_path(tmp_dir, args.shape_input, '.%s' % format) 50 tmp_input_path = icqsol_utils.get_input_file_path(tmp_dir, args.shape_input, '.%s' % format)
52 shape_to_clone = shape_mgr.loadAsShape(tmp_input_path) 51 shape_to_clone = shape_mgr.loadAsShape(tmp_input_path)