Using VIKTOR to Build a Shareable Truss Calculator App

Using VIKTOR to Build a Shareable Truss Calculator App

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

⏰ 2 h 58 min | 10 lessons
Published: July 2024
4.83
After completing this course, you will...
understand how to convert a Python script into a user-friendly VIKTOR app
be comfortable with the VIKTOR development workflow and paradigms
be able to deploy your app for end-users to interact with
understand enough to be able to build more complex projects independently
PROJECT OVERVIEW

In this project, we’ll 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!

To code along with this project, you'll need a free VIKTOR account. You can sign up here.

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.

🛠 The app we're building

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.

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

In this Python project, we'll work through the complete build process. 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.

Section 2
Building our App
4. Setting up input parameters 📂
23:50
5. Parsing user-provided data 📂
21:18
6. Solving the structure with OpenSeesPy and reporting results 📂
45:29
7. Visualising the structure and its response 📂
24:59
8. Exporting data/results 📂
09:47
Section 3
Deploying our App
9. Understanding workspaces and apps
05:26
10. Deploying, publishing and updating
11:45
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.

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.