file Documentation about writing macros

10 years 7 months ago #249 by ebr
Hi,

I moved your subject in the right section.

Regards,

ebr

Please Log in or Create an account to join the conversation.

10 years 7 months ago - 10 years 7 months ago #250 by chm
Hi jmmalmedy,

there are several documentation pages you should check to write your macros:
- Scripts & macros in modelio documentation
- Modelio Java API
- http://www.jython.org/

A few macros are already in the Scripts section of the forum, do not hesitate to add a new post if you encounter any problems.

Hope this helps!

Please Log in or Create an account to join the conversation.

10 years 7 months ago #251 by jmmalmedy
Hi,

Thanks for your answer.

I've already read these documents. Unfortunately, none of them gives a view on the Python classes and methods of Modelio.

The Python classes seem to be quite different from the Java ones. So the document about the Java API does not really help.

Is there somewhere a tutorial about scripting in Modelio with Python? I'm talking about the API of course, not about the Python syntax. Some kind of "Modelio Python API" document would be great.

Thank you very much in advance,

J-M Malmedy

Please Log in or Create an account to join the conversation.

10 years 7 months ago #252 by ebr
Hi,

I am not sure to get your point. Java classes and Jython classes seem quite similar for me. For example, if we want to create a component under the root package. The code in Java will be:
IModelingSession modelingSession = Modelio.getInstance().getModelingSession();
ITransaction tr = modelingSession.createTransaction("create component")
comp = modelingSession.getModel().createComponent();
comp.setOwner(modelingSession.getModel().getRoot());
modelingSession.commit(tr);

and in Jython:
modelingSession = Modelio.getInstance().getModelingSession()
tr = modelingSession.createTransaction("create component")
comp = modelingSession.getModel().createComponent()
comp.setOwner(modelingSession.getModel().getRoot())
modelingSession.commit(tr)

Regards,

ebr

Please Log in or Create an account to join the conversation.

10 years 7 months ago #253 by jmmalmedy
Hi,

Indeed. I guess I now understand the macthing between the Java API classes and the Pyhton classes.

Thanks a lot for your help.

J-M Malmedy

Please Log in or Create an account to join the conversation.

10 years 3 months ago #796 by pan
For those who are interested by writing macros, you can see this wiki explaining how to write Jython scripts and showing some examples and tutorials .

Hope this helps.

Please Log in or Create an account to join the conversation.

Moderators: chmcma
Time to create page: 0.043 seconds
^ Back to Top