mcp 接freecad画齿轮

python 复制代码
from mcp.server.fastmcp import FastMCP
import freecad.gears.commands
import os
from freecad import app
from freecad import part
mcp = FastMCP("Demo")

@mcp.tool()
def create_gear(num_teeth=20,height=10,double_helix= True):
     """
     创建一个渐开线齿轮并导出为 STEP 文件。

     参数:
          num_teeth (int): 齿轮的齿数,默认值为 20。
          height (float): 齿轮的高度(厚度),默认值为 10。
          double_helix (bool): 是否启用双螺旋,默认值为 True。
     
     返回:
           savepath:生成的齿轮保存地址。
     """
     app.newDocument()
     gear = freecad.gears.commands.CreateInvoluteGear.create()
     gear.num_teeth = num_teeth
     gear.height = height
     gear.double_helix = double_helix
     app.ActiveDocument.recompute()
     savepath = os.path.join(os.path.dirname(__file__), "gear.step")
     part.export([gear], savepath)
     return savepath



if __name__ == "__main__":
     mcp.run()
 

mcp 接freecad画齿轮_哔哩哔哩_bilibili

相关推荐
一个人旅程~7 天前
如何用命令行把win10/win11设置为长期暂停更新?
linux·windows·经验分享·电脑
Factory_Audit7 天前
亚马逊社会责任验厂审核标准及注意事项
大数据·经验分享
江南小书生7 天前
制造业系统赋能成熟度自测表(实操版)
经验分享·非标制造
三流架构师8 天前
述职报告资源合集
经验分享
徐先生 @_@|||8 天前
时间序列异常检测框架CrossAD论文阅读
经验分享·python·机器学习
LaughingZhu8 天前
Product Hunt 每日热榜 | 2026-02-25
数据库·人工智能·经验分享·神经网络·chatgpt
中屹指纹浏览器8 天前
2026 硬核技术实践:浏览器指纹生成算法与风控逆向对抗
经验分享·笔记
给老吕螺丝8 天前
提升国内访问GitHub稳定性的解决方案:Steamcommunity 302工具详解 (Ver.13.0.05+)
经验分享·github
智者知已应修善业8 天前
【查找指定字符串首位置与数量不区分大小写完整匹配】2025-5-3
c语言·c++·经验分享·笔记·算法
三水不滴8 天前
利用SpringCloud Gateway 重试 + 降级解决第三方接口频繁超时问题,提升性能
经验分享·笔记·后端·spring·spring cloud·gateway