谢谢广大亲们的关注及转发分享,离粉丝突破10000人还差9518人,哈。由于没有到各大行业群到处分享所以还是蛮感激关注本号的朋友和同事们。主要是觉得知识就在这里,好东西大家自然会去分享,没必要打扰到对此不感兴趣的朋友,同时我也没想让写文成为负担之一。但实话实说,粉丝多了,写的欲望便会强烈一些。上一期我介绍了一名结构工程师学习Python的心路历程,通过一些个人经验浅谈python的学习之路,当然每个人的学习之路都要自己去思考,更可贵的应该是说关注和坚持。花花世界,分散我们注意力的事情太多。
上一篇可能勾起了很多朋友学习Python的热情,但可能大部分人都会一直在print(“hello world“)等简单应用阶段,就好像之前背四六级单词表,每一次热血上头的时候就会翻看一遍,这是一件反讽的事情:当时唯一坚持去记单词,记住的只有单词本第一页的”abandon”(放弃)。当然也有一些高手,在学习Python从YJK数据库读取荷载工况信息后,举一反三写了转换yjk模型至abaqus程序的接口。
专注去做一件事,专注我们的行业。此处要替我们行业说句公道话,知乎上一片唱衰我们行业的,偶尔同行群里也有悲观的声音。其实我们的行业只是没有之前那么粗放式发展了,现在甲方要求更多,设计人员工作量更大,设计费却没有涨,所以相对来说我们的行业是有所萎缩的,但是随着一线城市旧改以及后续城市化发展加速,我们设计行业也还算可以的,靠技术可以求小康的,如果要想暴富那估计还是得求买彩票中一等奖了,而我们也应该多一些积极主动和正能量。其实开始学习Python之前,我们还真的必须想一想,在结构分析设计这个行当,Python真正能帮我们做哪些事情,有哪些工作可以让Python去干,我们要根据我们的需求去学。
当然可能有些人要提python人工智能出图这个概念,其实这离我们的日常还有一些遥远。据我所知,现有程序目前还没法代替人工,人工智能要获得自主意识抢夺我们的工作岗位可能还只存在科幻片里了。那我就简单说说Python能做哪些具体的工作吧,欢迎大家留言补充。
| 序号 | 结构设计有哪些事情可以让python做? |
---|---|---|
1 | 采用python可以实现ABAQUS参数化建模。ABAQUS支持Python脚本语言,也可以编写后处理及开发abaqus gui界面; | |
————————– | ———————————————————— | |
2 | 用python编写Grasshopper建模及算法的电池。Rhino+Grasshopper的支持脚本语言gpython,python在GH中进行可视化编程。软件有相关的帮助文档可以查看。 | |
3 | python采用ctype调用sap2000 和ETABS 的OAPI进行建模及分析前后处理。具体可以参考下其OPAI帮助文档中的实例和函数。非解构公众号最近有gh连接sap2000的视频介绍。我后续也会有一些相关的开发和分享。 | |
4 | python第三方包openssepy,在python中可以使用opensees,并且支持Matplotlib绘图。为开源的opensees在python中的拓展。网站链接:https://openseespydoc.readthedocs.io/en/latest/ | |
5 | python读取截面求解器XTRACT二进制文件,并输出到text中。已将此程序嵌入我司超限分析平台,大家可以观看视频号structurevspoem(与公众号同名),有此软件完全不用人工数据处理及绘图。 | |
6 | python求解地震波反应谱曲线,生成人工波曲线,修改波曲线。终于可以甩开matlab复杂的安装包了,放心用python吧。最近用c++写了一个读取地震波生成谱并绘图的工具,稍后文章再分享实用工具。可以查看下崔博士网站,吴博士及非解构等公众号上也有相关反应谱的介绍。 | |
7 | python采用sqlite3数据库,读取yjk和pkpm模型数据库及进行模型转换。目前已实现yjk转opensees tcl的几何模型转换及显示。可以参考下博文 | |
8 | python读取yjk文本结果或ETABS的mdb数据库,并存入excel中。这个应该最简单了,只需要知道正则表达式及python字符串处理以及xlsxwriter包的函数就可以了。我前期写的一些小震中震数据处理程序就是这个应用,但现在改成C++来写了,效率会更高一些,但python确实是在我没掌握C++之前最好的处理工具了。 | |
9 | python写一个生成xtract模型.xpj的程序,其实xtract模型为文本文件,按照固定的格式排列数据(具体可以搜我新浪博客有一些相关介绍),可以生成各种复杂的型钢混凝土柱截面。 | |
10 | python进行常用的计算软件模型转换,例如sap2000的s2k,etabs的e2k及midas gen的mgt,abaqus的等文本格式,都是按照固定规律排列,大概就是节点,单元,材料,附加质量,节点荷载,线荷载,面荷载等区块。Python是处理字符串最好的软件,转换这些文本文件的效率也挺高。 |
当然python还有很多 ,限于为给大家留更多思考空间,不全部写出,大家可以留言写下自己的应用或者设想也可以,不怕实现不了就怕想不到。当然有人要说爬虫和词云生成,编写机器人跟自己聊天啥的,这些都不在本行业的范围了。
大家有什么提高工作效率的方法也可以在此分享或电邮至idealzeng@qq.com。如果你觉得对你有所启发和激励,可以点击”在看”或转发给你熟悉的朋友。如果有想来我司工作,或想交流学习和想探讨下人生的朋友,也可以直接发简历给至我邮箱。
Thank you all for your attention and sharing! We are still 9,518 followers away from reaching 10,000. Since I haven’t actively promoted this account in various industry groups, I’m genuinely grateful to those who follow and support this account. I believe knowledge should be shared naturally, and there’s no need to disturb those uninterested. Meanwhile, I don’t want writing to become a burden. Frankly, more followers do motivate me to write more.
In the previous article A Structural Engineer’s Journey Learning Python, I shared personal experiences about learning Python. Everyone must find their own learning path through reflection. Persistence is crucial in this distracting world where countless things compete for our attention.
The previous article might have sparked enthusiasm for learning Python among many friends, but most might still linger at the print("hello world")
stage. Like reviewing English vocabulary books before exams, we often revisit the first page containing “abandon” (the first word in dictionaries, meaning “to give up”). However, some experts have successfully developed tools like converting YJK models to Abaqus interfaces after learning Extracting Load Case Information from YJK Database Using Python.
Focus on one task and our industry. Let me defend our field: while Zhihu (Chinese Quora) often criticizes structural engineering, and pessimism occasionally emerges in professional groups, our industry isn’t declining—it’s evolving. Clients demand more while design fees stagnate. However, with urban renewal in Tier-1 cities and accelerated urbanization, technical expertise can still secure a decent living. For wealth accumulation, you’d better rely on winning lotteries. Let’s maintain positivity and proactivity.
Some may mention AI-driven automated drawing with Python, but this remains distant from daily practice. Current programs cannot replace human engineers, and AI achieving consciousness to replace us exists only in sci-fi. Here are practical Python applications in structural engineering:
- ABAQUS Parametric Modeling: ABAQUS supports Python scripts for modeling, post-processing, and GUI development.
- Grasshopper Algorithm Components: Use Python in Rhino+Grasshopper for visual programming. Refer to official documentation.
- SAP2000/ETABS OAPI Integration: Use Python’s
ctypes
to call SAP2000/ETABS APIs for pre/post-processing. See OAPI examples. Non-destructive public account has SAP2000-GH integration videos. - OpenSeesPy: Python interpreter for OpenSees with Matplotlib visualization. Website: https://openseespydoc.readthedocs.io/en/latest/
- XTRACT Binary File Processing: Read XTRACT results into text files. Embedded in our company’s structural analysis platform. Watch videos on WeChat official account “structurevspoem”.
- Seismic Wave Analysis: Generate response spectra, artificial waves, and modify waveforms. C++ tools under development for efficiency.
- YJK/PKPM Database Integration: Use Python’s
sqlite3
to read YJK/PKPM databases and convert models. YJK-to-OpenSees geometry conversion achieved. - Result Data Extraction: Parse YJK text results/ETABS MDB into Excel using regex and
xlsxwriter
. Previously used in small earthquake data processing (now migrated to C++). - XTRACT Model Generation: Create
.xpj
files by formatting text data. See my Sina Blog for details on generating complex steel-concrete column sections. - Model Format Conversion: Convert S2K, E2K, MGT, Abaqus text formats (nodes, elements, materials, loads) using Python’s string processing capabilities.
Python offers endless possibilities—leaving room for your creativity! Share ideas via comments or email (idealzeng@qq.com). If inspired, click “See Original” or share with friends. Interested in job opportunities or technical discussions? Send your resume to my email.