本项目是一个中间件,用于连接Cline与Autodesk Fusion 360。它借助API将Fusion 360的工具栏命令转化为可调用工具,通过自然语言解析实现具体操作,如“创建一个带圆角的盒子”。项目会生成可在Fusion 360中直接运行的Python脚本。
本项目是连接Cline与Autodesk Fusion 360的中间件,借助API将Fusion 360工具栏命令转化为可调用工具,通过自然语言解析实现具体操作,还能生成可在Fusion 360中运行的Python脚本。
pip install -r requirements.txt
python server.py --http
访问http://localhost:5000使用REST API。
将server.py作为Fusion插件运行,通过标准输入输出与插件通信。
以下是脚本生成的示例代码,展示了如何在Fusion 360中创建一个简单的拉伸体:
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
design = app.activeProduct
# 获取当前组件
component = design.rootComponent
# 创建XY平面新草图
sketch = component.sketches.add(component.xYConstructionPlane)
# 绘制矩形
rectangle = sketch.sketchCurves.sketchLines.addTwoPointRectangle(
adsk.core.Point3D.create(0, 0, 0),
adsk.core.Point3D.create(10, 10, 0)
)
# 拉伸操作
prof = sketch.profiles.item(0)
extrude_input = component.features.extrudeFeatures.createInput(prof, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
distance_input = adsk.core.ValueInput.createByReal(5)
extrude_input.setDistanceExtent(False, distance_input)
extrude = component.features.extrudeFeatures.add(extrude_input)
ui.messageBox('操作完成')
except:
if ui:
ui.messageBox(f'失败:\n{traceback.format_exc()}')
tool_registry.json: 定义可用工具及其参数。script_generator.py: 根据工具调用生成Python脚本。tool_registry.json中添加新工具的定义,包括名称和参数。script_generator.py中的SCRIPT_TEMPLATES以支持新工具。_process_parameters函数中。项目遵循MIT许可证,详细信息见LICENSE文件。