Skip to main content

FdScript

Since FEM-Design 17.01.001, we support a basic automation workflow through scripting. It is capable to load/save file, execute analysis calculation and create outputs as .csv list or .docx documentation. Using scripting you can batch-analyze models created and execute long calculations during the night.

Concept​

The installation of FEM-Design creates the fdscript.xsd and example.fdscript in the templates folder. The latter can be used as a starting point of custom scripts since it has all the commands intended for users and useful comments on how to proceed.

In order to learn how the .fdscript file is formatted, we will do a step by step inspection of the main part of the file.

fdscript
<?xml version="1.0" encoding="UTF-8"?>
<fdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="fdscript.xsd">
<!-- SCRIPT HEADER ================================================================================== -->
<fdscriptheader>
<title>FEM-Design example script</title>
<version>2100</version>
<module>SFRAME</module>
<!-- log file where warnings from calculation and other interesting entries may appear -->
<logfile>e:\x.log</logfile>
</fdscriptheader>


<!-- command for menu file/open use the filename with extension -->
<cmdopen command="; CXL CS2SHELL OPEN">
<filename>e:\x.struxml</filename>
</cmdopen>


<!-- command for calculation on Analysis tab -->
<cmduser command="; CXL $MODULE RESMODE" />
<cmdcalculation command="; CXL $MODULE CALC">
<analysis
calcCase = "1"
calcCstage = "0"
calcImpf = "0"
calcComb = "1"
calcGmax = "0"
calcStab = "0"
calcFreq = "0"
calcSeis = "0"
calcFootfall = "0"
calcMovingLoad = "0"
calcBedding = "0"
calcThGroundAcc = "0"
calcThExforce = "0"
calcDesign = "0"

elemfine = "1"
diaphragm = "0"
peaksmoothing = "1"
>
<stage ghost = "0" />
<comb
NLEmaxiter = "30"

PLdefloadstep = "20"
PLminloadstep = "2"
PLmaxeqiter = "30"

NLSMohr = "1"
NLSinitloadstep = "10"
NLSminloadstep = "10"
NLSactiveelemratio = "5"
NLSplasticelemratio = "5"

CRloadstep = "20"
CRmaxiter = "30"
CRstifferror = "2"
>
<combitem
ImpfRqd = "0"
StabRqd = "0"

NLE = "0"
PL = "0"
NLS = "0"
Cr = "0"
f2nd = "0"
Im = "0"
Waterlevel = "0"
/>
<freq
Numshapes = "2"
MaxSturm = "0"
X = "1"
Y = "1"
Z = "1"
top = "0.0"
AutoIter = "5"
NormUnit = "0"
/>
<footfall TopOfSubstructure = "-0.01" />
<bedding
Ldcomb = "a"
Meshprep = "0"
Stiff_X = "0.5"
Stiff_Y = "0.5"
/>
</analysis>
</cmdcalculation>


<!-- command for calculation on RC design tab for load combinations, autodesign may be false if reinforcement present in input file -->
<cmduser command="; CXL $MODULE RCDESIGN" />
<cmdcalculation command="; CXL $MODULE CALC">
<design>
<cmax />
<autodesign>true</autodesign>
<check>true</check>
</design>
</cmdcalculation>


<!-- command for calculation on steel design tab, set autodesign to true if needed -->
<cmduser command="; CXL $MODULE STEELDESIGN" />
<cmdcalculation command="; CXL $MODULE CALC">
<design>
<cmax />
<autodesign>false</autodesign>
<check>true</check>
</design>
</cmdcalculation>


<!-- command to generate csv file output as from list panel batch, use proper filenames and "1" if want the checkbox option -->
<cmdlistgen command="$ MODULECOM LISTGEN" bscfile="e:\x.bsc" outfile="e:\x.csv" regional="0" fillcells="0" headers="0" />
<cmdlistgen command="$ MODULECOM LISTGEN" bscfile="e:\y.bsc" outfile="e:\y.csv" regional="0" fillcells="0" headers="0" />
<!-- repeat for additional batches if i.e each has just one table -->


<!-- command to make documentation from doc template -->
<cmdchild>e:\x.dsc</cmdchild>


<!-- command to export documantation to .docx -->
<cmdsavedocx command="$ DOC SAVEDOCX">
<filename>e:\x.docx</filename>
</cmdsavedocx>


