Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make an app for structural calculations? 2

Status
Not open for further replies.

milkshakelake

Structural
Jul 15, 2013
1,116
I'd like to make some mini calculation apps for my own purposes. I keep running into calculations that don't have canned solutions on the market, or the canned programs are too limited or complicated. I have no plans at the moment to release these mini apps to the public; I just want to streamline my workflow. I'm a beginner at programming. How do I get started? And is there a simpler tool for what I want to accomplish?

First goal: Calculation for CMU/concrete shear wall that has graphical output. Things like vertical rebar, horizontal rebar, thickness, end rebar, etc should be annotated.

My plan: Some Googling showed that web apps are the modern way to go. I'm looking at React.js at the moment.

Items needed:
1. Graphics are super important. For example, I need to have graphs and sketches/diagrams with annotations. Zooming/panning of graphics would be useful.
2. Save/load file capability.
3. It would be nice, but not necessary, to print the results. This might be hard for a beginner to program.
4. Also nice, but not necessary, is to have formulas look like formulas.

What doesn't work:
1. Excel VBA. It's great for most cases, but making graphical output is hacky and complicated. And it doesn't have things like zooming/panning, which makes it less useful.
2. Programs where I can attach an image and just update the annotation based on calculations. For example, if I do a concrete beam calculation, I want it to show the rebar and depth, not a generic beam with annotations like (5)#7.
 
Replies continue below

Recommended for you

I’m partial but Python with Jupyter Notebook or Python with Flask would be quick ways to get started. For what you describe I’d give it a go in Jupyter first. Python will have the benefit of the various free math libraries. Install with Anaconda, Link, and you won’t really need to configure anything.

React.js would be the way to go if you wanted to web host the calcs but you’ll end up needing to write some of your own higher math functions. Sonofatkins has a react based site I believe hopefully he drops in with an opinion as well.

I'm making a thing: (It's no Kootware and it will probably break but it's alive!)
 
For some learning resources there is a python humble bundle up for another 19hrs, Link

Edit: there is also a general coding cookbook bundle that covers react, javascript, etc., Link

The Harvard CS50 lecture series is also a great learning tool, Link

I'm making a thing: (It's no Kootware and it will probably break but it's alive!)
 
@Celt83 Thanks! I'll definitely go through those. I have some experience with Python so this seems like a good solution, and those links are useful. When you say higher math functions, do you mean something like sine/cosine or integrals, or something else entirely?

Did you use Python to make the tools on your website?
 
This book covers a lot of what you want as well ,it has some good sections on unit testing: Link

SciPy and Numpy are the big ones that bring root finding, matrix operations, gauss qaudrature, etc.

My site is Python with Flask as the web framework. Some of the calcs like the development length and corbel tools are done fully in javascript. With Anaconda installed I believe you should be able to download my site’s github repository and run it locally with flask on your machine, flask will run a development server locally that you can access on your web browser of choice by navigating to either localhost:5000 or the ip address it will display in the command prompt.

I'm making a thing: (It's no Kootware and it will probably break but it's alive!)
 
@Celt83 Those are some great resources! Thanks!

About the Excel Newton Bach tutorials, I've been going through those but ran into limitations. The whole thing is kind of clunky and it's basically all workarounds for something that Excel doesn't wholeheartedly support.

I'll definitely check out your github and get some ideas.
 
I would start with html + css + javascript. You can use the canvas element for diagrams.

That way you don't need to install external runtimes to execute your programs (like python), it runs pretty much anywhere plus you can easily put it on the web in case you want in the future.
 
You might want to look into SMath... it's a mathcad, workalike. I use it for almost any problem that I will run into 2 or 3 times...

Rather than think climate change and the corona virus as science, think of it as the wrath of God. Do you feel any better?

-Dik
 
@eng-erik Thanks, I'll look into that. I know a bit of Javascript; used it to make games. I'm only worried that I might hit some limitations that could matter.

@dik I looked into that but I didn't see that it can do custom generated graphics.
 
I have been playing around with Python and the tkinter library to UI's. Its not the best way to pack something up and ship it out to other users, but it gets the job done for what I need and python is pretty easy to get up and running with.
 
