首页/文章/ 详情

在VS Code中运行Plaxis Python

11月前浏览2484

1. 引言

在过去,《计算岩土力学》一直使用Spyder编辑和运行Plaixs【Plaxis使用Spyder替换默认编辑器SciTE的方法】,如在【VS Code运行Anaconda虚拟环境下的代码】所示,我们正在把各种应用代码的IDE逐渐转移到VS Code。本文描述了设置Plaxis Python的过程。


2. 连接

基本思路与前述设置相同,即要连接上能运行Plaxis的Pyhon解释器,在默认的搜索框中(Ctrl+Shift+P键)不包括Plaxis的Pyhton,因而需要使用"Enter interpreter path..."指定,找到Plaxis下python.exe的位置选择即可。

最新版的Plaxis改变了Python的保存位置。转到控制台(Command Prompt),如下所示: 

E:\05_Plaxis\VSCodeTest>"c:/ProgramData/Seequent/PLAXIS Python Distribution V2/python/Scripts/activate.bat"

(PLAXIS) E:\05_Plaxis\VSCodeTest>

这显示了VC Code和Plaixs Python进行了连接。

3. 测试

(1) 运行Plaxis使用Spyder替换默认编辑器SciTE的方法】中代码:









line1_g = g_i.line((0, 0), (3, 0))[-1]line2_g = g_i.line((5, 0), (5, 5))[-1]line3_g = g_i.line((0, 8), (3, 4))[-1]
beam1_g = g_i.plate(line1_g)beam2_g = g_i.plate(line2_g)
lines = [b.Parent for b in g_i.Plates]print(g_i.delete(*lines))

(2) 创建plate单元





















g_i.gotostructures()material=['Concrete']first_point=[-10,0]second_point=[10,0]
for i in range(len(material)):    g_i.platemat('Identification',material[i])
platematerials = [mat for mat in g_i.Materials[:] if mat.TypeName.value == 'PlateMat']
plate=g_i.plate(    (first_point[0],first_point[1]),    (second_point[0],second_point[1]),    )plate1=plate[-1]plate2=plate[-2]g_i.posinterface(plate2)g_i.neginterface(plate2)
plate1.setmaterial(platematerials[0])

来源:计算岩土力学
python岩土材料控制PLAXIS
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2023-09-26
最近编辑:11月前
计算岩土力学
传播岩土工程教育理念、工程分析...
获赞 138粉丝 991文章 1776课程 0
点赞
收藏
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