How to make a SCIA model with Python and VIKTOR

SHARE

Share on facebook
Share on linkedin
Share on twitter
Share on whatsapp
Share on reddit

FOLLOW

scia python
When I started working at VIKTOR as an aerospace engineer, I had little to zero knowledge of how civil structures are designed. During my first year I soon noticed that in such a design process, engineers commonly make use of SCIA Engineer to assess whether the design(s) suffice the requirements. We figured out that SCIA offers an API to create a structural model without having to manually use the interface. Together with my colleagues I created a Python library consisting of specific SCIA objects, which can be used to easily build up a (parametric) model. This model can be exported to XML format which can then be read in SCIA.
Download the white paper and get inspired
Learn about the trends on digital transformation and how to take the next step.

Soon after successfully finishing the application, more projects were lined up for which a SCIA model had to be created. This resulted in a larger and larger Python library, which we at some point included in the VIKTOR SDK, making it publicly available. Moreover, we also developed an integration with SCIA itself, which means that the engineer does not need to open the software at all!

This article presents and discusses the problem(s) that engineers often encounter when constructing a model manually in SCIA. Advantages of a parametric Python model and the reuse of existing code buildingblocks will be discussed as well as how VIKTOR plays a part in this.

Design, model, assess, repeat

A structural design process consists of several or perhaps many design iterations. For each iteration, an engineer has to construct a model and analyse it from which an assessment of the structure can be done. If the structure does not meet the requirements, or if some input has changed, this cycle is repeated and can therefore be very time-consuming. The more manual actions, the greater the risk of errors.

Time and risk can be significantly reduced by automating the above steps. The SCIA binding offered by VIKTOR makes this possible.

Creating the SCIA model with a few lines of Python code

Building SCIA models using the VIKTOR SDK is done by writing object-oriented Python code; no knowledge of the SCIA API is required. All the relevant building blocks can be found in the module viktor.external.scia, of which the starting point is the SciaModel. We will start by creating a new instance of this class, to which we can subsequently add the desired elements (e.g. nodes, cross-sections, beams, supports, loads etc.). The example below shows what this could look like in code:

We often recognise that it is difficult to verify whether the developed code actually builds up the correct SCIA model. That is why we recommend creating a visualization of the model within VIKTOR simultaneously. The visualization is not only helpful for visually verifying the model, it also serves as a very nice design overview for the end user! The method defined above can be used in a generic visualization method as shown below:

By using the geometric VIKTOR building blocks (viktor.geometry module), the elements of the SCIA model can be easily converted to geometric elements and passed to a geometry result. Such a visualization can result in something like this:

Verifying the model in SCIA

It is always useful to manually load the created SCIA model in the SCIA interface, which will help to verify that, for example, all the loads are correctly defined in terms of placement and magnitude.

To visualise the created model in the SCIA interface, the following three files are needed:

  • model file (*.esa)
  • definition file (*.def)
  • input file (*.xml)

The model file can simply be an empty project file. The other two files can be easily generated by calling the method generate_xml_input() on the SciaModel created above. It is probably a good idea to develop a download functionality such that the end user can manually download the input files as well:

The next step is to load the three files into the SCIA interface (File > Update > XML file) and verify the created model.

Analyzing the model from within VIKTOR

In addition to the binding to build up the SCIA model, the viktor.external.scia module also offers an analysis building block (SciaAnalysis) which sends the required input files to the so-called SCIA worker, which runs on a designated (virtual) machine and executes SCIA. When the analysis has been completed, the worker sends the result file back to the web application. The OutputParser (from viktor.external.scia) can be used to easily extract specific results from the result file. The example below shows an example of result processing and associated visualisation.

Conclusion

The SCIA binding developed by VIKTOR allows for an easy conversion between a parametric model, to a meaningful input for SCIA. A VIKTOR worker takes care of a connection between the web application and the software, such that SCIA can be executed from within the browser. After the analysis, the results are returned and can be visualised on top of the model visualization. This means that the manual tasks of constructing a SCIA model in the interface, analysing the model and assessing the results can all be done with a simple click of a button from within the VIKTOR interface!

Written by Kevin Hameeteman

SHARE THIS POST: 

Share on facebook
Share on linkedin
Share on twitter
Share on whatsapp
Share on reddit
Social

Follow us on LinkedIn and stay updated