Use Altair Compose commands to interact with Flux
Introduction
This section presents the different commands allowing the interaction between Flux and Compose using OML language.
Workflow
In the following table, the steps to follow in Compose for a nominal scenario are presented, an example is available in the installation path : INSTALLATION_FOLDER\flux\Flux\Api\win64\Compose\flux_mp.oml
Copy and paste this file in your working directory, the other file, flux_mp.bat starts the first one.- Add the corresponding toolbox FluxCompose.dll as
following:
% Install Flux component : INSTALLFLUX env variable must exist InstallFlux = getenv('INSTALLFLUX') cd(strcat(InstallFlux,'/Bin/dll/win64')) addtoolbox('FluxCompose.dll');
- To start with the commands, the flux server must be configured.
% # Create local Flux server ('FLUX2D','FLUX3D','FLUXSKEWED','FLUXPEEC') with dynamic memory in english with 5mn IDLE: serverUid=0; serverUid = FMP_startLocaleServer('FLUX2D','../','MEMSIZN3=0','CAO_DEFLAN=2','MAX_IDLE=300'); %% MEMSIZN3 is setted to 0 for dynamic memory %% CAO_DEFLAN=2 is setted to 2 for english language, set it to 1 for french language %% MAX_IDLE is setted to 300 for a 5mn time-out if there are no responses from Flux
Command example (OML language)
- Configure the server (add more options with the server arguments described above).
serverUid = FMP_startLocaleServer('FLUX2D','../','MEMSIZN3=0','CAO_DEFLAN=2','MAX_IDLE=300');
- Execute a python or a pyFlux command
FMP_executeJythonCommand(serverUid, 'newProject()')
FMP_executeJythonCommand(serverUid, 'Face[1].region=RegionFace[“IRON”]')
FMP_executeJythonCommand(serverUid, 'closeProject()')
FMP_executeJythonCommand(serverUid, 'PythonOrPyfluxCommand()')
FMP_executeJythonCommand(serverUid, 'executeBatchSpy('Python_File.py')')
- Set an array double
FMP_setJythonDoubleArrayValue(serverUid,'b',[123.4,567.8])
- Get an array double
b = FMP_getJythonDoubleArrayValue(serverUid,'b')
- Set an array integer
FMP_setJythonIntArrayValue(serverUid,'d',[123,456]);
- Get an array integer
d = FMP_getJythonIntArrayValue(serverUid,'d')
- Set an array string
FMP_setJythonStringArrayValue(serverUid,'f',{'text one','text two'});
- Get an array string
f = FMP_getJythonStringArrayValue(serverUid,'f')
lastInstance = MeshLineArithmetic(name='10',
color=Color['White'],
number=10)
And in Compose this command must not contain any line withdrawal. The
good Compose command for the following example : FMP_executeJythonCommand(serverUid, 'lastInstance = MeshLineArithmetic(name="10",color=Color["White"],number=10)');
Use Python API in Compose environment
A Python file which may be used with Compose environment is available in INSTALLATION_FOLDER\flux\Flux\Api\Compose\flux_mp.py