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>
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>
Open model​
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.
<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.
<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>
Create design group​
<cmddesgroup command="$ CODE_COM DESGROUP"
name="A" color="0" force="false" type="STBAR">
<GUID>2e290437-e86a-4e36-af7d-acde6a6146c8</GUID>
<GUID>2cba9c00-255d-4258-94fb-f164aafff214</GUID>
</cmddesgroup>
valid types are:
"FNISOLATED", "FNWALL", "FNSLAB", "RCSURFLONG", "RCSURFSHEAR", "RCPUNCH", "STBARSHELL", "STJOINT", "TMBAR", "TMPANEL", "TMPANELCLT", "MS", "COCOLUMN", "CODELTABEAM", "RCBAR", "RCHIDDENBAR", "STBAR", "STFIRE", "TMFIRE", "CLTFIRE"
without force the group must not already exist.
To delete a group use force="true" and empty guid list
All entities must be conforming to the group type.
remember that you must pass analytical entities!
Apply design changes​
<cmduser command="; CXL FEM $CODE(DESCHANGESAPPLY)" />
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).
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" />
Set project description​
<cmdprojdescr command="$ MODULECOM PROJDESCR"
read="0" reset="0"
szProject="t1"
szDescription="t2"
szDesigner="t3"
szSignature="t4"
szComment="t5">
<item id="a" txt="a_txt"/>
<item id="b" txt="b_txt"/>
</cmdprojdescr>
Global configurations​
<cmdglobalcfg command="$ FEM $CODE(GLOBALCFG)">
<soil_calculation
fSoilAsSolid = "0"
/>
<mesh_general
fAdjustToLoads = "0"
/>
<mesh_elements
fElemCalcRegion = "1"
rElemSizeDiv = "6.0"
fCorrectToMinDivNum = "1"
sDefaultDivision = "2"
rDefaultAngle = "15.0"
sDefaultEdgeDivision = "1"
/>
<mesh_functions
fRefineLocally = "1"
sRefineMaxStepNum = "5"
fMaxIterWarning = "0"
fReduceSize = "1"
sSmoothStepNum = "3"
fCheckMeshGeom = "1"
rCheckGeomMinAngle = "10.0"
rCheckGeomMaxAngle = "170.0"
rCheckGeomMaxSideRatio = "8.0"
fCheckMeshOverlap = "1"
fCheckMeshTopology = "1"
/>
<mesh_prepare
fAutoRegen = "1"
fThPeak = "1"
fThBeam = "0"
fThColumn = "1"
fThTruss = "0"
fThFicBeam = "0"
fThFreeEdge = "0"
fThRegionBorder = "0"
fThSuppPt = "1"
fThSuppLn = "0"
fThSuppSf = "0"
fThEdgeConn = "0"
fThConnPt = "0"
fThConnLn = "0"
fThConnSf = "0"
fThLoadPt = "0"
fThLoadLn = "0"
fThLoadSf = "0"
fThFixPt = "0"
fThFixLn = "0"
fAutoRebuild = "1"
fAutoSmooth = "1"
fAutoCheck = "0"
/>
<peaksm_method
sPeakFormFunc_M = "1"
sPeakFormFunc_N = "1"
sPeakFormFunc_V = "1"
/>
<peaksm_auto
fPeakBeam = "0"
fPeakColumn = "1"
fPeakTruss = "0"
fPeakFicBeam = "0"
fPeakPlate = "0"
fPeakWall = "0"
fPeakFicShell = "0"
fPeakSuppPt = "1"
fPeakSuppLn = "0"
fPeakSuppSf = "0"
fPeakConnPt = "0"
fPeakConnLn = "0"
fPeakConnSf = "0"
rPeakFactor = "0.5"
/>
</cmdglobalcfg>
Interaction surface​
<cmdinteractionsurface command="$ CODE_COM INTERACTIONSURFACE" guid="2e290437-e86a-4e36-af7d-acde6a6146c8" offset="0.0" fUlt="false" outfile="e:\res\a.txt" />
Load groups to load combinations​
<cmdldgroup2comb command="$ LOAD LDGROUP2COMB"
fU="true" fUa="true" fUs="true" fSq="true" fSf="true" fSc="true"
fSeisSigned="true" fSeisTorsion="true" fSeisZdir="false"
fSkipMinDL="true" fForceTemp="true" fShortName="true" >
<GUID>2e290437-e86a-4e36-af7d-acde6a6146c8</GUID>
<GUID>2cba9c00-255d-4258-94fb-f164aafff214</GUID>
</cmdldgroup2comb>
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>
End session​
<cmdendsession/>
Launching​
To launch the script use the menu command Tools -> Run script
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