<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=DrawBoundingBox</id>
	<title>DrawBoundingBox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=DrawBoundingBox"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;action=history"/>
	<updated>2026-05-25T13:39:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5442&amp;oldid=prev</id>
		<title>Pyadmin: 11 revisions</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5442&amp;oldid=prev"/>
		<updated>2014-03-28T01:43:48Z</updated>

		<summary type="html">&lt;p&gt;11 revisions&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:43, 28 March 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pyadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5441&amp;oldid=prev</id>
		<title>Mretegan: separated the run command from the python code</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5441&amp;oldid=prev"/>
		<updated>2013-01-16T12:36:29Z</updated>

		<summary type="html">&lt;p&gt;separated the run command from the python code&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:36, 16 January 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l18&quot; &gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Installation =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Installation =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Just copy &lt;/del&gt;the source to your computer&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. Then run&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Copy &lt;/ins&gt;the source &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;code &lt;/ins&gt;to your computer&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, and execute it by issuing the command &lt;/ins&gt;&amp;quot;run /path/to/drawBoundingBox.py&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; in PyMOL.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;source lang=&lt;/del&gt;&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;python&amp;quot;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;run /path/to/drawBoundingBox.py&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/source&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mretegan</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5440&amp;oldid=prev</id>
		<title>Newacct at 08:03, 27 November 2009</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5440&amp;oldid=prev"/>
		<updated>2009-11-27T08:03:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
Draws a bounding box around a given selection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:DrawMinBB.png|Example of a bounding box&lt;br /&gt;
Image:bb_with_padding.png|Two bounding boxes, one with 0 padding, the other with 10 Ang padding.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run ~/drawBoundingBox.py&lt;br /&gt;
fetch 1jsd&lt;br /&gt;
drawBoundingBox 1jsd, r=0.33, g=0.80&lt;br /&gt;
&lt;br /&gt;
# example from above w/padding, draw it light blue&lt;br /&gt;
drawBoundingBox padding=10, r=0.5, g=0.8, b=1.0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
Just copy the source to your computer. Then run&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run /path/to/drawBoundingBox.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: utf-8 -*-                                                                                     &lt;br /&gt;
from pymol.cgo import *                                                                                     &lt;br /&gt;
from pymol import cmd                                                                                       &lt;br /&gt;
from random import randint                                                                                  &lt;br /&gt;
&lt;br /&gt;
#############################################################################&lt;br /&gt;
#                                                                            &lt;br /&gt;
# drawBoundingBox.py -- Draws a box surrounding a selection &lt;br /&gt;
#&lt;br /&gt;
#                                                                            &lt;br /&gt;
# AUTHOR: Jason Vertrees                                                   &lt;br /&gt;
# DATE  : 2/20/2009                                                          &lt;br /&gt;
# NOTES : See comments below.                                                &lt;br /&gt;
#                                                                            &lt;br /&gt;
#############################################################################&lt;br /&gt;
def drawBoundingBox(selection=&amp;quot;(all)&amp;quot;, padding=0.0, linewidth=2.0, r=1.0, g=1.0, b=1.0):     &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;                                                                  &lt;br /&gt;
        DESCRIPTION                                                          &lt;br /&gt;
                Given selection, draw the bounding box around it.          &lt;br /&gt;
&lt;br /&gt;
        USAGE:&lt;br /&gt;
                drawBoundingBox [selection, [padding, [linewidth, [r, [g, b]]]]]&lt;br /&gt;
&lt;br /&gt;
        PARAMETERS:&lt;br /&gt;
                selection,              the selection to enboxen.  :-)&lt;br /&gt;
                                        defaults to (all)&lt;br /&gt;
   &lt;br /&gt;
                padding,                defaults to 0&lt;br /&gt;
&lt;br /&gt;
                linewidth,              width of box lines&lt;br /&gt;
                                        defaults to 2.0&lt;br /&gt;
&lt;br /&gt;
                r,                      red color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                               &lt;br /&gt;
