Skip to main content

SCIA Engineer

tip

This guide is an informative piece to help you if you have questions about our SCIA Engineer integration. If you would like a more instructive lesson, take a look at the SCIA Engineer tutorial we have available.

New in v14.1.0

Create selections using Model.create_selection()

New in v13.1.0

Several new objects can be constructed:

  • SolverSetup to configure (general) solver settings
  • ProjectData to set basic project information
  • Library cross-sections using Model.create_library_cross_section()
  • Cross-links using Model.create_cross_link()

Supported (tested) SCIA versions:

  • v25
  • v24
  • v23
  • v22
  • v21
  • v20
  • v19

VIKTOR's SCIA integration requires a specific SCIA worker which can be installed using these instructions.

Creating and analyzing a SCIA model in VIKTOR consists of the following steps:

  1. Create the empty model.
  2. Fill the model with the desired parts (e.g. nodes, beams, load cases, forces, etc.), by calling the corresponding create_xxx() methods.
  3. Generate the XML representation of the SCIA model.
  4. Run the SCIA analysis with the generated XML input file and a user-created esa template file.
  5. Obtain the results

In code this looks like:

import viktor as vkt

# 1. Create the empty model
model = vkt.scia.Model()

# 2. Fill the model with the parts (to be extended as desired)
cross_section = model.create_rectangular_cross_section(
'rectangular_section', vkt.scia.Material(455, 'test_material'), 100, 100
)
n1 = model.create_node('n1', 0, 0, 0)
n2 = model.create_node('n2', 1, 0, 0)
model.create_beam(n1, n2, cross_section, name='test_beam')

# 3. Generate the XML input file
xml_file, def_file = model.generate_xml_input()

# 4. Run the SCIA analysis
esa_file = vkt.File.from_path('my_template.esa')
scia_analysis = vkt.scia.SciaAnalysis(xml_file, def_file, esa_file)
scia_analysis.execute(300)

# Obtain the results
analysis_result = scia_analysis.get_xml_output_file()

The ESA template file

The ESA file must be created by the user by using the SCIA interface. It functions as the template to which the model is added. The materials used in the VIKTOR model must exist in the ESA template file: both the name and id of the material must match. The SCIA version in which the template file was created must match the SCIA version called by the worker.

note

An I/O document has to be defined in the .esa file, which has to be named "output". If not defined, the worker will not be able to write this expected document and fails to execute.

Example I/O document of the esa model

Supported parts

Currently, the creation of the following SCIA parts is (fully, or partially) supported in VIKTOR:

Libraries:

Structure:

Results:

Supports:

Sets:

Loads:

Misc.:

Testing

New in v13.3.0

mock_SciaAnalysis decorator for easier testing of SciaAnalysis

Model.generate_xml_input and SciaAnalysis.execute need to be mocked within the context of (automated) testing.

The viktor.testing module provides the mock_SciaAnalysis decorator that facilitate mocking of workers:

import unittest

from viktor import File
from viktor.testing import mock_SciaAnalysis

from app.my_entity_type.controller import MyEntityTypeController

class TestMyEntityTypeController(unittest.TestCase):

@mock_SciaAnalysis(
get_engineering_report=File.from_path('test_file.pdf'),
get_updated_esa_model=File.from_path('test_file.esa'),
get_xml_output_file=File.from_path('test_file.xml'),
)
def test_scia_analysis(self):
MyEntityTypeController().scia_analysis()

For the decorator's input parameters the following holds:

  • If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised.
  • If a single object is provided, the object is returned each time the corresponding method is called (endlessly).
  • If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly).