MCP ExplorerExplorer

Mcp Catia

@chenlei-ghon a year ago
5 MIT
FreeCommunity
AI Systems
# CATIA MCP Service A CATIA automation service based on `pycatia`, providing a REST API interface for remote control and operation of CATIA. ## Main Features - Document operations (create, open, save) - Geometry operations (points, lines, surfaces) - Sketch and feature operations - Assembly operations - Measurement and analysis - Engineering drawing operations

Overview

What is Mcp Catia

mcp-catia_ is an automation service for CATIA based on ‘pycatia’, providing a complete REST API interface for remote control and operation of CATIA software.

Use cases

Use cases include automating document operations (creating, opening, saving), performing geometric operations (creating points, lines, planes), conducting measurements and analyses, and generating engineering drawings.

How to use

To use mcp-catia_, clone the repository, set up a virtual environment, install dependencies, configure environment variables, and run the service. You can then interact with the API to perform various CATIA operations.

Key features

Key features include complete CATIA operation API support, RESTful API design, JWT authentication, cross-origin support, comprehensive logging, type hinting support, and exception handling mechanisms.

Where to use

mcp-catia_ can be used in fields such as mechanical engineering, product design, and any domain requiring CAD modeling and automation of design processes.

Content

CATIA MCP服务

这是一个基于pycatia的CATIA自动化服务,提供了完整的REST API接口,用于远程控制和操作CATIA。

功能特点

  • 完整的CATIA操作API支持
  • RESTful API设计
  • JWT认证保护
  • 跨域支持
  • 完整的日志记录
  • 类型提示支持
  • 异常处理机制

支持的功能

1. 文档操作

  • 创建新文档(Part/Product/Drawing)
  • 打开文档
  • 保存文档
  • 关闭文档

2. 参数操作

  • 获取参数列表
  • 设置参数值

3. 几何操作

  • 创建点
  • 创建线
  • 创建平面

4. 草图操作

  • 创建草图
  • 添加线条
  • 添加圆形

5. 特征操作

  • 创建凸台
  • 创建凹槽
  • 创建旋转体

6. 装配操作

  • 添加组件
  • 创建约束

7. 测量操作

  • 测量距离
  • 测量角度
  • 测量面积
  • 测量体积

8. 分析操作

  • 质量分析
  • 干涉检查

9. 工程图操作

  • 创建视图
  • 添加尺寸

10. 系统操作

  • 获取系统信息

安装要求

  • Python 3.8+
  • CATIA V5/V6
  • pycatia 0.8.2+
  • 其他依赖见requirements.txt

安装步骤

  1. 克隆仓库:
git clone [repository_url]
cd catia-mcp-service
  1. 创建虚拟环境:
python -m venv venv
source venv/bin/activate  # Linux/Mac
# 或
venv\Scripts\activate  # Windows
  1. 安装依赖:
pip install -r requirements.txt
  1. 配置环境变量:
  • 复制.env.example.env
  • 修改配置参数

运行服务

python catia_mcp_service.py

服务将在 http://localhost:5000 启动

API使用示例

1. 连接CATIA

import requests

# 获取JWT令牌
response = requests.post('http://localhost:5000/api/catia/connect', 
                        headers={'Authorization': f'Bearer {token}'})

2. 创建新文档

response = requests.post('http://localhost:5000/api/catia/document',
                        json={
                            'operation': 'create',
                            'doc_type': 'Part'
                        },
                        headers={'Authorization': f'Bearer {token}'})

3. 创建几何体

# 创建点
response = requests.post('http://localhost:5000/api/catia/geometry',
                        json={
                            'operation': 'point',
                            'x': 0,
                            'y': 0,
                            'z': 0
                        },
                        headers={'Authorization': f'Bearer {token}'})

API文档

认证

所有API请求都需要在header中包含JWT令牌:

Authorization: Bearer <token>

主要端点

  1. 连接CATIA
  • POST /api/catia/connect
  1. 文档操作
  • POST /api/catia/document
    • operation: open/save/create/close
  1. 参数操作
  • GET /api/catia/parameters
  • POST /api/catia/parameters
  1. 几何操作
  • POST /api/catia/geometry
    • operation: point/line/plane
  1. 草图操作
  • POST /api/catia/sketch
    • operation: create/add_line/add_circle
  1. 特征操作
  • POST /api/catia/feature
    • operation: pad/pocket/revolution
  1. 装配操作
  • POST /api/catia/assembly
    • operation: add_component/create_constraint
  1. 测量操作
  • POST /api/catia/measure
    • operation: distance/angle/area/volume
  1. 分析操作
  • POST /api/catia/analysis
    • operation: mass/interference
  1. 工程图操作
  • POST /api/catia/drawing
    • operation: create_view/add_dimension
  1. 系统操作
  • GET /api/catia/system

错误处理

所有API响应都遵循以下格式:

日志

服务运行日志保存在catia_mcp.log文件中,包含以下信息:

  • 时间戳
  • 日志级别
  • 模块名
  • 消息内容

注意事项

  1. 确保CATIA已正确安装并可以正常运行
  2. 使用前请先获取JWT令牌
  3. 所有API调用都需要包含认证信息
  4. 注意处理API返回的错误信息

贡献指南

  1. Fork项目
  2. 创建特性分支
  3. 提交更改
  4. 推送到分支
  5. 创建Pull Request

许可证

MIT License

联系方式

如有问题,请提交Issue或联系维护者。

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers