I have been trying to script adding functions to my Functional Chains. However I cannot seem to find a way to create a FunctionalChainInvolvementFunction that references a Function or is owned by a Functional Chain.
I have tried searching through the Java code for clues, but the closest that I have got is to create a FunctionalChainInvolvementFunction without referencing anything. I can get the Involver and Involved elements (of which there are None because I haven’t set them):
I think you need to create/change FunctionalChainInvolvementLink and use the setSource(myFunctionalChainInvolvementFunction) and setTarget(myFunctionalChainInvolvementFunction).
Does FunctionalChainInvolvementLink link a Function Involvement already in the Functional Chain or does it include the function in the functional chain by creating the Function Involvement? I’m trying to get the Function involved in the FC as opposed to linking an already existing Function Involvement.
where FCObj is my Functional Chain and Func is my Function I wish to get Involved and recieved the following error:
File "C:\Capella\T4C610\capella\plugins\py4j-python_0.10.9.5-bnd-2odeag\src\py4j\java_gateway.py", line 1313, in __call__
args_command, temp_args = self._build_args(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Capella\T4C610\capella\plugins\py4j-python_0.10.9.5-bnd-2odeag\src\py4j\java_gateway.py", line 1283, in _build_args
[get_command_part(arg, self.pool) for arg in new_args])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Capella\T4C610\capella\plugins\py4j-python_0.10.9.5-bnd-2odeag\src\py4j\java_gateway.py", line 1283, in <listcomp>
[get_command_part(arg, self.pool) for arg in new_args])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Capella\T4C610\capella\plugins\py4j-python_0.10.9.5-bnd-2odeag\src\py4j\protocol.py", line 298, in get_command_part
command_part = REFERENCE_TYPE + parameter._get_object_id()
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FunctionalChain' object has no attribute '_get_object_id'
What I need help with are steps 2 and 3. I am missing how to properly initialise the FunctionalChainInvolvementFunction.
I found the reference to getInvolvedElement() function in the Java code, but when I tried to use setInvolvedElement it failed and gave me the ‘method does not exist’ error. Code and error below:
FCIF1.setInvolvedElement(Func.get_java_object())
py4j.Py4JException: Method setInvolvedElement([class org.polarsys.capella.core.data.pa.impl.PhysicalFunctionImpl]) does not exist
Where:
‘Func1’ and ‘Func2’ are the Functions;
‘FuncEx’ is the functional exchange; and
‘FC’ is the Functional Chain
The following code will create the the FunctionalChainInvolvementFunctions, associates them with the functions, and the same with FunctionalChainInvolvementLink and the Functional Exchange.
Making the Functional Chain the parent makes it the ‘Involver’: