Hi all,
First of all, my configuration is following:
macOS: 10.14
conda: 4.5.11
python: 3.6.6
rdkit: 2018.09.01
I just tried to set bond width for 2D SVG images and I run into situation I
don’t understand much (nothing surprising ☺). I’m aware of 2 ways how to
generate SVG images
A simple one
from rdkit import Chem
from rdkit.Chem import Draw
width=100
mol = Chem.MolFromSmiles('c1cc(CCCO)ccc1')
Draw.DrawingOptions.bondLineWidth = 10
Draw.MolToFile(mol, 'img.svg', size=(width, width))
Here I can set bondLineWidth, it works like a charm, but if I use the other
approach I know, which allows a bit more configuration,
from rdkit import Chem
from rdkit.Chem import Draw
mol = Chem.MolFromSmiles('c1cc(CCCO)ccc1')
drawer = Draw.MolDraw2DSVG(width, width)
options = drawer.drawOptions()
options.bondLineWidth = 10 # does not work
Draw.DrawingOptions.bondLineWidth = 10 # does not work either
mol = Draw.PrepareMolForDrawing(mol)
drawer.DrawMolecule(mol)
drawer.FinishDrawing()
with open(f'img.svg', 'w') as f:
f.write(drawer.GetDrawingText())
the bondLineWidth property is not part of the object returned by drawOptions().
And setting it in a similar fashion as with the previous case does not work.
So, I am bit puzzled at this point, If I do something wrong, or if it is
possible to set it at all in the other approach.
At best, I’d like to set the other approach as it allows a bit more
configuration and I would like to avoid manipulating the svg text directly. I
appreciate all your help.
Thank you!
Lukas
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss