editor.options() - Get Editor Options

Q

How to get a list of options used by the Ketcher editor with the editor.options() method?

✍: FYIcenter.com

A

If you want to get a list of options used by the Ketcher editor, you can use the editor.options() method on the Ketcher Editor interface.

Here is an HTML document that shows you how to get a list of options currently used by the Ketcher editor.

<html>
<!-- editor-get-options.html Copyright (c) FYIcenter.com. -->
<head>
<title>Get Current Options 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 Current Options</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;
  options = editor.options();
  display.innerHTML = JSON.stringify(options, undefined, 2);
}
</script>
</body>
</html>

Open the above HTML document on your local Web server. Draw a chemical structure in the editor.

Click "Get Current Options" button, you will see that a list options of the editor is displayed.

{
  "dearomatize-on-load": false,
  "ignoreChiralFlag": false,
  "disableQueryElements": null,
  "showAtomIds": false,
  "showBondIds": false,
  "showHalfBondIds": false,
  "showLoopIds": false,
  "showValenceWarnings": true,
  "autoScale": false,
  "autoScaleMargin": 0,
  "maxBondLength": 0,
  "atomColoring": true,
  "hideImplicitHydrogen": false,
  "hideTerminalLabels": false,
  "carbonExplicitly": false,
  "showCharge": true,
  "showHydrogenLabels": "Terminal and Hetero",
  "showValence": true,
  "aromaticCircle": true,
  "scale": 40,
  "zoom": 1,
  "offset": {
    "x": 0,
    "y": 0,
    "z": 0
  },
  "lineWidth": 2,
  "bondSpace": 6,
  "stereoBond": 6,
  "subFontSize": 7,
  "font": "30px Arial",
  "fontsz": 13,
  "fontszsub": 13,
  "fontRLabel": 15.6,
  "fontRLogic": 9.1,
  "radiusScaleFactor": 0.38,
  "lineattr": {
    "stroke": "#000",
    "stroke-width": 2,
    "stroke-linecap": "round",
    "stroke-linejoin": "round"
  },
  "selectionStyle": {
    "fill": "#57FF8F",
    "stroke": "#57FF8F"
  },
  "hoverStyle": {
    "stroke": "#0097A8",
    "fill": "transparent",
    "fillSelected": "#CCFFDD",
    "stroke-width": 1.2
  },
  "sgroupBracketStyle": {
    "stroke": "darkgray",
    "stroke-width": 1
  },
  "lassoStyle": {
    "stroke": "gray",
    "stroke-width": "1px"
  },
  "hoverStyleSimpleObject": {
    "stroke": "#57FF8F",
    "stroke-width": 10,
    "stroke-linecap": "round",
    "stroke-opacity": 0.6
  },
  "atomSelectionPlateRadius": 13,
  "contractedFunctionalGroupSize": 50,
  "resetToSelect": "paste",
  "rotationStep": 15,
  "showStereoFlags": true,
  "stereoLabelStyle": "Iupac",
  "colorOfAbsoluteCenters": "#ff0000",
  "colorOfAndCenters": "#0000cd",
  "colorOfOrCenters": "#228b22",
  "colorStereogenicCenters": "LabelsOnly",
  "autoFadeOfStereoLabels": true,
  "absFlagLabel": "ABS",
  "andFlagLabel": "AND Enantiomer",
  "mixedFlagLabel": "Mixed",
  "orFlagLabel": "OR Enantiomer",
  "doubleBondWidth": 6,
  "bondThickness": 2,
  "stereoBondWidth": 6,
  "smart-layout": true,
  "ignore-stereochemistry-errors": true,
  "mass-skip-error-on-pseudoatoms": false,
  "gross-formula-add-rsites": true,
  "gross-formula-add-isotopes": true,
  "miewMode": "LN",
  "miewTheme": "light",
  "miewAtomLabel": "bright"
}

 

editor.setOptions() - Set Editor Options

editor.structSelected() - Get Selected Sub-Structure

Ketcher Editor Interface

⇑⇑ Ketcher - Chemical Structure Editor

2023-11-18, 270🔥, 0💬