&lt;br /&gt;
                g,                      green color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                                 &lt;br /&gt;
&lt;br /&gt;
                b,                      blue color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                                &lt;br /&gt;
&lt;br /&gt;
        RETURNS&lt;br /&gt;
                string, the name of the CGO box&lt;br /&gt;
&lt;br /&gt;
        NOTES&lt;br /&gt;
                * This function creates a randomly named CGO box that minimally spans the protein. The&lt;br /&gt;
                user can specify the width of the lines, the padding and also the color.                            &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;                                                                                                    &lt;br /&gt;
&lt;br /&gt;
        ([minX, minY, minZ],[maxX, maxY, maxZ]) = cmd.get_extent(selection)&lt;br /&gt;
&lt;br /&gt;
        print &amp;quot;Box dimensions (%.2f, %.2f, %.2f)&amp;quot; % (maxX-minX, maxY-minY, maxZ-minZ)&lt;br /&gt;
&lt;br /&gt;
        minX = minX - float(padding)&lt;br /&gt;
        minY = minY - float(padding)&lt;br /&gt;
        minZ = minZ - float(padding)&lt;br /&gt;
        maxX = maxX + float(padding)&lt;br /&gt;
        maxY = maxY + float(padding)&lt;br /&gt;
        maxZ = maxZ + float(padding)&lt;br /&gt;
&lt;br /&gt;
        if padding != 0:&lt;br /&gt;
                 print &amp;quot;Box dimensions + padding (%.2f, %.2f, %.2f)&amp;quot; % (maxX-minX, maxY-minY, maxZ-minZ)&lt;br /&gt;
&lt;br /&gt;
        boundingBox = [&lt;br /&gt;
                LINEWIDTH, float(linewidth),&lt;br /&gt;
&lt;br /&gt;
                BEGIN, LINES,&lt;br /&gt;
                COLOR, float(r), float(g), float(b),&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
                END&lt;br /&gt;
        ]&lt;br /&gt;
&lt;br /&gt;
        boxName = &amp;quot;box_&amp;quot; + str(randint(0,10000))&lt;br /&gt;
        while boxName in cmd.get_names():&lt;br /&gt;
                boxName = &amp;quot;box_&amp;quot; + str(randint(0,10000))&lt;br /&gt;
&lt;br /&gt;
        cmd.load_cgo(boundingBox,boxName)&lt;br /&gt;
        return boxName&lt;br /&gt;
&lt;br /&gt;
cmd.extend (&amp;quot;drawBoundingBox&amp;quot;, drawBoundingBox)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
[[Bounding_Box]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library|DrawMinBoundingBox]]&lt;br /&gt;
[[Category:Math_Scripts]]&lt;br /&gt;
[[Category:CGO]]&lt;/div&gt;</summary>
		<author><name>Newacct</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5438&amp;oldid=prev</id>
		<title>Slaw at 16:21, 27 May 2009</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5438&amp;oldid=prev"/>
		<updated>2009-05-27T16:21:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
Draws a bounding box around a given selection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:DrawMinBB.png|Example of a bounding box&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run ~/drawBoundingBox.py&lt;br /&gt;
fetch 1jsd&lt;br /&gt;
drawBoundingBox 1jsd, r=0.33, g=0.80&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
Just copy the source to your computer. Then run&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run /path/to/drawBoundingBox.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: utf-8 -*-                                                                                     &lt;br /&gt;
from pymol.cgo import *                                                                                     &lt;br /&gt;
from pymol import cmd                                                                                       &lt;br /&gt;
from random import randint                                                                                  &lt;br /&gt;
from string import split                                                                                    &lt;br /&gt;
&lt;br /&gt;
#############################################################################&lt;br /&gt;
#                                                                            &lt;br /&gt;
# drawBoundingBox.py -- Draws a box surrounding a selection &lt;br /&gt;
#&lt;br /&gt;
#                                                                            &lt;br /&gt;
# AUTHOR: Jason Vertrees                                                   &lt;br /&gt;
# DATE  : 2/20/2009                                                          &lt;br /&gt;
# NOTES : See comments below.                                                &lt;br /&gt;
#                                                                            &lt;br /&gt;
#############################################################################&lt;br /&gt;
def drawBoundingBox(selection=&amp;quot;(all)&amp;quot;, padding=0.0, linewidth=2.0, r=1.0, g=1.0, b=1.0):     &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;                                                                  &lt;br /&gt;
        DESCRIPTION                                                          &lt;br /&gt;
                Given selection, draw the bounding box around it.          &lt;br /&gt;
