Collections:
editor.structSelected() - Get Selected Sub-Structure
How to get the selected sub-structure currently in the Ketcher editor with the editor.structSelected() method?
✍: FYIcenter.com
If you want to get detailed information about the selected sub-structure
currently in the Ketcher editor,
you can use the editor.structSelected() method on the Ketcher Editor interface.
Here is an HTML document that shows you how to get detailed information of the selected sub-structure in the Ketcher editor.
<html>
<!-- editor-get-selected-structure.html Copyright (c) FYIcenter.com. -->
<head>
<title>Get Selected Sub-Structure from Editor</title>
</head>
<body>
<p>Create a molecule structure, then click generate button below the editor:</p>
<iframe id=frmKetcher src="/ketcher/index.html"
style="width: 680px; height: 400px;"></iframe>
<p><button onclick="generate();">Get Selected Sub-Structure</button></p>
<p>Output:</p>
<pre id=output style="background-color: #ddd;"></pre>
<script>
var ketcher = null;
var display = document.getElementById("output");
function generate() {
frm = document.getElementById("frmKetcher");
ketcher = frm.contentWindow.ketcher;
editor = ketcher.editor;
structure = editor.structSelected();
display.innerHTML = JSON.stringify(structure, undefined, 2);
}
</script>
</body>
</html>
Open the above HTML document on your local Web server. Draw an ethanol molecule in the editor, and select the C-C bond.
Click "Get Selected Sub-Structure" button, you will see that detailed information of the selected sub-structure in the editor is displayed.
{
"atoms": {
"nextId": 2
},
"bonds": {
"nextId": 1
},
"sgroups": {
"nextId": 0
},
"halfBonds": {
"nextId": 0
},
"loops": {
"nextId": 0
},
"isReaction": false,
"rxnArrows": {
"nextId": 0
},
"rxnPluses": {
"nextId": 0
},
"frags": {
"nextId": 1
},
"rgroups": {
"nextId": 0
},
"name": "",
"abbreviation": "",
"sGroupForest": {
"parent": {},
"children": {},
"atomSets": {}
},
"simpleObjects": {
"nextId": 0
},
"texts": {
"nextId": 0
},
"functionalGroups": {
"nextId": 0
},
"highlights": {
"nextId": 0
}
}
⇒ editor.options() - Get Editor Options
2023-11-23, 1176🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1002816 Names: InChIKey: CFAJZNAOOOFZDC-UHFFFAOYS A-NSMILES: CCCCNC(=O)c1c...
Molecule Summary: ID: FYI-1004795 Names: InChIKey: BQFHTVUWPJXLOW-VQTJNVASS A-NSMILES: Cc1cc(C#N)cnc...
Molecule Summary: ID: FYI-1006763 Names: InChIKey: VHYCDWMUTMEGQY-UHFFFAOYS A-NSMILES: CC(C)NCC(O)CO...
How to convert Convert SDF to SVG (Scalable Vector Graphics) using Open Babel? I want to see the mol...
Molecule Summary: ID: FYI-1001107 SMILES: CC1CC(C)c2c(n1)c1CCCCC1C C2Received at FYIcenter.com on: 2...