milkshakelake said:
About the Excel Newton Bach tutorials, I've been going through those but ran into limitations. The whole thing is kind of clunky and it's basically all workarounds for something that Excel doesn't wholeheartedly support.

I wouldn't call it workarounds. It's all VBA code calling methods in the Excel object model. I'm sure a lot of things could be tidied up, but all the code is open source :).

Another thing you might like to look at is linking Excel to Python with pyxll or XLwings, which gives access to all the plotting facilities in Python and associated libraries directly from Excel. See for some examples.

Also when browsing links to my "Daily Download" pages, they are approaching 10 years old now, so it's worth doing a search of the site for newer stuff, or browse by catagory.

Doug Jenkins
Interactive Design Services
 
IRstuff - Clicking on the link it downloaded for me just now.

Please let me know if it still isn't working for you.

Update:
Going to the download page at interactiveds.com.au, it displays a message about the link not being available, but that page is a Onedrive link and doesn't link to the actual download folder. If you click on the link in the blog post, that should download the zip file.

Doug Jenkins
Interactive Design Services
 
@IDS I didn't mean that your code is clunky, I mean Excel itself is. But it could just be due to my lack of knowledge of Excel, so I'll dive a bit deeper. And thanks for the tip about linking to Python!
 
I am a novice programmer, but I started tinkering on calcs.app as way to learn React. There are tons of good tutorials out there (for instance, anything by Kent C. Dodd is pretty high quality. Egghead.io is good for short little learning tidbits. Youtube is good for longer full tutorials). My goal was to learn react, rather than to build a calcs tool, so I didn't objectively evaluate alternative options. But there are some neat benefits of React including:
[ul]
[li]dont need to run a server, I can host the app on something like netlify for free and compute results on user's machine rather then sending to a server and paying for it.[/li]
[li]easy state management between the forms and calcs, allowing a dynamic update to the calc without page refreshes[/li]
[li]lots of 3rd party libraries for handling features like analytics, data persistence, user accounts, etc[/li]
[li]everything is javascript. only need to work in 1 programming language[/li]
[/ul]

Graphics are important, but hard. That's why most calcs I've made so far use static images. But you can look at the column design tool for an example of a dynamic svg. If you change the size or number of verts, the image will update at the same time. SVGs work pretty nicely with React because you can control them and manage their state just like any other html element in the react ecosystem. By contract, canvas is just more complex, low-level api, and generally needs a 3rd party library to interact with easily (like three.js). What you are describing seems readily achievable with SVG graphics in React.

Save/load could be simply handled in React by dumping the state to a json file, or more polished by creating user accounts and a database with something like Google's firebase.

Creating printable results is just a matter of using CSS styling rules to change how things look between a regular screen and a print screen. You can see an example on my site where I remove the header bar and only shown the basic calc when you hit ctrl+p.

Pretty formula text can be done using latex rendering like Katex, or Math.js. That's on my roadmap but it was just easier to get started without it.

A piece of general advice is to strip away all fancy features except for the bare minimum required to have a functional tool, then enhance it to the full vision over time. Otherwise, you will roadblock yourself by trying to learn too much at once.

Anyway, if you aren't scared away from React yet, feel free to contact me here or through my calcs.app info shown on the 'Contact' page of the site with any more questions. And if you are interested in collaborating I might be able to add the tool to calcs.app itself with your help (but totally understand if you want to do it on your own instead)



-JA
try [link calcs.app]Calcs.app[/url] and let me know what you think
 
Sonofatkins said:
A piece of general advice is to strip away all fancy features except for the bare minimum required to have a functional tool, then enhance it to the full vision over time. Otherwise, you will roadblock yourself by trying to learn too much at once.
I'm perpetually in this loop, great advice.

For pretty formulas give MathJax a try it was pretty simple to reference in via CDN. Link

I'm making a thing: (It's no Kootware and it will probably break but it's alive!)
 
@Sonofatkins Thanks so much for the thoughtful answer! I've actually bought a bunch of books on Python per Celt83's suggestions and am going through them, and also will get a bit better at VBA. I don't want to overload myself so I'm not going to check out React just yet, but I'll keep that in mind if Python doesn't work out. I'm not really into collaborating just yet since I'm a beginner, but that can be down the line when I have some programming notches in my belt. Time to dive into this new world!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor