MatrixFrame comes with console programs that calculate without the user interface. Use them from a script or from your own software: each run reads its input from files and writes its results and reports to files.
| Program | Use |
|---|---|
MxFrameAPI.exe | Calculates a MatrixFrame project and writes its results and reports. |
MxToolsAPI.exe | Calculates MatrixTools documents and writes MatrixTools reports. |
MxFloorAPI.exe | Calculates MatrixFloor projects; see MxFloor API. |
The programs are in the Bin folder of MatrixFrame. With a standard installation of MatrixFrame 2027 this is:
C:\Program Files\Matrix\MatrixFrame 2027\BinA program that is started without parameters lists its switches. The licence has to include the API module.
A path or a list that contains a space or a | sign has to be written between double quotes.
Versions
The examples on this page were made with MatrixFrame 2027. Most of it also works in earlier versions; the table shows since when. Earlier versions are installed in C:\Program Files (x86)\Matrix\MatrixFrame [version]\Bin.
| Program | Function | Available |
|---|---|---|
MxFrameAPI.exe | /LOAD, /LG, /CALC, /RESULT, /REPORT, /SAVE, /SETTINGS | since 5.6 |
MxFrameAPI.exe | /REPORTLIST | since 6.0 |
MxFrameAPI.exe | /CONCRETE, /STEEL, /TIMBER | 5.6 to 2026 |
MxFrameAPI.exe | Result flags concrete, steel, timber | since 2027 |
MxToolsAPI.exe | Input file with header and data, /OUTPUT:CONSOLE | since 6.1 |
MxToolsAPI.exe | /LOAD with /SAVE | since 6.0 |
MxToolsAPI.exe | /LOAD with /REPORT | since 2027 |
MxFrame API
| Switch | Description |
|---|---|
/LOAD:"<path>" | Loads a MatrixFrame project. |
/LG | Runs the load generator after the project is loaded. |
/CALC | Runs the structural analysis. |
/CALC:advanced | Runs the advanced structural analysis. |
/RESULT:"<flags>" | Writes the results of the analysis to <project>.results.xml. The flags, separated by |, select what is written; see below. |
/REPORT:"<items>" | Writes a report with the given items, separated by |, to <project>.report.pdf. |
/REPORTLIST | Lists the report items. |
/SAVE:"<path>" | Saves the project. |
/SETTINGS:"<path>" | Settings to use instead of those of MatrixFrame: a file, or the settings text itself. |
Examples
"C:\Program Files\Matrix\MatrixFrame 2027\Bin\MxFrameAPI.exe" /LOAD:"C:\Projects\simple-project.mxml" /CALC /RESULT:all /REPORT:"structure-geometry|result-forces"
"C:\Program Files\Matrix\MatrixFrame 2027\Bin\MxFrameAPI.exe" /LOAD:"C:\Projects\steel-project.mxml" /CALC /RESULT:"member-forces|steel"
"C:\Program Files\Matrix\MatrixFrame 2027\Bin\MxFrameAPI.exe" /LOAD:"C:\Projects\concrete-project.mxml" /CALC /RESULT:"member-forces|concrete"
"C:\Program Files\Matrix\MatrixFrame 2027\Bin\MxFrameAPI.exe" /LOAD:"C:\Projects\timber-project.mxml" /CALC /RESULT:"member-forces|timber|json"The files are written next to the project: simple-project.results.xml and simple-project.report.pdf for the first example.
Result flags
/RESULT without flags writes nodal-forces|member-forces|nodal-displacements|member-deflections|support-reactions|envelopes.
| Flag | Writes |
|---|---|
nodal-forces | Nodal forces |
member-forces | Member forces |
nodal-displacements | Nodal displacements |
member-deflections | Member deflections |
support-reactions | Support reactions |
force-cuts | Forces in the member cuts |
displ-cuts | Displacements in the member cuts |
envelopes | Envelopes |
polynoms | Polynomials |
stresses | Stresses |
concrete | Concrete code check (in the XML file only) |
steel | Steel code check |
timber | Timber code check |
all | Everything; can be combined with json |
json | Writes <project>.results.json instead of XML |
The flags are described in more detail on Results output flags. The code check data, which the versions up to 2026 write with the switches /CONCRETE, /STEEL and /TIMBER, is asked for with the result flags concrete, steel and timber since 2027.
Report items
/REPORTLIST prints the items of the installed version:
| Item | Chapter |
|---|---|
structure-info | Structure info |
structure-geometry | Geometry |
structure-sections | Sections |
restraints | Restraints |
structure-fnlconcrete | FNL concrete |
loads | Loads |
result-analysis | Analysis |
result-envelopes | Envelope |
result-forces | Forces |
result-reactions | Support reactions |
result-displacements | Nodal displacements |
result-deflections | Deflections |
result-soilpressure | Soil pressure |
result-stresses | Stresses |
result-fnl | FNL results |
result-dynamic | Dynamic analysis results |
result-stability | F-euler analysis results |
cc-steel | Steel code check |
cc-jc-steel | Steel joint connections |
cc-timber | Timber code check |
cc-telecom | Telecom |
cc-concrete | Concrete code check |
tools | Tools |
MxTools API
MxToolsAPI.exe does two things:
- it calculates documents from input files and writes each answer as JSON;
- it writes the reports of a MatrixTools project that was made in MatrixTools.
| Switch | Description |
|---|---|
/DATA:"<path>" | Calculates one input file (JSON or YAML) and writes the answer. |
/LOAD:"<path>" | Loads a MatrixTools project (*.mxft or *.mxtml). |
/REPORT | With /LOAD: writes the report of every document of the project to <project>.<document id>.report.pdf. |
/SAVE:"<path>" | With /LOAD: saves the loaded project, as *.mxft or *.mxtml. |
/OUTPUT:CONSOLE | Prints the answer instead of writing it to a file. |
/SETTINGS:"<path>" | Design code and language to use instead of those of MatrixTools: a file, or the settings text itself. |
Calculate documents from input files
/DATA calculates one input file:
"C:\Program Files\Matrix\MatrixFrame 2027\Bin\MxToolsAPI.exe" /DATA:"C:\Projects\mxtools.steel.cross.input.json"This writes the answer to mxtools.steel.cross.input.results.json next to the input file; the answer of a YAML input file gets the extension of that file. With /OUTPUT:CONSOLE the answer is printed instead.
Since 2027 the program ends with exit code 0 when the run succeeded and with exit code 1 when it failed, for example when the input file is not found or cannot be calculated.
The input file: JSON or YAML
An input file is written in JSON or in YAML. Both hold the same data, so use the one that suits you: JSON is the easiest to write from software, YAML is easier to read and to type and it can hold comments. The file has two parts:
headerwithtid, the document type (see the table below);datawithdoc, the input of the document.
Forces are in N, moments in Nm and lengths in m.
YAML
# one of (SERIES SECTION) or both must be provided.
# if SECTION is found then always single section will be calculated.
# otherwise all sections in series will be calculated.
header:
tid: 3000
data:
doc:
series: CLS
section: CLS 38 x 64
material: C30 # required
serviceClass: 1 # required. Valid values: 1, 2, 3
loadingClass: long # required. Timber.yml -> loadingClass
Mx: 500 # Nm, optional
My: 5000 # Nm, optional
Mz: 1000 # Nm, optional
Nx: -10000 # N, optional
Vy: 5000 # N, optional
Vz: 12000 # N, optionalJSON
{
"header": {
"tid": 3000
},
"data": {
"doc": {
"series": "CLS",
"section": "CLS 38 x 64",
"material": "C30",
"serviceClass": 1,
"loadingClass": "long",
"Mx": 500,
"My": 5000,
"Mz": 1000,
"Nx": -10000,
"Vy": 5000,
"Vz": 12000
}
}
}The comments in the YAML examples tell for every value whether it is required and what it may be. Where a comment names a list, such as Timber.yml -> loadingClass, that list is in the folder %ProgramData%\Matrix\MatrixFrame\2027\Interoperability\Library. The same samples are installed in %ProgramData%\Matrix\MatrixFrame\2027\Interoperability\Samples\MatrixTools.
The answer
The answer is always JSON, in UTF-8. output holds the results of the document, time the calculation time in seconds:
{
"output": [
{
"section": "CLS 38 x 64",
"reference": "NEN-EN1995-1-1 (6.19)",
"uc": 12.328179839268198,
"checkOk": false
}
],
"version": "1.0",
"time": 0.0005559
}When the input cannot be calculated the answer has no output; it has an error instead:
{
"version": "1.0",
"error": {
"id": 1004,
"message": "wrong input data"
},
"time": 0.0005
}| Id | Message | Meaning |
|---|---|---|
| 1001 | failed to parse json | The input file is neither valid JSON nor valid YAML. |
| 1002 | header branch not found | The input has no header. Input files of earlier versions, without header and data, give this answer. |
| 1003 | data branch not found | The input has no data. |
| 1004 | wrong input data | A value in data.doc is missing or not known, for example a section or a material name. |
| 4000 | no implementation for this document type | The document type cannot be calculated from an input file. |
| 4001 | no document type in header | The header has no tid. |
Which values can I use?
For a document type that chooses from lists, an input with aid: data instead of doc answers with those lists, for example the series, sections and materials of a steel cross-section:
header:
tid: 2000
data:
aid: dataDesign code and language
A calculation uses the design code and the language that MatrixTools was last used with on the computer. The texts in an answer, such as warnings, are in that language. /SETTINGS sets both, and MatrixTools keeps them afterwards:
# MatrixTools API settings - pass with /SETTINGS:"mxtools.settings.yaml"
# Without it the console uses the design code and the language MatrixTools was last used with.
settings:
codes: NEN-EN # EN, NEN-EN, NBN-EN, DIN-EN, LST-EN, SS-EN, DS-EN; second generation: 2G-EN, 2G-NEN, 2G-NBN, 2G-DIN, ...
language: US # language of the texts in an answer: US, NL, DE, LTDocument types and examples
These document types can be calculated from an input file. Every example is available as YAML and as JSON, with the answer it gives. All of them in one file: mxtoolsapi-examples.zip.
| Document | Type | Input | Answer | |
|---|---|---|---|---|
| Concrete cross-section M+V+T | 1001 | YAML | JSON | JSON |
| Concrete cross-section, bending resistance MRd | 1002 | YAML | JSON | JSON |
| Concrete cross-section, shear resistance VRd | 1003 | YAML | JSON | JSON |
| Concrete column + fire | 1004 | YAML | JSON | JSON |
| Concrete punching | 1005 | YAML | JSON | JSON |
| Concrete punching, advanced | 1006 | YAML | JSON | JSON |
| Concrete M-N-Kappa diagram | 1010 | YAML | JSON | JSON |
| Concrete juncture | 1013 | YAML | JSON | JSON |
| Steel cross-section | 2000 | YAML | JSON | JSON |
| Steel cross-section: the series, sections and materials to choose from | 2000 | YAML | JSON | JSON |
| Steel section library | 2004 | YAML | JSON | JSON |
| Steel fire protection | 2006 | YAML | JSON | JSON |
| Timber cross-section | 3000 | YAML | JSON | JSON |
| Timber cross-section: the series, sections and materials to choose from | 3000 | YAML | JSON | JSON |
| Strut and tie: deep beam | 8000 | YAML | JSON | JSON |
| Strut and tie: foundation block | 8001 | YAML | JSON | JSON |
| Strut and tie: corbel | 8002 | YAML | JSON | JSON |
| Strut and tie: T-shape | 8003 | YAML | JSON | JSON |
| Strut and tie: half joint | 8004 | YAML | JSON | JSON |
| Strut and tie: beam with a hole | 8005 | YAML | JSON | JSON |
| Strut and tie: column | 8006 | YAML | JSON | JSON |
The examples were calculated with the design code NEN-EN; see mxtools.settings.yaml.
Other document types, for example a timber beam floor, cannot be calculated from an input file. A report is always written from a project file; see the next section.
Write the reports of a MatrixTools project
Every document of a project made in MatrixTools can be written as a report, also the document types that cannot be calculated from an input file, such as the timber beam floors and roofs, the steel and timber columns, masonry and the steel joint connections.
"C:\Program Files\Matrix\MatrixFrame 2027\Bin\MxToolsAPI.exe" /LOAD:"C:\Projects\floor.mxtml" /REPORTThe program writes one PDF for each document of the project:
loading project: C:\Projects\floor.mxtml
report generated to: C:\Projects\floor.1.report.pdf- The project is a
*.mxftor a*.mxtmlfile, as saved by MatrixTools. - A report is named
<project>.<document id>.report.pdfand is written next to the project. An existing file is replaced. - The document id is the id the document has in the project; 0 is a valid id.
- The report is the one that Document print preview shows in MatrixTools: the document is calculated and reported with the report contents chosen in MatrixTools for its document type.
Example: mxtools.project.timber-floor.mxtml, a timber beam floor (document type 3002), gives mxtools.project.timber-floor.1.report.pdf.
The same from your own program
The functions of the console are also available to .NET and COM programs; see API via COM. There CallData takes the text of an input file and returns the answer, and LoadProject followed by MakeReport writes the report of a document of a project.