ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

cli-anything-freecad:基于 FreeCAD 的参数化建模 258 命令无头 CLI 接入指南

cli-anything-freecad:基于 FreeCAD 的参数化建模 258 命令无头 CLI 接入指南 cli-anything-freecad基于 FreeCAD 的参数化建模 258 命令无头 CLI 接入指南【免费下载链接】CLI-AnythingCLI-Anything: Making ALL Software Agent-Native -- CLI-Hub: https://clianything.cc/项目地址: https://gitcode.com/GitHub_Trending/cl/CLI-Anythingcli-anything-freecad 是 CLI-Anything 仓库中针对 FreeCAD 参数化 3D CAD 建模器实现的完整 Agent CLI 驱动harness。它把 FreeCAD 的 Part、Sketcher、PartDesign、Assembly、Mesh、TechDraw、Draft、FEM、CAM 等全工作台能力封装成 17 组共 258 条命令通过无头模式驱动真实 FreeCAD 引擎生成几何、导出工程文件并内置「捕获型预览、实时预览、运动渲染」三层可视化管线。阅读本文后你将掌握从环境安装、项目文件管理到布尔建模、草图约束、导出交换格式、面向 Agent 的 JSON 输出与可验证预览的完整实战方法。什么是 CLI harness一段「让 Agent 驱动 FreeCAD」的说明传统 FreeCAD 以 GUI 交互为主而 AI Agent 无法点击界面。cli-anything-freecad 的做法是以 JSON 项目文件*.json作为模型状态的中枢把用户或 Agent 发出的每条 CLI 命令翻译为一段 FreeCAD Python 宏脚本再交给本机 FreeCAD 的无头控制台可执行程序freecadcmd或FreeCADCmd执行最终把几何结果与输出文件以结构化 JSON 返回给调用方。整个链路可见于源码命令行入口 freecad_cli.py基于 Click 构建4911 行负责参数解析、错误处理与 REPL命令后端 core/ 目录 下按工作台拆分的 19 个核心模块FreeCAD 引擎封装 utils/freecad_backend.py宏脚本生成器 utils/freecad_macro_gen.py。前置条件与安装前提只有一个本机已安装 FreeCAD且freecadcmd位于PATH中可用freecadcmd --version验证。FreeCAD 的定位逻辑在 utils/freecad_backend.py 中实现查找顺序为环境变量FREECAD_PATH显式指定可执行文件按freecadcmd → FreeCADCmd → freecad → FreeCAD顺序在PATH中查找Windows 常见安装目录C:/Program Files/FreeCAD*/bin/...macOS 应用包路径/Applications/FreeCAD.app/Contents/MacOS/FreeCADCmdLinux 常见路径/usr/bin/freecadcmd、/snap/bin/freecad等。找不到时后端会抛出包含各平台安装指引的RuntimeError。常见安装方式参考 README.mdWindows从 FreeCAD 官网下载安装包Linuxsudo apt install freecad或sudo snap install freecadmacOSbrew install --cask freecad。安装 CLI harness 本身在仓库的freecad/agent-harness目录内cd freecad/agent-harness pip install -e .setup.pysetup.py声明了包名cli-anything-freecad、Python 3.10、运行时依赖click8.0.0与prompt-toolkit3.0.0并把控制台入口cli-anything-freecad注册到freecad_cli:main。安装完成后用cli-anything-freecad --help验证。三种基本用法freecad_cli.py的cli顶层命令支持--json、--project/-p与--dry-run三个全局选项cli-anything-freecad --json command # JSON 输出面向 Agent cli-anything-freecad --json -p proj.json cmd # 携带项目文件的一次性命令 cli-anything-freecad # 进入交互式 REPL一次性命令one-shot每次调用加载-p指定的项目 JSON执行命令后由call_on_close钩子自动把修改回写磁盘见 freecad_cli.py 中_auto_save逻辑--dry-run可跳过落盘交互式 REPL不带子命令时进入输入提示基于prompt-toolkit支持逐步试错而不必反复保存文件Agent 模式--json使所有输出变为机器可读的 JSON这是被 LLM/Agent 调用的推荐形态。Preview、Live Preview 与 Motion三层可视化管线SKILL.md 明确指出FreeCAD 是本分支中预览集成最深的工作台其设计哲学是预览Preview与运动渲染Motion分离——预览用于构建过程中快速、低成本的视觉核对运动渲染只用于最终成品的逐帧渲染与展示视频。预览配方recipe与捕获先列出可用配方再捕获真实四视图 bundle# 列出预览配方 cli-anything-freecad --json -p proj.json preview recipes # 捕获真实的 4 视图 bundle cli-anything-freecad --json -p proj.json preview capture --recipe quick从 core/preview.py 可见quick配方定义分辨率为 1280×960、白底四个视图分别映射到hero(viewIsometric)、front(viewFront)、top(viewTop)、right(viewRight)。典型的quickbundle 产物包括hero.png等轴测主视图front.png、top.png、right.png正交三视图捕获流程capture()preview.py会生成带 GUI 的预览宏 → 以QT_QPA_PLATFORMoffscreen环境调用 FreeCAD 无头渲染 → 对每个视图调用view.saveImage(path, width, height, background)写盘 → 汇总为带清单manifest的不可变 bundle 目录若项目指纹未变化且缓存命中会直接复用已有 bundlecached: true。实时预览Live Preview会话实时预览用于「迭代式构建循环」把每次快照发布进一个长期存在的会话# 启动 poll 模式实时预览项目文件反复保存时优先用 poll 模式 cli-anything-freecad --json -p proj.json preview live start --recipe quick --mode poll --source-poll-ms 500 # 只查询当前实时状态不触发渲染 cli-anything-freecad --json -p proj.json preview live status --recipe quick # 停止实时预览发布保留产物 cli-anything-freecad --json -p proj.json preview live stop --recipe quick底层机制core/preview.py会话持久化session.json、不可变 bundle 目录与trajectory.json其中source-poll-ms默认 500ms、最小被钳制到 250ms见_normalize_poll_mslive start --mode poll要求项目文件已落盘poll 轮询源并由preview live monitor后台轮询进程周期性比对项目文件指纹fingerprint指纹变化即自动重渲染并auto-poll发布新 bundlepoll_live_session_once同一文件约 12 个历史条目被保留preview live status --json面向 Agent除返回_session_dir、当前 bundle 引用与_trajectory_path外还附带紧凑的trajectory_summary适合作为低成本状态探测。查看已发布的预览cli-hub提供独立的查看器命令仅用于查看/打开已发布的预览cli-hub previews inspect /path/to/bundle-or-session cli-hub previews html /path/to/bundle-or-session -o page.html cli-hub previews watch /path/to/session --open cli-hub previews open /path/to/bundle-or-session当cli-hub可用时preview live start会通过_spawn_live_viewer自动拉起cli-hub previews watch --open见 freecad_cli.py。Motion最终成品的运动渲染Motion 与 preview 相互独立用于逐帧渲染真实模型与展示视频# 新建 6 秒、24fps 的运动序列 cli-anything-freecad --json -p proj.json motion new --name spin --duration 6 --fps 24 # 为 spin 的第 0 个部件在 t0 处写入关键帧位置 0,0,0 cli-anything-freecad --json -p proj.json motion keyframe spin --time 0.0 --part 0 --position 0,0,0 # 渲染为最终视频 cli-anything-freecad --json -p proj.json motion render-video spin output.mp4在 CLI 实现中freecad_cli.pyrender-video接收运动索引与输出路径可覆盖--camera、--width/--height、--background、--fit-mode并把渲染出的帧持久化到--frames-dir配套还有motion sample按时刻插值采样位姿与motion render-frames仅输出帧图序列供视频工具后续合成。从源码结构看Motion 系统按项目 JSON 中的motions集合管理多套序列一套序列可跨多个部件设定关键帧。17 组命令总览258 条下表为本 SKILL 声明覆盖全部工作台的能力矩阵分组与数量取自 SKILL.md 及 tests/TEST.md 中的扩展记录组命令数能力document5文档生命周期管理part293D 图元、布尔、变换、操作sketch26二维草图与约束body38PartDesign 特征建模material8PBR 材质与工程属性21 预置assembly11装配管理mesh16网格操作techdraw15技术图纸draft332D 制图与变换measure12测量分析surface6曲面操作fem12有限元分析cam10CNC 加工spreadsheet7参数化数据表import13导入 CAD/网格13 格式export3导出到 17 种格式session4撤销/重做document5 条— 文档管理# 新建文档并保存 cli-anything-freecad --json document new --name Part -o proj.json # 使用 print3d 预置档案mm 单位面向 3D 打印 cli-anything-freecad --json document new --profile print3d -o proj.json # 查看文档信息 cli-anything-freecad --json -p proj.json document info # 另存副本 cli-anything-freecad --json -p proj.json document save -o copy.json # 列出所有预置档案 cli-anything-freecad --json document profiles底层 core/document.py 定义 6 个预置档案default(mm)、metric_small(mm)、metric_large(m)、imperial(in)、print3d(mm)、cnc(mm)并校验单位只能是mm/m/in。每个项目 JSON 都包含version、name、units、metadata以及 parts/sketches/bodies/materials 等必需集合其余 assemblies、meshes、techdraw_pages、draft_objects、measurements、surfaces、fem_analyses、cam_jobs、spreadsheets、motions 集合按需惰性初始化。part29 条— 3D 图元、布尔、变换与操作# 图元box, cylinder, sphere, cone, torus, wedge, helix, spiral, thread, plane, polygon_3d cli-anything-freecad --json -p p.json part add box -P length20 -P width15 -P height5 cli-anything-freecad --json -p p.json part add cylinder -P radius3 -P height10 --position 10,7.5,0 # 操作 cli-anything-freecad --json -p p.json part boolean cut 0 1 cli-anything-freecad --json -p p.json part copy 0 cli-anything-freecad --json -p p.json part mirror 0 --plane XY cli-anything-freecad --json -p p.json part scale 0 --factor 2.0 cli-anything-freecad --json -p p.json part loft --indices 0,1,2 cli-anything-freecad --json -p p.json part sweep 0 1 cli-anything-freecad --json -p p.json part revolve 0 --axis Z --angle 360 cli-anything-freecad --json -p p.json part extrude 0 --direction 0,0,1 --length 10 cli-anything-freecad --json -p p.json part fillet-3d 0 --radius 2 cli-anything-freecad --json -p p.json part thickness 0 --thickness 1 cli-anything-freecad --json -p p.json part compound --indices 0,1,2 cli-anything-freecad --json -p p.json part section 0 --plane XY cli-anything-freecad --json -p p.json part info 0 cli-anything-freecad --json -p p.json part line-3d --start 0,0,0 --end 10,5,0 cli-anything-freecad --json -p p.json part wire --points 0,0,0;10,0,0;10,10,0参数约定与 CLI 解析器一致freecad_cli.py坐标用x,y,z逗号分隔_parse_vec3一组点用分号分隔_parse_points-P keyvalue传数值参数索引列表用逗号分隔整数。part boolean支持cut/fuse/common三种运算part scale可传单一系数或x,y,z非等比系数part thickness默认对所有面加壳也支持指定面索引子集。sketch26 条— 二维约束草图cli-anything-freecad --json -p p.json sketch new --plane XY cli-anything-freecad --json -p p.json sketch add-line 0 --start 0,0 --end 20,0 cli-anything-freecad --json -p p.json sketch add-circle 0 --center 10,10 --radius 5 cli-anything-freecad --json -p p.json sketch add-rect 0 --corner 0,0 --width 20 --height 15 cli-anything-freecad --json -p p.json sketch add-arc 0 --center 0,0 --radius 5 cli-anything-freecad --json -p p.json sketch add-ellipse 0 --center 0,0 --major-radius 10 --minor-radius 5 cli-anything-freecad --json -p p.json sketch add-polygon 0 --center 0,0 --sides 6 --radius 10 cli-anything-freecad --json -p p.json sketch add-bspline 0 --points 0,0;5,10;10,0;15,10 cli-anything-freecad --json -p p.json sketch add-slot 0 --center1 0,0 --center2 10,0 --radius 2 cli-anything-freecad --json -p p.json sketch constrain 0 distance --elements 0,1 --value 10 cli-anything-freecad --json -p p.json sketch edit-element 0 0 --radius 8 cli-anything-freecad --json -p p.json sketch remove-element 0 2 cli-anything-freecad --json -p p.json sketch validate 0 cli-anything-freecad --json -p p.json sketch solve-status 0草图元素索引与约束参数均为整数索引。支持全部约束类型coincident重合、horizontal、vertical、parallel、perpendicular、equal、fixed、distance、angle、radius、tangent、symmetric、block、diameter、point_on_object、distance_x、distance_y。约束命令用--elements 0,1圈定作用元素、--value给出尺寸/角度值。body38 条— PartDesign 特征cli-anything-freecad --json -p p.json body new cli-anything-freecad --json -p p.json body pad 0 0 --length 10 cli-anything-freecad --json -p p.json body pocket 0 1 --length 5 cli-anything-freecad --json -p p.json body groove 0 0 --angle 360 cli-anything-freecad --json -p p.json body fillet 0 --radius 2 cli-anything-freecad --json -p p.json body chamfer 0 --size 1.5 cli-anything-freecad --json -p p.json body revolution 0 0 --angle 360 cli-anything-freecad --json -p p.json body additive-loft 0 --sketch-indices 0,1 cli-anything-freecad --json -p p.json body additive-pipe 0 0 1 cli-anything-freecad --json -p p.json body additive-helix 0 0 --pitch 5 --height 20 cli-anything-freecad --json -p p.json body additive-box 0 -P length10 -P width10 -P height10 cli-anything-freecad --json -p p.json body hole 0 0 --diameter 5 --depth 10 --threaded cli-anything-freecad --json -p p.json body draft-feature 0 --angle 5 cli-anything-freecad --json -p p.json body thickness-feature 0 --thickness 1 cli-anything-freecad --json -p p.json body linear-pattern 0 --occurrences 5 --length 50 cli-anything-freecad --json -p p.json body polar-pattern 0 --occurrences 6 --angle 360 cli-anything-freecad --json -p p.json body mirrored 0 --plane XY cli-anything-freecad --json -p p.json body datum-plane 0 --reference XY --offset 10body 组覆盖 PartDesign 的加料特征pad、revolution、additive-*与减料特征pocket、groove圆角/倒角/拔模/抽壳线性/极坐标/镜像三种特征阵列以及基准面datum-plane。多数字符body cmd 0中的第一个索引指 body后续索引指被引用的草图等特征元素。material8 条— 带工程属性的 PBR 材质# 21 个预置steel, aluminum, copper, brass, titanium, stainless_steel, cast_iron, # carbon_fiber, nylon, abs, pla, petg, plastic_white, plastic_black, wood, glass, # rubber, gold, concrete, granite, marble cli-anything-freecad --json -p p.json material create --preset steel cli-anything-freecad --json -p p.json material create --preset titanium cli-anything-freecad --json -p p.json material assign 0 0 cli-anything-freecad --json -p p.json material set 0 density 7800 cli-anything-freecad --json -p p.json material import-material mat.json cli-anything-freecad --json -p p.json material export-material 0 --output mat.jsonmaterial assign 0 0中前一个索引为材质、后一个为部件material set 0 density 7800可修改如密度、颜色、金属度、粗糙度等属性非法属性名会抛出ValueError见 core/materials.py 对应测试用例材质还可以 JSON 形式导入/导出。assembly11 条— 装配管理cli-anything-freecad --json -p p.json assembly new --name MyAssembly cli-anything-freecad --json -p p.json assembly add-part 0 0 cli-anything-freecad --json -p p.json assembly constrain 0 coincident --components 0,1 cli-anything-freecad --json -p p.json assembly constrain 0 distance --components 0,1 --distance 10 cli-anything-freecad --json -p p.json assembly solve 0 cli-anything-freecad --json -p p.json assembly dof 0 cli-anything-freecad --json -p p.json assembly bom 0 cli-anything-freecad --json -p p.json assembly explode 0 --factor 2.0约束类型包括fixed、coincident、distance、angle、parallel、perpendicular、tangent、revolute、prismatic、cylindrical、ball、planar、gear、belt。配套命令可求解装配solve、输出自由度dof与物料清单bom并按系数生成爆炸视图。mesh16 条— 网格操作cli-anything-freecad --json -p p.json mesh from-shape 0 --deviation 0.1 cli-anything-freecad --json -p p.json mesh import path/to/model.stl cli-anything-freecad --json -p p.json mesh export 0 output.stl --format stl cli-anything-freecad --json -p p.json mesh boolean union 0 1 cli-anything-freecad --json -p p.json mesh decimate 0 --target-faces 1000 cli-anything-freecad --json -p p.json mesh smooth 0 --iterations 5 cli-anything-freecad --json -p p.json mesh repair 0 cli-anything-freecad --json -p p.json mesh to-shape 0形状与网格双向转换from-shape/to-shape、网格布尔union 等、简化decimate按目标面数、平滑、修复用于 3D 打印与逆向流程。techdraw15 条— 技术图纸cli-anything-freecad --json -p p.json techdraw new-page cli-anything-freecad --json -p p.json techdraw add-view 0 0 --direction 0,0,1 --scale 1.0 cli-anything-freecad --json -p p.json techdraw add-projection-group 0 0 cli-anything-freecad --json -p p.json techdraw add-section-view 0 0 cli-anything-freecad --json -p p.json techdraw add-dimension 0 0 length --references 0,1 cli-anything-freecad --json -p p.json techdraw add-annotation 0 Note text cli-anything-freecad --json -p p.json techdraw export-pdf 0 drawing.pdf cli-anything-freecad --json -p p.json techdraw export-svg 0 drawing.svg生成图纸页、普通/投影组/剖切视图、长度等标注类型与文字注释并直接输出 PDF 或 SVG。draft33 条— 二维制图cli-anything-freecad --json -p p.json draft wire --points 0,0,0;10,0,0;10,10,0 cli-anything-freecad --json -p p.json draft rectangle --width 20 --height 15 cli-anything-freecad --json -p p.json draft circle --radius 10 cli-anything-freecad --json -p p.json draft polygon --sides 6 --radius 10 cli-anything-freecad --json -p p.json draft text --content Hello --position 0,0,0 cli-anything-freecad --json -p p.json draft move 0 --vector 10,5,0 cli-anything-freecad --json -p p.json draft array-linear 0 --direction 1,0,0 --count 5 --spacing 10 cli-anything-freecad --json -p p.json draft array-polar 0 --center 0,0,0 --count 6 cli-anything-freecad --json -p p.json draft extrude 0 --direction 0,0,1 --length 10 cli-anything-freecad --json -p p.json draft to-sketch 0除上述几何外Draft 组还提供标注文字、移动、线性/极坐标阵列等 33 条命令并可将二维对象转换to-sketch为可被 PartDesign 引用的草图。measure12 条— 测量与分析cli-anything-freecad --json -p p.json measure volume 0 cli-anything-freecad --json -p p.json measure area 0 cli-anything-freecad --json -p p.json measure distance 0 1 cli-anything-freecad --json -p p.json measure bounding-box 0 cli-anything-freecad --json -p p.json measure center-of-mass 0 cli-anything-freecad --json -p p.json measure check-geometry 0surface6 条— 曲面操作cli-anything-freecad --json -p p.json surface filling --edges 0,1,2 cli-anything-freecad --json -p p.json surface sections --sections 0,1,2 cli-anything-freecad --json -p p.json surface extend 0 --length 10 cli-anything-freecad --json -p p.json surface sew --indices 0,1fem12 条— 有限元分析cli-anything-freecad --json -p p.json fem new-analysis cli-anything-freecad --json -p p.json fem add-fixed 0 --references face1,face2 cli-anything-freecad --json -p p.json fem add-force 0 --references face3 --magnitude 1000 cli-anything-freecad --json -p p.json fem set-material 0 0 cli-anything-freecad --json -p p.json fem mesh-generate 0 --max-size 5 cli-anything-freecad --json -p p.json fem solve 0 cli-anything-freecad --json -p p.json fem results 0引用面既支持形如face1,face2的字符串命名引用_parse_references会把纯数字转 int、其余保留字符串也支持数值索引。cam10 条— CNC 加工cli-anything-freecad --json -p p.json cam new-job 0 cli-anything-freecad --json -p p.json cam set-stock 0 --stock-type box cli-anything-freecad --json -p p.json cam set-tool 0 --diameter 6 --type endmill cli-anything-freecad --json -p p.json cam add-profile 0 cli-anything-freecad --json -p p.json cam add-pocket 0 --depth 5 cli-anything-freecad --json -p p.json cam generate-gcode 0 cli-anything-freecad --json -p p.json cam export-gcode 0 output.ncspreadsheet7 条— 参数化数据表cli-anything-freecad --json -p p.json spreadsheet new cli-anything-freecad --json -p p.json spreadsheet set-cell 0 A1 50 cli-anything-freecad --json -p p.json spreadsheet set-cell 0 B1 A1*2 cli-anything-freecad --json -p p.json spreadsheet set-alias 0 A1 plate_width cli-anything-freecad --json -p p.json spreadsheet export-csv 0 data.csv单元格支持公式如A1*2并可设置别名alias从而把别名暴露给其它特征做参数驱动支持导出 CSV。import13 条— 导入 CAD/网格文件cli-anything-freecad --json -p p.json import auto model.step cli-anything-freecad --json -p p.json import step model.step cli-anything-freecad --json -p p.json import stl model.stl cli-anything-freecad --json -p p.json import dxf drawing.dxf cli-anything-freecad --json -p p.json import info model.stepimport auto会按扩展名自动识别格式支持的格式来自 core/import_mod.py 与 SKILL.md包括step, iges, stl, obj, dxf, svg, brep, 3mf, ply, off, gltf等 13 种。export3 条— 导出到 17 种格式# 预置step, iges, stl, stl_fine, obj, brep, fcstd, dxf, svg, gltf, 3mf, ply, off, amf, pdf, png, jpg cli-anything-freecad --json -p p.json export render output.step --preset step cli-anything-freecad --json -p p.json export render model.stl --preset stl --overwrite cli-anything-freecad --json -p p.json export presetsexport组的底层实现是 core/export.py 的export_project()先生成宏脚本 → 由后端无头执行 → 校验产物存在且格式合法返回{output, format, file_size, method: freecad-headless}。对 STEP/IGES/STL/DXF/SVG/PDF/glTF/3MF 等格式还有专门的文件头校验器_FORMAT_VALIDATORS例如 STEP 校验ISO-10303-21头、3MF 校验 ZIP 内含3D/3dmodel.model、glTF 校验二进制魔数或asset键。export三令中包含覆盖全 17 种格式的预设说明输出。session4 条— 撤销/重做cli-anything-freecad --json -p p.json session undo cli-anything-freecad --json -p p.json session redo cli-anything-freecad --json -p p.json session status cli-anything-freecad --json -p p.json session history会话机制由 core/session.py 承担每次变更命令前调用snapshot()深拷贝当前项目状态入撤销栈撤销栈上限MAX_UNDO 50超出后 FIFO 丢弃最旧条目redo 栈在每次新快照时清空。保存使用带fcntl文件锁的原子写Windows 下自动降级为普通写保证与后台轮询进程并发访问同一项目文件时的安全。JSON 输出与错误处理约定所有命令都支持--json输出结构化数据{output: ..., format: step, file_size: 12345, method: freecad-headless}错误约定{error: message}错误写入 stderr 且进程以非零码退出REPL 模式下不退出。错误分类freecad_cli.py 的handle_error装饰器捕获FileNotFoundError/ValueError/IndexError/RuntimeError/FileExistsError/KeyError/TypeError缺少 FreeCAD给出清晰的各平台安装指引非法类型/参数返回合法的可选项列表索引越界报告当前合法范围目标文件已存在要求使用--overwrite。一次从零到导出的完整建模工作流参考 README.md 的快速开始也对应 tests/TEST.md 中「机械零件打孔」「基于草图的拉伸件」等真实工作流场景# 1) 新建文档 cli-anything-freecad document new --name MyPart -o project.json # 2) 添加底板 box 与打孔圆柱 cli-anything-freecad -p project.json part add box --name Base -P length20 -P width15 -P height5 cli-anything-freecad -p project.json part add cylinder --name Hole -P radius3 -P height10 --position 10,7.5,0 # 3) 布尔减料开孔 cli-anything-freecad -p project.json part boolean cut 0 1 --name BaseWithHole # 4) 赋予材质 cli-anything-freecad -p project.json material create --preset steel cli-anything-freecad -p project.json material assign 0 0 # 5) 导出 STEP cli-anything-freecad -p project.json export render output.step --preset step若需要视觉核对则在任意几何改动后执行preview capture --json生成四视图 bundle或启动preview live持续观察。面向 Agent 的预览使用守则SKILL.md 对 Agent 的调用姿势给出了明确建议避免昂贵或错误的操作几何发生变更需要视觉验证时使用preview capture --json迭代式构建循环使用preview live start当项目文件被反复保存时优先选择 poll 模式避免 manual 模式下多次手工 push把preview live status --json作为廉价状态探针在读取完整trajectory.json之前先探测轨迹概要trajectory_summary将_bundle_dir视为单一快照稳定的实时身份是_session_dir加上_trajectory_path会话目录与轨迹才是持续身份bundle 目录会随版本滚动替换cli-hub previews ...只用于查看/打开已经发布的预览不要试图让它代替渲染本身。正确性如何保障测试与验证命令面从 38 条扩展到 258 条后仍保持向后兼容。测试清单与真实运行结果见 tests/TEST.md单元测试约 45 条test_core.py覆盖 document、parts、sketch、body、materials、session 六个核心模块的创建/校验/异常路径E2E CLI 子进程约 15 条test_full_e2e.py覆盖中间项目文件结构、宏语法、保存加载回环以及需要真实 FreeCAD 的STEP/STL/FCStd 无头导出与格式校验文档记录的一次运行结果为67 passed in 3.47s通过率 100%REPL 交互、IGES/OBJ/BREP 导出为已注明的不覆盖项导出经由预置间接验证。自行运行测试在freecad/agent-harness目录内python -m pytest cli_anything/freecad/tests/ -v -s # 强制走已安装命令入口的测试 CLI_ANYTHING_FORCE_INSTALLED1 python -m pytest cli_anything/freecad/tests/ -v -s小结cli-anything-freecad 的价值在于把 FreeCAD 近乎全工作台的建模能力收敛为无 GUI、可脚本化、可机器消费的 258 条命令document/session保证状态与历史可追溯17 个工作台命令组覆盖从草图约束、特征建模、布尔运算到装配、网格、FEM、CAM、技术图纸的完整链路preview/motion提供从「过程可视化验证」到「成品展示渲染」的闭环而--json输出与{error: ...}错误约定让大模型 Agent 能够以最小成本驱动真实 CAD 引擎完成几何创建与多格式交换。读者可将 SKILL.mdskills/SKILL.md直接作为技能声明交付给 Agent辅以本仓库中的源码、README 与测试作为实现依据。【免费下载链接】CLI-AnythingCLI-Anything: Making ALL Software Agent-Native -- CLI-Hub: https://clianything.cc/项目地址: https://gitcode.com/GitHub_Trending/cl/CLI-Anything创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表