<!-- command to save the model, use extension with filename! -->
<cmdsave command="; CXL CS2SHELL SAVE">
<filename>e:\x1.str</filename>
</cmdsave>


<!-- command to quit the program -->
<cmdendsession/>


<!-- END SESSION =================================================================================== -->
</fdscript>
tip

The example script can be edited using notepad but it is more convenient to use a code editor such as Visual Studio Code.

Procedure​

Log file​

Enter the location for the log file that will contain all the information about performed calculations, errors and warnings. Always use absolute path for files.

<fdscriptheader>
<title>FEM-Design example script</title>
<version>2100</version>
<module>SFRAME</module>
<logfile>e:\x.log</logfile>
</fdscriptheader>

Model location​

Enter the location of the model that will be executed by the Run script function. The model can be saved both as .struxml or .str file type.

<cmdopen command="; CXL CS2SHELL OPEN">
<filename>e:\x.struxml</filename>
</cmdopen>

Analysis​

Select the type of analysis calculations that you wish to perform running the script. This is done by typing "1" or "0" next to the corresponding calculation type in the script example, where "1" means to perform that calculations. The listed calculation types exactly correspond to the order of calculations in the Calculation dialog in FEM-Design.

analysis

<cmduser command="; CXL $MODULE RESMODE" />
<cmdcalculation command="; CXL $MODULE CALC">
<analysis
calcCase = "1"
calcCstage = "0"
calcImpf = "0"
calcComb = "1"
calcGmax = "0"
calcStab = "0"
calcFreq = "0"
calcSeis = "0"
calcFootfall = "0"
calcMovingLoad = "0"
calcBedding = "0"
calcThGroundAcc = "0"
calcThExforce = "0"
calcDesign = "0"

elemfine = "1"
diaphragm = "0"
peaksmoothing = "1">
</analysis>
</cmdcalculation>

The example script contains more options to set up calculation parameters, for example details of construction stages analysis, Eigenfrequencies or calculation options for load combinations calculations.

eigen-freq

<freq
Numshapes = "2"
MaxSturm = "0"
X = "1"
Y = "1"
Z = "1"
top = "0.0"
AutoIter = "0"
NormUnit = "0"/>

<footfall TopOfSubstructure = "-0.01" />
</analysis>

Design​

Select whether you want to perform Auto design or Check calculations, by typing "false" or "true" in the corresponding design module part of the script.

<cmduser command="; CXL $MODULE RCDESIGN" />
<cmdcalculation command="; CXL $MODULE CALC">
<design>
<cmax />
<autodesign>true</autodesign>
<check>true</check>
</design>
</cmdcalculation>

<cmduser command="; CXL $MODULE STEELDESIGN" />
<cmdcalculation command="; CXL $MODULE CALC">
<design>
<cmax />
<autodesign>false</autodesign>
<check>true</check>
</design>
</cmdcalculation>

Generate csv output file​

It is possible to generate a csv file from List tables batch. First, select all the tables in List tables dialog in FEM-Design and save it as a batch file (.bsc).

bsc

Then replace the name and location of the batch file (.bsc) and output file (.csv) in the script example.

<cmdlistgen command="$ MODULECOM LISTGEN" bscfile="e:\x.bsc" outfile="e:\x.csv" regional="0" fillcells="0" headers="0" />

Export documentation to .docx file​

It is possible to export documentation in .docx file. Simply replace the name and location of the .docx file in the sample script.

<cmdsavedocx command="$ DOC SAVEDOCX">
<filename>e:\x.docx</filename>
</cmdsavedocx>

Save the model​

The model with documentation and results file will be saved to selected location.

<cmdsave command="; CXL CS2SHELL SAVE">
<filename>e:\x1.str</filename>
</cmdsave>

Launching​

To launch the script use the menu command Tools -> Run script

RunScript

or start the program with the command line:

fd3dstruct /s c:\mydir\example.fdcsript

For example,

C:\Program Files\StruSoft\FEM-Design 18\fd3dstruct.exe  /s C:\Users\xxx\Desktop\MyDir\ExampleScript.fdscript

XML Schema​

The fdscript format comes with an XML Schema that describes this specific XML type. XML Schema