in OMEdit, I can create a blank model/class, then drag and drop blocks/components, and make connections between them, incrementally building a model. Can I use OMPython to similarly incrementally build a model from scratch by adding blocks/components and connections? something like
from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
cmds = [
"newModel(getInstallationDirectoryPath() + "/share/doc/omc/testmodels/MyModel.mo")",
"addComponent(Modelica.Electrical.Analog.Basic.Resistor "R")",
"addComponent(Modelica.Electrical.Analog.Basic.Ground"gnd")",
"addConnection(R.n gnd.p)",
... until the model is complete
"translateModelFMU(MyModel)",
"simulate(MyModel)",
etc.
]
for cmd in cmds:
answer = omc.sendExpression(cmd)
print("\n{}:\n{}".format(cmd, answer))
i've read through
and nothing seemed to be obviously related to what i want to do.
using help(OMPython) i found this, is that related to what i want to do?
requestApi(self, apiName, entity=None, properties=None)
| # request to OMC
in OMEdit, I can create a blank model/class, then drag and drop blocks/components, and make connections between them, incrementally building a model. Can I use OMPython to similarly incrementally build a model from scratch by adding blocks/components and connections? something like
i've read through
and nothing seemed to be obviously related to what i want to do.
using help(OMPython) i found this, is that related to what i want to do?