sendExpression
Start a new OMCSession and send scripting API expressions to the omc session with sendExpression().
OMJulia.sendExpression — FunctionsendExpression(omc, expr; parsed=true)Send API call to OpenModelica ZMQ server. See OpenModelica User's Guide Scripting API for a complete list of all functions.
Some characters in argument expr need to be escaped. E.g. " becomes \". For example scripting API call
loadFile("/path/to/M.mo")will translate to
sendExpression(omc, "loadFile(\"/path/to/M.mo\")")On Windows path separation symbol \ needs to be escaped \\ or replaced to Unix style path / to prevent warnings.
loadFile("C:\\path\\to\\M.mo")translate to
sendExpression(omc, "loadFile(\"C:\\\\path\\\\to\\\\M.mo\")") # Windows
sendExpression(omc, "loadFile(\"/c/path/to/M.mo\")") # WindowsExample
using OMJulia
omc = OMJulia.OMCSession()
OMJulia.sendExpression(omc, "getVersion()")Examples
[ Info: Path to zmq file="/tmp/openmodelica.runner.port.julia.CiaerZV5lk"julia> version = OMJulia.sendExpression(omc, "getVersion()")"OpenModelica 1.24.0~dev-245-g021284b"julia> OMJulia.quit(omc)