A method to get the RxnMolecule from MSketchPane?

User 4fe72f6657

08-03-2007 01:22:55

Hello All,





I would like to get the RxnMolecule from MSketchPane,


and to get reactants and products from RxnMolecule.





Code:



Molecule mol = MSketchPane.getMol();


if (mol.isReaction())





...











But I couldn't convert Molecule to RxnMolecule.


Can I get the RxnMolecule from MSketchPane?

ChemAxon 7c2d26e5cf

08-03-2007 16:51:42

Try this to retrieve RxnMolecule from the sketcher:


Code:
   Molecule mol = sketchPane.getMol();   


   if(mol instanceof RgMolecule) {


       Molecule itsRoot = ((RgMolecule)mol).getRoot();


       if(itsRoot instanceof RxnMolecule) {


          RxnMolecule rm = (RxnMolecule)itsRoot;


          // do something


       }


   }

User 4fe72f6657

14-03-2007 02:20:47

Thank you.





I can get RxnMolecule.