IMP  2.0.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 with color and name.
3 
4 import IMP.display
5 
6 # or IMP.display.ChimeraWriter
7 # if using chimera, make sure there is a %1% in the name to support multiple frames
8 name=IMP.create_temporary_file_name("example", ".py")
9 print "File name is", name
11 
13  IMP.algebra.Vector3D(100, 100, 100))
14 # we could skip the outer loop if we only have one frame
15 for f in range(0,10):
16  w.set_frame(f)
18  g.set_name("bb")
19  w.add_geometry(g)
20  for i in range(0,10):
23  # give each a distinctive color
24  g.set_color(IMP.display.get_display_color(i))
25  g.set_name(str(i))
26  # add it to the file
27  w.add_geometry(g)