except: graphics = None pass ## Read in the solver file. solver = Solver(params) solver.graphics = graphics solver.read_solver_file() if graphics: graphics.solver = solver ## Read segment data. solver.read_segment_data() ## Write segment data if segments are not going # to be interactively selected. if params.output_file_name and not params.select_segment_names: solver.write_segment_data() ## Plot results. if params.plot_results: solver.plot_results() ## If displaying geometry then show the network. if graphics and params.display_geometry: graphics.add_graphics_points(solver.points_polydata, [0.8, 0.8, 0.8]) graphics.add_graphics_edges(solver.lines_polydata, solver.lines_segment_names, [0.8, 0.8, 0.8]) graphics.show()
params.solver_file_name = kwargs.get(Args.SOLVER_FILE) logger.info("Solver file: %s" % params.solver_file_name) if not os.path.exists(params.solver_file_name): logger.error("The solver file '%s' was not found." % params.solver_file_name) return None return params if __name__ == '__main__': init_logging() args, print_help = parse_args() params = set_parameters(**vars(args)) if not params: logger.error("Error in parameters.") sys.exit(1) ## Create graphics interface. graphics = Graphics() ## Read in the solver file. mesh = Mesh(params) mesh.graphics = graphics mesh.read_solver_file() graphics.add_graphics_points(mesh.points_polydata, [0.8, 0.8, 0.8]) graphics.add_graphics_edges(mesh.lines_polydata, [0.8, 0.8, 0.8]) graphics.mesh = mesh graphics.show()