Updated 3 July 2024
Reading time: 8 mins

Using VIKTOR to Build a Shareable Truss Calculator App - Project Overview

Build a user-friendly analysis web app powered by OpenSeesPy and VIKTOR
[object Object]
by Dr Seán Carroll

In this article, we’ll discuss how you can use the VIKTOR platform to build a 2D truss analysis app that can be easily shared and used in the browser. This means the end user doesn’t need to download or install anything and doesn’t even need to know Python!

Here, we’ll discuss why you might want to build a no-code app and we’ll briefly summarise the process and outline the main steps involved. The complete build-along tutorial is too big for a single article, so I’ve turned it into a free Python Project 👇

Using VIKTOR to Build a Shareable Truss Calculator App

Build a user-friendly analysis web app powered by OpenSeesPy and VIKTOR

After completing this project...

  • You will understand how to convert a Python script into a user-friendly VIKTOR app
  • You will be comfortable with the VIKTOR development workflow and paradigms
  • You will be able to deploy your app for end-users to interact with
  • You will understand enough to be able to build more complex projects independently

Simply log in to your EngineeringSkills account to get started (and download the final project code). If you don’t have an EngineeringSkills account yet, you can create one here. You'll also need a free VIKTOR account to follow along and build your own apps.

Create a free VIKTOR account to code along - you can sign up here.

🛠 The app we're building

We’ll base our VIKTOR app on the 2D truss analysis script we built previously using OpenSeesPy. If you’re new to OpenSeesPy, I suggest checking that tutorial out first before diving into this one.

