<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>There are several issues here.  Bild spheres and cylinders use a
      fixed subdivision into triangles.   Unlike atoms and bonds, which
      alter the amount of subdivisions based on how big they are drawn. 
      So if all you have are atoms and bonds, a fake molecule would be
      much faster, if they are tiny on the screen, or much better visual
      quality, if they are larger on the screen.  But, ignoring the
      subdivision issue, 10000 bild shapes should roughly the same speed
      as a molecule with 10000 elements. and possibly a little faster.<br>
    </p>
    <p>So back to coloring bild objects, with some Python code, you can
      change the color of individual bild shapes.  Consider this
      "unofficial", but this works if the bild model is the first one
      opened:</p>
    <p>
      <blockquote type="cite"><font face="monospace">RED = [255, 0, 0,
          255]<br>
          <br>
          def recolor_shape(model, index, color):<br>
              s = m.child_drawings()[0]<br>
              sh = s._shapes[index]<br>
          <br>
              vertices = set()<br>
              tris = s.triangles<br>
              for t in sh.triangle_range:<br>
                  vertices.update(tris[t])<br>
          <br>
              vc = s.vertex_colors<br>
              for v in vertices:<br>
                  vc[v] = color<br>
              s.vertex_colors = vc<br>
          <br>
          <br>
          m = session.models[0]<br>
          recolor_shape(m, 1, RED)<br>
        </font></blockquote>
    </p>
    <p>    HTH,</p>
    <p>    Greg<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2/26/2021 6:14 PM, Tom Goddard
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:E62D9227-E6D3-4E99-BB79-778CD2F5ABAF@sonic.net">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      Hi Tanmoy,
      <div class=""><br class="">
      </div>
      <div class="">  The BLD models do not support changing colors of
        individual spheres and cylinders.  And to get decent performance
        for 10000 shapes you need to use a fake molecule.  You can use a
        marker set which can have spheres and cylinders connecting
        spheres.  Each marker is an atom and each cylinder is a bond.
         Each marker has an id number which is its residue number, so
        you can color marker 57 with "color :57 gold".  Markers can be
        read from an XML file or made from Python.</div>
      <div class=""><br class="">
      </div>
      <div class=""><span class="Apple-tab-span" style="white-space:pre">     </span><a
href="https://www.rbvi.ucsf.edu/chimerax/docs/user/markers.html"
          class="" moz-do-not-send="true">https://www.rbvi.ucsf.edu/chimerax/docs/user/markers.html</a></div>
      <div class=""><br class="">
      </div>
      <div class="">  Tom<br class="">
        <div><br class="">
          <blockquote type="cite" class="">
            <div class="">On Feb 26, 2021, at 4:30 PM, Tanmoy Sanyal
              <<a href="mailto:tanmoy.7989@gmail.com" class=""
                moz-do-not-send="true">tanmoy.7989@gmail.com</a>>
              wrote:</div>
            <br class="Apple-interchange-newline">
            <div class="">
              <div dir="ltr" class="">
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif">Hi,</div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif">I have
                  a bunch of shapes (spheres and cylinders) created
                  through a .bld script. I'd like to load this script
                  once, and then be able to change the colors of said
                  shapes in successive operations. It is possible to set
                  the colors directly in the .bld script, but I need to
                  make an animation out of this. E.g: if my .bld script
                  contains lines that draws shapes like so:</div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif">.sphere
                  0 0 -1 5.0</div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif">.cylinder
                  0 0 0 1 1 1 1.0</div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif"><br
                    class="">
                </div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif">I want
                  to be able to later have a bunch of scripts called
                  1.cxc, 2.cxc, 3.cxc, .... each of which change the
                  color of the sphere and cylinder. This way, I can load
                  these scripts in the per-frame mode, to create an
                  animation out of the color changes. </div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif"><br
                    class="">
                </div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif">Alternatively,
                  I tried doing this with just the shape command and
                  without a .bld script, but I have over ~10000 shapes;
                  the shape command interprets each as a different
                  model, and my computer hangs. </div>
                <div class="gmail_default"
                  style="font-family:arial,helvetica,sans-serif"><br
                    class="">
                </div>
                <div class="">
                  <div dir="ltr" class="gmail_signature"
                    data-smartmail="gmail_signature">
                    <div dir="ltr" class="">
                      <div class="">
                        <div dir="ltr" class="">
                          <div class="">
                            <div dir="ltr" class="">
                              <div class="">
                                <div dir="ltr" class="">
                                  <div dir="ltr" class="">
                                    <div dir="ltr" class="">
                                      <div dir="ltr" class="">
                                        <div dir="ltr" class="">
                                          <div class="">-----</div>
                                          <div class="">Thanks,</div>
                                          <div class="">Tanmoy</div>
                                          <div class=""><br class="">
                                          </div>
                                          <div class="">Tanmoy Sanyal<br
                                              class="">
                                          </div>
                                          Postdoctoral scholar, <a
                                            href="https://salilab.org/"
                                            target="_blank" class=""
                                            moz-do-not-send="true">Sali
                                            lab</a>,</div>
                                        <div class=""><a
                                            href="https://bts.ucsf.edu/"
                                            target="_blank" class=""
                                            moz-do-not-send="true">Department
                                            of Bioengineering and
                                            Therapeutic Sciences</a>,</div>
                                        <div class="">University of
                                          California San Francisco</div>
                                        <div dir="ltr" class="">
                                          <div class="">Phone:- (+1)
                                            805-637-0375</div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              _______________________________________________<br
                class="">
              ChimeraX-users mailing list<br class="">
              <a href="mailto:ChimeraX-users@cgl.ucsf.edu" class=""
                moz-do-not-send="true">ChimeraX-users@cgl.ucsf.edu</a><br
                class="">
              Manage subscription:<br class="">
              <a class="moz-txt-link-freetext" href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br
                class="">
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
ChimeraX-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ChimeraX-users@cgl.ucsf.edu">ChimeraX-users@cgl.ucsf.edu</a>
Manage subscription:
<a class="moz-txt-link-freetext" href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a>
</pre>
    </blockquote>
  </body>
</html>