1. Awatif
  2. User Interface

Awatif User Interface

Building an interactive web app from scratch is a challenging task. awatif-ui takes care of all the boilerplate and infrastructure, allowing you to focus on the logic of your app. It is based on a simple concept: exposing parameters that you want the user to interact with, and at each parameter change, rerunning the script or algorithm for modeling, analysis, design, and reporting of your structure.

For Structural Engineers

Components for visualizing engineering results & reports.

Open source

Full control of behavior and looks

Extensible

Built on Three.js library for drawing complex geometry

Installation

npm install awatif-ui

Usage

import { Node, Element, AnalysisInput } from "awatif-data-structure";
import { app, Parameters, Model } from "awatif-ui";
import { analyze } from "awatif-fem";

const parameters: Parameters = {
  xPosition: { value: 12, min: 1, max: 20 },
  zPosition: { value: 0, min: 1, max: 10 },
};

function onParameterChange(parameters: Parameters): Model {
  const nodes: Node[] = [
    [5, 0, 0],
    [parameters.xPosition.value, 0, parameters.zPosition.value],
    [5, 0, 8],
  ];
  const elements: Element[] = [
    [0, 1],
    [1, 2],
  ];

  const analysisInputs: AnalysisInputs = {
    materials: new Map(),
    sections: new Map(),
    pointSupports: new Map(),
    pointLoads: new Map(),
  };

  analysisInputs.materials?.set(0, { elasticity: 200 });
  analysisInputs.sections?.set(0, { area: 1.2 });
  analysisInputs.materials?.set(1, { elasticity: 200 });
  analysisInputs.sections?.set(1, { area: 1.2 });
  analysisInputs.pointSupports?.set(0, [true, true, true, true, true, true]);
  analysisInputs.pointSupports?.set(2, [true, true, true, true, true, true]);
  analysisInputs.pointLoads?.set(1, [0, 0, -10, 0, 0, 0]);

  const analysisOutputs = analyze(nodes, elements, analysisInputs);

  return { nodes, elements, analysisInputs, analysisOutputs };
}

app({
  parameters,
  onParameterChange,
});

Examples

  1. Bars - view - source code
  2. Beams - view - source code
  3. More Examples

When you toggle the bending moment setting located at the top-left corner, you should see this:

portal-frame bending moment

API Reference

source code