&lt;br /&gt;
        USAGE:&lt;br /&gt;
                drawBoundingBox [selection, [padding, [linewidth, [r, [g, b]]]]]&lt;br /&gt;
&lt;br /&gt;
        PARAMETERS:&lt;br /&gt;
                selection,              the selection to enboxen.  :-)&lt;br /&gt;
                                        defaults to (all)&lt;br /&gt;
   &lt;br /&gt;
                padding,                defaults to 0&lt;br /&gt;
&lt;br /&gt;
                linewidth,              width of box lines&lt;br /&gt;
                                        defaults to 2.0&lt;br /&gt;
&lt;br /&gt;
                r,                      red color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                               &lt;br /&gt;
&lt;br /&gt;
                g,                      green color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                                 &lt;br /&gt;
&lt;br /&gt;
                b,                      blue color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                                &lt;br /&gt;
&lt;br /&gt;
        RETURNS&lt;br /&gt;
                string, the name of the CGO box&lt;br /&gt;
&lt;br /&gt;
        NOTES&lt;br /&gt;
                * This function creates a randomly named CGO box that minimally spans the protein. The&lt;br /&gt;
                user can specify the width of the lines, the padding and also the color.                            &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;                                                                                                    &lt;br /&gt;
&lt;br /&gt;
        ([minX, minY, minZ],[maxX, maxY, maxZ]) = cmd.get_extent(selection)&lt;br /&gt;
&lt;br /&gt;
        print &amp;quot;Box dimensions (%.2f, %.2f, %.2f)&amp;quot; % (maxX-minX, maxY-minY, maxZ-minZ)&lt;br /&gt;
&lt;br /&gt;
        minX = minX - float(padding)&lt;br /&gt;
        minY = minY - float(padding)&lt;br /&gt;
        minZ = minZ - float(padding)&lt;br /&gt;
        maxX = maxX + float(padding)&lt;br /&gt;
        maxY = maxY + float(padding)&lt;br /&gt;
        maxZ = maxZ + float(padding)&lt;br /&gt;
&lt;br /&gt;
        if padding != 0:&lt;br /&gt;
                 print &amp;quot;Box dimensions + padding (%.2f, %.2f, %.2f)&amp;quot; % (maxX-minX, maxY-minY, maxZ-minZ)&lt;br /&gt;
&lt;br /&gt;
        boundingBox = [&lt;br /&gt;
                LINEWIDTH, float(linewidth),&lt;br /&gt;
&lt;br /&gt;
                BEGIN, LINES,&lt;br /&gt;
                COLOR, float(r), float(g), float(b),&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
                END&lt;br /&gt;
        ]&lt;br /&gt;
&lt;br /&gt;
        boxName = &amp;quot;box_&amp;quot; + str(randint(0,10000))&lt;br /&gt;
        while boxName in cmd.get_names():&lt;br /&gt;
                boxName = &amp;quot;box_&amp;quot; + str(randint(0,10000))&lt;br /&gt;
&lt;br /&gt;
        cmd.load_cgo(boundingBox,boxName)&lt;br /&gt;
        return boxName&lt;br /&gt;
