IMP logo
IMP Reference Guide  2.6.0
The Integrative Modeling Platform
display/basic_geometry.py

This example shows how to write basic geometric primitives to a file with color and name.

1 ## \example display/basic_geometry.py
2 # This example shows how to write basic geometric primitives to a file
3 # with color and name.
4 
5 from __future__ import print_function
6 import IMP.display
7 import sys
8 
9 IMP.setup_from_argv(sys.argv,
10  "Write basic geometric primitives to a file with color and name.")
11 
12 name = IMP.create_temporary_file_name("example", ".py")
13 print("File name is", name)
15 
17  IMP.algebra.Vector3D(100, 100, 100))
18 # we could skip the outer loop if we only have one frame
19 for f in range(0, 10):
20  w.set_frame(f)
22  g.set_name("bb")
23  w.add_geometry(g)
24  for i in range(0, 10):
27  # give each a distinctive color
28  g.set_color(IMP.display.get_display_color(i))
29  g.set_name(str(i))
30  # add it to the file
31  w.add_geometry(g)