Converting AquaEdit models from the command line (modelconvert)
Last reviewed version: 2.23-betamodelconvert is a command-line tool for converting an AquaEdit model file (.amodel) into the AquaSim solver’s .txt input format, without opening the AquaEdit GUI.
Usage
modelconvert [-all | -group <name> [-index <id>] | -list] [-xml] <input.amodel> [outputDir]
<input.amodel>- required. Path to the model file to convert.[outputDir]- optional. Directory to write the exported.txtfile(s) into. Defaults to the same folder as<input.amodel>. Ignored when-listis used.
A model can contain more than one group of load cases (for example “Normal” and “Directional”), and each group can contain multiple individual load cases. By default, modelconvert exports every load case in the model’s active group. Use the options below to be more specific.
Options
| Option | Description |
|---|---|
-all |
Export the load cases from every group in the model, not just the active one. |
-group <name> |
Export only the load cases from the named group. Matching is case-insensitive. If the name doesn’t match any group, the available group names are printed. |
-index <id> |
Export only the single load case with this id, instead of every load case in the group. The id is taken from -list (see below). Applies to the active group, or to the group given with -group. Cannot be combined with -all. |
-list |
List every group in the model and the id of each load case in it, then exit without exporting anything. Cannot be combined with -all, -group, -index, or -xml. |
-xml |
Also write the AquaSim .xml file that goes with each .txt file exported (node/element/shape metadata used by AquaSim). This is only the numbered XML tied to each individual .txt file - it does not write the extra un-numbered “blank” XML or the .yaml file that the AquaEdit GUI’s export can also produce. |
Output filenames
Exported files are named:
<amodel filename>-<group name>-<id>.txt
<amodel filename>-<group name>-<id>.xml (only with -xml)
For example, converting demo-model.amodel and exporting id 3 from the “Directional” group produces demo-model-Directional-03.txt (and, with -xml, demo-model-Directional-03.xml) in the output directory.
Finding the right group and id
Use -list to see what a model contains before converting it:
modelconvert -list demo-model.amodel
Normal
1: Normal load [Amp = 0.0, T = 1.0, V = 0.0, c = 0.0/0.0]
Directional
1: Directional load[Hs = 0.6, Ts=1.58, WaveH = 0.0, CurrDir= 185.0, Vc=0.28]
2: Directional load[Hs = 0.7, Ts=1.83, WaveH = 45.0, CurrDir= 210.0, Vc=0.5]
Each numbered line is the id to pass to -index when combined with -group.
Examples
Export every load case in the active group, next to the input file:
modelconvert demo-model.amodel
Export every load case in the active group, into a specific folder:
modelconvert demo-model.amodel C:\Exports
Export every load case in every group:
modelconvert -all demo-model.amodel C:\Exports
Export every load case in just the “Directional” group:
modelconvert -group Directional demo-model.amodel C:\Exports
Export a single load case (id 2) from the “Directional” group:
modelconvert -group Directional -index 2 demo-model.amodel C:\Exports
List the groups and load case ids in a model, without exporting anything:
modelconvert -list demo-model.amodel
Export every load case in the active group, along with its AquaSim .xml file:
modelconvert -xml demo-model.amodel C:\Exports
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | Bad usage - missing/invalid arguments or conflicting options. |
| 2 | Input file not found. |
| 3 | The input file could not be imported (not a valid/readable .amodel file). |
| 4 | Nothing was exported - the requested group/id doesn’t exist, has no load cases, or the model has none at all. |
| 5 | Export failed for one of the load cases. |