Programmatic expansion of groups adding extraneous H

User aec227c3cb

22-01-2014 21:40:34

I am using the MViewPane to show structures and have it set to open the MSketcherPane on double-click.  When a user closes the sketcher, I want to expand all groups when they're displayed in the view pane.


This is the code (MarvinSketch 6.0.1_b94)


public void propertyChange(PropertyChangeEvent evt) {
        MDocument doc = (MDocument) evt.getNewValue();

        for (Molecule molecule : doc.getAllNonEmptyMolecules()) {
            molecule.expandSgroups();
        }
    }


From sketcher:



After executing above code, in view:



 


If you expand in the sketcher using Structure -> Group -> Expand Groups it works as expected:



Is my code wrong or could this be a bug?

ChemAxon 2c555f5717

10-02-2014 13:39:19

Dear Beajuest!


   I could not reproduce your problem. You could Try to run valanceCheck() on the Molecule objects, or you could call the expandSgroups() method on the primary molecule of the document (you can get it with getPrimaryMolecule() method). I hope this can help you.


Rgards:
Balázs