Line | |
---|
1 | # |
---|
2 | # box.py -- create a Compiled Graphics Object for a unit cell box |
---|
3 | |
---|
4 | from pymol.cgo import * |
---|
5 | from pymol import cmd |
---|
6 | |
---|
7 | # Arguments: |
---|
8 | # lv: List of vertices; each vertex is a [x,y,z] list |
---|
9 | # lw: Line width |
---|
10 | # r: Red component of box color |
---|
11 | # g: Green component of box color |
---|
12 | # b: Blue component of box color |
---|
13 | # name: Name of box, which can be used with other PyMOL commands |
---|
14 | def draw_box(lv, lw=2.0, r=0.5, g=0.5, b=0.5, name='unitcell'): |
---|
15 | box = [LINEWIDTH, lw, BEGIN, LINES, COLOR, r, g, b] |
---|
16 | for v in lv: |
---|
17 | box.append(VERTEX) |
---|
18 | box.append(v[0]) |
---|
19 | box.append(v[1]) |
---|
20 | box.append(v[2]) |
---|
21 | box.append(END) |
---|
22 | cmd.load_cgo(box, name) |
---|
23 | |
---|
24 | # Extend the PyMOL interpeter with the new "draw_box" command |
---|
25 | cmd.extend("draw_box", draw_box) |
---|
Note: See
TracBrowser
for help on using the repository browser.