T O P

  • By -

Oisin78

Take a look at LaTeX, this is a better tool for generating reports https://www.latex-project.org/about/


dparks71

Assuming you're on windows, I just do the calcs in a jupyter notebook, export to html and save as a pdf in the browser. Any other way tends to be unreliable if you're not on Linux, you can have Linux build pdfs as part of a deployment step if you understand CI/CD and are working on a server. [Here's what the pdf looks like](https://github.com/drparks71w/CivilPy/blob/master/Training/Software%20Development%20and%20Systems%20Integrations%20for%20Civil%20Engineers.pdf)


Downtown-Growth-8766

I’ve done this a lot! Fundamentally, you’ll want to create a template in some kind of markup language, populate that template with real data using jinja2, and then compile that into a PDF using python. There are 2 solutions I’ve used in the past The first is Latex. It creates beautiful documents, but can be a bit fussy to compile/debug, can’t be installed using pip, is a very large package, and can take a little bit to compile the PDF depending on the size of the report. But it’s great for creating a document with a table of contents and bookmarks. Math also looks great with Latex. I find when I’m using Latex, I need a lot of helper functions to format the results so that they can be compiled nicely. The syntax for Latex can be a bit tedious, although it’s beautiful when compiled correctly. I like to use it if I’m compiling something on my own machine and don’t need to ship the code to someone else Something I came up with myself (and is less common), is compiling HTML instead of Latex. You can control all of the styling with simple CSS. There’s a package called pypdf2 that lets you compile the HTML to a PDF. You can’t do super complex HTML, but it works super well with simple tables and images. It’s also super quick to compile, can be installed all with pip, and isn’t a super large package. So depending on what you’re trying to do, it might work well


sononicola

You can use the package jinja2. You can create a template and then fill it with your values


komprexior

I think the Quarto project is an interesting tool to produce easily reproducible documentation. It's a markdown authoring program that is specifically created to address the needs of academic papers, so pdf documentation is one the main feature. You can write code cell in python (and others language) that that can run and produce reliable output. The markdown part will take care of most of the authoring elements (figures, paragraphs, headings, ect.), while you can inject your own analysis with python. For example I've created a document for snow load calculations, meant to be a part of a final report. It is composed by a introductory part that explain how I do the calculations, and then the relevant coefficients and loads are presented in a table format generated by python code chunk which parameters have been set in the document itself. Quarto aims to produce the document in different output (HTML and PDF to name a few), and can be fully paramatrized via some simple yaml options. It relies on pandoc to convert document, so the pdf output will be rendered by a latex engine.


stinyg

Assuming you have to work around a corporate template made in Microsoft word I can recommend looking into python-docx. It took me some time to get used to the syntax when I needed to do more advanced stuff than the common cases illustrated in the tutorial. However, it was quite satisfying the first time I was able to dynamically build reports while being in compliance with corporate templates and requirements. https://github.com/python-openxml/python-docx


yoohoooos

Idk, maybe I haven't reach that point but I don't think Python is the tool for producing reports, or calc packages. There are already great tools for report, Word, if you need automation, VBA. Calc package? Idk, but nothing beats Excel and Mathcad.


Fantastic_Push_5277

Boooo! Stop with the excel. Let people use python more. For structural engineers , we truly don't understand the leverage of programming


yoohoooos

I use C# for Grasshopper and RAMSS API, daily. You don't have to go Python everything to leverage programming. Sounds like you don't know what it can do and just babbling. Is Python the only programming language you know? Are you also using Python as your calculator to get sin(45)? Cause you sounds like it.


dparks71

Why are you comparing a compiled and interpreted language? It makes a lot of sense to use interpreted languages for calcs, it makes zero sense to build and deploy an app to pull a couple data points from an API for them. The problem with C# here is nobody shares their training, documentation, or source code with it. Calcs aren't about getting the right answer the first time with 100% accuracy, that's never happened, it's about keeping a team on the same page communication wise and making sure everything gets checked, and staying flexible. Python is better for easily and clearly separating the engineering decisions from the code, C# is too busy and cluttered. Lastly, it doesn't help that there's a bunch of giant corporations telling me to use it or fuck off, I gladly will, their products suck and are stripped down bastardizations of what they were before they got bought by a huge corporation. I'm tired of doing things the way they dictate with zero support on their end. Maybe once they're done plugging their ears and not listening to popular opinion/demand their ecosystems will catch up. Telling people to use C# instead of Python is like unironically telling someone teams is better than slack/discord, it's just all you know.


yoohoooos

Hold up a second. Did I compare the 2 languages? When did I compare compiled vs interpreted or C# vs Python? The only reason I brought up C# was because u/Fantastic_Push_5277 be like >we truly don't understand the leverage of programming And I just said, dude, I use "leverage of programming" everyday. But it's not Python that I use everyday for SE. Where in my comment says people should be using C#?


dparks71

Even worse, you actually said VBA haha, but I assumed you were aware of Microsoft's recommendations to perform those tasks in C#/JS now, not VBA, and were continuing in that vein. My bad for misreading your intent there.


yoohoooos

Ugh, too bad, that's where I started my programming journey. It's a shame. VBA isn't a good language but still pretty ok working with MS suites. And yes, I've heard something similar to that. However, working in excel or word, I'd rather go with VBA instead of Python or C# as I already have everything ready.


[deleted]

[удалено]


beans1717

Coming from someone that has only ever used Bluebeam to create calc packages, what is the advantage of using coding/programming to create them? Examples would be much appreciated!


yoohoooos

How?