Skip to content

Instantly share code, notes, and snippets.

@ch-hristov
Created December 4, 2015 11:28
Show Gist options
  • Select an option

  • Save ch-hristov/770558a47b26aebff7a9 to your computer and use it in GitHub Desktop.

Select an option

Save ch-hristov/770558a47b26aebff7a9 to your computer and use it in GitHub Desktop.

Revisions

  1. ch-hristov renamed this gist Dec 4, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ch-hristov created this gist Dec 4, 2015.
    8 changes: 8 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    var engine = Python.CreateEngine();
    var scope = engine.CreateScope();
    scope.SetVariable("mol", new SmilesParser());
    string script = "import clr\nk = mol.ParseMolecule(\"CCCCCC\")\nr = k.Count";
    ScriptSource ss = engine.CreateScriptSourceFromString(script);
    ss.Execute(scope);
    var variable = scope.GetVariable("r");
    MessageBox.Show(variable.ToString());