I would make a copy of it myself, but deleting/adding should also work.

(It’s always good to keep the list cc:ed on replies to maximize the likelihood 
of a reply)

Kind regards,
Fredrik

On 6 maj 2017 00:53 +0200, xh s <sxh....@gmail.com>, wrote:
> Thanks for the reply!
>
> So if I still want the hydrogens in my molecule in the long run, I should 
> delete them before creating the SVG and then add them back?
>
> Xianghai
>
> > On Fri, May 5, 2017 at 3:05 PM, Fredrik Wallner <fred...@wallner.nu> wrote:
> > > Hi,
> > >
> > > I believe you are using AddOption correct, but not the correct option. 
> > > Option “C” does not turn off explicit hydrogens it turns off terminal C 
> > > with hydrogens (i.e. CH3 groups). If your molecule has explicit 
> > > hydrogens, you should remove them before creating the SVG (or in your 
> > > example code, don’t add them…)
> > >
> > > Kind regards,
> > > Fredrik
> > >
> > > On 5 maj 2017 19:46 +0200, xh s <sxh....@gmail.com>, wrote:
> > > > Hi,
> > > >
> > > > I'd like to output my molecules to svg with some options (e.g. implicit 
> > > > hydrogen). Here's a minimal example code:
> > > >
> > > > #include <openbabel/obconversion.h>
> > > > #include <openbabel/mol.h>
> > > > #include <iostream>
> > > > using namespace std;
> > > > using namespace OpenBabel;
> > > >
> > > > int main() {
> > > >   stringstream inputSmiles("CCC(CC)C");
> > > >   ofstream pic("minimal_conversion_pic.svg");
> > > >   OBConversion conv(&inputSmiles, &pic);
> > > >   conv.SetInAndOutFormats("can", "svg");
> > > >   OBMol mol;
> > > >   conv.Read(&mol);
> > > >   mol.AddHydrogens();
> > > >   conv.AddOption("C",OBConversion::OUTOPTIONS);
> > > >   conv.Write(&mol);
> > > > }
> > > >
> > > >
> > > > I believe "C" is an option to turn off explicit hydrogen in svg 
> > > > drawing. However this program still prints hydrogens. I tried other 
> > > > options too but none of them worked. Am I using AddOption wrong?
> > > >
> > > > Thank you,
> > > > Xianghai
> > > > ------------------------------------------------------------------------------
> > > > Check out the vibrant tech community on one of the world's most
> > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > > _______________________________________________
> > > > OpenBabel-discuss mailing list
> > > > OpenBabel-discuss@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to