Reports

To create a report, obtain a reference to the active report:

# Obtains the script report
report = GetScriptReport()
# Clean to erase previous stored objects
report.clear()

The following methods can be used to set report options:

# Setting report attributes
report.setTitle("CivilFEM Document")
report.setAuthor("YourName")
report.setRevision("1.0")
report.reportAnalysisType(True)
report.reportCodes(True)
report.reportProgramVersion(True)
report.reportDate(True)
report.reportUnits(True)
report.setLogo(r"E:\CivilFEM\program\res\Reports\report_header.png")

Entities

Different objects can be inserted in the report, for example an entities object:

# Creates an entity report
entitiesReport = EntitiesReport("KCoordSystemsContainer")
entitiesReport.setTitle("Coordinate systems")

# Three modes can be used to report an entity (Vertical/Horizontal/List)
# all entities must be of the same type
entitiesReport.addEntity(CoordSystem("Global Cartesian"), "VerticalTable")
entitiesReport.addEntity(CoordSystem("Global Cartesian 2"), "HorizontalTable")
entitiesReport.addEntity(CoordSystem("Global Cartesian 3"), "List")

# Insert the entities object
report.add(entitiesReport)

Images and Pagebreaks

Other objects that can be inserted are images and page breaks:

# Page breaks and image
report.add(PageBreakReport())
report.add(ImageReport(r"E:\LoadCases_16.png"))
report.add(PageBreakReport())

Results

To create result tables, you need to specify the columns to report and set the settings as the following nodal results example:

# Creates a nodal results table
resultsReport = ResultsReport()
resultsReport.addColumn("E:\Load Case 2.rcf", "NodeResult", "UTx", "m")
resultsReport.addColumn("E:\Load Case 2.rcf", "NodeResult", "UTy", "m")
resultsReport.addColumn("E:\Load Case 2.rcf", "NodeResult", "UTz", "m")
resultsReport.setTableTitle("Results table")
resultsReport.setLongNames(True)
resultsReport.setAverage(False)
resultsReport.useAllEntries(True)
report.add(resultsReport)

Selection groups can be used too, to set the rows to print:

# Creates an end results table
resultsReport = ResultsReport()
resultsReport.addColumn("E:\Load Case 2.rcf", "BeamResult", "Fx", "N")
resultsReport.addColumn("E:\Load Case 2.rcf", "BeamResult", "Fy", "N")
resultsReport.setTableTitle("Results table")
resultsReport.setLongNames(True)
resultsReport.setAverage(False)
resultsReport.useAllEntries(False)
resultsReport.addSelectionGroup(SelectionGroup("Group (2)"))
resultsReport.addSelectionGroup(SelectionGroup("Group"))
report.add(resultsReport)

Generation

Finally, the report can be loaded to the window by using the method:

report.loadOnWindow()
report.generateDocX(r"E:\prueba.docx")