This example shows how you can obtain a chemaxon.struc.Molecule instance from the selected row of a structure entity.
import chemaxon.struc.Molecule import com.im.commons.progress.* import com.im.df.api.chem.MarvinStructure def ety = dataTree.rootVertex.entity // assumes you have reference to the data tree def molFld = ety.fields.items.find { it.name == 'Structure' } // find the structure field def rs = ety.schema.dataProvider.getDefaultResultSet(dataTree, false, DFEnvironmentRO.DEV_NULL) // find the ResultSet def rootVS = rs.getVertexState(dataTree.rootVertex) // obtain the VertexState List ids = rootVS.getSelectedRowsIds() // get the selected IDs if (ids.size == 1) { Map rows = rootVS.getData(ids, DFEnvironmentRO.DEV_NULL) // get the data Map row = rows[ids[0]] // get the first and only row MarvinStructure mol = row[molFld.id] // Get the Structure. Its a com.im.df.api.chem.MarvinStructure instance Molecule cxnMol = mol.getNative() // obtain the chemaxon.struc.Molecule instance println "molecule: $cxnMol" // do something with the Moelcule } else { println "bad selection" }
Versions: This script has been tested on IJC version 6.0