&lt;br /&gt;
cmd.extend (&amp;quot;drawBoundingBox&amp;quot;, drawBoundingBox)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
[[Bounding_Box]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library|DrawMinBoundingBox]]&lt;br /&gt;
[[Category:Math_Scripts]]&lt;br /&gt;
[[Category:CGO]]&lt;/div&gt;</summary>
		<author><name>Slaw</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5436&amp;oldid=prev</id>
		<title>Mretegan: /* Installation */</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5436&amp;oldid=prev"/>
		<updated>2009-03-30T19:14:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Installation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:14, 30 March 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l137&quot; &gt;Line 137:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         cmd.load_cgo(boundingBox,boxName)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         cmd.load_cgo(boundingBox,boxName)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return boxName&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return boxName&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;cmd.extend (&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;getBox&lt;/del&gt;&amp;quot;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;getBox&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;cmd.extend (&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;drawBoundingBox&lt;/ins&gt;&amp;quot;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;drawBoundingBox&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mretegan</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5435&amp;oldid=prev</id>
		<title>Mretegan at 19:13, 30 March 2009</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5435&amp;oldid=prev"/>
		<updated>2009-03-30T19:13:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:13, 30 March 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l137&quot; &gt;Line 137:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         cmd.load_cgo(boundingBox,boxName)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         cmd.load_cgo(boundingBox,boxName)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return boxName&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return boxName&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cmd.extend (&amp;quot;getBox&amp;quot;, getBox)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mretegan</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5434&amp;oldid=prev</id>
		<title>Mretegan: DrawMinBoundingBox moved to DrawBoundingBox: Now it can use padding, so it's not only min.</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5434&amp;oldid=prev"/>
		<updated>2009-03-30T19:09:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/index.php/DrawMinBoundingBox&quot; class=&quot;mw-redirect&quot; title=&quot;DrawMinBoundingBox&quot;&gt;DrawMinBoundingBox&lt;/a&gt; moved to &lt;a href=&quot;/index.php/DrawBoundingBox&quot; title=&quot;DrawBoundingBox&quot;&gt;DrawBoundingBox&lt;/a&gt;: Now it can use padding, so it&amp;#039;s not only min.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:09, 30 March 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mretegan</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5433&amp;oldid=prev</id>
		<title>Mretegan: Added the padding option and some useful print statements. Change the name to drawBoundingBox, plus some code alterations</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=DrawBoundingBox&amp;diff=5433&amp;oldid=prev"/>
		<updated>2009-03-30T19:08:36Z</updated>

		<summary type="html">&lt;p&gt;Added the padding option and some useful print statements. Change the name to drawBoundingBox, plus some code alterations&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
Draws a bounding box around a given selection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:DrawMinBB.png|Example of a bounding box&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run ~/drawBoundingBox.py&lt;br /&gt;
fetch 1jsd&lt;br /&gt;
drawBoundingBox 1jsd, r=0.33, g=0.80&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
Just copy the source to your computer. Then run&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run /path/to/drawBoundingBox.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: utf-8 -*-                                                                                     &lt;br /&gt;
from pymol.cgo import *                                                                                     &lt;br /&gt;
from pymol import cmd                                                                                       &lt;br /&gt;
from random import randint                                                                                  &lt;br /&gt;
from string import split                                                                                    &lt;br /&gt;
&lt;br /&gt;
#############################################################################&lt;br /&gt;
#                                                                            &lt;br /&gt;
# drawBoundingBox.py -- Draws a box surrounding a selection &lt;br /&gt;
#&lt;br /&gt;
#                                                                            &lt;br /&gt;
# AUTHOR: Jason Vertrees                                                   &lt;br /&gt;
# DATE  : 2/20/2009                                                          &lt;br /&gt;
# NOTES : See comments below.                                                &lt;br /&gt;
#                                                                            &lt;br /&gt;
#############################################################################&lt;br /&gt;
def drawBoundingBox(selection=&amp;quot;(all)&amp;quot;, padding=0.0, linewidth=2.0, r=1.0, g=1.0, b=1.0):     &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;                                                                  &lt;br /&gt;
        DESCRIPTION                                                          &lt;br /&gt;
                Given selection, draw the bounding box around it.          &lt;br /&gt;
&lt;br /&gt;
        USAGE:&lt;br /&gt;
                drawBoundingBox [selection, [padding, [linewidth, [r, [g, b]]]]]&lt;br /&gt;
&lt;br /&gt;
        PARAMETERS:&lt;br /&gt;
                selection,              the selection to enboxen.  :-)&lt;br /&gt;
                                        defaults to (all)&lt;br /&gt;
   &lt;br /&gt;
                padding,                defaults to 0&lt;br /&gt;
&lt;br /&gt;
                linewidth,              width of box lines&lt;br /&gt;
                                        defaults to 2.0&lt;br /&gt;
&lt;br /&gt;
                r,                      red color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                               &lt;br /&gt;
&lt;br /&gt;
                g,                      green color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                                 &lt;br /&gt;
&lt;br /&gt;
                b,                      blue color component, valid range is [0.0, 1.0]&lt;br /&gt;
                                        defaults to 1.0                                &lt;br /&gt;
&lt;br /&gt;
        RETURNS&lt;br /&gt;
                string, the name of the CGO box&lt;br /&gt;
&lt;br /&gt;
        NOTES&lt;br /&gt;
                * This function creates a randomly named CGO box that minimally spans the protein. The&lt;br /&gt;
                user can specify the width of the lines, the padding and also the color.                            &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;                                                                                                    &lt;br /&gt;
&lt;br /&gt;
        ([minX, minY, minZ],[maxX, maxY, maxZ]) = cmd.get_extent(sel)&lt;br /&gt;
&lt;br /&gt;
        print &amp;quot;Box dimensions (%.2f, %.2f, %.2f)&amp;quot; % (maxX-minX, maxY-minY, maxZ-minZ)&lt;br /&gt;
&lt;br /&gt;
        minX = minX - float(padding)&lt;br /&gt;
        minY = minY - float(padding)&lt;br /&gt;
        minZ = minZ - float(padding)&lt;br /&gt;
        maxX = maxX + float(padding)&lt;br /&gt;
        maxY = maxY + float(padding)&lt;br /&gt;
        maxZ = maxZ + float(padding)&lt;br /&gt;
&lt;br /&gt;
       if padding != 0:&lt;br /&gt;
                 print &amp;quot;Box dimensions + padding (%.2f, %.2f, %.2f)&amp;quot; % (maxX-minX, maxY-minY, maxZ-minZ)&lt;br /&gt;
&lt;br /&gt;
        boundingBox = [&lt;br /&gt;
                LINEWIDTH, float(linewidth),&lt;br /&gt;
&lt;br /&gt;
                BEGIN, LINES,&lt;br /&gt;
                COLOR, float(r), float(g), float(b),&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, minZ,       #1&lt;br /&gt;
                VERTEX, minX, maxY, minZ,       #3&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, minZ,       #5&lt;br /&gt;
                VERTEX, maxX, maxY, minZ,       #7&lt;br /&gt;
&lt;br /&gt;
                VERTEX, minX, minY, maxZ,       #2&lt;br /&gt;
                VERTEX, minX, maxY, maxZ,       #4&lt;br /&gt;
&lt;br /&gt;
                VERTEX, maxX, minY, maxZ,       #6&lt;br /&gt;
                VERTEX, maxX, maxY, maxZ,       #8&lt;br /&gt;
&lt;br /&gt;
                END&lt;br /&gt;
        ]&lt;br /&gt;
&lt;br /&gt;
        boxName = &amp;quot;box_&amp;quot; + str(randint(0,10000))&lt;br /&gt;
        while boxName in cmd.get_names():&lt;br /&gt;
                boxName = &amp;quot;box_&amp;quot; + str(randint(0,10000))&lt;br /&gt;
&lt;br /&gt;
        cmd.load_cgo(boundingBox,boxName)&lt;br /&gt;
        return boxName&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
[[Bounding_Box]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library|DrawMinBoundingBox]]&lt;br /&gt;
[[Category:CGO]]&lt;/div&gt;</summary>
		<author><name>Mretegan</name></author>
	</entry>
</feed>