Here’s the app we’re going to build…have a look around or run an analysis! Start with the Data Input tab. You can see that's I've embedded it directly into this webpage (using an iframe - super handy if you're a web developer), but you can also visit the app directly here.

To get a better sense of exactly what we’ll be building and how it works, take a look at the project walkthrough video below 👇

Start here but build your own app next!

You should work through this project with me to get up and running with VIKTOR, but then I strongly recommend building an app around your own needs. Do you have a janky spreadsheet that you rely on or a spaghetti script you’ve been meaning to refactor? Why not convert it into an app?

You’ll learn so much more by building something that’s useful to you! So, think of this project as a quick way to cover the basics with VIKTOR - a primer that will leave you ready to strike out on your own.

Truss analysis is not the point!

We’re building a pretty simple 2D truss analysis app here. Don’t be put off by the simplicity of the underlying project. It’s just a vehicle allowing us to work through some core concepts. Ultimately, you can apply what you learn here to build far more complicated analysis and design apps.

After completing this tutorial project, you will:

  • understand how to convert a Python script into a user-friendly VIKTOR app
  • be comfortable with the VIKTOR development workflow and paradigms
  • know how to handle data import and export in your app
  • be able to deploy your app for end-users to interact with
  • understand enough to be able to build more complex projects independently

Why build a no-code web app version of your script?

If you’re an engineer reading this, you’re probably pretty comfortable working with scripts in Python. However, developing analyses and designs is only one part of the engineer’s job - we must also communicate our work effectively to others. This can be much easier if your work isn’t buried behind code.

Providing colleagues or end-users with an easy and approachable way to interact with your analysis can help them understand what it’s trying to tell them. A no-code app can help by allowing you to hide the implementation details and only surface the key inputs and outputs.

Packaging your analyses into a more digestible and easy to interact with toolbox also means your colleagues can take advantage of whatever tool you’ve built. This is one of the strengths of a web app with a clean UI - non-coders can use it without needing to download and install (or learn!) Python.

So, in this project, the aim is not to convince you that a VIKTOR app replaces your need to script in raw Python. Instead, the aim is to show you that when you want to bring your work to a wider audience, mapping your analysis to a VIKTOR app is an effective and relatively straightforward option.

What is VIKTOR?

If you haven’t come across VIKTOR.ai before, it’s a platform that allows you to build and host browser-based apps. The platform is optimised for engineering analysis like the app we're building but you can build pretty much any app, finance, project management, math/science-focused apps - it’s up to you. The platform is discipline-agnostic, although you’ll find a lot of Architecture, Engineering and Construction (AEC) apps in their app gallery.

To work with VIKTOR, we need to develop using their Software Development Kit (SDK) and familiarise ourselves with some VIKTOR development paradigms, which we’ll cover as we hit them in our project build. If you’re comfortable with basic Python - none of this will be a problem for you. VIKTOR also have some really good docs which makes life alot easier!

Building and deploying the app

We'll work through the complete build process over in the Python Project. Although this is a pretty simple project build - we’re going to cover a lot of ground - so here’s the roadmap.

Setting up our development environment

We'll start by setting up a cloud-based development environment using Github Codespaces. This is a simple process and doesn't require any downloads or local installs.

Initialising our app and understanding the structure of a VIKTOR app

With our development environment set up, we'll initialise a new VIKTOR app using the VIKTOR Command Line Interface or CLI. This will give us a boilerplate app that we can start editing. We'll poke around the boilerplate and discuss the basic structure of a VIKTOR app and how the app.py file is used to define the layout and logic of the app.

The structure of our truss analysis app

Then we'll discuss how we're going to structure the code in our truss analysis app.

Setting up input parameters and app layout

Next, we'll define the input parameters for our app and establish an intuitive layout to make it easy for users to navigate and interact with.

Converting our OpenSeesPy script

The brains behind our app is the OpenSeesPy script we built previously. Our next task will be to port this script over to our app and make sure the dependenices are in place.

Data visualisation

Once the analysis code is working as expected, we'll add some data visualisation to help users understand the results of their analysis. This will involve setting up plots and tables to display the output data.

Exporting results

We'll add the ability for users to export the results of their analysis. This will allow them to save the data to their local machine for further analysis or reporting.

Deploying and sharing the app

Finally, we'll deploy our app to the VIKTOR platform and make it available for others to use. We'll discuss how to share the app with colleagues and how to manage updates and changes.

Conclusion

So, that’s the plan! This project will give you a good grounding in the VIKTOR development platform and show you how to convert a Python script into a user-friendly app.

Hopefully you can see the potential for building your own apps. We're covering a lot of building blocks in this project, so you should be well-placed to start building your own apps after completing it.

getting-started
Dr Seán Carroll
BEng (Hons), MSc, PhD, CEng MIEI, FHEA
Hi, I’m Seán, the founder of EngineeringSkills.com (formerly DegreeTutors.com). I hope you found this tutorial helpful. After spending 10 years as a university lecturer in structural engineering, I started this site to help more people understand engineering and get as much enjoyment from studying it as I do. Feel free to get in touch or follow me on any of the social accounts.

Dr Seán Carroll's latest courses.

Analytical Modelling of Plate and Shell Structures: Part 2 - Shells

Analytical Modelling of Plate and Shell Structures: Part 2 - Shells

Unlocking the Fundamentals of Shell Behaviour with Analytical Modelling and Membrane Theory

Analytical Modelling of Plate and Shell Structures: Part 1 - Plates

Analytical Modelling of Plate and Shell Structures: Part 1 - Plates

A practical guide to the analysis of circular and rectangular plates under load, from first principles.

Fundamentals of Reinforced Concrete Design to Eurocode 2

Fundamentals of Reinforced Concrete Design to Eurocode 2

An introduction to ultimate limit state design for bending and shear with optional calculation automation using Python.

Modelling and Analysis of Non-linear Cablenet Structures using Python and Blender

Modelling and Analysis of Non-linear Cablenet Structures using Python and Blender

Learn how to combine parametric modelling, exploratory form-finding and iterative analysis techniques to simulate 3D tensile structures.


Do you have some knowledge or expertise you'd like to share with the EngineeringSkills community?
Check out our guest writer programme - we pay for every article we publish.

Featured Tutorials and Guides

If you found this tutorial helpful, you might enjoy some of these other tutorials.