Mass views exports

Hello @Thierry_Poupon ,
Concerning EIE type, you can use something like this :
For EIE in all_EIE:
EIE_Type = EIE.get_type()
EIE_Type_elem = EIE_Type[0].get_name()

Best regards,

Sophie

@Sophie_Plazant
Thanks Sophie

Hi Sophie
I’m trying to get the list of SCE: System Component exchanges:
I managed to get those outgoing from system actors… but now I need to append the ones outgoing from system… (Some CE are crossing from one actor to the next, so O can’t really take the inputs without having doublons)
Then for system: I tried to reuse same as for actors, but it does not work…

Currently this script has already 3 loops and 3 browses because I had to use component ports

The “get_outgoing component_exchange()” don’t run: issue in capella.py

Thanks for any help…
May be I’ll try to save a loop and run with connected componenent from CE…

Last try with this kind of script:

for elem_SAC in all_SAC:
Acteur = elem_SAC
#print(Acteur)

#SACOGCE = elem_SAC.get_outgoing_component_exchanges()
#print('found sourced CE')
ACPort = elem_SAC.get_contained_component_ports()
for elem_CP in ACPort:
    
    SACPO=elem_CP.get_orientation()
    if SACPO == "OUT" or SACPO == "INOUT":
        SACOGCE=elem_CP.get_component_exchanges()
            
        for elem_CE in SACOGCE:
                                       
            i = i + 1  
            worksheet.cell(row = i, column = 1).value = elem_CE.get_name()

All_SYS=[System]
for elem_SYS in All_SYS:
SYSCPort = elem_SYS.get_contained_component_ports()
print(elem_SYS)
for elem_CP in SYSCPort:
SYCPO=elem_CP.get_orientation()
print(SYCPO)
‘’’
for elem_CE in SYSOGCE:
i = i + 1
worksheet.cell(row = i, column = 1).value = elem_CE.get_name()

‘’’
Python wants a “self” as argument in get_contained_component_ports(self), but this generates another one, I tried as well the string ‘self’ but the string doesn’t fit either.
So now I try yours for EIE…
Regards
Thierry

Here is the result:

py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: Traceback (most recent call last):
File “C:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py”, line 186, in runcode
exec(compiled, self.locals)
File “L/Python4Capella/Scripts for MAEVA/Export_MAEVA_EI-EIE.py”, line 117, in
return _pyease_ListConverter().convert([
File “L/Python4Capella/simplified_api/capella.py”, line 202, in get_element_type
AttributeError: TODO

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\c520x\capella\plugins\py4j-python_0.10.9.3-bnd-2odeag\src\py4j\clientserver.py”, line 581, in _call_proxy
return_value = getattr(self.pool[obj_id], method)(*params)
File “C:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py”, line 335, in executeScript
return self.executeCommon(code_text, self.interp.runcode, filename)
File “C:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py”, line 313, in executeCommon
execution_result = code_exec(code_text, filename)
File “C:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py”, line 213, in runcode
except Exception:
TypeError: catching classes that do not inherit from BaseException is not allowed

at py4j.Protocol.getReturnValue(Protocol.java:476)
at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:108)
at com.sun.proxy.$Proxy25.executeScript(Unknown Source)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalExecute(Py4jScriptEngine.java:236)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.execute(Py4jScriptEngine.java:226)
at org.eclipse.ease.AbstractScriptEngine.inject(AbstractScriptEngine.java:245)
at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:309)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Have a good WE
Regards
Thierry

Hello @Thierry_Poupon ,
you can use as an alternative to get outgoing component exchanges : capella_query_by_name(e_object,‘Outgoing Component Exchanges’).
To see the available query, you can use available_query_names(e_object).

For ‘get_contained_components_ports()’, do you have an error with elem_SYS.get_contained_components_ports()?

Best regards

Sophie

Hello@Sophie
I understood that system is not an item but a singleton where a system element is…
This is causing me an additional browse and loop while getting modes and states.
For SCE, what I did is pretend I wanted all CE, then add them on list when connected component was system actor. Doing this, SCE between system actors are seen twice. I solve it in the excel part by removing duplicates while reading export. The constraint there is not to have several with the same name.
I consider this point as solved.
Thanks anyway :slight_smile:
I tried to continue exchange items checks…
I’m still missing a solution that alerts untyped EIE, and for untyped properties should be OK, but…
Reference value seems to be a project alone: each kind has to be separate (boolean; enumeration; string and numerical). On the other hand I couldn’t get the list of literals for each detail kind (some don’t have like physical quantities, they use numerics which have units…)
Class operation parameter is toot complicated for the moment, and needs imbricated loops… parameter have no accessible attribute.
As you can see, it’s not finished!
To come back to state machines: in my project I have a governed (modes driven by system of interest) way bigger than system of interest (which is “system”), so under system I have one state machine for the governed system lifecycle (with 2 main regions), one mode machine for its modes (with 2 main regions), then the mode machine for my system… each time I have imbricated mode or states.
The target is to lists all modes or states for each machine, and then check the traces linking governed system phase; governed system mode and system of interest modes.
Next step is to check that system functions involved in required capacity during a phase are woken up by the relevant system of interest mode… (then I’m speaking only about system, not actors)…
In this part I just begin…
Many thanks again for your support and your time
Best regards
Thierry

Hi there,
As mentionned in preceding answer to Sophie Plazanet, I’m looking for a way to find incoming traces to states (and modes which seems to be same class).
There is no get_traces in states, and I’m lacking B-plan…
Thanks for any help.
Thierry

Hello @Thierry_Poupon ,
You can use capella_query_by_name(e_object,‘Outgoing Generic Traces’) et capella_query_by_name(e_object,‘Incoming Generic Traces’).

Best regards

Sophie

Thanks Sophie
Can you tell me more about exact syntax?
Regards
Thierry
Edit1: Could this work for EI mechanism or data type?
Edit2: Found the syntax, incoming works, not outgoing but that’s enough for me.