Bonjour, Voici après quelques recherches les possibilités et comment les mettre en oeuvre pour le format MOL: Format en lecture: * JSON * readCIF * readJCAMP * readMOL * readPDB * readXYZ Format en ecriture: * JSON * writeMOL Affichage de molécule ===================== En gros les lignes importantes:: var eauMol = "Molecule Name\n CHEMDOOD11111213423D 0 0.00000 0.00000 0\n[Ins var eau = ChemDoodle.readMOL(eauMol); eau.scaleToAverageBondLength(14.4); viewerCanvas.loadMolecule(eau); Le tout dans une page HTML <html> <head> <meta http-equiv="X-UA-Compatible" content="chrome=1"> <link rel="stylesheet" href="../install/ChemDoodleWeb.css" type="text/css"> <script type="text/javascript" src="../install/ChemDoodleWeb-libs.js"></script> <script type="text/javascript" src="../install/ChemDoodleWeb.js"></script> <title>ChemDoodle Web Component Viewer : ACS Document 1996</title> </head> <body> <script> //initialize component and set visual specifications var viewerCanvas = new ChemDoodle.ViewerCanvas('viewerCanvas', 100, 100); //the width of the bonds should be .6 pixels viewerCanvas.specs.bonds_width_2D = .6; //the spacing between higher order bond lines should be 18% of the length of the bond viewerCanvas.specs.bonds_saturationWidth_2D = .18; //the hashed wedge spacing should be 2.5 pixels viewerCanvas.specs.bonds_hashSpacing_2D = 2.5; //the atom label font size should be 10 viewerCanvas.specs.atoms_font_size_2D = 10; //we define a cascade of acceptable font families //if Helvetica is not found, Arial will be used viewerCanvas.specs.atoms_font_families_2D = ["Helvetica", "Arial", "sans-serif"]; //display carbons labels if they are terminal viewerCanvas.specs.atoms_displayTerminalCarbonLabels_2D = true; //load data and read into a Molecule var caffeineMolFile = 'Molecule Name\n CHEMDOOD08070920033D 0 0.00000 0.00000 0\n[Insert Comment Here]\n 14 15 0 0 0 0 0 0 0 0 1 V2000\n -0.3318 2.0000 0.0000 O 0 0 0 1 0 0 0 0 0 0 0 0\n -0.3318 1.0000 0.0000 C 0 0 0 1 0 0 0 0 0 0 0 0\n -1.1980 0.5000 0.0000 N 0 0 0 1 0 0 0 0 0 0 0 0\n 0.5342 0.5000 0.0000 C 0 0 0 1 0 0 0 0 0 0 0 0\n -1.1980 -0.5000 0.0000 C 0 0 0 1 0 0 0 0 0 0 0 0\n -2.0640 1.0000 0.0000 C 0 0 0 4 0 0 0 0 0 0 0 0\n 1.4804 0.8047 0.0000 N 0 0 0 1 0 0 0 0 0 0 0 0\n 0.5342 -0.5000 0.0000 C 0 0 0 1 0 0 0 0 0 0 0 0\n -2.0640 -1.0000 0.0000 O 0 0 0 1 0 0 0 0 0 0 0 0\n -0.3318 -1.0000 0.0000 N 0 0 0 1 0 0 0 0 0 0 0 0\n 2.0640 -0.0000 0.0000 C 0 0 0 2 0 0 0 0 0 0 0 0\n 1.7910 1.7553 0.0000 C 0 0 0 4 0 0 0 0 0 0 0 0\n 1.4804 -0.8047 0.0000 N 0 0 0 1 0 0 0 0 0 0 0 0\n -0.3318 -2.0000 0.0000 C 0 0 0 4 0 0 0 0 0 0 0 0\n 1 2 2 0 0 0 0\n 3 2 1 0 0 0 0\n 4 2 1 0 0 0 0\n 3 5 1 0 0 0 0\n 3 6 1 0 0 0 0\n 7 4 1 0 0 0 0\n 4 8 2 0 0 0 0\n 9 5 2 0 0 0 0\n 10 5 1 0 0 0 0\n 10 8 1 0 0 0 0\n 7 11 1 0 0 0 0\n 7 12 1 0 0 0 0\n 13 8 1 0 0 0 0\n 13 11 2 0 0 0 0\n 10 14 1 0 0 0 0\nM END\n> <DATE>\n07-08-2009\n'; var caffeine = ChemDoodle.readMOL(caffeineMolFile); //the bond lengths should be 14.4 pixels in ACS Document 1996 caffeine.scaleToAverageBondLength(14.4); viewerCanvas.loadMolecule(caffeine); </script> </body> </html> Si l'on veut créer une image dans une nouvelle fenetre:: ChemDoodle.io.png.create(viewerCanvas); Edition et sauvegarde d'une molecule ==================================== <script> function save() { var mol = sketcher.getMolecule(); var molString = ChemDoodle.writeMOL(mol); alert(molString); // remplacer cette ligne par l'envoi de molString vers la base, ou un champs de formulaire qui sera soumis } </script> <a href="javascript:save()">Save</a> Le tout dans une page HTML:: <html> <head> <meta http-equiv="X-UA-Compatible" content="chrome=1"> <link rel="stylesheet" href="../install/ChemDoodleWeb.css" type="text/css"> <script type="text/javascript" src="../install/ChemDoodleWeb-libs.js"></script> <script type="text/javascript" src="../install/ChemDoodleWeb.js"></script> <link rel="stylesheet" href="../install/sketcher/jquery-ui-1.8.7.custom.css" type="text/css"> <script type="text/javascript" src="../install/sketcher/jquery-ui-1.8.7.custom.min.js"></script> <script type="text/javascript" src="../install/sketcher/ChemDoodleWeb-sketcher.js"></script> <title>ChemDoodle Web Component Sketcher</title> </head> <body> <script> // changes the default JMol color of hydrogen to black so it appears on white backgrounds ChemDoodle.ELEMENT['H'].jmolColor = 'black'; // darkens the default JMol color of sulfur so it appears on white backgrounds ChemDoodle.ELEMENT['S'].jmolColor = '#B9A130'; // initializes the SketcherCanvas; make sure to set the path to the icons correctly! var sketcher = new ChemDoodle.SketcherCanvas('sketcher', 500, 300, '../install/sketcher/icons/', ChemDoodle.featureDetection.supports_touch(), true); // sets terminal carbon labels to display sketcher.specs.atoms_displayTerminalCarbonLabels_2D = true; // sets atom labels to be colored by JMol colors, which are easy to recognize sketcher.specs.atoms_useJMOLColors = true; // the following two settings add overlap clear widths, so that some depth is introduced to overlapping bonds sketcher.specs.bonds_clearOverlaps_2D = true; sketcher.specs.bonds_overlapClearWidth_2D = 2; // the component needs to be repainted here because we do not call the <em>Canvas.loadMolecule()</em> function sketcher.repaint(); </script> <script> function save() { var mol = sketcher.getMolecule(); var molString = ChemDoodle.writeMOL(mol); alert(molString); // remplacer cette ligne par l'envoi de molString vers la base, ou un champs de formulaire qui sera soumis } </script> <br> <a href="javascript:save()">Save</a> </body> </html> -- Benjamin POUSSIN -------------------- tél: +33 (0) 2 40 50 29 28 email: poussin@codelutin.com http://www.codelutin.com