question-circle First steps in Modelio

8 years 4 months ago #2603 by jaracic
Hi,

I just downloaded modelio 3.1.1 on my macosx (10.8.5) to test it in order to integrate in my toolset (I'm a independant system engineering techniques consultant).

I think I will.

Yesterday I decided to explore the scripting language and I faced immediatly to a problem :
The basic example script
if (selectedElements.size() > 0):
	# str() function is used to convert an int to string
	print "We selected " + str(selectedElements.size()) + " elements."
	for e in selectedElements:
		print "- " + e.getMetaclassName() + " '" + e.getName() + "'"
else:
	print "No element has been selected."
found HERE does not work:

We selected 1 elements.
AttributeError: 'org.modelio.metamodel.impl.uml.statik.ClassImpl' object has no attribute 'getMetaclassName' in <script> at line number 5
Traceback (most recent call last):
File "<script>", line 5, in <module>
AttributeError: 'org.modelio.metamodel.impl.uml.statik.ClassImpl' object has no attribute 'getMetaclassName'


Not mention that the Module developer's API guide seems to be for Modelio 2...

Does someone could give some keys to unlock my situation ?

Thanks a lot for your help !
Joseph.

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

8 years 4 months ago - 5 years 11 months ago #2604 by chm
Hi jaracic,

you're right, this wiki page is about Modelio 2, I'll ask if there is another one for Modelio 3...

In the meantime, here's the fixed version of your script:
if (selectedElements.size() > 0):
	# str() function is used to convert an int to string
	print "We selected " + str(selectedElements.size()) + " elements."
	for e in selectedElements:
		print "- " + e.getMClass().getName() + " '" + e.getName() + "'"
else:
	print "No element has been selected."

You should be able to find some help about the Modelio 3 API right here !

Hope this helps,


chm
The following user(s) said Thank You: jaracic

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

8 years 4 months ago #2609 by pan
Hi,

This page does not exist for Modelio 3.
We will create a specific page for Modelio 3.

BR
The following user(s) said Thank You: jaracic

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

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