sendExpression

Start a new OMCSession and send scripting API expressions to the omc session with sendExpression().

OMJulia.sendExpressionFunction
sendExpression(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.

Note

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\")")
Warn

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\")")           # Windows

Example

using OMJulia
omc = OMJulia.OMCSession()
OMJulia.sendExpression(omc, "getVersion()")
source

Examples

[ Info: Path to zmq file="/tmp/openmodelica.runner.port.julia.ZpB0apgkiV"
julia> version = OMJulia.sendExpression(omc, "getVersion()")"OpenModelica 1.23.0~dev-391-g7423fcd"
julia> OMJulia.quit(omc)