On 12/23/18 2:52 PM, Spencer Trinh wrote:

> output=pybel.Outputfile('svg',filename='testsvg.svg',opt={'u':None,'C':None})
> 
> for name,mol in mols.items():
> 
> mol.removeh()
> 
> mol.title=name
> 
> output.write(mol)
> 
> output.close()

From
http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel.Outputfile:

"""
Although it’s possible to write a single molecule to a file by calling
the write() method of a Molecule, if multiple molecules are to be
written to the same file you should use the Outputfile class.
"""

Conversely, to write a single molecule:
http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.write:
"""
Write the molecule to a file or return a string.
"""

svg = mol.write( format = "svg",
                 opt = { "a" : None, "b" : "none", "i" : None } )

However, laying multiple images out on a grid is a different question. I
would recommend re-posting your question with a better subject, like
"how to draw multiple SVGs on a grid".

Merry Christmas,
-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to