Skip to main content

Python wrapper for SAP2000 structural analysis software API with LangChain AI agent support

Project description

PySap2000

PyPI version Python 3.8+ License: MIT

PySap2000 是一个现代化的 SAP2000 结构分析软件 Python API 封装库,提供面向对象的接口和 AI 智能助手功能。

✨ 特性

  • 🏗️ 面向对象设计 - 提供简洁直观的 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!

📧 联系

Project details


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.4.tar.gz (286.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysap2000-2.0.4-py3-none-any.whl (410.5 kB view details)

Uploaded Python 3

File details

Details for the file pysap2000-2.0.4.tar.gz.

File metadata

  • Download URL: pysap2000-2.0.4.tar.gz
  • Upload date:
  • Size: 286.2 kB
  • 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

Hashes for pysap2000-2.0.4.tar.gz
Algorithm Hash digest
SHA256 f1a7f82f77b1092ee013b4b1e8d85e53c8f416b0068f7b3256dd3dd0d6e18634
MD5 417a1299fbe3837a780b9ab8d79567fc
BLAKE2b-256 cd54b6152d2c96402b4e8af35aa184edf9098bc168d86627c0b10e2beb132530

See more details on using hashes here.

File details

Details for the file pysap2000-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: pysap2000-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 410.5 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

Hashes for pysap2000-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3c8c6339ff9217bca4db8f2fe93d8265de59271f5c2d5deba7785ffa203c43a8
MD5 d84cbb627b0df84b8a9cfe90de2a1533
BLAKE2b-256 8d287b51cc8f9519ad18de22b49d57c681dc83c741331d97f57fe04bb94119f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page