Python wrapper for SAP2000 structural analysis software API with LangChain AI agent support
Project description
PySap2000
PySap2000 是一个现代化的 SAP2000 结构分析软件 Python API 封装库,提供面向对象的接口和 AI 智能助手功能。
✨ 特性
- 🏗️ 面向对象设计 - 参考 dlubal.api 设计模式,提供简洁直观的 API
- 🤖 AI 智能助手 - 集成 LangChain Agent,支持自然语言控制 SAP2000
- 📊 完整功能覆盖 - 支持建模、分析、设计、结果提取等全流程
- 🔒 安全操作 - 修改操作需确认,支持撤回功能
- 📚 RAG 知识库 - 内置 SAP2000 API 文档搜索
📦 安装
基础安装
pip install pysap2000
安装 AI Agent 功能
pip install pysap2000[agent]
安装全部功能
pip install pysap2000[all]
🚀 快速开始
基础用法
from PySap2000 import Application
from PySap2000.structure_core import Point, Frame
from PySap2000.global_parameters import Units, UnitSystem
# 连接 SAP2000
with Application() as app:
# 设置单位
Units.set_present_units(app.model, UnitSystem.KN_M_C)
# 创建节点
app.create_object(Point(no=1, x=0, y=0, z=0))
app.create_object(Point(no=2, x=10, y=0, z=0))
# 创建框架
app.create_object(Frame(no=1, start_point=1, end_point=2, section="W14X30"))
# 运行分析
app.calculate()
AI 智能助手
from PySap2000.langchain_agent import SapAgent
# 创建 Agent(需要设置 DASHSCOPE_API_KEY 环境变量)
agent = SapAgent(provider="qwen")
# 自然语言控制
response = agent.chat("显示模型中所有杆件的截面信息")
print(response)
response = agent.chat("把上弦杆组的截面改成 H400x200x8x12")
# Agent 会请求确认后执行修改
📖 功能模块
| 模块 | 功能 |
|---|---|
Application |
SAP2000 连接和模型管理 |
structure_core |
Point, Frame, Material, Section |
loading |
LoadPattern, LoadCombination |
loads |
PointLoad, FrameDistributedLoad |
results |
PointResults, FrameResults |
design |
SteelDesign, ConcreteDesign |
langchain_agent |
AI 智能助手 |
⚙️ 环境要求
- 操作系统: Windows(SAP2000 仅支持 Windows)
- Python: 3.8+
- SAP2000: v19.0+ (需要已安装并激活)
🔑 AI Agent 配置
支持多种 LLM 提供商:
# 通义千问(推荐)
agent = SapAgent(provider="qwen") # 需要 DASHSCOPE_API_KEY
# DeepSeek
agent = SapAgent(provider="deepseek") # 需要 DEEPSEEK_API_KEY
# OpenAI
agent = SapAgent(provider="openai") # 需要 OPENAI_API_KEY
📄 许可证
MIT License - 详见 LICENSE
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📧 联系
- 作者: jiangyao
- 邮箱: 631488424@qq.com
- GitHub: pysap2000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysap2000-2.0.0.tar.gz
(1.0 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pysap2000-2.0.0-py3-none-any.whl
(410.4 kB
view details)
File details
Details for the file pysap2000-2.0.0.tar.gz.
File metadata
- Download URL: pysap2000-2.0.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d66fca5268bb6b710ec671cf325a124692234458f518978b23ab035e6899b7c1
|
|
| MD5 |
b01e911b9afaa619df1771317de2ac42
|
|
| BLAKE2b-256 |
90a1e3bbb2fe7e5e141e30482a2977bd80f76045b3b4cdd0ec8a91c6f7542f2f
|
File details
Details for the file pysap2000-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pysap2000-2.0.0-py3-none-any.whl
- Upload date:
- Size: 410.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57d5958a266c592d1a7cd410ac5b536cc5e9617b620e638496625e93d31b6b5c
|
|
| MD5 |
3a361bf77abb82fb8a16c95bd8f211e6
|
|
| BLAKE2b-256 |
22ebc0d1573349400c8416d55e2405293935a6ce77320bf5f1651828694d3283
|