rotation_axis = [ args.rotation_axis_x, args.rotation_axis_y, args.rotation_axis_z ] # Define the output file format and type. format, file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) tmp_dir = icqsol_utils.get_temp_dir() cloning = True if args.create_process == 'clone' else False # TODO: fix this to handle inputPLY files for cloning, but producing VTK POLYDATA. shape_mgr = icqsol_utils.get_shape_manager(format, icqsol_utils.POLYDATA) if cloning: # We're cloning an existing shape selected from the history. tmp_input_path = icqsol_utils.get_input_file_path(tmp_dir, args.shape_input, '.%s' % format) shape_to_clone = shape_mgr.loadAsShape(tmp_input_path) new_shape = shape_mgr.cloneShape(shape_to_clone) if icqsol_utils.asbool(args.rotate): shape_mgr.rotateShape(new_shape, axis=rotation_axis, angleDeg=args.rotation_degree) if icqsol_utils.asbool(args.translate): shape_mgr.translateShape(new_shape, disp=origin) else: # Create the primitive shape. if args.shape == 'box': new_shape = shape_mgr.createShape('box', origin=origin, lengths=lengths)
args = parser.parse_args() tmp_dir = icqsol_utils.get_temp_dir() shape_tuples = [] shape_mgr = icqsol_utils.get_shape_manager() # Load the shapes. for (expression_var, dataset_path, galaxy_ext, vtk_dataset_type) in args.shape_datasets: # Define the file format and type. format, file_type = icqsol_utils.get_format_and_type(galaxy_ext) if format == icqsol_utils.VTK: shape_mgr.setReader(file_format=format, vtk_dataset_type=vtk_dataset_type) else: shape_mgr.setReader(file_format=format) icqsol_path = icqsol_utils.get_input_file_path(tmp_dir, dataset_path, format) shape_tuple = (expression_var, shape_mgr.loadAsShape(icqsol_path)) shape_tuples.append(shape_tuple) # Define the output file format and type. output_format, output_file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) tmp_output_path = icqsol_utils.get_temporary_file_path(tmp_dir, output_format) shape_mgr.setWriter(file_format=output_format, vtk_dataset_type=icqsol_utils.POLYDATA) # Compose the shapes. composite_shape = shape_mgr.composeShapes(shape_tuples, args.expression) # Save the output. shape_mgr.saveShape(shape=composite_shape, file_name=tmp_output_path, file_type=output_file_type) shutil.move(tmp_output_path, args.output)
if args.length_x is not None and args.length_y is not None and args.length_z is not None: lengths = [args.length_x, args.length_y, args.length_z] if args.rotation_axis_x is not None and args.rotation_axis_y is not None and args.rotation_axis_z is not None: rotation_axis = [args.rotation_axis_x, args.rotation_axis_y, args.rotation_axis_z] # Define the output file format and type. format, file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) tmp_dir = icqsol_utils.get_temp_dir() cloning = True if args.create_process == 'clone' else False # TODO: fix this to handle inputPLY files for cloning, but producing VTK POLYDATA. shape_mgr = icqsol_utils.get_shape_manager(format, icqsol_utils.POLYDATA) if cloning: # We're cloning an existing shape selected from the history. tmp_input_path = icqsol_utils.get_input_file_path(tmp_dir, args.shape_input, '.%s' % format) shape_to_clone = shape_mgr.loadAsShape(tmp_input_path) new_shape = shape_mgr.cloneShape(shape_to_clone) if icqsol_utils.asbool(args.rotate): shape_mgr.rotateShape(new_shape, axis=rotation_axis, angleDeg=args.rotation_degree) if icqsol_utils.asbool(args.translate): shape_mgr.translateShape(new_shape, disp=origin) else: # Create the primitive shape. if args.shape == 'box': new_shape = shape_mgr.createShape('box', origin=origin, lengths=lengths) elif args.shape == 'cone': new_shape = shape_mgr.createShape('cone', radius=args.radius,
tmp_dir = icqsol_utils.get_temp_dir() shape_tuples = [] shape_mgr = icqsol_utils.get_shape_manager() # Load the shapes. for (expression_var, dataset_path, galaxy_ext, vtk_dataset_type) in args.shape_datasets: # Define the file format and type. format, file_type = icqsol_utils.get_format_and_type(galaxy_ext) if format == icqsol_utils.VTK: shape_mgr.setReader(file_format=format, vtk_dataset_type=vtk_dataset_type) else: shape_mgr.setReader(file_format=format) icqsol_path = icqsol_utils.get_input_file_path(tmp_dir, dataset_path, format) shape_tuple = (expression_var, shape_mgr.loadAsShape(icqsol_path)) shape_tuples.append(shape_tuple) # Define the output file format and type. output_format, output_file_type = icqsol_utils.get_format_and_type( args.output_vtk_type) tmp_output_path = icqsol_utils.get_temporary_file_path(tmp_dir, output_format) shape_mgr.setWriter(file_format=output_format, vtk_dataset_type=icqsol_utils.POLYDATA) # Compose the shapes. composite_shape = shape_mgr.composeShapes(shape_tuples, args.expression) # Save the output.