I have no idea what CDKMolDepict is, a Knime thing? It's probably just not being updated. Testing the following on master/main works as expected (DepictionGenerator computes the 2D as needed, no need to clear the 3D):
public static void main(String[] args) { String molfile = "\n" + " MJ231200 \n" + "\n" + " 5 4 0 0 1 0 0 0 0 0999 V2000\n" + " 0.9718 -0.1139 0.6193 O 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 0.9448 0.0189 -0.2285 S 0 0 0 0 0 0 0 0 0 0 0 0\n" + " -0.0042 0.1584 -0.4371 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " -0.2882 0.8589 -0.1053 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 1.1863 -0.8418 -0.6272 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 1 2 2 0 0 0 0\n" + " 2 3 1 0 0 0 0\n" + " 3 4 1 0 0 0 0\n" + " 2 5 1 0 0 0 0\n" + "M END\n"; IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); try (MDLV2000Reader mdlr = new MDLV2000Reader(new StringReader(molfile))) { IAtomContainer mol = mdlr.read(bldr.newAtomContainer()); new DepictionGenerator().depict(mol).writeTo("/tmp/tmp.svg"); } catch (IOException e) { throw new RuntimeException(e); } catch (CDKException e) { throw new RuntimeException(e); } } On Tue, 19 Sept 2023 at 18:15, Tim Dudgeon <tdudgeon...@gmail.com> wrote: > I'm using StructureDiagramGenerator.generateCoordinates() to create a > layout before using CDKMolDepict to generate images for molecules, and I've > hit a problem when using molecules that already have 3D coordinates as > StructureDiagramGenerator.generateCoordinates() does not generate a new 2D > layout if 3D coordinates are present, and passing in a molecule with 3D > coordinates seems to make CDKMolDepict crash badly. > > So, what is the best way to clear the 3D coordinates for a molecule, so > that StructureDiagramGenerator.generateCoordinates() can do its job? > _______________________________________________ > Cdk-user mailing list > Cdk-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/cdk-user >
_______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user