Python Console in UnityMolX

Table of Contents

1. Exhaustive list of functions

See an overview of all PythonAPI functionalities in API.md

Python integration in UnityMol X is implemented using IronPython. It is a powerful python integration without needing to define every bindings for a function, meaning that you can call every C# and Unity class/methods. For example:

GameObject.Find("Main
Camera").transform.position = Vector3(0.1,0.2,0.3)

However, not every python module is available (eg. numpy, scipy, … are missing).

An API is defined to perform all the actions accessible from the UI.

2. Essentials

To show (and hide) the console press the CTRL + <space bar> key combination

2.1. Some examples of commands in the APIPython definition

load("filePath")
fetch("1KX2")
select("1KX2 and resname CYS", "mySelection")
show("cartoon")
hide("hb")
showSelection("mySelection", "line")
hideSelection("mySelection", "line")
centerOnSelection("mySelection")
loadTraj("structureName", "filePath.xtc")
delete("structureName")
colorSelection("mySelection", "line", "red")
colorByChain("mySelection", "s")
renameSelection("mySelection", "myNewSelection")
screenshot("C:/Users/myUserName/Desktop/UMolScreenshot1.png")
startVideo("C:/Users/myUserName/Desktop/UMolVid1.mp4")
stopVideo()
connectIMD("myStructure", "127.0.0.1", 8888)
disconnectIMD("myStructure")

Author: Marc Baaden

Created: 2025-12-03 Mer 19:03

Validate